Table of Contents

Kinect

device

/etc/udev/rules.d/90-kinect2.rules

# ATTR{product}=="Kinect2"
SUBSYSTEM=="usb", ATTR{idVendor}=="045e", ATTR{idProduct}=="02c4", MODE="0666"
SUBSYSTEM=="usb", ATTR{idVendor}=="045e", ATTR{idProduct}=="02d8", MODE="0666"
SUBSYSTEM=="usb", ATTR{idVendor}=="045e", ATTR{idProduct}=="02d9", MODE="0666"
sudo udevadm control --reload

On Ubuntu avoid autosuspend of USB. Add usbcore.autosuspend=-1 to grub options

# check with
grep . /sys/bus/usb/devices/*/power/autosuspend

To connect kinect I have to use proper USB 3.0 chipset like this

USB controller: Renesas Technology Corp. uPD720201 USB 3.0 Host Controller

OpenCL

sudo apt-get install beignet beignet-dev opencl-headers

libfreenect2 for CUDA

git clone https://github.com/xlz/libfreenect2.git
sudo apt-get install -y build-essential libturbojpeg libtool autoconf libudev-dev cmake mesa-common-dev freeglut3-dev libxrandr-dev doxygen libxi-dev libjpeg-turbo8-dev
cd libfreenect2/depends
cp -r $path_of_gstjpeg_src/nv_headers .
sh install_ubuntu.sh
sudo ln -s /usr/lib/arm-linux-gnueabihf/libturbojpeg.so.0.0.0 /usr/lib/arm-linux-gnueabihf/libturbojpeg.so
cd ../examples/protonect/
mkdir build && cd build
cmake ..
make
../bin/Protonect

MAX_ISO_BUFFER_LENGTH in usbfs.h caused issues. In the published version, the size is 49152 * 128, the mPCIe card/Jetson didn't like that, but works when the size is 49152.

libfreenect2

cd /lab/kinect
sudo apt-get install -y build-essential libturbojpeg libtool autoconf libudev-dev cmake \
  freeglut3-dev libxrandr-dev doxygen libxi-dev libopencv-dev
sudo ln -s /usr/lib/x86_64-linux-gnu/libturbojpeg.so.0 /usr/lib/x86_64-linux-gnu/libturbojpeg.so
git clone https://github.com/OpenKinect/libfreenect2
 
cd libfreenect2/depends
./install_ubuntu.sh
cd ../examples/protonect
cmake  -DENABLE_CXX11=ON
make && sudo make install

Patch to avoid black screen

For example in Protonect.cpp:

add an include after line 37

#include <libfreenect2/packet_pipeline.h>

change line 61 from

libfreenect2::Freenect2Device *dev = freenect2.openDefaultDevice();

to

libfreenect2::Freenect2Device *dev = freenect2.openDefaultDevice(new libfreenect2::CpuPacketPipeline());

References

ROS

Ubuntu 14.04

sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu trusty main" > /etc/apt/sources.list.d/ros-latest.list'
wget https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -O - | sudo apt-key add -
sudo apt-get update
sudo apt-get install ros-indigo-desktop-full

initialization

sudo rosdep init
rosdep update

activate on working shell

echo "source /opt/ros/indigo/setup.bash" >> ~/.bashrc
source ~/.bashrc

create workspace

mkdir -p /lab/catkin_ws/src
cd /lab/catkin_ws/src
catkin_init_workspace
cd ..
catkin_make

iai_kinect2

cd /lab/catkin_ws/src
git clone https://github.com/code-iai/iai_kinect2.git
cd iai_kinect2
rosdep install -r --from-paths .
cd /lab/catkin_ws
catkin_make -DCMAKE_BUILD_TYPE="Release"