ROS与VSLAM入门教程-ORB-SLAM2安装

ROS与VSLAM入门教程-ORB-SLAM2安装

说明:

  • 介绍如何安装ORB-SLAM2

环境:

  • Ubuntu14.04 + ROS indigo
  • Kinect V1.

准备:

sudo apt-get install libboost-all-dev
  • 安装Pangolin:
git clone https://github.com/stevenlovegrove/Pangolin.git 
cd Pangolin 
mkdir build 
cd build 
cmake .. 
make -j 
  • 安装OpenCV,版本为OpenCV2.4.11,参考文章
  • 安装Eigen3
sudo apt-get install libeigen3-dev
#ls查看,含有3个文件: Eigen  signature_of_eigen3_matrix_library  unsupported
cd /usr/include/eigen3     
#将Eigen文件夹放在 /usr/include 下面  
sudo cp Eigen/ .. -R               
  • DBoW2和g2o (included in Thirdparty) 在ORB-SLAM2的Thirdparty文件夹里面,无需安装。

安装ORB-SLAM2:

  • 下载编译ORB-SLAM2:
cd ~
git clone https://github.com/raulmur/ORB_SLAM2.git ORB_SLAM2
cd ORB_SLAM2
chmod +x build.sh
./build.sh

单目测试:

  1. TUM Dataset:
  • 下载数据集http://vision.in.tum.de/data/datasets/rgbd-dataset/download
  • 执行命令:
./Examples/Monocular/mono_tum Vocabulary/ORBvoc.txt Examples/Monocular/TUMX.yaml PATH_TO_SEQUENCE_FOLDER
  • 可以改变TUMX.yaml为 TUM1.yaml,TUM2.yaml or TUM3.yaml 针对 freiburg1, freiburg2 和freiburg3
  • 改变PATH_TO_SEQUENCE_FOLDER为对应解压后的目录
  1. KITTI Dataset:
  • 下载数据集http://www.cvlibs.net/datasets/kitti/eval_odometry.php
  • 执行命令:
./Examples/Monocular/mono_kitti Vocabulary/ORBvoc.txt Examples/Monocular/KITTIX.yaml PATH_TO_DATASET_FOLDER/dataset/sequences/SEQUENCE_NUMBER
  • 改变KITTIX.yaml为 KITTI00-02.yaml, KITTI03.yaml or KITTI04-12.yaml
  • 针对0 to 2, 3, and 4 to 12
  • 改变PATH_TO_DATASET_FOLDER为解压的目录
  • 改变SEQUENCE_NUMBER 为00, 01, 02,.., 11.
  1. EuRoC Dataset:
  • 下载数据集 http://projects.asl.ethz.ch/datasets/doku.php?id=kmavvisualinertialdatasets
  • 执行命令,针对V1和V2 sequences.:
./Examples/Monocular/mono_euroc Vocabulary/ORBvoc.txt Examples/Monocular/EuRoC.yaml PATH_TO_SEQUENCE_FOLDER/mav0/cam0/data Examples/Monocular/EuRoC_TimeStamps/SEQUENCE.txt 
  • 执行命令,针对MH sequences.
./Examples/Monocular/mono_euroc Vocabulary/ORBvoc.txt Examples/Monocular/EuRoC.yaml PATH_TO_SEQUENCE/cam0/data Examples/Monocular/EuRoC_TimeStamps/SEQUENCE.txt
  • 改变PATH_TO_SEQUENCE_FOLDER和SEQUENCE为你想要执行的数据

双目测试:

  1. KITTI Dataset
  • 下载数据集http://www.cvlibs.net/datasets/kitti/eval_odometry.php
  • 执行命令:
./Examples/Stereo/stereo_kitti Vocabulary/ORBvoc.txt Examples/Stereo/KITTIX.yaml PATH_TO_DATASET_FOLDER/dataset/sequences/SEQUENCE_NUMBER
  • 改变KITTIX.yaml为KITTI00-02.yaml, KITTI03.yaml or KITTI04-12.yaml
  • 针对序列0 to 2, 3, and 4 to 12
  • 改变PATH_TO_DATASET_FOLDER为下载的数据集
  • 改变SEQUENCE_NUMBER为00, 01, 02,.., 11.
  1. EuRoC Dataset
  • 下载数据集 http://projects.asl.ethz.ch/datasets/doku.php?id=kmavvisualinertialdatasets
  • 执行命令, 针对 V1 and V2 序列:
./Examples/Stereo/stereo_euroc Vocabulary/ORBvoc.txt Examples/Stereo/EuRoC.yaml PATH_TO_SEQUENCE/mav0/cam0/data PATH_TO_SEQUENCE/mav0/cam1/data Examples/Stereo/EuRoC_TimeStamps/SEQUENCE.txt
  • 执行命令,针对MH sequences
./Examples/Stereo/stereo_euroc Vocabulary/ORBvoc.txt Examples/Stereo/EuRoC.yaml PATH_TO_SEQUENCE/cam0/data PATH_TO_SEQUENCE/cam1/data Examples/Stereo/EuRoC_TimeStamps/SEQUENCE.txt
  • PATH_TO_SEQUENCE_FOLDER and SEQUENCE 更改你想执行的数据集

RGB-D 例子测试:

  1. TUM Dataset
  • 下载数据库http://vision.in.tum.de/data/datasets/rgbd-dataset/download
  • 关联RGB图和深度图,可以使用associate.py脚本
  • 在Examples/RGB-D/associations/.有一些现成的associations文件
  • 或者生产自己的associations文件
python associate.py PATH_TO_SEQUENCE/rgb.txt PATH_TO_SEQUENCE/depth.txt > associations.txt
  • 执行命令:
./Examples/RGB-D/rgbd_tum Vocabulary/ORBvoc.txt Examples/RGB-D/TUMX.yaml PATH_TO_SEQUENCE_FOLDER ASSOCIATIONS_FILE
  • 改变TUMX.yaml为TUM1.yaml,TUM2.yaml or TUM3.yaml ,针对 freiburg1, freiburg2 and freiburg3 sequences
  • PATH_TO_SEQUENCE_FOLDER为解压的目录
  • ASSOCIATIONS_FILE为对应的associations文件

ROS Examples

  1. 针对 mono, monoAR, stereo and RGB-D
  • 添加路径到 .bashrc
export ROS_PACKAGE_PATH=${ROS_PACKAGE_PATH}:PATH/ORB_SLAM2/Examples/ROS
  • 执行编译
chmod +x build_ros.sh
./build_ros.sh
  • 运行 Monocular Node
rosrun ORB_SLAM2 Mono PATH_TO_VOCABULARY PATH_TO_SETTINGS_FILE
  • 输入图像话题是/camera/image_raw
  • 运行 Monocular Augmented Reality Demo
rosrun ORB_SLAM2 MonoAR PATH_TO_VOCABULARY PATH_TO_SETTINGS_FILE
  • 输入图像话题是/camera/image_raw
  • 这是增强现实的演示,您可以使用界面在场景的平面区域中插入虚拟立方体
  • 运行 Stereo Node
rosrun ORB_SLAM2 Stereo PATH_TO_VOCABULARY PATH_TO_SETTINGS_FILE ONLINE_RECTIFICATION
  • 输入话题/camera/left/image_raw and /camera/right/image_raw
  • 运行RGB_D Node
rosrun ORB_SLAM2 RGBD PATH_TO_VOCABULARY PATH_TO_SETTINGS_FILE
  • 输入话题/camera/rgb/image_raw and /camera/depth_registered/image_raw

参考:

  • https://github.com/raulmur/ORB_SLAM2.git
  • http://www.cnblogs.com/zengcv/p/6021512.html

纠错,疑问,交流: 请进入讨论区点击加入Q群

获取最新文章: 扫一扫右上角的二维码加入“创客智造”公众号


标签: ros与vslam入门教程