Intel RealSense D435 / D405使用和发布相机的ROS2话题

官网:https://www.intelrealsense.com/sdk-2/

1.Windows系统下使用Intel RealSense Viewer

在这里插入图片描述
使用教程:https://blog.csdn.net/weixin_45263375/article/details/106584903

2.Linux系统

2.1 安装和使用RealSense Viewer

  • 注册服务器的公钥
sudo mkdir -p /etc/apt/keyrings
curl -sSf https://librealsense.intel.com/Debian/librealsense.pgp | sudo tee /etc/apt/keyrings/librealsense.pgp > /dev/null
  • 确保安装了APTHTTPS⽀持
sudo apt-get install apt-transport-https
  • 将服务器添加到存储库列表
echo "deb [signed-by=/etc/apt/keyrings/librealsense.pgp] https://librealsense.intel.com/Debian/apt-repo $(lsb_release -cs) main" |   sudo tee /etc/apt/sources.list.d/librealsense.list

sudo apt-get update
  • 安装库
sudo apt-get install librealsense2-dkms   # 注意系统内核版本
sudo apt-get install librealsense2-utils 
  • 安装开发⼈员和调试软件包(可选,按需安装)
sudo apt-get install librealsense2-dev
sudo apt-get install librealsense2-dbg
  • 验证安装(启动GUI界⾯)
realsense-viewer

在这里插入图片描述

2.2 安装RealSense-ROS2

  • 安装librealsense
sudo apt install ros-humble-librealsense2*
  • 安装RealSense-ROS
 # 创建⼯作空间
mkdir -p ~/realsense_ws/src
cd ~/realsense_ws/src/

# ros2
git clone https://github.com/IntelRealSense/realsense-ros.git -b ros2-master
cd ~/realsense_ws

# ros2
sudo apt install python3-pip -y
sudo pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple rosdepc
sudo rosdepc init
sudo rosdepc fix-permissions
rosdepc update
rosdepc install -i --from-path src --rosdistro $ROS_DISTRO --skip keys=librealsense2 -y

colcon build
source /opt/ros/humble/setup.bash
. install/setup.bash
  • 启动Realsen节点
    PS:这里以相机分辨率设置为640*360为例
source install/setup.bash
ros2 launch realsense2_camera rs_align_depth_launch.py depth_module.depth_profile:=640x360x30 rgb_camera.color_profile:=640x360x30

在这里插入图片描述

  • 可以查看是否有release相关的话题,通过rviz2订阅查看图像信息
ros2 topic list 
/camera/camera/aligned_depth_to_color/camera_info
/camera/camera/aligned_depth_to_color/image_raw # 深度信息
/camera/camera/color/camera_info
/camera/camera/color/image_rect_raw # RGB图像
/camera/camera/color/metadata
/camera/camera/depth/camera_info
/camera/camera/depth/image_rect_raw
/camera/camera/depth/metadata
/camera/camera/extrinsics/depth_to_color
/parameter_events
/rosout
/tf_static

rviz2

在这里插入图片描述

2.2 RealSense-ROS2 话题

Linux系统intelRealSense相机SDK开发C++
SDK源码:https://github.com/IntelRealSense/librealsense/releases/tag/v2.56.2

# 发布RGB和对齐的深度图像话题————常用
ros2 launch realsense2_camera rs_align_depth_launch.py

# 发布点云话题(无序点云,(x,y,z)单位: m):/camera/camera/depth/color/points
ros2 launch realsense2_camera rs_d405_pointcloud_launch.py

# 未验证
ros2 launch realsense2_camera rs_launch.py pointcloud.enable:=true

# rgb_image_topic  = "/camera/camera/color/image_rect_raw";
# depth_image_topic = "/camera/camera/aligned_depth_to_color/image_raw"; // 发布的深度信息单位 mm
# camera_topic_ = "/camera/camera/color/camera_info"; // 有内参矩阵和畸变系数
# std::string point_cloud_topic_ = "/camera/camera/depth/color/points"; // 发布的点云数据单位 m

参考博文:https://blog.csdn.net/qq_36372352/article/details/136598775

3.补充

  • 坐标系:
    在这里插入图片描述
  • SDK获取的深度单位

IntelRealSense-D435深度信息单位:1mm
IntelRealSense-D405深度信息单位:0.1mm

  • 通过ROS2话题获取的深度信息单位

IntelRealSense-D405深度信息单位:1mm

猜你喜欢

转载自blog.csdn.net/qq_45445740/article/details/143613024