本文参考http://blog.csdn.net/gobitan/article/details/51541977的文章,实际在自己电脑上有些小问题,结合出现的问题整理一下。
第一步:搭建Ubuntu14.04.4+ROS indigo基础环境
[1] 在http://releases.ubuntu.com/14.04/官网下载ubuntu-14.04.4-desktop-i386.iso安装包,大约1G。然后在VMware Player里安装好,可以采用VMPlayer的Easy Install自动化安装整个过程不需要干预。
备注:因为ROS包含rviz可视化环境,因此需要选择桌面版。(双系统,没用上)
[2] 将安装源换成阿里云的,如何换请参考http://mirrors.aliyun.com/help/ubuntu;
备注:强烈建议将安装源换成国内的,否则安装的时候要么速度慢,要么可能连不上。(没用上)
[3] 在Ubuntu14.04.4中安装ROS indigo,参考: http://wiki.ros.org/indigo/Installation/Ubuntu
dennis@ubuntu:~$ sudo apt-get update
dennis@ubuntu:~$ sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
dennis@ubuntu:~$ sudo apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net --recv-key 0xB01FA116
dennis@ubuntu:~$ sudo apt-get update
dennis@ubuntu:~$ sudo apt-get install ros-indigo-desktop-full
备注:这里采用的完整安装模式.
dennis@ubuntu:~$ sudo rosdep init
dennis@ubuntu:~$ rosdep update
dennis@ubuntu:~$ echo "source /opt/ros/indigo/setup.bash" >> ~/.bashrc
dennis@ubuntu:~$ source ~/.bashrc
[4] 校验安装是否成功,输入roscore命令,如下:
dennis@ubuntu:~$ roscore
.
.. logging to /home/dennis/.ros/log/9f2ace00-16b9-11e6-a10c-000c29b0df82/roslaunch-ubuntu-2078.log
Checking log directory for disk usage. This may take awhile.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.
started roslaunch server http://ubuntu:44364/
ros_comm version 1.11.19
SUMMARY
========
PARAMETERS
* /rosdistro: indigo
* /rosversion: 1.11.19
NODES
auto-starting new master
process[master]: started with pid [2090]
ROS_MASTER_URI=http://ubuntu:11311/
setting /run_id to 9f2ace00-16b9-11e6-a10c-000c29b0df82
process[rosout-1]: started with pid [2103]
started core service [/rosout]
[5] 安装ROS工具
dennis@ubuntu:~$ sudo apt-get install python-rosinstall
第二步:初始化ros编译环境及编译lsd_slam
dennis@ubuntu:~$ mkdir ~/rosbuild_ws
dennis@ubuntu:~$ cd ~/rosbuild_ws/
dennis@ubuntu:~/rosbuild_ws$ rosws init . /opt/ros/indigo
dennis@ubuntu:~/rosbuild_ws$ mkdir package_dir
dennis@ubuntu:~/rosbuild_ws$ rosws set ~/rosbuild_ws/package_dir -t .
dennis@ubuntu:~/rosbuild_ws$ echo "source ~/rosbuild_ws/setup.bash" >> ~/.bashrc
dennis@ubuntu:~/rosbuild_ws$ bash
dennis@ubuntu:~/rosbuild_ws$ cd package_dir/
dennis@ubuntu:~/rosbuild_ws/package_dir$
dennis@ubuntu:~/rosbuild_ws/package_dir$ sudo apt-get install ros-indigo-libg2o ros-indigo-cv-bridge liblapack-dev libblas-dev freeglut3-dev libqglviewer-dev libsuitesparse-dev libx11-dev
dennis@ubuntu:~/rosbuild_ws/package_dir$ git clone https://github.com/tum-vision/lsd_slam.git lsd_slam
dennis@ubuntu:~/rosbuild_ws/package_dir$ ls -lrt
total 4
drwxrwxr-x 5 dennis dennis 4096 May 8 03:30 lsd_slam
dennis@ubuntu:~/rosbuild_ws/package_dir$ rosmake lsd_slam
第三步:采用官方提供的数据集进行测试
备注:数据集下载请参考本文的参考资料[2].
测试方法一(采用image):(亲测)
第一个终端运行
roscore
第二个终端
cd rosbuild_ws/
source setup.bash
rosrun lsd_slam_viewer viewer
第三个终端
source setup.bash
rosrun lsd_slam_core dataset_slam _files:=/home/wbs/LSD_machine/images _hz:=0 _calib:=/home/wbs/LSD_machine/cameraCalibration.cfg
测试方法二(采用bag文件):
dennis@ubuntu:~$ roscore
dennis@ubuntu:~$ rosrun lsd_slam_viewer viewer
dennis@ubuntu:~$ rosrun lsd_slam_core live_slam image:=/image_raw camera_info:=/camera_info
dennis@ubuntu:~$ rosbag play LSD_room.bag
————————————————————————————续 9.12———————————————————————————————
摄像头下跑通LSD
终端1:
rosrun
终端2:
rosrun uvc_camera uvc_camera_node device:=/dev/video0
终端3:
cd rosbuild_ws/
source setup.bash
rosrun lsd_slam_viewer viewer
终端4:
source setup.bash
rosrun lsd_slam_core live_slam /image:=image_raw _calib:=/home/wbs/LSD_machine/cameraCalibration.cfg (这里.cfg有问题,应该采用自己的标定文件,这里先对付用着)
———————————————————————————续9.14——————————————————————————————————
调试方法,更改CMake 文件中的 set(ROS_BUILD_TYPE RelWithDebInfo)后运行
rosrun rqt_reconfigure rqt_reconfigure