(一)、环境的配置
1.ros环境的安装,可直接参开wiki.ros
2.building ORB_SLAM2
git clone https://github.com/raulmur/ORB_SLAM2.git ORB_SLAM2
3.编译
cd ORB_SLAM2
chmod +x build.sh
. /build.sh
4.Monocular Example
## TUM Dataset
1. Download a sequence from http://vision.in.tum.de/data/datasets/rgbd-dataset/download and uncompress it.
2. Execute the following command. Change `TUMX.yaml` to TUM1.yaml,TUM2.yaml or TUM3.yaml for freiburg1, freiburg2 and freiburg3 sequences respectively. Change `PATH_TO_SEQUENCE_FOLDER`to the uncompressed sequence folder.
```
./Examples/Monocular/mono_tum Vocabulary/ORBvoc.txt Examples/Monocular/TUMX.yaml PATH_TO_SEQUENCE_FOLDER
5. ROS Example
a. 需要再.bashrc文件中将路径设置一下,eg: export ROS_PACKAGE_PATH=${ROS_PACKAGE_PATH}:PATH/ORB_SLAM2/Examples/ROS
b. 执行build_ros.sh 脚本
chmod +x build_ros.sh
./build_ros.sh
c. 跑一个Monocular 的例子
1. rosrun ORB_SLAM2 Mono PATH_TO_VOCABULARY PATH_TO_SETTINGS_FILE
2. rosbag play --pause Example.bag
3. 注意下ros_mono.cc中处理相机的topic和Example.bag 中topic 要一致。
6. 建图
a. 需要安装usb_cam,再ros上下载这个包,然后编译一下。
b.启动相机节点,rosrun usb_cam usb_cam_node
c. rosrun ORB_SLAM2 Mono PATH_TO_VOCABULARY PATH_TO_SETTINGS_FILE
d. 注意usb_cam 中相机发出的topic与ORB_SLAM2 系统中接收的topic 一致。