mkdir -p install/kinect
cd app
cd kinect
git clone https://github.com/OpenKinect/libfreenect
cd libfreenect
mkdir build
cd build
cmake -L .. # -L lists all the project options
make
注:在cmake可能会提示要求更高的cmake版本,需自行在cmake官网下载并安装
注:这三个安装包版本要对应,不然会导致报错,实测在ubuntu16.04和ubuntu18.04下OpenNI-Bin-Dev-Linux-x64-v1.5.7.10、Sensor-Bin-Linux-x64-v5.1.2.1、NITE-Bin-Linux-x64-v1.5.2.23这三个版本均可用
cd ~/install/kinect
cd OpenNI-Bin-Dev-Linux-x64-v1.5.7.10
sudo ./install.sh
注:卸载时同样运行./install.sh 带上参数-u,即:sudo ./install.sh -u
cd ..
cd Sensor-Bin-Linux-x64-v5.1.2.1
sudo ./install.sh
注:卸载时同样运行./install.sh 带上参数-u,即:sudo ./install.sh -u
cd ..
cd NITE-Bin-Linux-x64-v1.5.2.23
sudo ./install.sh
注:卸载时运行./uninstall.sh,即:sudo ./uninstall.sh
roslaunch openni_launch openni.launch
cd ~/install/kinect/OpenNI-Bin-Dev-Linux-x64-v1.5.7.10/Samples/Bin/x64-Release
./NiViewer
若出现画面说明运行成功
注:若出现如下情况
(1)请检查是否成功运行openni.launch
(2)尝试重新安装Sensor(具体操作见上文)
(一)ubuntu16.04:
sudo apt-get update
sudo apt-get install ros-kinetic-openni-camera ros-kinetic-openni-launch
sudo apt-get install ros-kinetic-freenect-camera ros-kinetic-freenect-stack ros-kinetic-freenect-launch
(二)ubuntu18.04:
sudo apt-get update
sudo apt-get install ros-melodic-openni-*
sudo apt-get install ros-kinetic-freenect-*
roslaunch freenect_launch freenect.launch
roslaunch openni_launch openni.launch
若成功运行,则kinect的环境配置完毕
注:若出现报错情况,可尝试重新安装Sensor(或者卸载掉Sensor不要再安装),然后重新安装NITE
cd ~/catkin_ws/src
git clone https://github.com/ros-drivers/openni_tracker.git
cd ..
catkin_make
roslaunch openni_launch openni.launch camera:=openni
rosrun openni_tracker openni_tracker
rosrun rviz rviz
cd ~/catkin_ws/src
git clone https://github.com/pirobot/skeleton_markers.git
cd skeleton_markers
git checkout indigo-devel
cd ~/catkin_ws
catkin_make
rospack profile
(1)
roslaunch skeleton_markers markers_from_tf.launch
rosrun rviz rviz -d `rospack find skeleton_markers`/markers_from_tf.rviz
roslaunch openni_launch openni.launch
roslaunch skeleton_markers skeleton.launch
文章参考链接:
https://blog.csdn.net/MyJournal/article/details/84553242#Kinect_V1_167
https://blog.csdn.net/weewqrer/article/details/48183969