Book Image

Learning Robotics using Python

Book Image

Learning Robotics using Python

Overview of this book

If you are an engineer, a researcher, or a hobbyist, and you are interested in robotics and want to build your own robot, this book is for you. Readers are assumed to be new to robotics but should have experience with Python.
Table of Contents (14 chapters)
13
Index

Programming Kinect with Python using ROS, OpenCV, and OpenNI


Let's look at how we can interface and work with the Kinect sensor in ROS. ROS is bundled with OpenNI driver, which can fetch RGB and the depth image of Kinect. This package can be used for Microsoft Kinect, PrimeSense Carmine, Asus Xtion Pro, and Pro Live.

This driver mainly publishes raw depth, RGB, and IR image streams. The openni_launch package will install packages such as openni_camera and openni_launch. The openni_camera package is the Kinect driver that publishes raw data and sensor information, whereas the openni_launch package contains ROS launch files. It's basically an XML file that launches multiple nodes at a time and publishes data such as point clouds.

How to launch OpenNI driver

The following command will open the OpenNI device and load all nodelets to convert raw depth/RGB/IR streams to depth images, disparity images, and point clouds. The ROS nodelet package is designed to provide a way to run multiple algorithms...