ROS环境编译编译 ORB_SLAM2 遇到的问题

编译 ORB_SLAM2 遇到的问题
问题1:ROS环境编译报错double-check ROS_PACKAGE_PATH

ROS环境编译报错:
You should double-check your ROS_PACKAGE_PATH to ensure that packages are found in the correct precedence order.
Call Stack (most recent call first): /opt/ros/melodic/share/ros/core/rosbuild/public.cmake:177 (_rosbuild_check_package_location)
CMakeLists.txt:4 (rosbuild_init)

解决方法

(1)原因:很有可能是你以前编译过ORB_SLAM的ros包,然后再次编译就会可能路径不一样出错

(2)进入share目录,删除原来的ORB_SLAM2软连接(如果没有这个软连接,就直接进入第(3)步)
cd /opt/ros/melodic/share
sudo rm -r ORB_SLAM2

(3)对当前工程在/opt/ros/melodic/share目录下建立软连接
sudo ln -s /home/YOUR_FOLDER_PATH/ORB_SLAM2 /Examples/ROS/ORB_SLAM2 /opt/ros/melodic/share/ORB_SLAM2

原文链接:https://blog.csdn.net/BigHandsome2020/article/details/123435000

问题2:
报错:
ROS环境编译编译 ORB_SLAM2 遇到的问题_第1张图片解决方法:
首先定位出问题的位置:

 locate libopencv_imgproc.so
 locate libopencv_core.so

之后将/usr/lib/x86_64-linux-gnu/libopencv_imgproc.4.2.0和/usr/lib/x86_64-linux-gnu/libopencv_core.4.2.0复制到ORB_SLAM2的lib文件夹当中

最后,复制过后,在 ORB_SLAM2/Examples/ROS/ORB_SLAM2路径下的 CMakeList.txt 文件中添加

${PROJECT_SOURCE_DIR}/../../../lib/libopencv_imgproc.so.4.2.0
${PROJECT_SOURCE_DIR}/../../../lib/libopencv_core.so.4.2.0

否则会报以下错误信息
ROS环境编译编译 ORB_SLAM2 遇到的问题_第2张图片另解决办法:
换个用opencv4的ORB-SLAM2, github上有 https://github.com/mateomd-dev/orb-slam2。

你可能感兴趣的:(人工智能)