4 Aralık 2014 Perşembe

Kinect Installation on Ubuntu 12.04 Platfrom

***Getting the OpenNI and PrimeSense drivers working on Ubuntu***
Here’s an overview of the process to get the OpenNI and PrimeSense drivers working with the Kinect and Ubuntu 12.04.

If you have not 51-android.rules in /etc/udev/rules.d/ you should copy.
Before copy operation please change OWNER="xxx". Replace your username with xxx.
$ sudo cp External/51-android.rules /etc/udev/rules.d/

Copy 55-primesense-usb.rules file to cp /etc/udev/rules.d/55-primesense-usb.rules ~/Desktop/
$ sudo cp External/55-primesense-usb.rules /etc/udev/rules.d/
$ udevadm control --reload-rules
$ udevadm trigger (if not works try "sudo shutdown -r 0")

-------------------------------------
Begin by installing some dependencies:
$ sudo apt-get install git-core cmake freeglut3-dev pkg-config build-essential libxmu-dev libxi-dev libusb-1.0-0-dev doxygen graphviz

Install Eclipse and JDK 1.6 or upper version

-------------------------------------
Installation should in the order:
    1. OpenNI
    2. SensorKinect driver
    3. NITE

-------------------------------------
Make a directory to store the build, then clone the OpenNI source from Github.
$ mkdir ~/kinect
$ cd ~/kinect
$ git clone https://github.com/OpenNI/OpenNI.git

Run the RedistMaker script in the Platform/Linux folder and install the output binaries
$ cd OpenNI/Platform/Linux/CreateRedist/
$ git checkout unstable
$ chmod +x RedistMaker
$ ./RedistMaker
$ cd ../Redist/OpenNI-Bin-Dev-Linux-x64-v1.5.4.0/

In ~/kinect/OpenNI/Data
 - SampleConfig.xml

To SampleConfig XML file:
  - add <License> attribute to <Licences> subterms:
     <License vendor="PrimeSense" key="0KOIk2JeIBYClPWVnMoRKn5cdY4="/>

  - add <MapOutputMode> attribute to <Configuration> subterms:
     <MapOutputMode xRes="640" yRes="480" FPS="30"/>

$ chmod +x install.sh
$ sudo ./install.sh

-------------------------------------
Next, clone the Avin2 SensorKinect source from Github.
$ cd ~/kinect/
$ git clone https://github.com/avin2/SensorKinect.git

Run the RedistMaker script in the Platform/Linux folder and install the output binaries.
$ cd SensorKinect/Platform/Linux/CreateRedist/
$ git checkout unstable
$ chmod +x RedistMaker
$ ./RedistMaker
You change x.x according to your Sensor-Bin version
$ cd ../Redist/Sensor-Bin-Linux-x64-v5.1.x.x/
$ chmod +x install.sh
$ sudo ./install.sh

Attention: If unstable branch gives compilation errors please try master branch again.

-------------------------------------
Then download the OpenNI Compliant Middleware NITE Binaries to ~/kinect
$ cd ~/kinect
$ wget http://www.mira-project.org/downloads/3rdparty/bin-linux/nite-bin-linux-x64-v1.5.2.21.tar.bz2

Extract the contents of the archive and switch to the Data directory contained within.
$ cd ~/kinect
$ tar -xvjpf nite-bin-linux-x64-v1.5.2.21.tar.bz2
$ cd NITE-Bin-Dev-Linux-x64-v1.5.2.21/Data

Now modify the license in the files: Sample-Scene.xml, Sample-Tracking.xml, and Sample-User.xml.
Edit four XML Configuration Files

In ~/kinect/NITE-Bin-Dev-Linux-x64-v1.5.2.21/Data:
 - Sample-Scene.xml
 - Sample-Training.xml
 - Sample-User.xml

To all XML files:
  - add <License> attribute to <Licences> subterms:
     <License vendor="PrimeSense" key="0KOIk2JeIBYClPWVnMoRKn5cdY4="/>

  - add <MapOutputMode> attribute to <Configuration> subterms:
     <MapOutputMode xRes="640" yRes="480" FPS="30"/>

You must edit Nite.ini in Hands_1_5_2/Data
(or whatever the latest version of Hands_XXX/ is called) to allow NITE
to track multiple hands. Uncommented both property lines, so the file contains:

[HandTrackerManager]
AllowMultipleHands=1
TrackAdditionalHands=1

Change back to the NITE directory and run the install script.
$ cd ..
$ sudo ./install.sh

-------------------------------------
That’s it!. You can plug your kinect to computer. You should see following line after "lsusb" command;
$ lsusb
>> Bus 002 Device 009: ID 045e:02ad Microsoft Corp. Xbox NUI Audio
>> Bus 002 Device 008: ID 045e:02b0 Microsoft Corp. Xbox NUI Motor
>> Bus 002 Device 010: ID 045e:02ae Microsoft Corp. Xbox NUI Camera

If you followed steps through to here you should be able to run the sample applications.
The OpenNI samples are here:
$ cd ~/kinect/OpenNI/Platform/Linux/Bin/x64-Release
$ ./Sample-NiSimpleViewer
$ ./Sample-NiHandTracker
and the PrimeSense samples are here:
$ cd ~/kinect/NITE-Bin-Dev-Linux-x64-v1.5.2.21/Samples/Bin/x64-Release
$ ./Sample-Boxes

-------------------------------------
Note: if you get the error:
InitFromXml failed: Failed to set USB interface!
the solution is to remove the gspca_linect kernel module:
$ sudo rmmod gspca_kinect

OpenNi, PrimeSense sensor installed, but Microsoft Kinect® does not work under Linux

Error message: "One or more of the following nodes could not be enumerated: Device: PrimeSense/SensorV2/5.0.0.43: The device is not connected!". Some older drivers result in a slightly different message like "Can't create any node of the requested type!" or "Open failed: Failed to set USB interface! Press any key to continue . . ."

Use lsusb or USB Viewer (yum install usbview) to identify if the device is recognized by the USB hub. There you will find three entries. Xbox NUI Audio, Xbox NUI Motor, Xbox NUI Camera. This means your installation of OpenNI is fine. In USB Viewer you will see the camera entry in black, and not as intended in red.

In my opinion the problem is caused by two reasons. First the presence of the Linux kernel module gspca_kinect and secondly in not automatically mounting the usb device as a filesystem.

Type lsmod to list all your running modules. You'll find the module gspca_kinect in /lib/modules/*.i686/kernel/drivers/media/video/gspca/gspca_kinect.ko. To disable the module use: rmmod gspca_kinect. If that does not help use force: rmmod -f gspca_kinect. Then unplug and plug back in your kinect! Note after reboot the module is loaded again. Use a blacklist to disable loading of the module in the first place. Add the entry blacklist gspca_kinect to the file /etc/modprobe.de/blacklist.conf. Renaming the module to *.bak does not help. After reboot it will be built again.

Secondly mount the usb device as a filesystem. Use the mount command: mount -t usbdevfs none /proc/bus/usb. Note that the none keyword is arbitrary, you can use anything like usbdevfs or kinect. If you do not want to have to mount the filesystem each time you reboot the system, you can add the entry none /proc/bus/usb usbdevfs defaults 0 0 to the file /etc/fstab after the /proc. This has the same effect as the mount command.

-------------------------------------

***Getting the OpenNI and PrimeSense drivers working on Android Pandaboard***
Please look at http://www.hirotakaster.com/ to install Kinect environment on android pandaboard.

Ümit Uzun
14/06/2013