ubuntu14.04下 Kinect V2+Ros接口安装

1. 首先git下载代码,放到主文件夹下面

git clone https://github.com/OpenKinect/libfreenect2.git

 2. 然后安装依赖项如下,最好事先编译安装好OpenCV

sudo apt-get install build-essential cmake pkg-config libturbojpeg libjpeg-turbo8-dev mesa-common-dev freeglut3-dev libxrandr-dev libxi-dev

 3. 然后安装libusb。此处需要添加一个PPA

sudo apt-add-repository ppa:floe/libusb
sudo apt-get update
sudo apt-get install libusb-1.0-0-dev

 4. 接着运行下面的命令,安装GLFW3

sudo apt-get install libglfw3-dev

     如果没有成功的话,使用下面的命令,来代替上面的

cd libfreenect2/depends
sh install_ubuntu.sh
sudo dpkg -i libglfw3*_3.0.4-1_*.deb

 5. 然后安装OpenCL的支持库(没有使用GPU,这一步直接跳过没做)

 6. 接着编译库

cd ..
mkdir build && cd build
cmake ..
make
sudo make install

 7. 测试

     在build下面有个bin文件夹,放置生成的输出文件,插上kinect,然后运行。此时黄灯变成白色的,表示有驱动。注意:只能用于USB3的接口,好在台式机和笔记本都有3.0的口。

./bin/Protonect

     如果提示权限不够,failed to open Kinect V2 Access denied

     此时需要把libfreenect2文件夹下面的rules里面的一个90开头的文件复制到/etc/udev/rules.d/下面就可以了。

     然后重新运行上面的命令就可以了。

8. Ros接口安装

    对于已经安装了Ros Indigo的Ubuntu14.04来说,使用下面的命令

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

9. 测试ros接口

roslaunch kinect2_bridge kinect2_bridge.launch

     然后重新开一个新的终端

rosrun kinect2_viewer kinect2_viewer

     显示图像如下:

 

原文地址:https://www.cnblogs.com/lvchaoshun/p/5964751.html