From Wiki for iCub and Friends
Revision as of 13:08, 21 November 2012 by Daniele.Domenichelli@iit.it (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

He everyone, I would like to propose a group for all interested in on line human tracking by using the Kinect. If you already did this, please let me know or you can point me to the right direction. I hope that someone is interested in this topic :)

By the way I'm Karinne Ramirez-Amaro. If you want to be included in the mailing list of this group, please send an email to Mike.

**Updates** We will have a very informal meeting at 10:00 tomorrow Tuesday 24th June in the projector room. We are going to walk through the Kinect device code developed by Duarte.



Kotaro Nagahama: Hi Karinne, I'm a beginner using the iCub, but I'm interested in this topic. Is there anyone else in this project?

Mike Ciaraldi: Sign me up! Last year I help implement a YARP module for the Polhemus motion tracker, but I have never worked with Kinect. Update: Now I have!

Christian Dondrup

NOTE: Please add yourself. Everybody is welcome to join this group :)

Kinect set up

Dear all, I will bring the kinect tomorrow and we can start playing around with the libraries that are already on the yarp repository. I will propose that we gather at 15:30? and try the modules together :)

I found this link Kinect Device Driver

OK. Let's talk about the project at 15:30. I also have my kinect, so we can use two kinects for the experiments. -- Kotaro

Instructions for installation

  • Install Required support library: First step is to check if you have all the needed libraries, and if they are up to date.
 $sudo apt-get install libusb-1.0-0-dev freeglut3-dev g++
  • Install OpenNi and NITE
Option 1:
Follow the steps in this article about how to install the Ubuntu binaries.
You can find the binary files Kinect software
or you can always try to install the sources from: OpenNI package from here and NITE from here

Option 2:
Download the binary openni and nite libraries from the synaptic, for that you need to configure your Ubuntu repositories.
Configure your Ubuntu repositories to allow "restricted," "universe," and "multiverse." By doing the following:
* Setup your sources.list
$sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu oneiric main" > /etc/apt/sources.list.d/ros-latest.list'
 NOTE: you should change the "oneiric" for the name of your current system.
 Set up your keys:
 $wget http://packages.ros.org/ros.key -O - | sudo apt-key add -
 and update the repository:
 $ sudo apt-get update
Option 3:
If you are using Ubuntu 10.04 and get a Segmentation fault when running the KinectDeviceLocal, this guide could help.
First you have to undo all previous installations:
* If you downloaded the binaries and used the install scripts, use the install scripts again with -u for uninstall or the uninstall.sh script from NITE
* If you downloaded the Synaptec packages you have to remove them with Synaptec.
Now we can start building and installing:
* Download OpenNI from the git repository. It is important that you use the unstable version as described below:
 $git clone https://github.com/OpenNI/OpenNI.git
 $cd OpenNI
 $git checkout unstable
 $cd Platform/Linux/CreateRedist
 $cd ../Redist/*
 $sudo ./install.sh
* Download the avin2 Sensorkit
 $git clone https://github.com/avin2/SensorKinect.git
 $cd SensorKinect
 $git checkout unstable
 $cd Platform/Linux/CreateRedist
 $cd ../Redist/*
 $sudo ./install.sh
* Download the Nite binaries from the OpenNI website.
* Exchange the three xml files in the Nite/Data dierctory with the ones you can find here.
* Run the Nite install.sh script
  • Testing your installation
* Got to your OpenNI directory (the one you downloaded)
* If you downloaded the binaries:
 $cd Samples/Bin/*-Release
* If you built it from Source like described by Option 3:
 $cd Platform/Linux/Bin/*-Release
* If that does not run you have to try another installation version
  • Now it is time to compile YARP to be able to work with the kinect device
 Go to the root directory of YARP source code and make an update of the yarp source code
 yarp$ svn up
 and enter to the build directory
 $cd build
 run "ccmake .." (on UNIX) or "cmake" (on Windows):
 $ccmake .. 
 inside cmake select the "CREATE_DEVICE_LIBRARY_MODULES" option to "ON". After you configure, turn ENABLE_yarpmod_KinectDeviceClient="ON" and ENABLE_yarpmod_KinectDeviceLocal="ON"
 $press "c" to configure and the "g" to generate
 $make install
  • Test everything and hope for the best :)
 go to the yarp root directory and open the TEST folder inside the kinect folder
 $cd yarp/src/modules/kinect/OpenNI/TEST/  and compile it
 $mkdir build
 $cd build
 $ccmake ..
 configure press "c" and generate "g"
 $make <- if you get an error you may need to update your yarp version and compile it again
 It is time to test the kinect under yarp
 $yarpdev --device KinectDeviceLocal --name /kinect --portPrefix /kinect --userDetection
 $cd yarp/src/modules/kinect/OpenNI/TEST/build
 $ ./DeviceTest

Running the on-line imitation Demo

This is a code that Duarte implemented. You can download the code from here:

svn checkout https://wiiarmctrl.googlecode.com/svn/trunk/FinalInteractionSoftware/Kinect_iCub_ctrl Kinect_iCub_ctrl

After you compile this code, you can run this code in the simulation. If you want to run the demo in the real robot, you need to change the name of the port inside the file "ModuleCtrl.cpp" and modify the port name "string robotPortName = "/icub";" inside the function open().

Useful Links

Kinect microsoft Library

Microsoft on Kinect data formats

More on data formats

How to Hack Kinect (PDF)

Diagrams showing the layers of Kinect software: upper layers (PDF), lower layers (PDF), editable (ODG (LibreOffice Draw) format).