![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=1739300719-s1v6s9d4E7OFDZJJOG1fdGc6l5Dy2HOl-0-b189c1fc5bec8d93aa4b4fe4e272071e)
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=1739300719-mlhZX2SLdAs2ptIQtcqJfQk1QkNYjpvz-0-c8587423fe2e6606c569e18807bcde6c)
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=1739300719-fJHqAJG6LMbMKZKls5l4yZz3OocgzfFF-0-00252b938890aa9482122fd3a902e40b)
Figure 5: Viewing point cloud data from an rgb-d sesor in RViz