配置rtabmap 参考:rtabmap安装与使用
配置orbslam2参考:ubuntu18.04 安装orb_slam2并结合ZED运行
建图参考:Rtabmap+ORB_SLAM2+D435i(稠密地图)_三野燎原的博客-CSDN博客
运行 rtabmap+orb_slam2(RGB-D)+realsense2
启动realsense
roslaunch realsense2_camera rs_rgbd.launch
启动rtabmap
roslaunch rtabmap_ros rtabmap.launch rtabmap_args:="--delete_db_on_start --Odom/Strategy 5 --OdomORBSLAM2/VocPath "/home/huang/orb_slam/src/ORB_SLAM2/Vocabulary/ORBvoc.txt"" depth_topic:=/camera/depth/image_rect_raw rgb_topic:=/camera/color/image_raw camera_info_topic:=/camera/color/camera_info approx_sync:=false
注:
1.如果运行roslaunch realsense2_camera rs_rgbd.launch 出现以下错误
解决方式如下:
sudo apt-get install ros-melodic-rgbd-launch
2.如果运行第二条命令出现红字报错:
‘RTAB-Map is not built with ORB_SLAM support! Select another visual odometry’
解决方法参考:【ROS】RTABMAP+ORBSLAM3环境搭建步骤
1.检查bashrc文件是否添加ORBSLAM2
export ORB_SLAM_ROOT_DIR=~/orb_slam/src/ORB_SLAM2
2. RTABMAP要使用ORBSLAM,需要先卸载rtabmap binaries这些环境
git clone https://github.com/introlab/rtabmap.git #有就不用运行
cd rtabmap/build/
sudo apt remove ros-melodic-rtabmap
cmake -DWITH_G2O=OFF -DWITH_ORB_SLAM=ON ..
make -j4
在cmake后要检查结果
出现YES说明关联成功
安装后要添加
export RTABMap_DIR=~/rtabmap_slam/rtabmap/build