电脑连接上kinect v1 ,运行命令:
roslaunch turtlebot_navigation gmapping_demo.launch
出现下面的错误
[ INFO] [1511252619.048751272]: No matching device found.... waiting for devices.
Reason: std::string openni2_wrapper::OpenNI2Driver::resolveDeviceURI(const string&) @ /tmp/binarydeb/ros-indigo-openni2-camera-0.2.9/src/openni2_driver.cpp @ 737 : Invalid device number 1, there are 0 devices connected.
[ INFO] [1511252622.049099861]: No matching device found.... waiting for devices.
Reason: std::string openni2_wrapper::OpenNI2Driver::resolveDeviceURI(const string&) @ /tmp/binarydeb/ros-indigo-openni2-camera-0.2.9/src/openni2_driver.cpp @ 737 : Invalid device number 1, there are 0 devices connected.
设备不匹配,发现一个设备,但是无效的。
当时一看,怎么调用到openni2上去了,对于v1设备应该是openni就可以了,使用openni2反而会有兼容性问题。
然后重新下载了库文件
sudo apt-get install --reinstall ros-indigo-openni-camera ros-indigo-openni-launch
才次执行命令,发现还是不行。然后就怀疑是不是应该卸载掉ros-indigo-openni2-*的东西,执行命令sudo apt-get remove ,发现连navigation,bringup等组件也会卸载掉。一下狠心,将这些组建都卸载掉了,然后重新安装,发现安装过程由于navigation,bringup等组件依赖ros-indigo-openni2-*,so,也将这个又安装回去了,这下就无语了。这么搞肯定是不对的。
再然后到网上找,发现命令
roslaunch openni_launch openni.launch
roslaunch freenect_launch freenect.launch
都可以执行成功,并且用rviz可以看到rgb图和深度图。那就是驱动没有问题,会不会是gmapping中include了openni2而不是openni。一路跟踪...
ubuntu@ubuntu-ThinkPad-X220:/opt/ros/indigo/share/turtlebot_bringup/launch$ grep -nsr openni ./*
./3dsensor_kinect.launch:4: We use openni_camera here, turn everything on by default
./3dsensor.launch:4: We use openni_camera here, turn everything on by default
./includes/3dsensor/asus_xtion_pro.launch.xml:23: <include file="$(find openni2_launch)/launch/openni2.launch">
./includes/3dsensor/asus_xtion_pro_offset.launch.xml:23: <include file="$(find openni2_launch)/launch/openni2.launch">
发现kinect是用的openni,而asus_xtion_pro使用的是openni2,怪不的组件间有依赖。
最后想到,是不是会是3d 摄像头的环境变量没有设置,导致自动识别asus_xtion_pro设备,而不是kinect设备。
查看.bashrc,发现
#export TURTLEBOT_3D_SENSOR=kinect
果然被注释掉了,取消注释gmapping就跑成功了。
因为前段时间使用laser而故意把这里注释掉了,然后就忘记了....
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)