Kinect v1
1.安装OpenNI
cd git clone https://github.com/OpenNI/OpenNI.git cd OpenNI/Platform/Linux/CreateRedist/ chmod +x RedistMaker ./RedistMaker cd ../Redist/OpenNI-Bin-Dev-Linux-x64-v1.5.7.10/ sudo ./install.sh
2.安装SensorKinect:
cd git clone git://github.com/avin2/SensorKinect.git cd SensorKinect/Platform/Linux/CreateRedist/ chmod +x RedistMaker ./RedistMaker 在SensorKinect的Bin目录下解压出Sensor-Bin-Linux-x64... cd ~/SensorKinect/Bin/Sensor-Bin-Linux-x64-v5.1.2.1 chmod +x install.sh sudo ./install.sh
3.安装Nite
cd NITE-Bin-Dev-Linux-x64-v1.5.2.23 sudo ./install.sh
ROS组件:
在安装了所有次要库之后,我们可以安装OpenNI使用所需的ros-core-.。但是我们必须删除之前的一个库,否则会出现一些问题:
sudo apt-get remove libopenni-sensor-pointclouds0
4.安装ROS-Kinect-driver
sudo apt-get install ros-indigo-openni-launch sudo apt-get install ros-indigo-openni-camera # 移除 sudo apt-get remove ros-indigo-openni-launch sudo apt-get remove ros-indigo-openni-camera
5.安装openni_tracker到工作空间下:
cd ~/ros_ws/src git clone https://github.com/ros-drivers/openni_tracker.git cd .. catkin_make
6.测试:
Terminal_1:
roslaunch openni_launch openni.launch
Terminal_2:
rosrun openni_tracker openni_tracker
Terminal_3:
rosrun rviz rviz
Kinect v2
1.NiViewer2
cd ~/libfreenect2/build sudo apt-get install openni2-utils cmake .. make && sudo make install (optional) sudo make install-openni2 NiViewer2
在Baxter实战 (四)里面我有安装OpenNI,网上也有别的安装方式参考安装OpenNI,https://structure.io/openni
cd cd OpenNI-Linux-x64-2.2/ sudo ./install.sh
生成的环境变量拷到.bashrc
cd ~
sudo gedit .bashrc
4.下载NiTE-2.0.0并解压:链接:https://pan.baidu.com/s/1NZkCL6--MfZORBQu9rTqUw 提取码:46pg
cd NiTE-2.0.0 sudo ./install.sh 生成NiTedevEnvironment文件,生成的环境变量拷到.bashrc gedit ./Samples/Bin/OpenNI.ini 加上一句Repository=/usr/lib/OpenNI2/Drivers(就是安装openni2生成的driver路径) ################# [Drivers] Repository=/usr/lib/OpenNI2/Drivers ################# cd ./Samples/Bin ./UserViewer
关键的一步,我当时运行UserViewer也是打不开设备,所以才想到这一步的,cd到NiTE-2.0.0/Samples/Bin/下,看到有一个libOpenNI2.so,这是安装包自带的一个当然不行,于是我把OpenNI-Linux-x86-2.2/Redist下的libopenNI.so考过来replace掉原来的那个文件,在进到NiTE-2.0.0/Samples/Bin/下跑UserViewer时出现了想要的深度图,在前面移动一下还有Tracking的标签。
这一步运行成功之后不要做ros的同学到这里就可以了。
5.ROS组件:
在安装了所有次要库之后,我们可以安装OpenNI使用所需的ros-core-.。但是我们必须删除之前的一个库,否则会出现一些问题:
sudo apt-get remove libopenni-sensor-pointclouds0
6.安装ROS-Kinect-driver
sudo apt-get install ros-indigo-openni2-launch sudo apt-get install ros-indigo-openni2-camera # 移除 sudo apt-get remove ros-indigo-openni2-launch sudo apt-get remove ros-indigo-openni2-camera
7.安装openni_tracker到工作空间下:
cd ~/ros_ws/src git clone https://github.com/ros-drivers/openni2_tracker.git cd .. catkin_make
报错:
Could not find a package configuration file provided by "orocos_kdl" with
any of the following names:
orocos_kdlConfig.cmake
orocos_kdl-config.cmake
将openni2_tracker下面CMakeLists.txt文件中下面这个命令
find_package(catkin REQUIRED COMPONENTS orocos_kdl )
改为:
find_package(catkin REQUIRED COMPONENTS ) find_package(orocos_kdl REQUIRED)
8.测试:
Terminal_1:
roslaunch openni2_launch openni2.launch
报错:Unsupported IR video mode - Resolution: 640x480@30Hz Format: Gray16,这个没有关系,只是表示当前的这个不支持color和ir图像模式,出现这个提示正常。
Terminal_2:这个~/NiTE-2.0.0/Redist终端目录下面执行
rosrun openni2_tracker openni2_tracker
Terminal_3:
rosrun rviz rviz
显示:
再打开终端运行:
rosrun kinect_based_arm_tracking tf_listen_v8_puber.py
发现坐标变换这个包没有写。凉凉。
https://github.com/birlrobotics/birl_baxter_demos/tree/master/kinect_based_arm_tracking
> 我的微信公众号名称:深度学习与先进智能决策
> 微信公众号ID:MultiAgent1024
> 公众号介绍:主要研究分享深度学习、机器博弈、强化学习等相关内容!期待您的关注,欢迎一起学习交流进步!