编译ORB_SLAM3 遇到的小坑总结

ORB_SLAM3与ORB_SLAM2的安装相同先请阅读此文章

orb_slam安装中的坑,mission planner多机仿真_Chasing的博客-CSDN博客

1. mz/catkin_ws/src/ORB_SLAM3/src/LocalMapping.cc:628:49: error: no match for ‘operator/’ (operand types are ‘cv::Matx’ and ‘float’) x3D = x3D_h.get_minor<3,1>(0,0) / x3D_h(3)错误

 将x3D = x3D_h.get_minor<3,1>(0,0) / x3D_h(3);

 修改为

  x3D = cv::Matx31f(x3D_h.get_minor<3,1>(0,0)(0) / x3D_h(3), x3D_h.get_minor<3,1>(0,0)(1) /    x3D_h(3), x3D_h.get_minor<3,1>(0,0)(2) / x3D_h(3));


 

 

2.出现 fatal error :xxx.h 错误  没有那个文件或目录

        修改ORB-SLAM3/include路径下的Atlas.h,KeyFrame.h和Tracking.h

        分别将  #include "GeometricCamera.h"
                       #include "Pinhole.h"
                       #include "KannalaBrandt8.h"
 

        改为 :#include "CameraModels/GeometricCamera.h"
                      #include "CameraModels/Pinhole.h"
                      #include "CameraModels/KannalaBrandt8.h"

 3.‘ORB_SLAM2’ has not been declared

          将提示出错的文件打开,将文件中出现的每一个ORB_SLAM2改为ORB_SLAM3

  4.   修改对应的cmakelists  加入-lboost_system

        编译ORB_SLAM3 遇到的小坑总结_第1张图片

5. 定位不到ros

[rosbuild] rospack found package "ORB_SLAM3" at "", but the current
  directory is "/home/bill/ORB_SLAM3/Examples/ROS/ORB_SLAM3".  You should
  double-check your ROS_PACKAGE_PATH to ensure that packages are found in the
  correct precedence order.

编译ORB_SLAM3 遇到的小坑总结_第2张图片

解决办法:

    (1)首先在~/.bashrc上设置了路径(注意这个path是我的路径,读者需要自己修改):

sudo vim ~/.bashrc
export ROS_PACKAGE_PATH=${ROS_PACKAGE_PATH}:/home/bill/ORB_SLAM3/Examples/ROS
source ~/.bashrc

    (2) 在ROS的安装路径下更改路径:

 

cd /opt/ros/melodic/
sudo vim setup.bash 
export ROS_PACKAGE_PATH=${ROS_PACKAGE_PATH}:/home/bill/ORB_SLAM3/Examples/ROS
source setup.bash

   (3)查看路径是否添加成功:

   

echo $ROS_PACKAGE_PATH

你可能感兴趣的:(自动驾驶)