1.安装驱动
cd ~ git clone https://github.com/OpenKinect/libfreenect2.git cd libfreenect2
2.安装依赖项
sudo apt-get install build-essential cmake pkg-config sudo apt-get install libusb-1.0-0-dev sudo apt-get install libturbojpeg libjpeg-turbo8-dev sudo apt-get install libglfw3-dev sudo apt-get install libopenni2-dev//还有一些是可选的,具体上github上看sudo apt-get install beignet-dev
3.编译
mkdir build && cd build cmake .. -DCMAKE_INSTALL_PREFIX=/usr/local/ #修改了原来的安装位置 make sudo make install
sudo cp ../platform/linux/udev/90-kinect2.rules /etc/udev/rules.d/
4.运行
./bin/Protonect #重新接入之后运行测试,断电 sudo apt-get install openni2-utils && sudo make install-openni2 && NiViewer2 #可选测试
5.结果
6.卸载
sudo rm -rf /usr/local/include/libfreenect2 cd /usr/local/lib sudo rm -rf libfreenect2.so libfreenect2.so.0.2 libfreenect2.so.0.2.0 cd OpenNI2/Drivers sudo rm -rf libfreenect2-openni2.so libfreenect2-openni2.so.0
7.在ROS上运行
mkdir catkin_ws cd catkin_ws mkdir src cd ~/catkin_ws/src/ git clone https://github.com/code-iai/iai_kinect2.git cd iai_kinect2 rosdep install -r --from-paths . cd ~/catkin_ws catkin_make -DCMAKE_BUILD_TYPE="Release" rospack profile
8.运行
cd ~/catkin_ws source devel/setup.bash roslaunch kinect2_bridge kinect2_bridge.launch
9.重新打开一个终端
cd ~/catkin_ws source devel/setup.bash rosrun kinect2_viewer kinect2_viewer