Skip to content

Instantly share code, notes, and snippets.

@brannondorsey
Created December 5, 2015 22:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brannondorsey/21efaefca9708549996f to your computer and use it in GitHub Desktop.
Save brannondorsey/21efaefca9708549996f to your computer and use it in GitHub Desktop.
2014-01-25-kinect Ubuntu

2014-01-25-kinect Ubuntu

  • Installation notes for Ubuntu Desktop LTS 12.04 Precise.

  • NOTE: All code is installed to ~/Developer/Work

Install Updates

  • Update system:
sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade
sudo reboot
sudo apt-get autoremove

Install freenect from github

  • Install dependencies:
sudo apt-get install cmake libpthread-stubs0-dev libgl1-mesa-dev libx11-dev libxrandr-dev \
libfreetype6-dev libglew1.5-dev libjpeg8-dev libsndfile1-dev libopenal-dev freeglut3-dev \
libxmu-dev libxi-dev build-essential libusb-1.0-0-dev git git-core
  • Clone libfreenect:
mkdir -p ~/Developer/Work
cd ~/Developer/Work
git clone https://github.com/OpenKinect/libfreenect
cd libfreenect
git checkout tags/v0.3.0
  • NOTE: Tested with stable release v0.3.0

  • Build and install:

cd  ~/Developer/Work/libfreenect
mkdir build
cd build
cmake .. -DBUILD_OPENNI2_DRIVER=ON
make
sudo make install
  • Add to library path:
sudo vi /etc/ld.so.conf.d/custom.conf
/usr/local/lib64/ 
/usr/local/lib64/OpenNI2-FreenectDriver/
sudo ldconfig 
  • Test with glview:
sudo glview

Install node.js

  • Install node.js from source, this will take 10 min:
sudo apt-get install g++ curl libssl-dev apache2-utils
cd ~/Developer/Work
wget http://nodejs.org/dist/node-latest.tar.gz
tar -xzf node-latest.tar.gz
cd node-v*
./configure
make
sudo make install
  • NOTE: Tested with v0.10.23

Install OpenNI and NiTE

unzip OpenNI-Linux-x64-2.2.0.33.tar.zip
tar xvf OpenNI-Linux-x64-2.2.tar.bz2
mv OpenNI-Linux-x64-2.2 ~/Developer/Work/
cd ~/Developer/Work/OpenNI-Linux-x64-2.2
sudo ./install.sh
unzip NiTE-Linux-x64-2.2.tar1.zip
tar xvf NiTE-Linux-x64-2.2.tar.bz2
mv NiTE-Linux-x64-2.2 ~/Developer/Work/
cd ~/Developer/Work/NiTE-Linux-x64-2.2
sudo ./install.sh
  • Copy libFreenectDriver.so to OpenNI2 directory:
cp /usr/local/lib64/OpenNI2-FreenectDriver/libFreenectDriver.so \
~/Developer/Work/OpenNI-Linux-x64-2.2/Redist/OpenNI2/Drivers/
  • Copy all libraries to /usr/local/lib
sudo cp -R ~/Developer/Work/OpenNI-Linux-x64-2.2/Redist/* /usr/local/lib
sudo cp -R ~/Developer/Work/NiTE-Linux-x64-2.2/Redist/* /usr/local/lib
  • Add to library path:
sudo vi /etc/ld.so.conf.d/custom.conf
/usr/local/lib64/ 
/usr/local/lib64/OpenNI2-FreenectDriver/
# Added
/usr/local/lib
sudo ldconfig 
  • Add OpenNI and NiTE to .bashrc:
cat ~/Developer/Work/OpenNI-Linux-x64-2.2/OpenNIDevEnvironment >> ~/.bashrc
cat ~/Developer/Work/NiTE-Linux-x64-2.2/NiTEDevEnvironment >> ~/.bashrc
  • Logout and log back in to include changes made to .bashrc.

Install Nuimotion and Websocket

  • Make project directory:
mkdir ~/Developer/Work/prototype-nuimotion/
  • Copy Redist files to the root of the app:
cp -R ~/Developer/Work/NiTE-Linux-x64-2.2/Redist/* ~/Developer/Work/prototype-nuimotion/
cp -R ~/Developer/Work/OpenNI-Linux-x64-2.2/Redist/* ~/Developer/Work/prototype-nuimotion/
  • Install websocket:
npm install websocket
  • Install node-gyp:
sudo npm install -g node-gyp
  • Create prototype-nuimotion and download the nuimotion project to the node_modules directory:
mkdir ~/Developer/Work/prototype-nuimotion/node_modules
cd ~/Developer/Work/prototype-nuimotion/node_modules
wget https://github.com/bengfarrell/nuimotion/archive/master.zip
unzip master.zip
mv nuimotion-master nuimotion
rm master.zip
  • Rebuild:
cd ~/Developer/Work/prototype-nuimotion/node_modules/nuimotion
node-gyp rebuild
  • Edit index.js to fix require, remove 'src' prefix in first line:
vi ~/Developer/Work/prototype-nuimotion/node_modules/nuimotion/index.js
module.exports = require('./build/Release/nuimotion.node');
...
  • Copy basicquickstart.js and run:
cp ~/Developer/Work/prototype-nuimotion/node_modules/nuimotion/quickstart/basicquickstart.js ~/Developer/Work/prototype-nuimotion/
cd ~/Developer/Work/prototype-nuimotion/
sudo node basicquickstart.js

Is the hardware being detected?

lsusb | grep Xbox
  • Should result in:
Bus 002 Device 006: ID 045e:02ad Microsoft Corp. Xbox NUI Audio
Bus 002 Device 005: ID 045e:02b0 Microsoft Corp. Xbox NUI Motor
Bus 002 Device 007: ID 045e:02ae Microsoft Corp. Xbox NUI Camera
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment