Using your Kinect

For your convenience, the ROSLab machines are already configured properly so that you can plug in and communicate with a Microsoft Kinect.

Over the past few months, multiple Kinect drivers and related code stacks have been posted at ros.org. We will be using the openni_kinect stack to communicate with the Kinect. It uses the open source driver that was released by OpenNI. It is only officially supported for Diamondback.

Bringing up the Kinect
Getting Kinect Data into C++ or Python
Getting Kinect Data into Matlab
List of Available Topics


How to bringup the Kinect:

As long as you are configured to use Diamondback, you can really just follow the directions that are located OpenNI Demo. I will spell out all of the steps for you here just in case.

  1. Make sure you are configured to use the new version of ROS called 'Diamondback'.
    • To check the version of ros you are running, run:
      rosversion ros
      (If you are using Diamondback, you should see version number '1.4.6' or greater.)
    • If you aren't using Diamondback, then configure your machine to use it:
      • Open your ~/.bashrc file for editing.
      • Assuming you are using boxturtle or cturtle, change the line that says:
        source /opt/ros/cturtle/setup.bash
        to:
        source /opt/ros/diamondback/setup.bash
      • If you aren't configured to use ROS yet, then add the line above to your ~/.bashrc file.
  2. At this point, you can follow the OpenNI Demo directions. You do not need to perform the first step, 'rosmake openni_camera' because that has been done for you.
  3. If everything went well, you should have seen a point cloud in rviz or an RGB or monochrome image in image_view (depending on which command you ran).

How to retrieve data from the Kinect(C++/Python)

Now you know that roslaunching the openni_camera/openni_node.launch launch file brings up all of the proper nodes and topics to receive RGB images, depth images and point clouds from the Kinect. Now we need to fetch the frames from the Kinect. To retrieve data, you just need to subscribe to the corresponding topic.

This is a list of the most useful topics that are published. Refer to the openni_camera page for more information.

  • /camera/depth/camera_info : Camera parameters for the IR (depth) camera
  • /camera/depth/image : single channel floating point (float32) depth image, containing the depth in meters.
  • /camera/depth/points : point cloud without color information
  • /camera/rgb/camera_info : Camera parameters for the RGB camera
  • /camera/rgb/image_color : RGB image
  • /camera/rgb/image_mono : Grayscale image
  • /camera/rgb/points : point cloud containing RGB value for each point

How to retrieve data from the Kinect(Matlab)

Tutorial: Retrieving images from the Kinect using ROS into Matlab


List of Available Topics

Below is a complete list of topics that are published. You do not need to use most of them. They are just here to show you:

/camera/depth/camera_info
/camera/depth/disparity
/camera/depth/image
/camera/depth/image/compressed
/camera/depth/image/compressed/parameter_descriptions
/camera/depth/image/compressed/parameter_updates
/camera/depth/image/theora
/camera/depth/image/theora/parameter_descriptions
/camera/depth/image/theora/parameter_updates
/camera/depth/image_raw
/camera/depth/image_raw/compressed
/camera/depth/image_raw/compressed/parameter_descriptions
/camera/depth/image_raw/compressed/parameter_updates
/camera/depth/image_raw/theora
/camera/depth/image_raw/theora/parameter_descriptions
/camera/depth/image_raw/theora/parameter_updates
/camera/depth/points
/camera/rgb/camera_info
/camera/rgb/image_color
/camera/rgb/image_color/compressed
/camera/rgb/image_color/compressed/parameter_descriptions
/camera/rgb/image_color/compressed/parameter_updates
/camera/rgb/image_color/theora
/camera/rgb/image_color/theora/parameter_descriptions
/camera/rgb/image_color/theora/parameter_updates
/camera/rgb/image_mono
/camera/rgb/image_mono/compressed
/camera/rgb/image_mono/compressed/parameter_descriptions
/camera/rgb/image_mono/compressed/parameter_updates
/camera/rgb/image_mono/theora
/camera/rgb/image_mono/theora/parameter_descriptions
/camera/rgb/image_mono/theora/parameter_updates
/camera/rgb/image_raw
/camera/rgb/image_raw/compressed
/camera/rgb/image_raw/compressed/parameter_descriptions
/camera/rgb/image_raw/compressed/parameter_updates
/camera/rgb/image_raw/theora
/camera/rgb/image_raw/theora/parameter_descriptions
/camera/rgb/image_raw/theora/parameter_updates
/camera/rgb/points
/openni_node1/parameter_descriptions
/openni_node1/parameter_updates