First, make sure you have everything you need to compile OpenNI (if you don’t already have a Java JDK, you will need to install one):
sudo apt-get install git-core cmake freeglut3-dev pkg-config \ build-essential libxmu-dev libxi-dev libusb-1.0-0-dev \ doxygen graphviz mono-complete
Next, make a directory to store the build in, then clone the OpenNI source from GitHub:
mkdir ~/kinect cd ~/kinect git clone https://github.com/OpenNI/OpenNI.git
Due to a bug in the OpenNI driver, you cannot use custom USB control types on Linux and Mac without first changing some lines in the XnUSBLinux.cpp file. Here’s how:
gedit ~/kinect/OpenNI/Source/OpenNI/Linux/XnUSBLinux.cpp
Search for the two lines that contain “XN_STATUS_USB_WRONG_CONTROL_TYPE”, comment them out and then insert “bmRequestType = nType;” just before them, as is in the following snippet:
else if (nType == XN_USB_CONTROL_TYPE_STANDARD) { bmRequestType = LIBUSB_REQUEST_TYPE_STANDARD; } else { bmRequestType = nType; //return (XN_STATUS_USB_WRONG_CONTROL_TYPE); } bmRequestType |= LIBUSB_ENDPOINT_IN;
The line numbers for this should be 761 and 819.
Now compile OpenNI by using the RedistMaker script in the Platform/Linux folder and install the binaries that are created by using the install script:
cd ~/kinect/OpenNI/Platform/Linux/CreateRedist/ chmod +x RedistMaker ./RedistMaker cd ../Redist/OpenNI-Bin-Dev-Linux-x86-v1.5.2.23/ sudo ./install.sh
That’s it! You should now have a working OpenNI installation that is compatible with my kinectmotorcontrol program. If you want to install SensorKinect and NITE, this page should help you continue with that:
Comments are closed.