Mastering ROS for Robotics Programming(Second Edition)
上QQ阅读APP看书,第一时间看更新

Visualizing the 3D sensor data

After launching the simulation using the preceding command, we can check topics generated by the sensor plugin:

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:

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:

Figure 5: Viewing point cloud data from an  rgb-d sesor in RViz