ROS 公用包学习解析 rgbd_launch

本文深入解析了ROS中的rgbd_launch模块,详细介绍了其如何通过一系列launch文件处理RGB-D设备数据,生成深度图、视差图及点云等。重点分析了processing.launch.xml和kinect_frames.launch的工作流程。

http://blog.sina.com.cn/s/blog_602f87700102wtxu.html
http://blog.sina.com.cn/s/blog_602f87700102wtxu.html
ROS 公用包学习解析<三> rgbd_launch (2017-08-01 11:42:34)

作者: Sam (甄峰) sam_code@hotmail.com

  1. rgbd_launch简介:
    一组打开RGBD设备,并load 所有nodelets去转化 raw depth/RGB/IR 流到 深度图(depth image), 视差图(disparity image)和点云(point clouds)的launch文件集。

这些Launch文件在ROS中,使用RGB-D设备(如Microsoft Kinect, Xtion)。 它创建一个nodelet graph, 把Device Driver中获取Raw Data转换为点云,视差图或其它指定格式。

rgbd_launch包含一系列common launch文件,他们会被driver指定的launch Package使用。Driver指定的Launch Package包括:openni_launch或freenect_launch.

  1. launch 详细分析:
    两个launch文件最重要:
    launch/includes/processing.launch.xml:
    从RGB-D driver (openni_camera, freenect_camera)获取数据,并处理。

launch/kinect_frames.launch:
为Kinect启动TF Tree。 它可以由openni_launch或freenect_launch启动。

1.1:processing.lanch.xml详解:
这个Launch中,可以启动nodelet去转换Raw RGB和depth image到可以使用的信息,如点云。可以使用参数来设置哪些工作可以做。

rgb_processing (bool, default: true)

Launch nodelets for generating raw and rectified monochrome and color images. Given bayer encoded images on the rgb/image_raw topic from the RGB-D driver, the rgb processing chain produces rgb/image_mono,rgb/image_rect_mono, rgb/image_color and rgb/image_rect_color.
控制是否启动nodelet去产生raw Data和校正(rectified)过的单色以及色彩Image。把从RGB-D driver读取的数据以bayer编码RGB编码放入 rgb/image_raw Topic中。同时产生rgb/image_mono,rgb/image_rect_mono, rgb/image_color and rgb/image_rect_color这系列Topic。

如果rgb_processing被设置为True。则$(find rgbd_launch)/launch/includes/rgb.launch.xml

debayer_processing (bool, default: true)

Usage of this parameter requires rgb_processing to be true. Debayers the image into monochrome and color. If set to true then explanation for rgb_processing directly applies. If set to false the rgb processing chain only producesrgb/image_rect_color.

ir_processing (bool, default: true)

If set to true, rectifies the raw IR image (ir/image_raw -> ir/image_rect_raw)
$(find rgbd_launch)/launch/includes/ir.launch.xml

depth_processing (bool, default: true)

Given the raw depth image, rectifies it, converts both the raw and rectified images to metric format (uint16 ->float), and produces a pointcloud. Requires depth/image_raw. Produces depth/image_rect_raw (rectified),depth/image (metric), depth/image_rect (rectified, metric), depth/points (pointcloud).

depth_registered_processing (bool, default: true)

Generates a registered RGBD pointcloud from the device data (requires rgb_processing to be enabled). A pointcloud can be generated through a software registration pipeline (sw_registered_processing = true, used when depth_registration for device driver is set to false ) by registering the depth image from the depth frame to an RGB frame and merging with the RGB image. If software registration is being used, depth_processing needs to be enabled. Alternatively, the device can be directly asked to generate a registered depth image in the RGB frame with can be merged with the RGB Image through the hardware registration pipeline (hw_registered_processing = true, used when depth_registration for device driver is set to true)

disparity_processing (bool, default: true)

Generates a disparity image from unregistered depth data (i.e. in the depth frame). Converts depth/image_rect_rawand projector/camera_info into the disparity image depth/disparity. Requires depth_processing to be enabled.

sw_registered_processing (bool, default: true)

Enables the software registration pipeline. depth/image_rect_raw ->depth_registered/sw_registered/image_rect_raw (registered) -> depth_registered/points ANDdepth_registered/disparity.

hw_registered_processing (bool, default: true)

Enables the hardware registration pipeline. depth/image_raw -> depth_registered/hw_registered/image_rect_raw(rectified) -> depth_registered/points AND depth_registered/disparity.

1.2:其它XML:
rgb.launch.xml:
利用nodelet,启动 image_proc/debayer, image_proc/rectify, image_proc/rectify
换句话说,把Raw Data使用image_proc的nodelet来校准。

depth.launch.xml:
利用nodelet, 启动 image_proc/rectify, depth_image_proc/convert_metric, depth_image_proc/convert_metric, depth_image_proc/point_cloud_xyz。

附1:

RAW RGB与Bayer RGB

对于Sensor来说,Bayer RGB和RAW RGB两者的图象结构都是BG/GR的。(Bayer pattern说的是COLOR FILTER的结构,分为两种:STD Bayer pattern 与Pair pattern,其中STD Bayer pattern的结构是BG/GR的,而Pair Pattern顾名思义是指BGBG/GRGR的结构,即以四行为一个单位,前两行是BG的结构,后两行是GR的结构,这种结构是美光专门为此申请了专利的,主要是在输出TV模式(NTSC/PAL制)时用到).
### ROS感知相关的RGBD相机启动文件或配置 对于ROS中的RGBD相机启动文件和配置,`rgbd_launch`提供了一种便捷的方式来设置并运行带有深度传感器的机器人系统。此通常用于集成各种类型的RGB-D摄像头到基于ROS的应用程序中[^1]。 #### 安装必要的软件 为了能够顺利使用`rgbd_launch`功能,在开始之前需确认已安装了相应的依赖项。可以通过下面命令来确保环境准备就绪: ```bash sudo apt-get update && sudo apt-get install ros-<distro>-rgbd-launch ``` 请注意替换 `<distro>` 为当前使用的ROS版本名称,比如 `noetic`, `foxy` 或者其他适用版本号[^2]。 #### 创建自定义启动文件 创建一个新的`.launch` 文件作为启动脚本的一部分,该文件可以用来加载特定于硬件设备的参数以及初始化节点。这里给出一个简单的例子,假设正在处理的是Kinect v1型号的RGB-D摄像机: ```xml <!-- my_kinect_rgbd.launch --> <launch> <!-- 启动openni_camera驱动器 --> <include file="$(find openni_launch)/launch/openni.launch"> <arg name="depth_registration" value="true"/> </include> <!-- 加载3D传感器配置 --> <rosparam command="load" file="$(find my_robot_moveit_config)/config/sensors_3d.yaml"/> <!-- 发布tf变换关系 --> <node pkg="tf" type="static_transform_publisher" name="camera_link_broadcaster" args="0 0 0 0 0 0 base_link camera_rgb_optical_frame 100" /> </launch> ``` 上述XML片段展示了如何通过含来自`openni_launch`的标准配置来简化过程,并且还设置了静态转换发布器以便正确关联坐标系之间的位置信息[^3]。 #### 运行RGDB Launch 一旦完成了所有必需的准备工作之后,则可以直接调用刚才编写的启动文件来进行测试: ```bash roslaunch my_package_name my_kinect_rgbd.launch ``` 这将会激活所有的相关组件并将数据流传递给RVIZ或其他订阅这些话题的服务端应用上显示出来。
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值