![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=1738835387-OqPzBcEn7B0FUM3DQlVAqrZUviLkhKj9-0-12ccac64f4ff4bea9b41cde88e06c67f)
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=1738835387-gXUMMbHDoL6Q9FCS9qSBnzMK3nSyXemu-0-09cbc0873054422c78211bcb6853e337)
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=1738835387-R9LQwkdHrAivvQ3ldBX3b3wgihOFVsqQ-0-66db33f8192eceea32e554e332cb27b9)
Figure 5: Viewing point cloud data from an rgb-d sesor in RViz