前面我們提到,ORB-SLAM3作為常用的機(jī)器人建圖與定位技術(shù),是當(dāng)前最優(yōu)秀的基于特征點(diǎn)的視覺SLAM系統(tǒng)之一。
它支持單目、雙目、單目慣導(dǎo)、雙目慣導(dǎo)、RGB-D等多種相機(jī)模式,兼具精度和魯棒性,是機(jī)器人SLAM算法工程師的一項「必備技能」。
為了更好地幫助大家學(xué)習(xí)和理解ORB-SLAM3,小智計劃進(jìn)行一系列理論與實踐相結(jié)合的深度技術(shù)分享。而這些,都是我們在實踐過程中總結(jié)出來的寶貴經(jīng)驗。
具體內(nèi)容包括:
1. ORB-SLAM3論文導(dǎo)讀與整體算法流程梳理
2. ORB-SLAM3中的跟蹤線程
2.1特征點(diǎn)提取、匹配,以及地圖初始化
2.2 IMU預(yù)積分原理及代碼梳理
2.3跟蹤模式詳解:參考關(guān)鍵幀跟蹤、恒速模型跟蹤、重定位跟蹤、局部地圖跟蹤
3.?ORB-SLAM3中的局部建圖線程
3.1?IMU的初始化
3.2?局部建圖線程代碼梳理
4.?ORB-SLAM3中的閉環(huán)檢測及多地圖融合線程
4.1閉環(huán)檢測代碼梳理
4.2多地圖概念及地圖融合代碼梳理
?本期則是這系列課程的「開胃前菜」——ORB-SLAM3的編譯運(yùn)行。
我們結(jié)合實踐經(jīng)驗,對ORB-SLAM3安裝和編譯的常見問題進(jìn)行總結(jié)分享,同時細(xì)化不同傳感器的運(yùn)行方式??梢哉f,這是一份非常適合「新手小白」的ORB-SLAM3編譯運(yùn)行指南。
ORB-SLAM3編譯及常見問題解決
第一步,下載代碼:
git clone https://github.com/UZ-SLAMLab/ORB_SLAM3
或者
git clone https://github.com/electech6/ORB_SLAM3_detailed_comments
第二步,按照代碼中的README.md,進(jìn)行環(huán)境安裝和編譯即可,具體就不贅述了。
不過我掐指一算,大家在編譯過程中,可能會遇到幾個小問題:
1)提示找不到GLEW;
解決方法:sudo apt install libglew-dev;
2)當(dāng)執(zhí)行./euroc_examples.sh時,出現(xiàn)找不到libpango_image.so這個庫的情況;
解決方法:首先,在系統(tǒng)中查找文件sudo find?/?-name libpango_image.so;結(jié)果為:/usr/local/lib/libpango_image.so
然后,將.so文件路徑的目錄添加到/etc/ld.so.conf:
sudo gedit/etc/ld.so.conf,同時在文件的末尾添加一行:/usr/local/lib/libpango_image.so,執(zhí)行sudo?/sbin/ldconfig生效。
最后,在編譯build_ros.sh之前,需要執(zhí)行g(shù)edit ~/.bashrc,在文件末尾添加如下:
export ROS_PACKAGE_PATH=${ROS_PACKAGE_PATH}:PATH/ORB_SLAM3/Examples/ROS
ORB-SLAM3各類傳感器運(yùn)行
不同傳感器下,ORB-SLAM3的運(yùn)行方式存在著差異。在這里,我們分為非ROS和ROS兩種環(huán)境來進(jìn)行討論。
非ROS環(huán)境下運(yùn)行
1)EuROC數(shù)據(jù)集
用微型飛行器采集的視覺慣性數(shù)據(jù)集,包含雙目相機(jī)和IMU同步測量數(shù)據(jù)及位姿的真值。
這里需下載MH_01_easy.zip;下載地址:https://projects.asl.ethz.ch/datasets/doku.php?id=kmavvisualinertialdatasets
將其解壓后并命名為MH01;之后根據(jù)自己的地址${dir}來運(yùn)行。
-
純單目
./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
-
單目慣導(dǎo)
./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
-
?雙目慣導(dǎo)
./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 數(shù)據(jù)集
其采用的相機(jī)和IMU傳感器,在硬件上進(jìn)行了時間同步。
所提供的圖像具有高動態(tài)范圍,事先進(jìn)行了光度標(biāo)定,用20Hz的幀率采集,分辨率為1024像素*1024像素;三軸IMU采樣頻率為200Hz,可測量加速度和角速度。
需要下載數(shù)據(jù)集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
-
單目慣導(dǎo)
./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
-
雙目慣導(dǎo)
./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
-
?RGB-D
這里下載數(shù)據(jù)集:rgbd_dataset_freiburg1_desk,下載地址:https://cvg.cit.tum.de/data/datasets/rgbd-dataset/download
然后下載associate.py,下載地址:https://cvg.cit.tum.de/data/datasets/rgbd-dataset/tools
目的是從rgb.txt?文件和?depth.txt?文件中讀取時間戳,并通過查找最佳匹配來連接它們。
之后開始運(yùn)行:
./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
ROS環(huán)境下運(yùn)行
-
純單目
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
-
單目慣導(dǎo)
rosrun ORB_SLAM3 Mono_Inertial Vocabulary/ORBvoc.txt Examples/Monocular-Inertial/EuRoC.yaml
rosbag play MH_01_easy.bag
-
雙目慣導(dǎo)
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
-
RGB-D
下載數(shù)據(jù)集:rgbd_dataset_freiburg1_xyz.bag,fr1/xyz選擇more info找到bag文件后,然后下載。下載地址:
https://cvg.cit.tum.de/data/datasets/rgbd-dataset/download#freiburg1_xyz
之后運(yùn)行:
rosrun ORB_SLAM3 RGBD Vocabulary/ORBvoc.txt Examples/RGB-D/TUM1.yaml
rosbag play rgbd_dataset_freiburg1_xyz.bag
文章來源:http://www.zghlxwxcb.cn/news/detail-643754.html
至于KITTI數(shù)據(jù)集,我們留給感興趣的同學(xué)自行下載探索。下載地址:https://www.cvlibs.net/datasets/kitti/eval_object.php文章來源地址http://www.zghlxwxcb.cn/news/detail-643754.html
到了這里,關(guān)于實操指南:ORB-SLAM3的編譯運(yùn)行的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!