source ~/.bashrc
export ROS_PACKAGE_PATH=${ROS_PACKAGE_PATH}:/home/user/ORB_SLAM2/Examples/ROS
上面这个一定要做,否则会出错说找不到路径和包之后按照orbslam2的github::https://github.com/raulmur/ORB_SLAM2编译ros节点:1.chmod +x build_ros.sh
./build_ros.sh
确保原程序可以编译
2.打开一个终端,运行:roslaunch kinect2_bridge kinect2_bridge.launch3.再打开另一个终端,输入:rostopic list查看此时Kinect2发布的topic,我用的是/kinect2/qhd/image_color_rect和/kinect2/qhd/image_depth_rect4.找到源文件ros_rgbd.cc,按照上面3的topic修改里面的ros订阅的内容5.重新编译工程
chmod +x build_ros.sh
./build_ros.sh
6.在~/ORB_SLAM2/Examples/ROS$ 目录下,运行rosrun ORB_SLAM2 RGBD /home/user/ORB_SLAM2/Vocabulary/ORBvoc.txt /home/user/ORB_SLAM2/Examples/RGB-D/kinect2_qhd.yaml即可得到实时在线轨迹。
时间: 2024-10-29 03:49:30