运行ORB-SLAM2

1.ORB-SLAM2在KITTI和TUM数据集的运行命令

单目

①KITTI

./Examples/Monocular/mono_kitti Vocabulary/ORBvoc.txt Examples/Monocular/KITTI00-02.yaml /home/hope/Downloads/dataset/sequences/00

②TUM

./Examples/Monocular/mono_tum Vocabulary/ORBvoc.txt Examples/Monocular/TUM1.yaml /home/hope/Downloads/TUM/rgbd_dataset_freiburg1_xyz

③EuRoc

./Examples/Monocular/mono_euroc Vocabulary/ORBvoc.txt Examples/Monocular/EuRoC.yaml /home/hope/Downloads/EuRoc/ Examples/Monocular/EuRoC_TimeStamps/MH01.txt 

双目

①KITTI

./Examples/Stereo/stereo_kitti Vocabulary/ORBvoc.txt Examples/Stereo/KITTI00-02.yaml /home/hope/Downloads/dataset/sequences/00

②EuRoc

./Examples/Stereo/stereo_euroc Vocabulary/ORBvoc.txt Examples/Stereo/EuRoC.yaml /home/hope/Downloads/EuRoc/ Examples/Monocular/EuRoC_TimeStamps/MH01.txt

RGB-D

①TUM

需要对数据集中的rgb图和depth图做匹配,官方提供了脚本程序

匹配命令:

python associate.py PATH_TO_SEQUENCE/rgb.txt PATH_TO_SEQUENCE/depth.txt > associate.txt

 运行命令:

./Examples/RGB-D/rgbd_tum Vocabulary/ORBvoc.txt Examples/RGB-D/TUM1.yaml /home/hope/Downloads/TUM/rgbd_dataset_freiburg1_xyz /home/hope/Downloads/TUM/rgbd_dataset_freiburg1_xyz/associate.txt 

参考:
GitHub - raulmur/ORB_SLAM2: Real-Time SLAM for Monocular, Stereo and RGB-D Cameras, with Loop Detection and Relocalization Capabilitieshttps://github.com/raulmur/ORB_SLAM2

ORB SLAM 2 demo 复现(普通模式 + ROS 模式) - 简书 (jianshu.com)https://www.jianshu.com/p/31c95d9a5f97

2.在ROS环境下运行ORB-SLAM2

要用 ROS 模式跑 demo,还要额外编译 ROS 文件。
首先是将 ROS 文件所在路径加入到 ROS_PACKAGE_PATH 环境变量中。
具体操作是

打开终端脚本~/.bashrc文件:
sudo gedit ~/.bashrc

 在文件末尾加入以下语句:

export ROS_PACKAGE_PATH=${ROS_PACKAGE_PATH}:/ORB_SLAM2/Examples/ROS

可以新开一个命令行窗口或者在当前窗口中运行 source ~/.bashrc,检查一下 ROS_PACKAGE_PATH 环境变量是否更新:

echo $ROS_PACKAGE_PATH

 source 更新变量之后开始编译:

chmod +x build_ros.sh

./build_ros.sh

在 ROS 模式下,需要从 rosbag 里面发布数据,因此要下载相应的 rosbag 数据包。

单目:

TUM

roscore

rosrun ORB_SLAM3 Mono Vocabulary/ORBvoc.txt Examples/Monocular/TUM1.yaml 

rosbag play /home/hope/Downloads/TUM/rgbd_dataset_freiburg1_xyz.bag /camera/rgb/image_color:=/camera/image_raw

双目:

EuRoc

roscore

rosrun ORB_SLAM3 Stereo Vocabulary/ORBvoc.txt Examples/Stereo/EuRoC.yaml false

rosbag play  /home/hope/Downloads/EuRoc/MH_01_easy.bag /cam0/image_raw:=/camera/left/image_raw /cam1/image_raw:=/camera/right/image_raw

KITTI

roscore

rosrun ORB_SLAM3 Mono Vocabulary/ORBvoc.txt Examples/Monocular/KITTI00-02.yaml

rosbag play /home/hope/Downloads/dataset/kitti_00_l.bag

RGB-D:

TUM

roscore 

rosrun ORB_SLAM3 RGBD Vocabulary/ORBvoc.txt Examples/RGB-D/TUM1.yaml

rosbag play /home/hope/Downloads/TUM/rgbd_dataset_freiburg1_xyz.bag /camera/rgb/image_color:=/camera/rgb/image_raw /camera/depth/image:=/camera/depth_registered/image_raw

你可能感兴趣的:(slam)