zoukankan      html  css  js  c++  java
  • ubuntu14.04 and ros indigo install kinect driver--16

    摘要: 原创博客:转载请表明出处:http://www.cnblogs.com/zxouxuewei/

    今日多次测设ros indigo install kinect driver ,提示各种失败,然后心情非常不好 ,时不时的吐槽一下没有好的资料,在翻遍近百个贴后终于有初步结果。

    1.在ubuntu上安装kinect驱动比较繁琐,需要安装以下3个驱动包,

      OpenNI-Bin-Dev-Linux-x64-v1.5.7.10

      NITE-Bin-Dev-Linux-x64-v1.5.2.23

      Sensor-Bin-Linux-x64-v5.1.2.1

    2.可以在我的git上下载:https://github.com/ZXWBOT/kinect_driver

    git clone https://github.com/ZXWBOT/kinect_driver.git

    也可以直接在网盘下载:http://pan.baidu.com/s/1hqHB10w 提取密码:wrmn

    3.下载好三个驱动包后,在相应的文件夹解压。

    4.然后一次安装:

    安装之前首先说明一下:特殊压缩的解压方法:

    xxx.tar.gz 解压:tar xvzf xxx.tar.gz

    xxx.zip  解压:unzip  xxx.zip

    xxx.tar.bz2  解压:tar -jxvf xxx.tar.bz2

    xxx.tar.zip 分两步解压  1> unzip xxx.tar.zip  结果为 xxx.tar.bz2

               2>  tar -jxvf xxx.tar.bz2

    1>、安装openni

    cd !/kinect/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 ***
    则安装成功

    2>、安装NITE

    cd ~/kinect/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 ***
    则安装成功

    3>、安装Sensor

    cd ~/kinect/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 ***
    则安装成功

    5、运行示例
    连上kinect的数据线

    cd ~/kinect/OpenNI-Bin-Dev-Linux-x64-v1.5.7.10/Samples/Bin/x64-Release
    ./NiViewer 

    如果出现kinect画面则配置成功

    六、问题

    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版本则出现上面报错。
    之前安装好了驱动可以正常运行的,今天运行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
    我尝试用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了,如果不行还需要重启一下电脑

    8、Find user generator failed: Error!
    我使用xtion遇到这个问题如下报错,重新把压缩包拷到电脑上解压之后编译openni、Sensor、NITE这三个驱动,然后取消GlobalDefaults.ini文件里;UsbInterface=2 行的注释就好了

    $ ./Sample-NiSimpleSkeleton 
    Reading config from: '../../Config/SamplesConfig.xml'
    Could not find data file /usr/etc/primesense/Features_1_5_2/s.dat
    current working directory = /home/robot/software/OpenNI-Bin-Dev-Linux-x86-v1.5.7.10/Samples/Bin/x86-Release
    Find user generator failed: Error!

    9、No devices connected…. waiting for devices to be connected
    如果出现如下报错:

    roslaunch openni_launch openni.launch
    [ INFO] [1470382635.817744169]: Initializing nodelet with 4 worker threads.
    [ INFO] [1470382643.589318569]: No devices connected.... waiting for devices to be connected
    • 首先是驱动问题
      检查前面说的驱动是否正确安装
      如果之前是正常使用的,驱动没有问题
    • 再检查USB设备
      运行lsusb
    $ lsusb 
    Bus 004 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
    Bus 004 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
    Bus 003 Device 004: ID 04f2:b398 Chicony Electronics Co., Ltd 
    Bus 003 Device 012: ID 04ca:2007 Lite-On Technology Corp. 
    Bus 003 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
    Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
    Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
    Bus 001 Device 029: ID 045e:02ad Microsoft Corp. Xbox NUI Audio
    Bus 001 Device 027: ID 045e:02c2 Microsoft Corp. Kinect for Windows NUI Motor
    Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

    如果只有Microsoft Corp.设备只有一个或没有说明Kinect线没插上或者供电不足,检查Kinect分叉线的连接处和电源接口处是否正确连接,并检查电量。

    比如我的turtlebot2在底盘电量显示还有30%左右的时候用lsusb 查看设备发现只有Microsoft Corp. Kinect for Windows NUI Motor 而找不到Microsoft Corp. Xbox NUI Audio ,换一个外部供电的Kinect可以正常使用,lsusb 显示的也是两个设备。这也是很无奈的事情,只好乖乖充电了,也许底盘电量显示不符合实际。

    10、turtlebot官网的驱动安装

    • 首先按照前面说的安装openni
      请参照 二、安装OpenNI
    • 安装SensorKinect
    mkdir ~/kinectdriver 
    cd ~/kinectdriver 
    git clone https://github.com/avin2/SensorKinect 
    cd SensorKinect/Bin/
    tar xvjf SensorKinect093-Bin-Linux-x64-v5.1.2.1.tar.bz2
    cd Sensor-Bin-Linux-x64-v5.1.2.1/
    sudo ./install.sh
  • 相关阅读:
    Search Insert Position
    Sum Root to Leaf Numbers
    String to Integer (atoi)
    Populating Next Right Pointers in Each Node
    Triangle
    Pascal's Triangle II
    Longest Consecutive Sequence
    属性透明度
    ul的列表符号在IE6下显示不全
    table的属性border-collapse 设置边框是否合并
  • 原文地址:https://www.cnblogs.com/zxouxuewei/p/5271939.html
Copyright © 2011-2022 走看看