Intel RealSense D435i:ROS接口相关配置和启动参数的进一步学习

Sep 25,2020   6595 words   24 min

Tags: SLAM

之前博客中,我们已经介绍了如何配置D435i的启动环境并进行了简单的测试。在这篇博客中,我们会以rs_camera节点为例,对其launch文件中的参数进行进一步分析,从而更好地使用。

1.launch文件

rs_camera节点的默认launch文件如下。 可以看到有非常多的参数可以设置,大部分根据名字就可以理解。这里列举几个重要的参数进行介绍。

(1)enable_depth

布尔型变量,默认为true,用于指定传感器是否发布深度相关Topic。其主要影响/camera/depth/相关Topic的发布,如下。

/camera/depth/camera_info
/camera/depth/color/points
/camera/depth/image_rect_raw
/camera/depth/image_rect_raw/compressed
/camera/depth/image_rect_raw/compressed/parameter_descriptions
/camera/depth/image_rect_raw/compressed/parameter_updates
/camera/depth/image_rect_raw/compressedDepth
/camera/depth/image_rect_raw/compressedDepth/parameter_descriptions
/camera/depth/image_rect_raw/compressedDepth/parameter_updates
/camera/depth/image_rect_raw/theora
/camera/depth/image_rect_raw/theora/parameter_descriptions
/camera/depth/image_rect_raw/theora/parameter_updates
(2)enable_infra

其实一共包括enable_infraenable_infra1enable_infra2三个变量,用于控制是否输出红外影像。enable_infra1enable_infra2分别表示左、右红外相机的影像。这三个变量默认都为false。其主要影响/camera/infra1//camera/infra2/相关Topic的发布,如下。

/camera/infra1/camera_info
/camera/infra1/image_rect_raw
/camera/infra1/image_rect_raw/compressed
/camera/infra1/image_rect_raw/compressed/parameter_descriptions
/camera/infra1/image_rect_raw/compressed/parameter_updates
/camera/infra1/image_rect_raw/compressedDepth
/camera/infra1/image_rect_raw/compressedDepth/parameter_descriptions
/camera/infra1/image_rect_raw/compressedDepth/parameter_updates
/camera/infra1/image_rect_raw/theora
/camera/infra1/image_rect_raw/theora/parameter_descriptions
/camera/infra1/image_rect_raw/theora/parameter_updates

/camera/infra2/camera_info
/camera/infra2/image_rect_raw
/camera/infra2/image_rect_raw/compressed
/camera/infra2/image_rect_raw/compressed/parameter_descriptions
/camera/infra2/image_rect_raw/compressed/parameter_updates
/camera/infra2/image_rect_raw/compressedDepth
/camera/infra2/image_rect_raw/compressedDepth/parameter_descriptions
/camera/infra2/image_rect_raw/compressedDepth/parameter_updates
/camera/infra2/image_rect_raw/theora
/camera/infra2/image_rect_raw/theora/parameter_descriptions
/camera/infra2/image_rect_raw/theora/parameter_updates

需要注意的是,enable_infra并不会真正影响红外影像的发布,真正影像开关的是enable_infra1enable_infra2。虽然一般应该不会这么做,但是我们完全可以只打开一个红外相机,关闭另一个。

(3)enable_color

布尔型变量,默认为true,用于指定RGB相机是否发布RGB影像相关Topic。其主要影响/camera/color/相关Topic的发布,如下。

/camera/color/camera_info
/camera/color/image_raw
/camera/color/image_raw/compressed
/camera/color/image_raw/compressed/parameter_descriptions
/camera/color/image_raw/compressed/parameter_updates
/camera/color/image_raw/compressedDepth
/camera/color/image_raw/compressedDepth/parameter_descriptions
/camera/color/image_raw/compressedDepth/parameter_updates
/camera/color/image_raw/theora
/camera/color/image_raw/theora/parameter_descriptions
/camera/color/image_raw/theora/parameter_updates
(4)enable_gyro

布尔型变量,默认为false,用于指定陀螺仪是否发布相关Topic。其主要影响/camera/gyro/相关Topic的发布,如下。

/camera/gyro/imu_info
/camera/gyro/sample
(5)enable_accel

布尔型变量,默认为false,用于指定加速度计是否发布相关Topic。其主要影响/camera/accel/相关Topic的发布,如下。

/camera/accel/imu_info
/camera/accel/sample
(6)enable_sync

布尔型变量,默认为false,顾名思义,用于同步各传感器之间的数据,这样由D435i发出的各个Topic的频率就相同了。

(7)align_depth

布尔型变量,默认为false,顾名思义,用于将RGB图像与深度图像对齐,它并不会修改之前发出的Topic,而是重新发出两类多个Topic:/camera/aligned_depth_to_color/camera/aligned_depth_to_infra1,如下。

/camera/aligned_depth_to_color/camera_info
/camera/aligned_depth_to_color/image_raw
/camera/aligned_depth_to_color/image_raw/compressed
/camera/aligned_depth_to_color/image_raw/compressed/parameter_descriptions
/camera/aligned_depth_to_color/image_raw/compressed/parameter_updates
/camera/aligned_depth_to_color/image_raw/compressedDepth
/camera/aligned_depth_to_color/image_raw/compressedDepth/parameter_descriptions
/camera/aligned_depth_to_color/image_raw/compressedDepth/parameter_updates
/camera/aligned_depth_to_color/image_raw/theora
/camera/aligned_depth_to_color/image_raw/theora/parameter_descriptions
/camera/aligned_depth_to_color/image_raw/theora/parameter_updates

/camera/aligned_depth_to_infra1/camera_info
/camera/aligned_depth_to_infra1/image_raw
/camera/aligned_depth_to_infra1/image_raw/compressed
/camera/aligned_depth_to_infra1/image_raw/compressed/parameter_descriptions
/camera/aligned_depth_to_infra1/image_raw/compressed/parameter_updates
/camera/aligned_depth_to_infra1/image_raw/compressedDepth
/camera/aligned_depth_to_infra1/image_raw/compressedDepth/parameter_descriptions
/camera/aligned_depth_to_infra1/image_raw/compressedDepth/parameter_updates
/camera/aligned_depth_to_infra1/image_raw/theora
/camera/aligned_depth_to_infra1/image_raw/theora/parameter_descriptions
/camera/aligned_depth_to_infra1/image_raw/theora/parameter_updates

顾名思义也很显而易见,一个是将深度对齐到RGB彩色图像,另一个是将深度对齐到红外左影像。如下是未对齐的RGB影像和深度影像: 可以看到,深度影像中的物体轮廓明显是要小于RGB影像的,所以不是对齐的。而将深度对齐到RGB影像的效果如下。 可以看到,深度图和RGB图拥有基本相同的轮廓了。同理,下面是将深度图对齐到左红外影像的结果。 另外,由上面的影像也可以看到,红外相机的影像和RGB影像差别还是比较大的。

以上就是Launch文件中几个常用的参数了,之后如果有新的东西也会陆续补充。

2.启动时的提示信息

这里,我们把深度(enable_depth)、双目红外(enable_infra)、RGB相机(enable_color)、陀螺仪(enable_gyro)、加速度计(enable_accel)全部打开,其余默认。然后输入roslaunch realsense2_camera rs_camera.launch启动节点。正常情况下,终端中就会输出一长串的提示信息,如下图所示,这里我们就简单对这些数据的信息进行分析。 首先,节点输出了很多我们刚刚设置的相关的参数(Parameters)。所以如果运行的时候和我们预期的不同,不妨可以先来这里找找,看看是不是哪个参数没有设置好。然后就是一系列ROS相关的输出。不出意外启动节点后,就会输出很多以[info]开头的信息,这些信息就是由节点本身输出的了,之前上面的信息都是由ROS输出的。首先会输出很多和设备版本、序列号相关的信息。然后就会输出刚刚设置的一些模式信息,开启了哪些传感器,如Align Depth、Sync Mode等。由于这里我们开启了深度、红外、RGB传感器,所以节点依次输出了这些数据流的格式,包括长宽、FPS、数据格式内容。然后节点会根据当前的配置设置Publisher和Stream,最后节点就会输出RealSense Node Is Up!就表示设备可用了,可以通过订阅相应Topic来接收数据了。

3.发布的Topic

(1)带有info的Topic

如果想获得传感器相关信息,直接订阅带info的Topic即可。

/camera/depth/camera_info	# 深度相机信息
/camera/infra1/camera_info	# 左红外相机信息
/camera/infra2/camera_info	# 右红外相机信息
/camera/color/camera_info	# RGB相机信息
/camera/gyro/imu_info	# 陀螺仪信息
/camera/accel/imu_info	# 加速度计信息
/camera/aligned_depth_to_color/camera_info	# 对齐到RGB影像的深度图信息
/camera/aligned_depth_to_infra1/camera_info	# 对齐到左红外影像的深度图信息

比如下面利用rostopic echo /camera/infra1/camera_info展示了左红外相机影像的相关信息。 可以看到包含一些影像宽高和默认的畸变参数等相关信息。

(2)带有compress的Topic

另外,还有很多带compress的Topic,顾名思义也非常简单,就是经过压缩后的数据流,大小更小。但同时数据的质量可能会有一定的下降。

(3)带有raw的Topic

和上面压缩的数据流对应,带有raw的Topic就是未经过压缩的原始数据流。如果数据传输带宽不是特别限制,一般使用原始数据(带有raw的Topic)就好。

(4)带有theora的Topic

上面看到过很多次的包含theora的Topic,这些Topic其实从内容上来说,和不带theora的Topic是一样的,差别在于编码方式。Theora是一种开放而且免费的视频压缩编码技术。因此在使用的时候如果没什么特别需求,直接使用一般的就可以了。

(5)带有rect的Topic

另外,带有rect的Topic是表示校正后的数据,Rectify的缩写。

(6)其它Topic

如果需要获得加速度计或陀螺仪的数据,订阅/camera/gyro/sample/camera/accel/sample就可以了。如下获得的是加速度计的内容。

以上就是关于D435i ROS接口更多详细的信息。在之后会基于之前介绍过的Kalibr对其进行标定,以及尝试使用D435i跑ORB-SLAM3。

本文作者原创,未经许可不得转载,谢谢配合

返回顶部