1、配置环境、安装ROS ubuntu16.04 + kinetic
2、安装依赖 cmake opencv Eigen3:
sudo apt-get install libeigen3-dev
3、创建catkin_ws 文件夹,并ROS初始化工作空间
mkdir -p ~/catkin_ws/src
cd ~/catkin_ws/src
catkin_init_workspace
cd ~/catkin_ws/
catkin_make
4、git或者手动下载ORB-SLAM2的源代码
git clone https://github.com/raulmur/ORB_SLAM2.git ORB_SLAM2
5、配置ORB-SLAM2的ROS路径
vim或者gedti .bahsrc
写如路径
export ROS_PACKAGE_PATH=${ROS_PACKAGE_PATH}:PATH/ORB_SLAM2/Examples/ROS
source /opt/ros/kinetic/setup.bash
PATH:改为自己的ORB-SLAM2文件夹的路径 /home/zz/catkin_ws/src
6、source .bashrc 使环境生效
7、下载usbc_cam驱动摄像头安装包
8、编译ORB-SLAM2 的算法库和ROS可执行程序
编译ORB-SLAM2算法库 sudo ./build.sh
编译ROS程序 sudo ./build_ros.sh
9、开三个窗口分别运行
roscore
roslaunch usb_cam usb_cam-test.launch
rosrun ORB_SLAM2 Mono /home/zz/catkin_ws/src/ORB_SLAM2-master/Vocabulary/ORBvoc.txt /home/zz/catkin_ws/src/ORB_SLAM2-master/Examples/Monocular/TUM1.yaml
10、实际效果