1、感谢大佬的改进版ORB2dense,
https://github.com/Zhu-Liyuan/ORB-SLAM2_RGBD_DENSE_MAP
2、git clone 后,在文件夹根目录下放入所使用的相机内外参数文件,我使用的是KinectV2。
3、修改ORB-SLAM2_RGBD_DENSE_MAP/Examples/ROS/ORB_SLAM21/src下,ros_rgb.cc文件内订阅的话题为自己的相机。Kinect2如下:
message_filters::Subscriber<sensor_msgs::Image> rgb_sub(nh, "/kinect2/qhd/image_color_rect", 1);
message_filters::Subscriber<sensor_msgs::Image> depth_sub(nh, "/kinect2/qhd/image_depth_rect", 1);
4、运行build.sh build_ros.sh编译
5、新开终端,启动Kinect
roslaunch kinect2_bridge kinect2_bridge.launch depth_method:=opengl reg_method:=cpu
6、在 ORB-SLAM2_RGBD_DENSE_MAP文件夹路径下启动算法
rosrun ORB_SLAM21 RGBD Vocabulary/ORBvoc.txt kinect2.yaml
roslaunch octomap.launch