Difference between revisions of "PCL/OpenNI tutorial 1: Installing and testing"

From robotica.unileon.es
Jump to: navigation, search
(Installing the drivers)
Line 43: Line 43:
  
 
For this tutorial, we are going to use PCL.
 
For this tutorial, we are going to use PCL.
 +
 +
==Ubuntu==
 +
 +
There is a [https://launchpad.net/~v-launchpad-jochen-sprickerhof-de/+archive/pcl PPA] (Personal Package Archive, a private repository) which has everything we need. Add it to your sources, and install everything:
 +
 +
<geshi lang=Bash lines=0>sudo add-apt-repository ppa:v-launchpad-jochen-sprickerhof-de/pcl
 +
sudo apt-get install libpcl-all libpcl-all-dev openni-dev ps-engine</geshi>

Revision as of 11:18, 13 September 2012

Microsoft Kinect device.

This series of tutorials will explain the usage of a Kinect device for "serious" researching purposes. As you may know, Kinect is in fact an affordable depth sensor, developed with technology from PrimeSense, based on infrarred structured light method. It also has a common camera (which makes it a RGB-D device), a microphone and a motorized pivot. Its use is not limited to playing with a Xbox360 console, you can plug it to a computer and use it like any other sensor. Many open-source drivers and frameworks are available.

Since its release on November 2010, it has gained a lot of popularity, specially among the scientific community. Many researches have procured themselves one because, despite the low cost (about 150 €), it has proven to be a powerful solution for depth sensing projects. Current investigations focus on real-time surface mapping, object recognition and tracking, and localization. Impressive results (like the KinectFusion project from Microsoft) are already possible.

I will explain the installation and usage of one of these Kinect devices with a common PC, and the possibilities it offers. I will do it in an easy to understand way, intended for students that have just acquired it and want to start from scratch.

NOTE: The tutorials are written for Linux platforms.

Requirements

You will need the following:

  • A common Kinect device, out of the box. You can buy it in your local electronics shop, or online. It also includes a free copy of Kinect Adventures, which is useless if you don't own the console. Microsoft has released a Kinect for Windows device, which is a normal looking Kinect no longer compatible with Xbox360, that will only work with their official SDK, intended for developers only.
  • A computer running Linux (Debian or Ubuntu preferably).
  • A medium-sized room. Kinect has some limitations for depth measurement: 40cm minimum, 8m maximum (make it 6).

NOTE: Kinect for Windows may have problems working with open source drivers on Linux .

Connecting everything

Kinect does not work with a common USB port. Its power consumption is a bit higher because of the motor, so Microsoft came up with a connector that combines USB and power supply. Old Xbox 360 models needed a special adapter, new ones already have this new port. Luckily, Kinect comes with the official adapter out of the box (otherwise you will have to buy one).

Just plug the adapter to any power socket, and the USB to your computer. Let's check typing this in a terminal:

<geshi lang=Bash lines=0>lsusb</geshi>

Output should list the following devices:

<geshi lang=Bash lines=0>Bus 001 Device 005: ID 045e:02b0 Microsoft Corp. Xbox NUI Motor Bus 001 Device 006: ID 045e:02ad Microsoft Corp. Xbox NUI Audio Bus 001 Device 007: ID 045e:02ae Microsoft Corp. Xbox NUI Camera</geshi>

Installing the drivers

There is more than one way to get your Kinect working on your PC, and start developing applications for it:

  • Kinect for Windows: released on June 16, 2011 as a non-commercial SDK intended for application development. Version 1.5 was released on May 21, 2012. Because it comes from Microsoft, it's obviously the easiest way to get everything working. Sadly, there is no Linux version.
  • libfreenect library: from the OpenKinect project, it is intended to be a free and open source alternative to the official drivers. libfreenect is used by projects like ofxKinect, an addon for the openFrameworks toolkit that runs on Linux and OS X. ofxKinect packs a nice example application to show the RGB and point cloud taken from Kinect.
  • Primesense drivers: they were released as open source after the the OpenNI project was created, along with the motion tracking middleware, NITE. NI stands for Natural Interaction, and the project tries to enforce a common standard for human input using Kinect-like sensors. These official drivers are used by ROS (the Robot Operating System, a massive collection of libraries and tools for robotic researchers) and PCL (the Point Cloud Library, with everything needed for 3D point cloud processing).
  • SensorKinect: a modified version of the official PrimeSense drivers, used for example by ofxOpenNI (another openFrameworks addon).

For this tutorial, we are going to use PCL.

Ubuntu

There is a PPA (Personal Package Archive, a private repository) which has everything we need. Add it to your sources, and install everything:

<geshi lang=Bash lines=0>sudo add-apt-repository ppa:v-launchpad-jochen-sprickerhof-de/pcl sudo apt-get install libpcl-all libpcl-all-dev openni-dev ps-engine</geshi>