rtabmap_ros---43

一、前言

RTAB-Map (Real-Time Appearance-Based Mapping)是一种基于全局贝叶斯闭环检测的RGB-D Graph SLAM方法。它可以用kinect的深度信息结合kinect变

换得到的激光数据进行即时定位与建图(gmapping算法志只用到了kinect转换得到的激光数据,而把深度信息丢弃了)。
官网地址:http://introlab.github.io/rtabmap/
ROS下面安装请看:https://github.com/introlab/rtabmap_ros#rtabmap_ros
教程请看:https://github.com/introlab/rtabmap/wiki/Tutorials
在机器人上使用RTAB-Map:Setup RTAB-Map on Your Robot!

二、deb方式安装

嫌麻烦采用deb方式安装

Jade:   $ sudo apt-get install ros-jade-rtabmap-ros
Indigo: $ sudo apt-get install ros-indigo-rtabmap-ros
Hydro:  $ sudo apt-get install ros-hydro-rtabmap-ros 

三、源码安装

请看github上的安装说明:https://github.com/introlab/rtabmap_ros#rtabmap_ros
简单的安装方法是:
indigo:

$ sudo apt-get install libsqlite3-dev libpcl-1.7-all libfreenect-dev libopencv-dev 

hydro:

$ sudo apt-get install libsqlite3-dev libpcl-1.7-all ros-hydro-libfreenect ros-hydro-opencv2

然后下载RTAB-Map源码编译安装:

$ git clone https://github.com/introlab/rtabmap.git rtabmap
$ cd rtabmap/build
$ make -j4
$ make install

安装完之后插上Kinect在终端运行命令:

$ rtabmap

出现GUI,然后选择“File”——“New database”,再点击开始按键就可以出现图像了

在catkin工作空间中安装RTAB-Map ros-pkg

$ cd ~/catkin_ws
$ git clone https://github.com/introlab/rtabmap_ros.git src/rtabmap_ros
$ catkin_make

1、安装可选的依赖项

(1)如果你需要用到SURF/SIFT那就装一下OpenCV
请看:http://blog.csdn.net/u013453604/article/details/49781771
由于cv-bridge依赖的是opencv2,所以装opencv3的话rtabmap_ros里面有些库会冲突,这里建议装opencv 2.4.11。
(2)安装g2o,这是在闭环检测中实现图优化的包
先安装依赖项

$ sudo apt-get install cmake libeigen3-dev libsuitesparse-dev

下载源码编译安装

$ cd
$ git clone https://github.com/RainerKuemmerle/g2o.git
$ cd g2o/
$ mkdir build
$ cd build/
$ cmake ../
$ make

安装完之后库文件在/usr/local/lib,头文件在/usr/local/include/g2o
(3)安装其他依赖项Qt, PCL, dc1394, OpenNI, OpenNI2, Freenect, g2o, Costmap2d, Rviz, Octomap, CvBridge

$ sudo apt-get install libqt4-dev libpcl-1.7-all-dev libdc1394-22-dev ros-indigo-openni-launch ros-indigo-openni2-launch ros-indigo-freenect-launch ros-indigo-costmap-2d ros-indigo-octomap-ros ros-indigo-rviz ros-indigo-cv-bridge

如果按照github上的命令安装依赖项不成功就运行上述命令吧,其中opencv和g2o我是源码安装的,所以相对于github上的命令我这里把ros-indigo-g2o去掉了,把libdc1394-dev改成了libdc1394-22-dev
(4)安装GTSAM

GTSAM is a library of C++ classes that implement smoothing and mapping (SAM) in robotics and vision, using factor graphs and Bayes networks as the underlying computing paradigm rather than sparse matrices.

把gtsam包下载到某处进行编译安装:

$ cd software/
$ git clone https://bitbucket.org/gtborg/gtsam.git
$ cd gtsam
$ mkdir build
$ cd build
$ cmake ..
$ make check
$ make install

(5)安装cvsba

cvsba is an OpenCV wrapper for the well-known Sparse Bundle Adjustment library (sba) by M. Lourakis.

安装依赖项

$ sudo apt-get install liblapack-dev libf2c2-dev 

下载cvsba:http://sourceforge.net/projects/cvsba/files/latest/download?source=typ_redirect
解压得到cvsba-1.0.0文件夹,我把它放到~/software/文件夹下

$ cd ~/software/cvsba-1.0.0
$ mkdir build
$ cd build
$ cmake ..
$ make
$ sudo make install 

安装完之后还要执行以下命令才可以让rtabmap_ros找到它

$ sudo mkdir /usr/local/lib/cmake/cvsba
$ sudo mv /usr/local/lib/cmake/Findcvsba.cmake /usr/local/lib/cmake/cvsba/cvsbaConfig.cmake

(6)安装Freenect2

请看这里:https://github.com/OpenKinect/libfreenect2#debianubuntu-1404-perhaps-earlier

Driver for Kinect for Windows v2 (K4W2) devices (release and developer preview).

Note: libfreenect2 does not do anything for either Kinect for Windows v1 or Kinect for Xbox 360 sensors. Use libfreenect1 for those sensors.

This driver supports:

RGB image transfer
IR and depth image transfer
registration of RGB and depth images

先下载Freenect2源代码

$ cd ~/software
$ git clone https://github.com/OpenKinect/libfreenect2.git

安装依赖项

$ 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

注意libusb版本要大于1.0.20,否则编译freenect2的时候会报错:

CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
LibUSB_LIBRARY
linked by target "freenect2" in directory /home/siat/libfreenect2

如果libusb版本太低可以先卸载libusb-1.0-0-dev更新软件源重装libusb-1.0-0-dev,运行如下命令

$ sudo apt-get remove libusb-1.0-0-dev
$ sudo apt-add-repository ppa:floe/libusb
$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get install libusb-1.0-0-dev

安装 GLFW3

$ sudo apt-get install libglfw3-dev

如果上面命令无效请使用下面命令:

$ cd libfreenect2/depends
$ sh install_ubuntu.sh
$ sudo dpkg -i libglfw3*_3.0.4-1_*.deb

安装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

编译Freenect2

$ mkdir build && cd build
$ cmake ..
$ make
$ sudo make install # without sudo if cmake -DCMAKE_INSTALL_PREFIX=$HOME/...

运行测试

$ ./bin/Protonect

2、下载安装RTAB-Map

$ cd ~
$ git clone https://github.com/introlab/rtabmap.git rtabmap
$ cd rtabmap/build
$ cmake -DCMAKE_INSTALL_PREFIX=~/catkin_ws/devel ..
$ make -j4
$ make install

3、在catkin工作空间中安装RTAB-Map ros-pkg

$ cd ~/catkin_ws
$ git clone https://github.com/introlab/rtabmap_ros.git src/rtabmap_ros
$ catkin_make

4、更新版本

$ cd rtabmap
$ git pull origin master
$ cd build
$ make
$ make install

$ roscd rtabmap_ros
$ git pull origin master
$ cd ~/catkin_ws
$ catkin_make

四、遇到的报错

编译时遇到如下报错,最后发现是关于openni的库有问题,因为我用源码装过openni驱动,有可能是版本冲突了,其实根本没必要从源码安装, 可以从其他电脑上把usr/include下面的ni文件夹拷过来,我是重装了Ubuntu和ros indigo,然后按照前面简单的安装方法安装的,过程中自动安装了openni

[email protected]:~/rtabmap/build$ make -j4
[  7%] Built target rtabmap_utilite
[  7%] Built target uresourcegenerator
[  8%] Built target imagesJoiner
[  9%] Built target extractObject
[ 10%] Building CXX object corelib/src/CMakeFiles/rtabmap_core.dir/CameraThread.cpp.o
[ 10%] [ 11%] [ 12%] Building CXX object corelib/src/CMakeFiles/rtabmap_core.dir/CameraRGBD.cpp.o
Building CXX object corelib/src/CMakeFiles/rtabmap_core.dir/VisualWord.cpp.o
Building CXX object corelib/src/CMakeFiles/rtabmap_core.dir/EpipolarGeometry.cpp.o
In file included from /usr/include/ni/XnOS.h:27:0,
                 from /usr/include/pcl-1.7/pcl/io/openni_camera/openni.h:47,
                 from /usr/include/pcl-1.7/pcl/io/openni_camera/openni_depth_image.h:44,
                 from /home/siat/rtabmap/corelib/src/../include/rtabmap/core/CameraRGBD.h:37,
                 from /home/siat/rtabmap/corelib/src/CameraRGBD.cpp:28:
/usr/include/ni/XnPlatform.h:73:3: error: #error OpenNI Platform Abstraction Layer - Unsupported Platform!
  #error OpenNI Platform Abstraction Layer - Unsupported Platform!
   ^
.
.
.
In file included from /usr/include/pcl-1.7/pcl/io/openni_camera/openni.h:50:0,
                 from /usr/include/pcl-1.7/pcl/io/openni_camera/openni_depth_image.h:44,
                 from /home/siat/rtabmap/corelib/src/../include/rtabmap/core/CameraRGBD.h:37,
                 from /home/siat/rtabmap/corelib/src/CameraThread.cpp:31:
/usr/include/ni/XnCppWrapper.h:10045:76: error: macro "XN_VALIDATE_NEW" passed 4 arguments, but takes just 2
    XN_VALIDATE_NEW(pTrans, StateChangedCallbackTranslator, handler, pCookie);
                                                                            ^
/usr/include/ni/XnCppWrapper.h:10104:75: error: macro "XN_VALIDATE_NEW" passed 4 arguments, but takes just 2
   XN_VALIDATE_NEW(pTrans, StateChangedCallbackTranslator, handler, pCookie);
                                                                           ^
[ 13%] Building CXX object corelib/src/CMakeFiles/rtabmap_core.dir/VWDictionary.cpp.o
In file included from /usr/include/ni/XnStatusCodes.h:27:0,
                 from /usr/include/ni/XnMacros.h:27,
                 from /usr/include/ni/XnOS.h:28,
                 from /usr/include/pcl-1.7/pcl/io/openni_camera/openni.h:47,
                 from /usr/include/pcl-1.7/pcl/io/openni_camera/openni_depth_image.h:44,
                 from /home/siat/rtabmap/corelib/src/../include/rtabmap/core/CameraRGBD.h:37,
                 from /home/siat/rtabmap/corelib/src/CameraRGBD.cpp:28:
/usr/include/ni/XnStatus.h:33:9: error: ‘XnUInt32’ does not name a type
 typedef XnUInt32 XnStatus;

         ^
时间: 2024-10-17 09:12:04

rtabmap_ros---43的相关文章

自定义属性之图片切换实例——代码简化、函数合并——JS学习笔记2015-5-30(第43天)

鉴于for循环的重要性,今天再来回顾下什么时候想到使用for循环: 1.重复执行某些代码:2.每次执行的时候有个数字在变化: 说道代码简化,函数合并 这里要去观察自己的代码,当发现自己写的代码,在功能上存在相似的代码段时,看看他们能不能合并 也就是函数的使用思想,就是被用来重复调用:让程序的整体代码变得简洁: 和合并的过程中,注意调试效果,看看有没有影响到原来效果的执行: 1 <!DOCTYPE HTML> 2 <html> 3 <head> 4 <meta ht

Effective C++ 43,44

43.明智地使用多继承. 多继承带来了极大的复杂性.最基本的一条就是二义性. 当派生类为多继承时,其多个基类有同名的成员时,就会出现二义性.通常要明确其使用哪个成员的.显式地限制修饰成员不仅很笨拙,而且会带来限制.当显式地用一个类名来修饰一个虚函数时,函数就会被固定,而不再具有虚拟的特性.对于虚函数,若两个基类拥有一个同名同参的虚函数,当派生类没有重新定义虚函数时(可以只声明),直接调用这个同名函数会出二义性错误,需要指明其类.而当派生类中重新定义了这个函数,这是不可能的,因为一个类只允许有唯一

CentOS7.2 FTP(pure-ftpd-1.0.43)安装

一.下载最新安装包并解压 cd /usr/local/src wget ftp://ftp.pureftpd.org/pub/pure-ftpd/releases/pure-ftpd-1.0.43.tar.gz     tar -vxf pure-ftpd-1.0.43.tar.gz     cd pure-ftpd-1.0.43 二.准备环境 yum -y install gcc    #安装编译器    yum -y install openssl   openssl-devel     #

django之创建第4-3个项目-访问list数据

1.index <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>django之创建第4-2个项目</title> </head> <body> <h2>访问list数据,用索引获取list内的数:{{test.0}}</h2> <!--模板 变量用变量

&lt;LeetCode OJ&gt; 43. Multiply Strings

43. Multiply Strings My Submissions Question Total Accepted: 51859 Total Submissions: 231017 Difficulty: Medium 以字符串的形式给定两个数字,返回相乘的结果,注意:结果也是字符串,因为数字可能很大 Given two numbers represented as strings, return multiplication of the numbers as a string. Note

43: Construct Binary Tree from Preorder and Inorder Traversal

/************************************************************************/            /*       43:  Construct Binary Tree from Preorder and Inorder Traversal                            */            /**************************************************

thinkphp开发系列-ueditor1.43修改图片上传路径

最近用的ueditor1.43感觉分厂不错,但是如何能自定义ueditor的上传路径呢 然后进入php目录 打开后参考下图修改

云计算学习(4-3)虚拟化技术-存储虚拟化

云计算学习(4-3)虚拟化技术-存储虚拟化 存储虚拟化:统一存取接口,屏蔽物理实现. 本地存储:本地硬盘 光纤FC存储:光纤 ISCSI存储:TCP/IP NFS存储:TCP/IP,NAS 分布式存储:FunsionStorage,能够形成存储池,像普通设备一样提供稳定的存储服务. 虚拟化存储:用文件系统屏蔽了底层设备差异,能够提供高级特性. 非虚拟化存储:没有高级特性,但性能更好. 裸设备映射: 优点: 精简配置:能够让虚拟磁盘不必一次占用所有空间,而是随使用逐渐增长. 快照:用来快速备份和恢

编写高质量代码改善C#程序的157个建议——建议43:让接口中的泛型参数支持协变

建议43:让接口中的泛型参数支持协变 除了上一建议中提到的使用泛型参数兼容接口不可变性外,还有一种办法是为接口中的泛型声明加上out关键字来支持协变,如下所示: interface ISalary<out T> //使用out关键字 { void Pay(); } static void Main(string[] args) { ISalary<Programmer> s = new BaseSalaryCounter<Programmer>(); ISalary&l

Java知多少(43)异常处理基础

Java异常是一个描述在代码段中发生的异常(也就是出错)情况的对象.当异常情况发生,一个代表该异常的对象被创建并且在导致该错误的方法中被抛出(throw).该方法可以选择自己处理异常或传递该异常.两种情况下,该异常被捕获(caught)并处理.异常可能是由Java运行时系统产生,或者是由你的手工代码产生.被Java抛出的异常与违反语言规范或超出Java执行环境限制的基本错误有关.手工编码产生的异常基本上用于报告方法调用程序的出错状况. Java异常处理通过5个关键字控制:try.catch.th