安装各种依赖库
orb-slam3非常友好,不用自己下载各种依赖库,因为他们全部在thirdParty
文件夹中,编译orb-slam3的同时会自动编译各种依赖库
安装orb-slam3:https://gitee.com/YaoFL/ORB_SLAM3
cd ORB_SLAM3
chmod +x build.sh
./build.sh
数据集网址:https://projects.asl.ethz.ch/datasets/doku.php?id=kmavvisualinertialdatasets
下载 ASL Dataset Format 一列
在主目录下添加 Datasets/EuRoC/MH01 文件夹并讲数据集放入
./Examples/Monocular/mono_euroc ./Vocabulary/ORBvoc.txt ./Examples/Monocular/EuRoC.yaml ./Datasets/EuRoC/MH01 ./Examples/Monocular/EuRoC_TimeStamps/MH01.txt dataset-MH01_mono
./Datasets/EuRoC/MH01
改成自己文件夹的路径
MH01.txt
存储图片名称
遇到问题:运行成功但是没有显示视频?
【1】代码没有更该为播放模式
mono_euroc.cc文件83 false
改为 true
ORB_SLAM3::System SLAM(argv[1],argv[2],ORB_SLAM3::System::MONOCULAR, false);
参考:https://blog.csdn.net/changym5/article/details/125041396
【2】内置播放器有问题
ubuntu没有安装video播放器,安装ffmpeg,参考链接
直接在软件更新中下载video(TMD)
??????还是没有视频??????????
./Examples/Stereo/stereo_euroc ./Vocabulary/ORBvoc.txt ./Examples/Stereo/EuRoC.yaml ./Datasets/EuRoC/MH01 ./Examples/Stereo/EuRoC_TimeStamps/MH01.txt dataset-MH01_stereo
./Examples/Monocular-Inertial/mono_inertial_euroc ./Vocabulary/ORBvoc.txt ./Examples/Monocular-Inertial/EuRoC.yaml ./Datasets/EuRoC/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 ./Datasets/EuRoC/MH01 ./Examples/Stereo-Inertial/EuRoC_TimeStamps/MH01.txt dataset-MH01_stereoi
配置ros,建立catkin_ws工作空间,将orb-slam3代码加入,一键编译
cd ~/catkin_ws/src/ORB_SLAM3
chmod +x build.sh
./build.sh
export ROS_PACKAGE_PATH=$ROS_PACKAGE_PATH:~/catkin_ws/src/ORB_SLAM3/Examples/ROS #将这句放到~/.bashrc中,以后使用更方便
chmod +x build_ros.sh
./build_ros.sh
解决build catkin_ws时电脑卡死的问题,减少编译线程数量(默认应该是-j8),操作如下
gedit ~/.bashrc
export ROS_PARALLEL_JOBS=-j3
source ~/.bashrc
ros遇到bug,运行roscore没有反应,因为改了网络代理,导致Ubuntu系统ifconfig得到的ip和~/.bashrc里面的ip不一致
#export ROS_HOSTNAME=master
#export ROS_MASTER_URI=http://master:11311
export ROS_HOSTNAME=192.168.1.114
export ROS_MASTER_URI=http://192.168.1.114:11311
直接按照官网的启动方法是没有图像的,但是双目检查话题也正确,为什么没有图像?
因为双目是usb直接连到主机上,不能自动形成一个ros话题发布,而slam3需要接受两个摄像头的话题,因此下载usb_cam包,该包将摄像头图像通过sensor_msgs::Image消息发布出去,https://github.com/bosch-ros-pkg/usb_cam.git
ROS下使用单目/双目摄像头发布图像话题:https://blog.csdn.net/weixin_53073284/article/details/125671358
运行
roscore
#roslaunch usb_cam usb_cam_stereo.launch
rosrun ORB_SLAM3 Stereo ./Vocabulary/ORBvoc.txt ./Examples/Stereo/EuRoC.yaml true
1)下载支持相机的SDK,下载realsense-ros并编译https://github.com/IntelRealSense/realsense-ros
2)检查/ORB_SLAM3/Examples/ROS/ORB_SLAM3/src/ros_rgbd.cc
代码中相机话题名称是否正确,将之改成相机对应话题
//message_filters::Subscriber<sensor_msgs::Image> rgb_sub(nh, "/camera/rgb/image_raw", 100);
//message_filters::Subscriber<sensor_msgs::Image> depth_sub(nh, "camera/depth_registered/image_raw", 100);
message_filters::Subscriber<sensor_msgs::Image> rgb_sub(nh, "/camera/color/image_raw", 100);
message_filters::Subscriber<sensor_msgs::Image> depth_sub(nh, "/camera/depth/image_rect_raw", 100);
3)同时Examples/RGB-D/TUM1.yaml
中的相机参数应该改为自己的相机参数
D435i可以选择多种模式运行ros版本的orb,包括1)深度相机模式、2)双目相机模式、3)双目+imu模式
运行
roslaunch realsense2_camera rs_rgbd.launch
rosrun ORB_SLAM3 RGBD Vocabulary/ORBvoc.txt Examples/RGB-D/TUM1.yaml
运行效果:
可以自己调整订阅的双目图像的话题,以及发布的相机位姿的话题
roslaunch realsense2_camera rs_camera_orb3.launch
rosrun ORB_SLAM3 Stereo ~/ORB_SLAM3/Vocabulary/ORBvoc.txt ~/ORB_SLAM3/config/real_camera.yaml true /camera/left/image_raw:=/camera/infra1/image_rect_raw /camera/right/image_raw:=/camera/infra2/image_rect_raw /orbslam3/vision_pose/pose:=/iris_0/orbslam3/vision_pose/pose
可以自己调整订阅的双目图像的话题和imu的话题,以及发布的相机位姿的话题
这里有问题???
roslaunch realsense2_camera rs_camera_orb3.launch
rosrun ORB_SLAM3 Stereo_Inertial ~/ORB_SLAM3/Vocabulary/ORBvoc.txt ~/ORB_SLAM3/config/real_camera_imu.yaml true /camera/left/image_raw:=/camera/infra1/image_rect_raw /camera/right/image_raw:=/camera/infra2/image_rect_raw /imu:=/camera/imu /orbslam3/vision_pose/pose:=/iris_0/orbslam3/vision_pose/pose