1. 程式人生 > >libfreenect2+iai_kinect2+kinect v2+ros indigo

libfreenect2+iai_kinect2+kinect v2+ros indigo

reference::

https://github.com/OpenKinect/libfreenect2

https://github.com/code-iai/iai_kinect2

if it is not work, try this:

3.ubuntu16.04kinectV2 進行連線

參考: http://www.linuxdiyf.com/linux/24563.html

http://www.cnblogs.com/hitcm/p/5118196.html

(1)、通過git下載libfreenect2

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

(2)、然後安裝依賴項如下,最好事先編譯安裝好OpenCV

$ sudo apt-get install build-essential cmake pkg-config libturbojpeglibjpeg-turbo8-dev mesa-common-dev freeglut3-dev libxrandr-devlibxi-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)、接著編譯庫(其實就是在libfreenect2資料夾下新建了build目錄,然後再進入build目錄執行編譯)

$ cd ..

$mkdir build && cd build

$cmake ..

$make

$sudo make install

>>測試

1. shell視窗執行libusb可以檢視當前連線的USB外設情況。(如果看到有“Microsoft Coop.”的項表示連線上了!)

2. 執行libfreenect2自帶的測試程式.

build下面有個bin資料夾,放置生成的輸出檔案,插上kinect,然後執行。此時黃燈變成白色的,表示有驅動。注意:只能用於USB3的介面,好在臺式機和筆記本都有3.0的口。

$ ./bin/Protonect

提示許可權不夠,failedto open Kinect V2 Access denied

此時需要把libfreenect2資料夾下面的rules裡面的一個90開頭的檔案複製到/etc/udev/rules.d/下面:

$ cp ../platform/linux/udev/90-kinect2.rules /etc/udev/rules.d

發現此時執行$ ./bin/Protonect還是會提示Access denied。前面加上sudo後可以了。。。

最終使用的命令:$ sudo ./bin/Protonect

===============================================================================

!!! bug fixed::

1,final step:

roscore
rosrun kinect2_bridge kinect2_bridge _depth_method:=opengl _reg_method:=cpu
rosrun kinect2_viewer kinect2_viewer

2,in the process of install libfreenect2 ---->can not open ubuntu

gpu drive issue: in bios change gpu of default or search baidu or google for can not open ubuntu or black screen when open ubuntu