ROS下运行ORBSLAM2

这里主要做一个简单的总结:
首先我本人对ROS操作系统不是很熟悉;看了高博用KinectV2跑ORBSLAM2的时候觉得不知道怎么跟着下手,所以查了简单的资料,在这里做一个总结;
我的环境是这样:ubuntu 14.04.5 + ROS indigo

1、建立一个ros的工作空间

mkdir -p ~/catkin_ws/src
cd ~/catkin_ws/
catkin_make
source devel/setup.bash
echo "source devel/setup.bash" >> ~/.bashrc
source ~/.bashrc

索性在catkin文件夹下面ctrl+h,找到隐藏文件夹.bashrc。在.bashrc 最下面添加,

source /opt/ros/indigo/setup.bash
source ~/catkin_ws/devel/setup.bash
  1. 安装Pangolin,用于可视化和用户接口
git clone https://github.com/stevenlovegrove/Pangolin.git
cd Pangolin
mkdir build
cd build
cmake -DCPP11_NO_BOOST=1 ..
make -j

3、编译usb_cam(下载链接)
将usb_cam复制到catkin_ws/src下

$ cd catkin_ws/src/usb_cam
$ mkdir build
$ cd build
$ cmake ..
$ make
  1. 构建ORB_SLAM2
cd catkin_ws
git clone https://github.com/raulmur/ORB_SLAM2.git ORB_SLAM2
cd ORB_SLAM2
chmod +x build.sh
./build.sh
chmod +x build_ros.sh
./build_ros.sh

export ROS_PACKAGE_PATH=${ROS_PACKAGE_PATH}:/home/【pan】/catkin_ws/src/ORB_SLAM2/Examples/ROS

5、利用相机进行实时的操作

5.1 普通单目摄像头实现ORBSLAM2

cd /home/pan/catkin_ws/src/usb_cam
cd launch
gedit usb_cam-test.launch

将其中的内容替换成


  "camera" pkg="usb_cam" type="usb_cam_node" output="screen" >
    <param name="video_device" value="/dev/video0" />
    <param name="image_width" value="640" />
    <param name="image_height" value="480" />
    <param name="pixel_format" value="yuyv" />
    <param name="camera_frame_id" value="camera" />
    <param name="io_method" value="mmap"/>
    from="/usb_cam/image_raw" to="/camera/image_raw" />
  
  "image_view" pkg="image_view" type="image_view" respawn="false" output="screen">
    from="image" to="/camera/image_raw"/>
    <param name="autosize" value="true" />
  
roscore

roslaunch usb_cam usb_cam-test.launch

rosrun ORB_SLAM2 Mono /home/pan/catkin_ws/src/ORB_SLAM2/Vocabulary/ORBvoc.txt /home/pan/catkin_ws/src/ORB_SLAM2/Examples/Monocular/TUM1.yaml

【接着我会补充总结 kinectV2的安装和利用其进行ORBSLAM2的一个实时测试】

参考博客:
http://blog.csdn.net/bbzz2/article/details/52104370
http://blog.csdn.net/qq_18661939/article/details/51829157

你可能感兴趣的:(视觉SLAM)