![Mastering ROS for Robotics Programming(Second Edition)](https://wfqqreader-1252317822.image.myqcloud.com/cover/200/36700200/b_36700200.jpg)
上QQ阅读APP看书,第一时间看更新
Visualizing the 3D sensor data
After launching the simulation using the preceding command, we can check topics generated by the sensor plugin:
![](https://epubservercos.yuewen.com/1D30EC/19470397401586306/epubprivate/OEBPS/Images/0118563d-c4e6-4919-8d25-d020bb675975.png?sign=1739523513-yVo6QufR9JajxbEDlzUt4c705Rysk9LS-0-9401546d24063db8d54e48f5ff149987)
Figure 3: rgb- d image topics generated by Gazebo
Let's view the image data of a 3D vision sensor using the following tool called image_view:
- View the RGB raw image:
$ rosrun image_view image_view image:=/rgbd_camera/rgb/image_raw
- View the IR raw image:
$ rosrun image_view image_view image:=/rgbd_camera/ir/image_raw
- View the depth image:
$ rosrun image_view image_view image:=/rgbd_camera/depth/image_raw
Here is the screenshot with all these images:
![](https://epubservercos.yuewen.com/1D30EC/19470397401586306/epubprivate/OEBPS/Images/1fcbbb9c-8036-4cca-9f58-b80425d519b2.jpg?sign=1739523513-AO2zaRHJ5aNXk2DrYTa0ueJsizQz0IdX-0-131a5e1837fd3ae56d3c417c7fc6e2a3)
Figure 4: Viewing images of the rgb- d sensor in Gazebo
We can also view the point cloud data of this sensor in RViz.
Launch RViz using the following command:
$ rosrun rviz rviz -f /rgbd_camera_optical_frame
Add a PointCloud2 display type and set the Topic as /rgbd_camera/depth/points. We will get a point cloud view as follows:
![](https://epubservercos.yuewen.com/1D30EC/19470397401586306/epubprivate/OEBPS/Images/8813a546-34b4-4352-b50b-9a8139acf276.png?sign=1739523513-zgVQumWyETqtux5RZih1qIRO9XzxvN4O-0-5603e3faa898f6675b6809c232aac7a4)
Figure 5: Viewing point cloud data from an rgb-d sesor in RViz