环境:ubuntu16.04 ROS kinetic
1. 建立 ROS 工作空间:
cd projects/ORB_SLAM2ws
mkdir src
catkin_make
2.在 /src 目录下:
git clone https://github.com/raulmur/ORB_SLAM2.git
3.构建 ORB_SLAM2:
cd ORB_SLAM2
sudo chmod +x build.sh
./build.sh
chmod +x build_ros.sh
./build_ros.sh
cd
gedit .bashrc
在末尾加上:
export ROS_PACKAGE_PATH=${ROS_PACKAGE_PATH}:/home/【本机】/projects/ORB_SLAM2ws/src/ORB_SLAM2/Examples/ROS
编译 ./build_ros.sh 时可能报错
解决方法是修改/ORB_SLAM2/Examples/ROS/ORB_SLAM2/CmakeLists.txt,添加一句
#新加
find_package(Boost COMPONENTS filesystem system REQUIRED)
set(LIBS
${OpenCV_LIBS}
${EIGEN3_LIBS}
#新加
${Boost_LIBRARIES}
${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
)