1.电脑联想Y7000,显卡1050Ti
2.预先装有ros2-humble版本
(一键安装ros2可以到小鱼社区那安装) link
git clone https://github.com/raulmur/ORB_SLAM2.git ORB_SLAM2
如果安装了ros2,只需要下面两个依赖(Eigen3有了):
1.Pangolin
2.opencv-4.5.4
(这个CSDN上有很多教程)link
1.在下列源码中加入#include
Examples/Monocular/mono_kitti.cc
Examples/Monocular/mono_tum.cc
Examples/RGB-D/rgbd_tum.cc
Examples/Stereo/stereo_euroc.cc
Examples/Stereo/stereo_kitti.cc
src/LocalMapping.cc
src/LoopClosing.cc
src/System.cc
src/Tracking.cc
src/Viewer.cc
2.按照源码readme中的要求编译(在ORB_SLAM2目录下,可以将build.sh中的make -j改为make -j4编译快一些),建议逐条编译,可以查找问题.
cd ORB_SLAM2
chmod +x build.sh
./build.sh
3.相关报错
针对opencv,原文链接link
但是我这还是有问题,又添加了下列代码
set(OpenCV_DIR /home/aidn/opencv-4.5.4/build)#自己安装opencv文件夹的目录
find_package(OpenCV REQUIRED)
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")改为
set(CMAKE_CXX_STANDARD 14)
针对Eigen出现的问题,继续修改为如下代码,
find_package(Eigen3 3.4.0 REQUIRED NO_MODULE)
针对运行代码一会出现,核心已转存link
New Map created with 118 points
段错误(核心已转储)
修改如下(每个txt文件里的都要改):
# set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -O3 -march=native ")
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -O3 -march=native")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -O3")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -O3")
最后,重新运行代码,大概率是可以通过的
./build.sh
TUMX改为TUM1,这里PATH_TO_SEQUENCE_FOLDER之的是数据集所的位置
./Examples/Monocular/mono_tum Vocabulary/ORBvoc.txt Examples/Monocular/TUMX.yaml PATH_TO_SEQUENCE_FOLDER
我自己运行的为例
./Examples/Monocular/mono_tum Vocabulary/ORBvoc.txt Examples/Monocular/TUM1.yaml ./Data/rgbd_dataset_freiburg1_xyz