ROS与VSLAM入门教程-rtabmap_ros-安装
ROS与VSLAM入门教程-rtabmap_ros-安装
说明:
- 介绍如何安装rtabmap和rtabmap_ros
deb方式安装
deb安装比较简单,但不是最新的版本
在indigo版本:
$ sudo apt-get install ros-indigo-rtabmap-ros
- 在kinetic版本:
$ sudo apt-get install ros-kinetic-rtabmap-ros
源码安装
源码安装可以更新为最新的版本,但可能遇到问题比较多
要求:PCL >=1.7 默认Hydro/Indigo/Jade/Kinetic/Lunar版本下都支持
新建工作空间如catkin_ws
mkdir -p ~/catkin_ws/src
cd ~/catkin_ws
catkin_make
- 加载相应的环境,也可以添加到~/.bashrc文件,不用每次手动执行
$ source /opt/ros/kinetic/setup.bash
$ source ~/catkin_ws/devel/setup.bash
- 必要的依赖安装,最简单的方法安装相关依赖 (Qt, PCL, VTK, OpenCV, ...):
$ sudo apt-get install ros-kinetic-rtabmap ros-kinetic-rtabmap-ros
$ sudo apt-get remove ros-kinetic-rtabmap ros-kinetic-rtabmap-ros
- 通过安装二进制版本,再删除。
可选依赖安装g2o
- 安装g2o依赖包:
$ sudo apt-get install cmake libeigen3-dev libsuitesparse-dev
- 源码编译g2o
$ cd
$ git clone https://github.com/RainerKuemmerle/g2o.git
$ cd g2o/
$ mkdir build
$ cd build/
$ cmake ../
$ make
- 安装完之后库文件在/usr/local/lib,头文件在/usr/local/include/g2o
可选安装GTSAM
- 源码安装
$ cd
$ git clone https://bitbucket.org/gtborg/gtsam.git
$ cd gtsam
$ mkdir build
$ cd build
$ cmake ..
$ make check
$ make install
可选安装cvsba
- 依赖安装
$ sudo apt-get install liblapack-dev libf2c2-dev
- 下载cvsba-1.0.0:http://sourceforge.net/projects/cvsba/files/latest/download?source=typ_redirect
- 解压编译cvsba-1.0.0
$ cd ~/cvsba-1.0.0
$ mkdir build
$ cd build
$ cmake ..
$ make
$ sudo make install
- 让rtabmap可以找到,配置如下:
$ sudo mkdir /usr/local/lib/cmake/cvsba
$ sudo mv /usr/local/lib/cmake/Findcvsba.cmake /usr/local/lib/cmake/cvsba/cvsbaConfig.cmake
可选安装Freenect2
- 安装依赖
$ sudo apt-get install build-essential cmake pkg-config libturbojpeg libjpeg-turbo8-dev mesa-common-dev freeglut3-dev libxrandr-dev libxi-dev
- 安装libusb依赖
$ sudo apt-get install libusb-1.0-0-dev
- 安装GLFW3依赖
$ sudo apt-get install libglfw3-dev
- 安装OPENCL依赖
对于AMD GPU:
$ apt-get install opencl-headers
对于Nvidia GPU:(前提是你已经安装Nvidia驱动)
$ apt-get install opencl-headers
对于Intel GPU:
$ apt-get install beignet-dev
不行的话运行:
$ sudo apt-add-repository ppa:pmjdebruijn/beignet-testing
- 源码下载
$ cd ~
$ git clone https://github.com/OpenKinect/libfreenect2.git
$ cd libfreenect2
$ mkdir build && cd build
$ cmake ..
$ make
$ sudo make install # without sudo if cmake -DCMAKE_INSTALL_PREFIX=$HOME/...
- 连接kinect2,可运行测试
$ ./bin/Protonect
下载安装RTAB-Map
- 源码安装rtabmap
$ cd ~
$ git clone https://github.com/introlab/rtabmap.git rtabmap
$ cd rtabmap/build
$ cmake -DCMAKE_INSTALL_PREFIX=~/catkin_ws/devel ..
$ make -j4
$ make install
- 源码安装rtabmap_ros
$ cd ~/catkin_ws
$ git clone https://github.com/introlab/rtabmap_ros.git src/rtabmap_ros
$ catkin_make -j1
内存太小的话,使用-j1 ,内存大可以去掉。
版本更新
$ cd rtabmap
$ git pull origin master
$ cd build
$ make
$ make install
$ roscd rtabmap_ros
$ git pull origin master
$ cd ~/catkin_ws
$ catkin_make
测试运行:
- 启动深度相机kinect
$ roslaunch freenect_launch freenect.launch depth_registration:=true
- 启动建图
$ roslaunch rtabmap_ros rtabmap.launch rtabmap_args:="--delete_db_on_start"
- 或者
$ roslaunch rtabmap_ros rtabmap.launch rtabmap_args:="--delete_db_on_start" rviz:=true rtabmapviz:=false
- 效果图:
参考:
- https://github.com/introlab/rtabmap/wiki/Installation
- https://github.com/introlab/rtabmap/wiki/Tutorials
- https://github.com/introlab/rtabmap_ros#rtabmap_ros
- http://introlab.github.io/rtabmap/
- http://wiki.ros.org/rtabmap_ros/Tutorials/SetupOnYourRobot
获取最新文章: 扫一扫右上角的二维码加入“创客智造”公众号