ubuntu18.04 ORB-SLAM3编译运行
一、ORB-SLAM3如何编译?
1、代码下载;
git clone https://github.com/UZ-SLAMLab/ORB_SLAM3
或者git clone https://github.com/electech6/ORB_SLAM3_detailed_comments
2、按照里面的README.md进行环境安装和编译,即可,不再赘述;
3、编译过程中可能会遇到的问题:
1)提示找不到GLEW
解决方法:sudo apt install libglew-dev
;
2)当执行./euroc_examples.sh时,会出现找不到libpango_image.so
这个库
解决方法:
a、首先在系统中查找这个文件sudo find / -name libpango_image.so;结果为:
/usr/local/lib/libpango_image.so
b、将.so文件路径的目录添加到/etc/ld.so.conf:
sudo gedit /etc/ld.so.conf,在文件的末尾添加一行:
/usr/local/lib/libpango_image.so,执行
sudo /sbin/ldconfig
生效;
c、在编译build_ros.sh之前,需要执行
gedit ~/.bashrc,在文件末尾添加如下
export ROS_PACKAGE_PATH=${ROS_PACKAGE_PATH}:PATH/ORB_SLAM3/Examples/ROS
目前基本就遇到以上问题;
二、ORB-SLAM3各传感器类型如何运行?
1、非ROS环境运行
1)EuROC数据集
EuRoC数据集的简单介绍介绍:它是用微型飞行器(Micro Aerial Vehicle,MAV)采集的视觉惯性数据集。其包含双目相机和IMU同步测量数据及位姿的真值。详细介绍参考:BURRI M, NIKOLIC J, GOHL P, et al.The EuRoC micro aerial vehicle datasets[J]. The International Journal of Robotics Research,2016,35(10):1157-1163.
这里下载的MH_01_easy.zip;下载地址:https://projects.asl.ethz.ch/datasets/doku.php?id=kmavvisualinertialdatasets
将其解压后并命名为MH01;下面根据自己的地址${dir}来运行
纯单目:
./Monocular/mono_euroc ../Vocabulary/ORBvoc.txt ./Monocular/EuRoC.yaml ${dir}/MH01 ./Monocular/EuRoC_TimeStamps/MH01.txt dataset-MH01_mono
纯双目:
./Examples/Stereo/stereo_euroc ./Vocabulary/ORBvoc.txt ./Examples/Stereo/EuRoC.yaml ${dir}/MH01 ./Examples/Stereo/EuRoC_TimeStamps/MH01.txt dataset-MH01_stereo
单目惯导:
./Examples/Monocular-Inertial/mono_inertial_euroc ./Vocabulary/ORBvoc.txt ./Examples/Monocular-Inertial/EuRoC.yaml ${dir}/MH01 ./Examples/Monocular-Inertial/EuRoC_TimeStamps/MH01.txt dataset-MH01_monoi
双目惯导:
./Examples/Stereo-Inertial/stereo_inertial_euroc ./Vocabulary/ORBvoc.txt ./Examples/Stereo-Inertial/EuRoC.yaml ${dir}/MH01 ./Examples/Stereo-Inertial/EuRoC_TimeStamps/MH01.txt dataset-MH01_stereoi
2)TUM VI 数据集
TUM VI数据集介绍:该数据集采用的相机和IMU传感器在硬件上进行了时间同步,提供的图像具有高动态范围,事先进行了光度标定,用20Hz的帧率采集,分辨率为1024像素*1024像素;三轴IMU采样频率是200Hz,可测量加速度和加速度。详细介绍参考:SCHUBERT D, GOLL T,DEMMEL N,et al. The TUM VI benchmark for evaluating visual-inertial odometry[C]//2018 IEEE/RSJ International Conference on Intelligent Robots and Systems(IROS).IEEE,2018:1680-1687。
再下载数据集dataset-room1_512_16,下载地址:https://cvg.cit.tum.de/data/datasets/rgbd-dataset/download
纯单目:
./Monocular/mono_tum_vi ../Vocabulary/ORBvoc.txt Monocular/TUM_512.yaml ${dir}/dataset-room1_512_16/mav0/cam0/data Monocular/TUM_TimeStamps/dataset-room1_512.txt dataset-room1_512_mono
纯双目:
./Stereo/stereo_tum_vi ../Vocabulary/ORBvoc.txt Stereo/TUM_512.yaml ${dir}/dataset-room1_512_16/mav0/cam0/data /home/sangfor/2023/bro_ws/dataset-room1_512_16/mav0/cam1/data Stereo/TUM_TimeStamps/dataset-room1_512.txt dataset-room1_512_stereo
单目惯导:
./Monocular-Inertial/mono_inertial_tum_vi ../Vocabulary/ORBvoc.txt Monocular-Inertial/TUM_512.yaml ${dir}/dataset-room1_512_16/mav0/cam0/data Monocular-Inertial/TUM_TimeStamps/dataset-room1_512.txt Monocular-Inertial/TUM_IMU/dataset-room1_512.txt dataset-room1_512_monoi
双目惯导:
./Stereo-Inertial/stereo_inertial_tum_vi ../Vocabulary/ORBvoc.txt Stereo-Inertial/TUM_512.yaml ${dir}/dataset-room1_512_16/mav0/cam0/data ${dir}/dataset-room1_512_16/mav0/cam1/data Stereo-Inertial/TUM_TimeStamps/dataset-room1_512.txt Stereo-Inertial/TUM_IMU/dataset-room1_512.txt dataset-room1_512_stereoi
rgbd:
下载数据集:https://cvg.cit.tum.de/data/datasets/rgbd-dataset/download
这里下载的:rgbd_dataset_freiburg1_desk
下载associate.py,下载地址https://cvg.cit.tum.de/data/datasets/rgbd-dataset/tools,其目的是:它从rgb.txt文件和 depth.txt 文件中读取时间戳,并通过查找最佳匹配来连接它们。
之后开始运行:
./Examples/RGB-D/rgbd_tum Vocabulary/ORBvoc.txt Examples/RGB-D/TUM1.yaml ${dir}/rgbd_dataset_freiburg1_desk /home/sangfor/2023/bro_ws/rgbd_dataset_freiburg1_desk/associations.txt
2、ROS环境运行
纯单目:
rosrun ORB_SLAM3 Mono Vocabulary/ORBvoc.txt Examples/Monocular/EuRoC.yaml
rosbag play MH_01_easy.bag /cam0/image_raw:=/camera/image_raw
纯双目:
rosrun ORB_SLAM3 Stereo Vocabulary/ORBvoc.txt Examples/Stereo/EuRoC.yaml false
rosbag play MH_01_easy.bag /cam0/image_raw:=/camera/left/image_raw /cam1/image_raw:=/camera/right/image_raw
单目惯导:
rosrun ORB_SLAM3 Mono_Inertial Vocabulary/ORBvoc.txt Examples/Monocular-Inertial/EuRoC.yaml
rosbag play MH_01_easy.bag
双目惯导:
rosrun ORB_SLAM3 Stereo_Inertial Vocabulary/ORBvoc.txt Examples/Stereo-Inertial/EuRoC.yaml false
rosbag play MH_01_easy.bag /cam0/image_raw:=/camera/left/image_raw /cam1/image_raw:=/camera/right/image_raw /imu0:=/imu
运行rgbd:
数据集下载地址:https://cvg.cit.tum.de/data/datasets/rgbd-dataset/download#freiburg1_xyz
fr1/xyz选择more info找到bag文件,下载之;rgbd_dataset_freiburg1_xyz.bag
rosrun ORB_SLAM3 RGBD Vocabulary/ORBvoc.txt Examples/RGB-D/TUM1.yaml
rosbag play rgbd_dataset_freiburg1_xyz.bag
最后KITTI数据集自行下载并按照上面方式运行。具体下载地址:https://www.cvlibs.net/datasets/kitti/eval_object.php。
在oak-d-w上进行运行:
1.标定方面的文章请移步到https://www.cnblogs.com/gary-guo/p/9281221.html
2.运行驱动
~/source-code/oak-d-wide-ws$ roslaunch depthai_examples stereo_inertial_node.launch
3.运行ORB-SLAM3:
/ORB_SLAM3/Examples/Stereo-Inertial$ rosrun ORB_SLAM3 Stereo_Inertial ../../Vocabulary/ORBvoc.txt ../Stereo-Inertial/EuRoC.yaml false
问题: Error from directory check: /opt/ros/melodic/share/ros/core/rosbuild/bin/check_same_directories.py
.bashrc文件:export ROS_PACKAGE_PATH=${ROS_PACKAGE_PATH}:/home/gary/source-code/zed_ws/nindanaoto/ORB_SLAM3/Examples/ROS
问题:c++ error: ‘decay_t’ is not a member of ‘std’解决方法
解决:
最终将CmakeLists.txt中
set(CMAKE_CXX_FLAGS "-std=c++11")
改为
set(CMAKE_CXX_STANDARD 14)