在ROS中实现多Realscene D455数据的读取并发布

简介

D455作为新一代的英特尔RealSense深度摄像头,网上的资料很少,同时除了官方的资料以外,我们很难找到相关的ROS相关的文档。同时由于D455支持的是realsense SDK2.0。所以SDK1.0的数据也不适用。本文档主要提供了一套完整的Ubuntu 18.04 + Realsense D455 + ROS melodic 的代码。
在ROS中实现多Realscene D455数据的读取并发布

详细步骤

1.环境依赖

依赖环境 版本号
ROS melodic
Opencv 3.2.0
C++ 11+

2.树形图

src
├── CMakeLists.txt 
├── real_sense_multi
│   ├── CMakeLists.txt
│   ├── include
│   ├── launch
│   │   └── realsense_multi_cam.launch #launch 启动文件
│   ├── package.xml
│   └── src
│       └── realsense_multi_cam.cpp
CMakeLists.txt
cmake_minimum_required(VERSION 3.0.2)
project(real_sense_multi)

## Compile as C++11, supported in ROS Kinetic and newer
# add_compile_options(-std=c++11)

set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g ")
set (CMAKE_VERBOSE_MAKEFILE ON)
set(OpenCV_DIR /usr/local/share/OpenCV)

## Find catkin macros and libraries
## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz)
## is used, also find other catkin packages

find_package(OpenCV REQUIRED)
find_package(catkin REQUIRED COMPONENTS
  roscpp
  rospy
  std_msgs
  cv_bridge
  image_transport
  sensor_msgs
)

catkin_package(
#  INCLUDE_DIRS include
#  LIBRARIES real_sense_multi
CATKIN_DEPENDS 
roscpp 
rospy 
std_msgs   
cv_bridge
image_transport
sensor_msgs
#  DEPENDS system_lib
)


if(CMAKE_COMPILER_IS_GNUCC)
    ADD_DEFINITIONS ( -std=c++11 )
endif(CMAKE_COMPILER_IS_GNUCC)

## Your package locations should be listed before other locations
include_directories(
  include
  ${catkin_INCLUDE_DIRS}
  ${OpenCV_INCLUDE_DIRS}
  /opt/ros/melodic/include
)

link_directories(/opt/ros/melodic/lib)

add_executable(realsense_multi_cam_node src/realsense_multi_cam.cpp)
target_link_libraries(realsense_multi_cam_node ${catkin_LIBRARIES} ${OpenCV_LIBS} realsense2)

…详情请参照古月居

上一篇:ROS 学习笔记(一)


下一篇:设计公司的人员管理系统要求:(实训3)