ORB_SLAM2文件夹下,使用rosrun命令无法成功运行,报错:
/home/junchuan/catkin_ws/src/ORB_SLAM2/Examples/ROS/ORB_SLAM2/Stereo: error while loading shared libraries: librealsense.so.1: cannot open shared object file: No such file or directory
又不想重装librealsense,只能从头编译。
首先安装Pangolin,在cmake --build .时报错:
#include 找不到,推测还是没有装librealsense的缘故。
删除build文件夹,修改Pangolin/src/CMakelists.txt文件中的option(BUILD_PANGOLIN_LIBREALSENSE "Build support for LibRealSense video input" ON)和option(BUILD_PANGOLIN_LIBREALSENSE2 "Build support for LibRealSense2 video input" ON):
把ON都变成OFF,再次编译则成功。
在ORB_SLAM2文件夹下,打开build.sh,按其中提到的找到所有已有的build文件夹删除,重新执行build.sh,仍然遇到报错:
error: static assertion failed: std::map must have the same value_type as its allocator
按照链接:
https://github.com/raulmur/ORB_SLAM2/pull/585/files
修改相应文件,则build.sh不再报错。
接下来执行build_ros.sh时报错:
error: ‘usleep’ was not declared in this scope
按照连接:
fix compilation error in ubuntu16.04 by varyshare · Pull Request #834 · raulmur/ORB_SLAM2 · GitHub
在相应的Examples/ROS/ORB_SLAM2/src/AR/ViewerAR.cc文件中加入了:#include
build_ros.sh不再报错,且能够正常运行ORB_SLAM2相关算法。