参考链接:https://blog.csdn.net/u012526003/article/details/51003347
使用平台
ubuntu 16.04
ros kinetic
kinect安装步骤
1.安装kinect驱动文件
sudo apt-get install libfreenect-dev
sudo apt-get install ros-kinetic-freenect-launch
2.运行kinect
roslaunch freenect_launch freenect.launch
ORB_SLAM2程序
1.首先把ORB_SLAM2文件夹放在创建的catkin_ws工作空间中的src文件夹下.
2.在环境变量中加入下面这行
export ROS_PACKAGE_PATH=${ROS_PACKAGE_PATH}:PATH/ORB_SLAM2/Examples/ROS
把PATH
换成~/catkin_ws/src
3.最后重新加载环境文件
4.执行build_ros.sh脚本
$ chmod +x build_ros.sh
$ ./build_ros.sh
注释:
出现了’usleep’ was not declared in this scope问题.在出现问题的文件中添加
#include<unistd.h>
依然错误
参考了连接:https://blog.csdn.net/qq_17232031/article/details/79519695
MakeFiles/Makefile2:718: recipe for target 'CMakeFiles/Mono.dir/all' failed
make[1]: *** [CMakeFiles/Mono.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
make[2]: *** No rule to make target '/opt/ros/kinetic/lib/libopencv_calib3d3.so.3.2.0', needed by '../RGBD'. Stop.
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/RGBD.dir/all' failed
make[1]: *** [CMakeFiles/RGBD.dir/all] Error 2
make[2]: *** No rule to make target '/opt/ros/kinetic/lib/libopencv_calib3d3.so.3.2.0', needed by '../Stereo'. Stop.
CMakeFiles/Makefile2:104: recipe for target 'CMakeFiles/Stereo.dir/all' failed
make[1]: *** [CMakeFiles/Stereo.dir/all] Error 2
解决办法:修改ORB_SLAM2/Examples/ROS/ORB_SLAM2中CMakelists.txt,在set那里添加-lboost_system
set(LIBS
${OpenCV_LIBS}
${EIGEN3_LIBS}
${Pangolin_LIBRARIES}
${PROJECT_SOURCE_DIR}/../../../Thirdparty/DBoW2/lib/libDBoW2.so
${PROJECT_SOURCE_DIR}/../../../Thirdparty/g2o/lib/libg2o.so
${PROJECT_SOURCE_DIR}/../../../lib/libORB_SLAM2.so
-lboost_system
)
真机测试
在三个终端分别执行以下命令,或把以下命令写入文件
roscore(启动ros)roslaunch freenect_launch freenect-registered-xyzrgb.launch(启动摄像头)rosrun ORB_SLAM2 RGBD ~/catkin_ws/src/ORB_SLAM2/Vocabulary/ORBvoc.txt ~/catkin_ws/src/ORB_SLAM2/Examples/RGB-D/TUM1.yaml