How to run the Kinect on Ubuntu 14.04

      This page documents how to set up a Kinect sensor for your Ubuntu 14.04 operating system running on a BeagleBoard-xM system. All these steps, required in order to install all the necessary components to support Kinect sensor, were discovered by studying and testing different tutorials on the internet and they are completed based on my own experience.

 

1.     First, be root to solve a lot of problems!!!

 

# sudo -sH

 

Install all the supporting packages

 

2.     The following is a comprehensive list of libraries and apps that you’re going to need installed on BeagleBoard:

 

# apt-get install    git-core

cmake

freeglut3-dev

pkg-config

gcc

g++

build-essential

libxmu-dev

libxi-dev

libusb-1.0-0-dev

doxygen

graphviz

git

 

3.     Install OpenJDK 6:

 

# apt-get install openjdk-6-jdk

 

Install OpenNI - more information on

 

Open Natural Interaction is an industry-led, non-profit organization focused on certifying and improving interoperability of natural user interface and organic user interface for natural interaction devices, applications that use those devices and middleware that facilitates access and use of such devices.

Natural Interaction Devices or Natural Interfaces are devices that capture body movements and sounds to allow for a more natural interaction of users with computers in the context of a Natural user interface. The Kinect and Wavi X-tion are examples of such devices.

 

4.     Prepare the require environment:

 

# mkdir ~/kinect

# cd ~/kinect

 

5.     Download and OpenNI from the git repo:

 

# git clone https://github.com/OpenNI/OpenNI.git

 

6.     Change the path:

 

# cd OpenNI/Platform/Linux/Build

 

7.     Next install OpenNI:

 

# make

 

You will get the following errors:

/usr/include/features.h:374:25: fatal error: sys/cdefs.h: No such file or directory\

/usr/include/sys/cdefs.h:385:27: fatal error: bits/wordsize.h: No such file or directory

/usr/include/features.h:398:23: fatal error: gnu/stubs.h: No such file or directory

 

8.     All of these problems are due to a change of the directory structure. To solve all of these errors do it in the following way:

 

# mkdir /usr/include/sys

# cp /usr/include/arm-linux-gnueabihf/sys/*.* /usr/include/sys

# mkdir /usr/include/bits

# cp /usr/include/arm-linux-gnueabihf/bits/*.* /usr/include/bits

# mkdir /usr/include/gnu

# cp /usr/include/arm-linux-gnueabihf/gnu/*.* /usr/include/gnu

 

9.     Try again:

 

# make

 

10.  Other errors appears:

/usr/include/gnu/stubs.h:7:29: fatal error: gnu/stubs-soft.h: No such file or directory

/usr/include/linux/errno.h:1:23: fatal error: asm/errno.h: No such file or directory

 

To solve all of these:

You're probably compiling on a linaro version newer than 12.x. Linaro had switched to hard-floats. Try removing the "-mfloat-abi=softfp" flag from the following file:

~/kinect/OpenNI/Platform/Linux/Build/Common/Platform.ARM

 

11.  After all of these the make command will works fine:

 

# make

 

12.  Now install:

 

# make install

 

13.  In the final part other errors appear:

* Redist OpenNi Ended.   !!

/root/kinect/OpenNI/Platform/Linux/Build

cd ../Redist; ./install.sh; cd -

/bin/sh: 1: ./install.sh: not found

 

14.  Change the path:

 

#cd ..

#ls –l

 

total 16

drwxr-xr-x  3 root root 4096 Nov 27 16:46 Bin

drwxr-xr-x 11 root root 4096 Nov 21 10:35 Build

drwxr-xr-x  4 root root 4096 Nov 27 18:36 CreateRedist

drwxr-xr-x  3 root root 4096 Nov 27 18:33 Redist

 

# cd Redist

# ls -l

 

total 4

drwxr-xr-x 8 root root 4096 Nov 27 18:33 OpenNI-Bin-Dev-Linux-Arm-v1.5.7.10

 

# cd OpenNI-Bin-Dev-Linux-Arm-v1.5.7.10

# ls –l

 

total 76

drwxr-xr-x  2 root root  4096 Nov 27 18:33 Bin

drwxr-xr-x  3 root root  4096 Nov 27 18:33 Documentation

drwxr-xr-x  5 root root  4096 Nov 27 18:33 Include

-r-xr-xr-x  1 root root  3638 Nov 27 18:33 install.sh

drwxr-xr-x  2 root root  4096 Nov 27 18:33 Jar

drwxr-xr-x  2 root root  4096 Nov 27 18:33 Lib

-rw-r--r--  1 root root 11358 Nov 27 18:33 LICENSE

-rw-r--r--  1 root root 34562 Nov 27 18:33 NOTICE

drwxr-xr-x 19 root root  4096 Nov 27 18:33 Samples

 

15.  … and finally install:

# ./install.sh

 

Installing OpenNI

****************************

copying shared libraries...OK

copying executables...OK

copying include files...OK

creating database directory...OK

registering module 'libnimMockNodes.so'...OK

registering module 'libnimCodecs.so'...OK

registering module 'libnimRecorder.so'...OK

creating java bindings directory...OK

Installing java bindings...OK

*** DONE ***

 

After all of these are done, install the Kinect driver by giting the Kinect sensor driver git repo

 

16.  Be in the right place:

 

# cd ~/kinect/

 

17.  Get Sensor Kinect from git clone: https://github.com/avin2/SensorKinect

 

# git clone https://github.com/avin2/SensorKinect.git

 

18.  Change directory into SensorKinect:

 

# cd SensorKinect

 

19.  Install the sensor and Kinect driver

 

# cd Platform/Linux/Build

# make

  

20.  And ... the first error: 

/usr/include/gnu/stubs.h:7:29: fatal error: gnu/stubs-soft.h: No such file or directory

 # include <gnu/stubs-soft.h>

You're probably compiling on a linaro version newer than 12.x. Linaro had switched to hard-floats. Remove the "-mfloat-abi=softfp" flag from the following file:

~/kinect/SensorKinect/Platform/Linux/Build/Common/Platform.ARM

 

21.  Second error:

 

   virtual XnStatus GetPixelCoordinatesInViewPoint(ProductionNode& other, XnUInt32
x, XnUInt32 y, XnUInt32& altX, XnUInt32& altY) = 0;
                    ^
make[1]: *** [Arm-Release/XnSensorDepthGenerator.o] Error 1
make[1]: Leaving directory
`/root/kinect/SensorKinect/Platform/Linux/Build/XnDeviceSensorV2'
make: *** [XnDeviceSensorV2] Error 2

The errors are in the files “XnSensorDepthGenerator.cpp” and “XnSensorDepthGenerator.h”. Now get the patch from:

https://raw.githubusercontent.com/bchretien/PKGBUILD/master/sensorkinect/XnSensorDepthGenerator.patch

put the patch in the same folder with the two files:

~/kinect/SensorKinect/Source/XnDeviceSensorV2

# cd ~/kinect/SensorKinect/Source/XnDeviceSensorV2

 

22.  To apply a patch, change to the directory where the file is located and call patch:

 

# patch < XnSensorDepthGenerator.patch

 

23.  Build the sensor and Kinect driver:

 

# cd ~/kinect/SensorKinect/Platform/Linux/Build

# make

 

24.  … and install:

 

# make install

 

25.  Uups … the third error: 

Creating redist folder...
Creating tar...
Done!
/root/kinect/SensorKinect/Platform/Linux/Build
cd ../Redist; ./install.sh; cd -
/bin/sh: 1: ./install.sh: not found
/root/kinect/SensorKinect/Platform/Linux/Build 

Solution:

 

# cd ..

# cd Redist

# cd Sensor-Bin-Linux-Arm-v5.1.2.1

# ./install.sh

Installing PrimeSense Sensor
**************************** 
creating config dir /usr/etc/primesense...OK
copying shared libraries...OK
copying executables...OK
registering module 'libXnDeviceSensorV2KM.so' with OpenNI...OK
registering module 'libXnDeviceFile.so' with OpenNI...OK
copying server config file...OK
setting uid of server...OK
creating server logs dir...OK
installing usb rules...OK
installing modprobe blacklist...OK
*** DONE ***

 

Install NITE

 

Up to now we did not install NITE - the middleware that allows for skeleton and gesture detection. If we are only processing raw depth data we do not need NITE. All of the non-graphical examples will run, but any example with glut (an OpenGL command for displaying images on the screen) will seg fault. 

 

26.  Download NITE Arm Version (for Skeleton Function):

 

https://docs.google.com/file/d/0B84NiCHwiRIMWXByR1lHV2dTaU9NSTU2SzAyaV9VQQ/edit?pli=1

 

27.  Decompress the package:

 

# mkdir nite-arm

# cd nite-arm

# tar –xvf  ../nite-bin-linux-arm-v1.5.0.1.tar.bz2

 

28.  Play with license:

 

# cd ~/kinect/ nite-arm/Data

 

Open:

Sample-User.xml,

Sample-Scene.xml and

Sample-Tracking.xml

 

and replace the existing License line with the line below (note: this is case sensitive!):

 

<vendor="PrimeSense" key="0KOIk2JeIBYClPWVnMoRKn5cdY4=">

 

29.  Install license:

 

# niLicense PrimeSense 0KOIk2JeIBYClPWVnMoRKn5cdY4=

 

30.  Check the license:

 

# niLicense -l

 

31.  Install NITE

 

# ./install.sh

 

32.  Put the user in the correct group:

 

# adduser YOURNAME video

 

Check all from sample

 

Ex.1.

# cd ~/kinect/OpenNI/Platform/Linux/Redist/OpenNI-Bin-Dev-Linux-Arm-v1.5.7.10/Samples/Bin/Arm-Release#

# ./Sample-NiSimpleRead 

        Reading config from: '../../Config/SamplesConfig.xml'
        Open failed: USB interface is not supported! 

Solution:

1.     Edit the file: 
        /usr/etc/primesense/GlobalDefaultsKinect.ini
2.     uncomment the line:
        UsbInterface=2
3.     … and replace value with 1.

 

Ex.2.

cd ~/kinect/openni/Samples/Bin/x64-Release/

./Sample-NiSimpleSkeleton

Ex.3. with problems !!!!

 

# java -jar org.openni.Samples.SimpleViewer.jar 

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error (os_linux_zero.cpp:285), pid=1619, tid=3054912608
#  fatal error: caught unhandled signal 11
#
# JRE version: OpenJDK Runtime Environment (7.0_65-b32) (build 1.7.0_65-b32)
# Java VM: OpenJDK Zero VM (24.65-b04 mixed mode linux-arm )
# Derivative: IcedTea 2.5.3
# Distribution: Ubuntu 14.04 LTS, package 7u71-2.5.3-0ubuntu0.14.04.1
# Failed to write core dump. Core dumps have been disabled. To enable core dumping,
try "ulimit -c unlimited" before starting Java again
#
# An error report file with more information is saved as:
#
/root/kinect/OpenNI/Platform/Linux/Redist/OpenNI-Bin-Dev-Linux-Arm-v1.5.7.10/Samples/Bin/Arm-Release/hs_err_pid1619.log
#
# If you would like to submit a bug report, please include
# instructions on how to reproduce the bug and visit:
#   http://icedtea.classpath.org/bugzilla
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
Aborted

Now the build crash ! Any solutions ? Please help me (mdobrea[at]etti.tuiasi.ro) !

Some information regarding this error: "Signal 11 is seg fault, which could be from it trying to use more memory than is possible. I'm using java 8 (1.8.0-ea) and when I do "java -help" it shows an option -minimal that selects the minimal VM; you might try that. Then there are the memory options; -Xms, -Xmx, and -Xss. Do a google search; there are many web pages describing people's adventures with those options. (With mine "java -X" shows help for all of the -X options.)"

Keywords: Kinect sensor, Ubuntu 14.04, NITE, OpenNI, install

Back
Main Frame (acces to all the site)
Course of Intelligent Embedded Systems
"Gheorghe Asachi" Technical University of Iasi
Faculty of Electronics, Telecommunications and Information Technology
Associate Professor Dan Marius Dobrea