Friday, 4 March 2011

Installing Kinect on Ubuntu (A full guide)

1) sudo apt-get install libglut3-dev build-essential libusb-1.0-0-dev git-core

2) mkdir ~/kinect && cd ~/kinect

3) git clone https://github.com/OpenNI/OpenNI.git

4) cd OpenNI/Platform/Linux-x86/Build

5) make && sudo make install

6) cd ~/kinect/

7) git clone https://github.com/boilerbots/Sensor.git

8) cd Sensor

9) git checkout kinect

10) cd Platform/Linux-x86/Build

11) make && sudo make install

12) go to this page at openNI to download the latest NITE release for your platform:NITE download page or for the impatient:
32-bit
64-bit

13) Save the NITE tarball to ~/kinect and untar it

14) cd ~/kinect/NITE/Nite-1.3.0.17/Data

15) 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=">

16) Repear step 15 and replace the existing MapOutputMode line with the line below in all 3 files.

< xres="640" yres="480" fps="30">

19) sudo niLicense PrimeSense 0KOIk2JeIBYClPWVnMoRKn5cdY4=

20) cd ~/kinect/NITE/Nite-1.3.0.17/

21) sudo ./install.bash

22) make && sudo make install

23) cd ~/kinect/NITE/Nite-1.3.0.17/Samples/Bin

24) sudo adduser YOURNAME video

25) nano /usr/etc/primesense/XnVHandGenerator/Nite.ini by uncommenting the two config parameters it contains

26) sudo nano /etc/udev/rules.d/51-kinect.rules

# ATTR{product}=="Xbox NUI Motor"
SUBSYSTEM=="usb", ATTR{idVendor}=="045e", ATTR{idProduct}=="02b0", MODE="0666"
# ATTR{product}=="Xbox NUI Audio"
SUBSYSTEM=="usb", ATTR{idVendor}=="045e", ATTR{idProduct}=="02ad", MODE="0666"
# ATTR{product}=="Xbox NUI Camera"
SUBSYSTEM=="usb", ATTR{idVendor}=="045e", ATTR{idProduct}=="02ae", MODE="0666"

27) sudo /etc/init.d/udev restart

28) cd ~kinect/Nite-1.3.0.17/Samples/Bin/

29) ./Sample-PointViewer and PLAY

21 comments:

Ibrahim M.mahmoud said...

Hi,

I am trying to install Kinect on Ubuntu. I am following your steps, however when I reach step number [11] I get this error after issuing the make command:

make -C XnCore CFG=Release
make[1]: Entering directory `/home/ibrahim/kinect/Sensor/Platform/Linux-x86/Build/XnCore'
../EngineLibMakefile:24: /usr/include/ni/CommonMakefile: No such file or directory
make[1]: *** No rule to make target `/usr/include/ni/CommonMakefile'. Stop.
make[1]: Leaving directory `/home/ibrahim/kinect/Sensor/Platform/Linux-x86/Build/XnCore'
make: *** [XnCore] Error 2


I checked for usr/include/ni but I found that this directory is not exist. I wish you can help.

Regards,

identitycrisis said...

getting into the same issue as Ibrahim is please help

ltertok said...

getting into the same issue as Ibrahim is please help too.

Dave Touretzky said...

They renamed CommonMakefile to CommonCppMakefile in the latest version of OpenNI. But the Sensor package hasn't been updated to match this. Simple fix:

cd /usr/include/ni
sudo ln -s CommonCppMakefile CommonMakefile

Anon said...

Hi

Real nice documentation. However, I get a problem at step 3 during the install process for the sensor. When I run ./RedistMaker, it gives:
make: Entering directory `/home/—–/kinect/Sensor/Platform/Linux-x86/Build’
make -C XnCore CFG=Release
make[1]: Entering directory `/home/—–/kinect/Sensor/Platform/Linux-x86/Build/XnCore’
../EngineLibMakefile:24: /usr/include/ni/CommonMakefile: No such file or directory
make[1]: *** No rule to make target `/usr/include/ni/CommonMakefile’. Stop.
make[1]: Leaving directory `/home/——/kinect/Sensor/Platform/Linux-x86/Build/XnCore’
make: *** [XnCore] Error 2
make: Leaving directory `/home/——/kinect/Sensor/Platform/Linux-x86/Build’

Following your previous comment I did the following:
cd /usr/include/ni
sudo ln -s CommonCppMakefile CommonMakefile
However, after this when I try the installation(./RedistMaker) it gives this:
…….
…….
./Release/jutils.o: In function `jcopy_sample_rows’:
jutils.c:(.text+0x9c): undefined reference to `xnOSMemCopy’
./Release/jutils.o: In function `jzero_far’:
jutils.c:(.text+0×36): undefined reference to `xnOSMemSet’
./Release/jutils.o: In function `jcopy_block_row’:
jutils.c:(.text+0×50): undefined reference to `xnOSMemCopy’
collect2: ld returned 1 exit status
make[1]: *** [../../Bin/Release/libXnFormats.so] Error 1
make[1]: Leaving directory `/home/——/kinect/Sensor/Platform/Linux-x86/Build/XnFormats’
make: *** [XnFormats] Error 2
make: Leaving directory `/home/—–/kinect/Sensor/Platform/Linux-x86/Build’

Any ideas whats wrong?
I tried installing the sensor modules from the OpenNI repo and continued with the remaining installation but the final release binaries did not work and kept saying ‘InitXmlfiles failed…..’
For your info:
OS: Linux 10.10
Pro: intel xenon

valle said...

I have exactly the same Problem as Anon described above. Make doesn´t work for boilerbots/Sensor but it works for Sensor from the OpenNI Page. With the sensor files from OpenNI starting the samples results with ‘InitXmlfiles failed…..’

gilead said...

There seems to be an error in the file kinect/Sensor/Platform/Linux-x86/Build:

LIB_USED must be replaced with USED_LIBS.

This should fix the linker errors on making XnFormats.

(BTW I've got the feeling that the Linux variant of this source is not maintained in a good way. All these errors (missing directory /var/lib/ni from install.sh, missing CommonMakefile and this error in Makefile are still in git master though found months ago)

carloos said...

hello i also work qith kienct and i have the same problem of us, i like that all people cooperate to help our-self, me mail is carloospm@gmail.com

best said...

I'm trying to install the NITE, but when i run the niLicense command I get this error:

Failed: Failed to write to the file!

Thus anyone know what it is?

Aron said...

Hi...I had a working system under Maverick, but after an upgrade to Oneirick, the following error keeps hunting me, when running any sample:

bontius@bontius-laptop:~/kinect/NITE/Nite-1.4.0.5/Samples/Bin/Release$ ./Sample-Boxes
1249 INFO OpenNI version is 1.3.3 (Build 6)-Linux-x86 (Oct 19 2011 17:54:01)
1281 INFO Filter Info - minimum severity: ERROR, masks: NONE
InitFromXml failed: Failed to set USB interface!
bontius@bontius-laptop:~/kinect/NITE/Nite-1.4.0.5/Samples/Bin/Release$ sudo ./Sample-Boxes
120 INFO OpenNI version is 1.3.3 (Build 6)-Linux-x86 (Oct 19 2011 17:54:01)
157 INFO Filter Info - minimum severity: ERROR, masks: NONE
InitFromXml failed: Failed to set USB interface!
bontius@bontius-laptop:~/kinect/NITE/Nite-1.4.0.5/Samples/Bin/Release$ sudo ./Sample-Boxes
121 INFO OpenNI version is 1.3.3 (Build 6)-Linux-x86 (Oct 19 2011 17:54:01)
153 INFO Filter Info - minimum severity: ERROR, masks: NONE
InitFromXml failed: The network connection has been closed!

I recompiled, make-d, make installed every step described in this guide...but it doesn't work...does anyone have any ideas why?

mangodan said...

I have the same problem with 64bit Oneiric, anybody tried with 32bit?

mangodan said...

Found the answer to the (or a) "InitFromXml failed: Failed to set USB interface!" problem.

rmmod gspca_kinect

Have fun!

Aron said...

Hey,

thanks for the reply...unfortunately, it's not solving the problem for me:

"ERROR: Module gspca_kinect does not exist in /proc/modules"

Am Ii doing something wrong?

thx,
regards,
Aron

Aron said...

Hey!

It works! Thanks for the tip!

Although the rmmod gspca_kinect didn't work, I "removed" the .ko file, and now it works:

sudo mv /lib/modules/3.0.0-12-generic/kernel/drivers/media/video/gspca/gspca_kinect.ko /lib/modules/3.0.0-12-generic/kernel/drivers/media/video/gspca/gspca_kinect.ko.BAK

Thanks,
Regards,
Aron

Guan said...

having problem in the 1st step..

this appear when i enter the command..
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package libglut3-dev is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'libglut3-dev' has no installation candidate

hw to solve this?

Jorge Ramon said...

Hello Ibrahim M.mahmoud, I solved the problem with this:

Open the EngineLibMakefile with and editor and change:
/usr/include/openni \ instead of /usr/include/ni \

and

include /usr/include/openni/CommonCppMakefile instead of
include /usr/include/ni/CommonMakefile

I hope you be help.
Regards,

jrcarvel@gmail.com

Jorge Ramon said...

Hello Ibrahim M.mahmoud, I solved the problem with this:

Open the EngineLibMakefile with and editor and change:
/usr/include/openni \ instead of /usr/include/ni \

and

include /usr/include/openni/CommonCppMakefile instead of
include /usr/include/ni/CommonMakefile

I hope you be help.
Regards,

jrcarvel@gmail.com

leodin said...

Guys,
just spent several hours to make it work, because the USB permissions didn't work. I'm running Ubuntu 12.04 with kernel 3.2.
After several attempts, I tried it on a kernel 2.6, and it worked perfectly.

Looking at the differences between the two systems, i noticed that the permissions on /dev/bus/usb/your_bus were different.

At the end, it turned out that it was a problem with the matching rules in udev. In fact, on the new kernels, the SYSFS{} syntax for udev matching was deprecated and it does't work anymore.

Thus, if you are running new kernels and you are not able to make it work after all the suggestions in this post, you may probably need to edit /etc/udev/rules.d/55-primesense-usb.rules by replacing all the SYSFS occurrences with ATTR. Save the file and run sudo service udev restart to make the changes effective. Unplug and re-plug the kinect, and you will be all set.

Hope this can be helpful!

Best

leodin

кαятнιк said...

Hi,

Iam getting an error
" Adding license.. install.sh: 84: install.sh: 0: not found "
any ideas??

Unknown said...

HI, i'm trying to install kinect on my linuxMint15 64bits but, i've encoutered this :
/usr/bin/ld: ./x64-Release/NiViewer.o: undefined reference to symbol 'glLightfv'
/usr/bin/ld: note: 'glLightfv' is defined in DSO /usr/lib/nvidia-325/libGL.so.1 so try adding it to the linker command line
/usr/lib/nvidia-325/libGL.so.1: could not read symbols: Invalid operation
collect2: error: ld returned 1 exit status
make[1]: *** [../../../Bin/x64-Release/NiViewer] Error 1
make[1]: Leaving directory `/home/daniel/kinect/OpenNI/Platform/Linux/Build/Samples/NiViewer'
make: *** [Samples/NiViewer] Error 2

Any idea of how to fix this glLightfv bug ?

thanks

Daniele said...

I get the same exact error:

/usr/bin/ld: ./x64-Release/NiViewer.o: undefined reference to symbol 'glLightfv'
/usr/bin/ld: note: 'glLightfv' is defined in DSO /usr/lib/nvidia-current/libGL.so.1 so try adding it to the linker command line
/usr/lib/nvidia-current/libGL.so.1: could not read symbols: Invalid operation
collect2: error: ld returned 1 exit status
make[1]: *** [../../../Bin/x64-Release/NiViewer] Error 1
make: *** [Samples/NiViewer] Error 2

Any clues? I've tried manually adding /usr/lib to LD_LIBRARY_PATH but to no avail.

Any clues?