先說一下博主的運行環境:
Ubuntu kylin14.04
kinect第一代
另外還要注意的是openni、NITE、Sensor這三個包的版本必須匹配才能正常運行,我的版本分別是:
OpenNI-Bin-Dev-Linux-x64-v1.5.7.10.tar
NITE-Bin-Linux-x64-v1.5.2.23.tar
SensorKinect093-Bin-Linux-x64-v5.1.2.1
可以在我的網盤下載:http://pan.baidu.com/s/1hqHB10w 提取密碼:wrmn
【重要】
這三個軟件包的安裝要注意順序:先安裝openni,再安裝Sensor,最後安裝NITE。
另外可以帶-u參數卸載這些軟件包重新安裝$ sudo ./install.sh -u
,但是NITE裡有專門的uninstall.sh可以運行它來卸載。
下載OpenNI-Bin-Dev-Linux-x64-v1.5.7.10.tar解壓得到OpenNI-Bin-Dev-Linux-x64-v1.5.7.10文件夾,我把這三個包都放在home下面的software目錄下
$ cd /home/siat/software/OpenNI-Bin-Dev-Linux-x64-v1.5.7.10 $ sudo ./install.sh
如果顯示如下
Installing OpenNI
****************************
copying shared libraries...OK
copying executables...OK
copying include files...OK
creating database directory...OK
registering module 'libnimMockNodes.so'...OK
registering module 'libnimCodecs.so'...OK
registering module 'libnimRecorder.so'...OK
creating java bindings directory...OK
Installing java bindings...OK
*** DONE ***
則安裝成功
下載SensorKinect093-Bin-Linux-x64-v5.1.2.1.tar.bz2解壓得到SensorKinect093-Bin-Linux-x64-v5.1.2.1文件夾放到software下面
$ cd /home/siat/software/Sensor-Bin-Linux-x64-v5.1.2.1
$ sudo ./install.sh
如果顯示如下
Installing PrimeSense Sensor
****************************
creating config dir /usr/etc/primesense...OK
copying shared libraries...OK
copying executables...OK
registering module 'libXnDeviceSensorV2KM.so' with OpenNI...OK
registering module 'libXnDeviceFile.so' with OpenNI...OK
copying server config file...OK
setting uid of server...OK
creating server logs dir...OK
installing usb rules...OK
installing modprobe blacklist...OK
*** DONE ***
則安裝成功
下載NITE-Bin-Linux-x64-v1.5.2.23.tar解壓得到NITE-Bin-Linux-x64-v1.5.2.23文件夾放在software下面
$ cd /home/siat/software/NITE-Bin-Linux-x64-v1.5.2.23
$ sudo ./install.sh
如果顯示如下:
Installing NITE
***************
Copying shared libraries... OK
Copying includes... OK
Installing java bindings... OK
Installing module 'Features_1_3_0'...
Registering module 'libXnVFeatures_1_3_0.so'... OK
Installing module 'Features_1_3_1'...
Registering module 'libXnVFeatures_1_3_1.so'... OK
Installing module 'Features_1_4_1'...
Registering module 'libXnVFeatures_1_4_1.so'... OK
Installing module 'Features_1_4_2'...
Registering module 'libXnVFeatures_1_4_2.so'... OK
Installing module 'Features_1_5_2'...
Registering module 'libXnVFeatures_1_5_2.so'... OK
Copying XnVSceneServer... OK
Installing module 'Features_1_5_2'
registering module 'libXnVHandGenerator_1_3_0.so'...OK
Installing module 'Features_1_5_2'
registering module 'libXnVHandGenerator_1_3_1.so'...OK
Installing module 'Features_1_5_2'
registering module 'libXnVHandGenerator_1_4_1.so'...OK
Installing module 'Features_1_5_2'
registering module 'libXnVHandGenerator_1_4_2.so'...OK
Installing module 'Features_1_5_2'
registering module 'libXnVHandGenerator_1_5_2.so'...OK
Adding license.. OK
*** DONE ***
則安裝成功
連上kinect的數據線
$ cd ~/software/OpenNI-Bin-Dev-Linux-x64-v1.5.7.10/Samples/Bin/x64-Release
$ ./NiViewer
如果出現kinect畫面則配置成功
如果想卸載這三個軟件包只要同樣運行./install.sh
帶上參數-u
即可
$ sudo ./install.sh -u
1、注意如果出現:
One or more of the following nodes could not be enumerated:
Device: PrimeSense/SensorV2/5.1.6.6: The device is not connected!
Device: PrimeSense/SensorV2/5.1.0.41: The device is not connected!
Device: PrimeSense/SensorV2/5.1.6.6: The device is not connected!
Device: PrimeSense/SensorV2/5.1.0.41: The device is not connected!
Press any key to continue . . .
這樣的問題有可能是這三個包版本不匹配,我這裡的三個包親測是可用的。但是Sensor如果是5.1.6.6版本則出現上面報錯。
—-2015.10.19
之前安裝好了驅動可以正常運行的,今天運行openni的節點卻發現不能正常打開Kinect了,報錯如下:
Device: PrimeSense/SensorV2/5.1.0.41: The device is not connected!
於是我重新做了一遍步驟四
$ cd /home/siat/software/Sensor-Bin-Linux-x64-v5.1.2.1
$ sudo ./install.sh
再次運行示例程序成功啟動Kinect
—-2016.06.13
我嘗試用32位版本的驅動來啟動xtion,還是提示連不上設備,當我重新編譯上面三個64位驅動運行NiViewr的時候出現如下提示:
One or more of the following nodes could not be enumerated:
Device: PrimeSense/SensorKinect/5.1.2.1: The device is not connected!
Device: PrimeSense/SensorV2/5.1.0.41: The device is not connected!
Device: PrimeSense/SensorKinect/5.1.2.1: The device is not connected!
Device: PrimeSense/SensorV2/5.1.0.41: The device is not connected!
Press any key to continue . . .
我用./install.sh -u
卸載Openni和Sensor,用./uninstall.sh
卸載NITE,然後重新到原64位Sensor驅動下運行./install.sh
之後正常使用NiViewr開啟kinect。
2、注意openni2和NITE2版本的包現在只能用於xtion,kinect只能使用版本1的驅動
3、查看版本
$ pkg-config --modversion opencv
會顯示版本號,比如
2.4.11
可以將opencv替換為其他包名字,用Tab鍵補全以避免名字出錯
4、用apt-get方式安裝的一些包
kinect用的freenect:
$ sudo apt-get install ros-indigo-freenect-launch
$ sudo apt-get install ros-indigo-freenect-camera
$ sudo apt-get install ros-indigo-freenect-stack
xtion用的openni:
$ sudo apt-get install ros-indigo-openni-camera
$ sudo apt-get install ros-indigo-openni-launch
上面如果不行請使用下面的驅動
$ sudo apt-get install ros-indigo-openni2-camera
$ sudo apt-get install ros-indigo-openni2-launch
5、關於kinect和xtion切換的問題
openni默認的設備是kinect,如果你用的是kinect,裝完上面的驅動之後運行NiViewer可以正常使用
但是如果你使用的設備是xtion,直接運行NiViewer會出現如下報錯
Open failed: USB interface is not supported!
運行$ roslaunch openni_launch openni.launch
出現如下報錯
[ INFO] [1464612941.306334563]: Initializing nodelet with 4 worker threads.
[ INFO] [1464612947.664521213]: Number devices connected: 1
[ INFO] [1464612947.666982470]: 1. device on bus 002:04 is a SensorV2 (601) from PrimeSense (1d27) with serial id '1312120224'
[ INFO] [1464612947.667906288]: Searching for device with index = 1
[ INFO] [1464612947.670034045]: No matching device found.... waiting for devices. Reason: openni_wrapper::OpenNIDevice::OpenNIDevice(xn::Context&, const xn::NodeInfo&, const xn::NodeInfo&, const xn::NodeInfo&, const xn::NodeInfo&) @ /tmp/binarydeb/ros-indigo-openni-camera-1.9.5/src/openni_device.cpp @ 61 : creating depth generator failed. Reason: USB interface is not supported!
USB interface is not supported!
的問題 解決方案如下:參考博客
修改GlobalDefaults.ini配置文件
$ sudo gedit /etc/openni/GlobalDefaults.ini
將第60行前面的分號去掉(即取消注釋)
;UsbInterface=2
再次嘗試運行openni.launch
或者NiViewer
就可以用xtion了,如果不行還需要重啟一下電腦
關於xtion博主還有一個一直很困擾的問題,在剛裝系統的電腦上安裝上面三個驅動使用xtion很正常,但是在使用了一段時間的電腦上裝這三個驅動卻一直提示the device is not connected!
,試了上面所有的方案都不行,估計是驅動沖突,我卸載了所有openni、nite相關的包重新安裝驅動也不行,最後只好無奈的使用微軟的Kinect才正常
6、Open failed: Xiron OS failed to wait on event!
運行如下命令:
$ sudo chmod +x /usr/bin/XnSensorServer
7、博主重裝了32位ubuntu14.04,然後下載上面三個驅動對應的32位驅動,編譯之後可以驅動華碩的xtion pro live,值得注意的是有可能遇到如下問題
Open failed: Failed to set USB interface!
這個問題跟前面的類似,需要改GlobalDefaults.ini 文件,但是32位驅動的這個配置文件不在/etc/openni/下了,搜索了一下文件夾找到這個文件原來是在/usr/etc/primesense/
$ sudo gedit /usr/etc/primesense/GlobalDefaults.ini
將第60行前面的分號去掉(即取消注釋)
;UsbInterface=2
再次嘗試運行openni.launch
或者NiViewer
就可以用xtion了,如果不行還需要重啟一下電腦