原文:http://blog.csdn.net/xueyinhualuo/article/details/48490939
环境:Ubuntu 14.04 + ROS Indigo
LSD-SLAM 安装网址:https://github.com/tum-vision/lsd_slam
数据集:http://vision.in.tum.de/research/vslam/lsdslam?redirect=1
ROS Indigo 安装请参照:http://wiki.ros.org/cn/indigo/Installation/Ubuntu
前言:如果是初次安装Ubuntu并准备作为长期编程平台
建议安装顺序为 OpenCV依赖包-》Nvidia驱动(可选)-》opencv-》ROS
否则容易出现libqt4相关软件包的依赖问题
一. 安装并配置好 ROS Indigo(建议使用ROS官网推荐安装教程)
二. 安装uvc_camera (可选,适用于需要USB摄像头且没有安装过ROS摄像驱动的情况)
此节来自http://www.jb51.cc/article/p-ramzggao-bbn.html,感谢sonictl
- $sudoapt-getinstallros-indigo-uvc-camera
或者使用catkin,工作空间构建请参考ROS官网相关教程
- $cd~/catkin_ws/src
- $gitclonehttps://github.com/ktossell/camera_umd
- $cd~/catkin_ws
- $catkin_make
- $source~/catkin_ws/devel/setup.bash
开启三个终端:
第一个启动ROS服务:
- $roscore
- $rosrunuvc_camerauvc_camera_nodedevice:=/dev/video0
- $rosrunimage_viewimage_viewimage:=/image_raw
三. 安装并运行LSD-SLAM
1. 如果没有rosbuild并且打算使用rosbuild空间的话,执行下列代码
- sudoapt-getinstallpython-rosinstall
- mkdir~/rosbuild_ws
- cd~/rosbuild_ws
- roswsinit./opt/ros/indigo
- mkdirpackage_dir
- roswsset~/rosbuild_ws/package_dir-t.
- echo"source~/rosbuild_ws/setup.bash">>~/.bashrc
- bash
- cdpackage_dir
2. 安装依赖包
- sudoapt-getinstallros-indigo-libg2oros-indigo-cv-bridgeliblapack-devlibblas-devfreeglut3-devlibqglviewer-devlibsuitesparse-devlibx11-dev
3. 在你的ROS package path,git clone或者下载LSD-SLAM,LSD-SLAM 安装网址: https://github.com/tum-vision/lsd_slam
- gitclonehttps://github.com/tum-vision/lsd_slam.gitlsd_slam
4. 如果你需要openFabMap去闭环检测的话(可选)
在
- lsd_slam_core/CMakeLists.txt
- #add_subdirectory(${PROJECT_SOURCE_DIR}/thirdparty/openFabMap)
- #include_directories(${PROJECT_SOURCE_DIR}/thirdparty/openFabMap/include)
- #add_definitions("-DHAVE_FABMAP")
- #set(FABMAP_LIBopenFABMAP)
需要注意openFabMap需要OpenCv nonfree模块支持,OpenCV3.0以上已经不包含,作者推荐2.4.8版本
其中nonfree模块可以由以下方式安装
- $sudoadd-apt-repository--yesppa:xqms/opencv-nonfree
- $sudoapt-getupdate
- $sudoapt-getinstalllibopencv-nonfree-dev
5. 编译LSD-SLAM
- $rosmakelsd_slam
6. 运行LSD-SLAM
开启四个终端窗口
第一个启动ROS服务:
- $roscore
第二个启动摄像服务(USB摄像模式):
- $rosrunuvc_camerauvc_camera_nodedevice:=/dev/video0
- $rosrunlsd_slam_viewerviewer
(1)数据集模式
- $rosrunlsd_slam_coredataset_slam_files:=<files>_hz:=<hz>_calib:=<calibration_file>
如:
- $rosrunlsd_slam_coredataset_slam_files:=<yourpath>/LSD_room/images_hz:=0_calib:=<yourpath>/LSD_room/cameraCalibration.cfg
(2)USB摄像模式
- $rosrunlsd_slam_corelive_slam/image:=<yourstreamtopic>_calib:=<calibration_file>
如:
- $rosrunlsd_slam_corelive_slam/image:=image_raw_calib:=<yourpath>/LSD_room/cameraCalibration.cfg
运行成功图如下:
原文链接:https://www.f2er.com/ubuntu/352657.html