使用自己笔记本摄像头运行orbslam2

首先你已经装了ros indigo
(1)配置环境变量
下面我们开始创建一个catkin 工作空间:(在主文件夹下)

$ mkdir -p ~/catkin_ws/src
$ cd ~/catkin_ws/src

即使这个工作空间是空的(在'src'目录中没有任何软件包,只有一个CMakeLists.txt链接文件),你依然可以编译它:

$ cd ~/catkin_ws/
$ catkin_make
(2)
在主文件夹下ctrl+h后找到隐藏文件夹.bashrc。在.bashrc 最下面添加
source /opt/ros/indigo/setup.bash
source ~/catkin_ws/devel/setup.bash

(3)编译usb_cam(下载链接:https://github.com/bosch-ros-pkg/usb_cam)
把usb_cam放到catkin_ws/src下
$ cd catkin_ws/src/usb_cam
$ mkdir build
$ cd build
$ cmake ..
$ make

(4)编译orb_slam2(下载链接: https://github.com/raulmur/ORB_SLAM2)
把orbslam2放到catkin_ws/src下
$ cd catkin_ws/src/orbslam2
$ mkdir build
$ cd build
$ cmake ..
$ make
$ cd ..
$ cd Examples/ROS/ORB_SLAM2
$ mkdir build
$ cd build
$ cmake ..
$ make

(5)运行usb_cam和orbslam2
$ roslaunch usb_cam usb_cam-test.launch
$ rosrun ORB_SLAM2 Mono /home/liqingfeng/catkin_ws/src/ORB_SLAM2/Vocabulary/ORBvoc.txt /home/liqingfeng/catkin_ws/src/ORB_SLAM2/my.yaml (liqingfeng 是我电脑主机名,请改为自己的)

你可能感兴趣的:(slam学习)