实验室电脑环境ubuntu14.04和ROS indigo已经装好。
1. 构建工作空间【非常重要的一步】
mkdir -p ~/catkin_ws/src cd ~/catkin_ws/ catkin_make
source devel/setup.bash
echo "source devel/setup.bash" >> ~/.bashrc
source ~/.bashrc
将source ~/catkin_ws/devel/setup.bash加入到~/.bashrc中去
2. 安装Pangolin,用于可视化和用户接口
git clone https://github.com/stevenlovegrove/Pangolin.git cd Pangolin mkdir build cd build cmake -DCPP11_NO_BOOST=1 .. make -j
3. 安装BLAS和LAPACK
sudo apt-get install libblas-dev sudo apt-get install liblapack-dev
4. 构建ORB_SLAM2库
git clone https://github.com/raulmur/ORB_SLAM2.git ORB_SLAM2 cd ORB_SLAM2 chmod +x build.sh ./build.sh
5. 在~/.bashrc添加路径
export ROS_PACKAGE_PATH=${ROS_PACKAGE_PATH}:/home/lzp/catkin_mono_orb/src/ORB_SLAM2/Examples/ROS
6. 在ORB_SLAM2文件夹编译
mkdir build cd build cmake .. -DROS_BUILD_TYPE=Release make -j
7. 实现
roscore
roslaunch freenect_launch freenect-registered-xyzrgb.launch
rosrun ORB_SLAM2 RGBD /home/lzp/catkin_mono_orb/src/ORB_SLAM2/Vocabulary/ORBvoc.txt /home/lzp/catkin_mono_orb/src/ORB_SLAM2/Examples/RGB-D/TUM1.yaml
注:Kinect驱动的安装
sudo apt-get install ros-indigo-openni-* ros-indigo-openni2-* \ ros-indigo-freenect-* rospack profile
普通单目摄像头实现ORBSLAM2
1. 使用usb_cam作为单目相机驱动
从https://github.com/bosch-ros-pkg/usb_cam下载usb_cam,放到工作空间catkin_ws/src下,catkin_make编译
cd /home/lzp/catkin_mono_orb/src/usb_cam
cd launch
gedit usb_cam-test.launch
将以下launch文件内容复制到launch文件中:
<launch> <node name="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"/> <remap from="/usb_cam/image_raw" to="/camera/image_raw" /> </node> <node name="image_view" pkg="image_view" type="image_view" respawn="false" output="screen"> <remap from="image" to="/camera/image_raw"/> <param name="autosize" value="true" /> </node> </launch>
<remap from="/usb_cam/image_raw" to="/camera/image_raw" />
<remap from="image" to="/camera/image_raw"/>
对两句进行了修改
2. 中间过程与RGBD过程相同
3. 实现
roscore roslaunch usb_cam usb_cam-test.launch rosrun ORB_SLAM2 Mono /home/lzp/catkin_mono_orb/src/ORB_SLAM2/Vocabulary/ORBvoc.txt /home/lzp/catkin_mono_orb/src/ORB_SLAM2/Examples/Monocular/TUM1.yaml
OK
参考:
1. http://webdiis.unizar.es/~raulmur/orbslam/
2 https://github.com/raulmur/ORB_SLAM2