1、安装工具
sudo apt-get install vim git cmake
sudo apt-get install gcc g++
2、安装ROS kinetic(选择性安装)
http://wiki.ros.org/cn/kinetic/Installation/Ubuntu
按照以上步骤安装,基本不会有太大问题
3、安装ORB-SLAM2
https://github.com/raulmur/ORB_SLAM2
4 、安装kinect v1驱动 包括: openni、Sensor、NITE(可不安装)
(1)安装openni
安装依赖
sudo apt-get install git build-essential python libusb-1.0-0-dev freeglut3-dev openjdk-8-jdk
sudo apt-get install doxygen graphviz mono-complete
安装openni
$ git clone https://github.com/OpenNI/OpenNI.git
$ cd OpenNI
$ git checkout Unstable-1.5.4.0
$ cd Platform/Linux/CreateRedist
$ chmod +x RedistMaker
$ ./RedistMaker
$ cd ../Redist/OpenNI-Bin-Dev-Linux-[xxx] (where [xxx] is your architecture and this particular OpenNI release)
$ sudo ./install.sh
(2)安装Kinect Sensor
$ git clone https://github.com/avin2/SensorKinect
$ cd SensorKinect
$ cd Platform/Linux/CreateRedist
$ chmod +x RedistMaker
$ ./RedistMaker
$ cd ../Redist/Sensor-Bin-Linux-[xxx] (where [xxx] is your architecture and this particular OpenNI release)
$ chmod +x install.sh
$ sudo ./install.sh
(3)测试(连接kinect v1,2.0或3.0都可以)
$ cd OpenNI/Platform/Linux-x86/Bin/Release
(我的目录是:/home/xxx/catkin_ws/src/kinect/OpenNI/Platform/Linux/Bin/x64-Release)
$ ./NiViewer
# 运行结果是黄黑色深度图像
5 在ROS下运行ORB_SLAM2
(1)构建RGBD节点
将包含Examples / ROS / ORB_SLAM2的路径添加到ROS_PACKAGE_PATH环境变量中。打开.bashrc文件并在末尾添加以下行。
$ gedit ~/.bashrc
添加:export ROS_PACKAGE_PATH=${ROS_PACKAGE_PATH}:PATH/ORB_SLAM2/Examples/ROS
# 我的路径为:export ROS_PACKAGE_PATH=${ROS_PACKAGE_PATH}:/home/xxx/catkin_ws/src/ORB_SLAM2/Examples/ROS
(2)运行build_ros.sh脚本
$ chmod +x build_ros.sh
$ ./build_ros.sh
(3)运行
# 终端1:kinect的驱动文件
$ roslaunch freenect_launch freenect-registered-xyzrgb.launch
# 终端2:运行RGBD节点
rosrun ORB_SLAM2 RGBD PATH_TO_VOCABULARY PATH_TO_SETTINGS_FILE
$ rosrun ORB_SLAM2 RGBD /home/xxx/catkin_ws/src/ORB_SLAM2/Vocabulary/ORBvoc.txt /home/xxx/catkin_ws/src/ORB_SLAM2/Examples/RGB-D/TUM1.yaml
参考:
https://blog.csdn.net/radiantjeral/article/details/82193370
https://blog.csdn.net/sinat_38343378/article/details/79180265
安装过程中遇到的问题:
/usr/lib/x86_64-linux-gnu/libboost_system.so: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
解决:https://github.com/raulmur/ORB_SLAM2/issues/494
补:安装usb_cam驱动
cd ~/catkin_ws/src
# 下载usb_cam包
git clone https://github.com/bosch-ros-pkg/usb_cam.git usb_cam
# 编译
cd ..
catkin_make
# 启动节点测试
roslaunch usb_cam usb_cam-test.launch