How does Kinect send data from the sensors, and how do we see it?

Now, we are going to see what we can do with these nodes. List the topics that you have created using this command:

    $ rostopic list
  

Then, you will see a lot of topics, but the most important ones for us are the following:

    ...
    /camera/rgb/image_color
    /camera/rgb/image_mono
    /camera/rgb/image_raw
    /camera/rgb/image_rect
    /camera/rgb/image_rect_color
    ...
  

We will see a lot of topics created by nodes. If you want to see one of the sensors, for example, the RGB camera, you can use the /camera/rgb/image_color topic. To see the image from the sensor, we are going to use the image_view package. Type the following command in a shell:

    $ rosrun image_view image_view image:=/camera/rgb/image_color
  

Note that we need to rename (remap) the image topic to /camera/rgb/image_color using the parameter's image. If everything is fine, a new window appears that shows the image from Kinect.

If you want to see the depth sensor, you can do so just by changing the topic in the last command line:

    $ rosrun image_view image_view image:=/camera/depth/image
  

You will then see an image similar to the following screenshot:

RGB and depth image from Kinect

Another important topic is the one that sends the point cloud data. This kind of data is a 3D representation of the depth image. You can find this data in /camera/depth/points, /camera/depth_registered/points and other topics.

We are going to see the type of message this is. To do this, use rostopic type. To see the fields of a message, we can use rostopic type /topic_name | rosmsg show. In this case, we are going to use the /camera/depth/points topic:

    $ rostopic type /camera/depth/points | rosmsg show  
To see the official specification of the message, visit http://ros.org/doc/api/sensor_msgs/html/msg/PointCloud2.html.

If you want to visualize this type of data, run rviz in a new shell and add a new PointCloud2 data visualization, as shown here:

    $ rosrun rviz rviz  

Click on Add, order topics by display type, and select PointCloud2. Once you have added a PointCloud2 display type, you have to select the name of the camera/depth/points topic.

On your computer, you will see a 3D image in real time; if you move in front of the sensor, you will see yourself moving in 3D, as you can see in the following screenshot:

3D point cloud data from Kinect
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.220.9.237