Turtlebot2 rgbdslam_v2环境配置
创建一个工作空间,编译一遍
$ mkdir -p ~/catkin_ws/src
$ cd ~/catkin_ws
$ catkin_make
下载rgbdslam_v2代码包
$ cd ~/catkin_ws/src
$ wget -q http://github.com/felixendres/rgbdslam_v2/archive/kinetic.zip
$ unzip kinetic.zip
(把解压出来的文件名更改为rgbdslam_v2)
$ sudo cp -a ~/catkin_ws/src/rgbdslam_v2 /opt/ros/kinetic/share
安装g2o的依赖
$ sudo apt-get install libsuitesparse-dev
创建eigen工作空间
$ mkdir ~/src
$ cd ~/src
$ wget http://bitbucket.org/eigen/eigen/get/3.2.10.tar.bz2
mkdir eigen
$ tar -xvjf 3.2.10.tar.bz2 -C eigen --strip-components 1
创建g2o工作空间
$ cd ~/src
$ git clone https://github.com/felixendres/g2o.git
$ cd ~/src/g2o
$ mkdir ~/src/g2o/build
$ cd ~/src/g2o/build
配置g2o代码包中的CMakeLists.txt文件
$ vi ~/src/g2o/CMakeLists.txt
(如果不习惯vi 可以执行 sudo gedit ~/src/g2o/CMakeLists.txt也可以使用atom文本编辑器打开)
在251行中:将SET(G2O_EIGEN3_INCLUDE ${EIGEN3_INCLUDE_DIR} CACHE PATH "Directory of Eigen3")替换为SET(G2O_EIGEN3_INCLUDE "~/src/eigen" CACHE PATH "Directory of Eigen3"),保存退出
编译g2o工作空间
$ cd ~/src/g2o/build
$ cmake ../
$ make
$ sudo make install
下载PCL1.8(点云库:Point Cloud Library)
在此过程中,采用了很多方法,但都失败了,最后直接找到源代码的位置,下载zip文件(tar文件无法下载),下载之后放在~/src目录下解压。
$ cd ~/src
$ unzip pcl-pcl-1.8.0.zip
配置PCL,使其支持C++2011
$ cd ~/src/pcl-pcl-1.8.0
$ vi CMakeLists.txt(或者sudo gedit CMakeLists.txt)
在146行(endif()下一行)中加入SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
编译PCL
$ cd ~/src/pcl-pcl-1.8.0
$ mkdir build
$ cd build
$ cmake ../
$ make VERBOSE=1 (此步骤是为了验证PCL是否支持C++2011,如果能在输出中看到"-std=c++11",则说明是支持的,没有问题,按Ctrl+C退出,执行下一行命令。)
$ make
$ sudo make install
配置rgbdslam_v2
$ cd ~/catkin_ws/src/rgbdslam_v2
$ vi CMakeLists.txt(sudo gedit CMakeLists.txt)
在第六行中加入:add_compile_options(-std=c++11)
之后将find_package(PCL 1.7 REQUIRED COMPONENTS common io)
替换为:
find_package(PCL 1.8 REQUIRED COMPONENTS common io)
编译rgbdslam_v2
$ cd ~/catkin_ws
$ source devel/setup.bash
$ cd ~/catkin_ws/src/rgbdslam_v2
$ catkin_make
$ source devel/setup.bash
$ echo "source ~/catkin_ws/devel/setup.bash" >> ~/.bashrc
环境测试
$ roslaunch freenect_launch freenect.launch
(或者输入:roslaunch openni_launch openni.launch,如果没有设备连接,会显示"waiting for devices to be connected")
$ roslaunch rgbdslam openni+rgbdslam.launch(运行此命令就可以看到一个UI的界面了)
查看地图
$ rosrun pcl_ros pcd_to_pointcloud quicksave.pcd
有关博客参考:
https://hubpages.com/technology/Instructions-for-compiling-rgbdslam-v2-on-a-fresh-Ubuntu-1604-install-ros-kinetic-in-virtualbox
https://blog.csdn.net/u011178262/article/details/83046256
https://blog.csdn.net/yangtze_1006/article/details/51606680
www.guyuehome.com/860
https://www.cnblogs.com/gaoxiang12/p/4462518.html
https://github.com/felixendres/rgbdslam_v2
https://www.ncnynl.com/archives/201708/1931.html
来源:CSDN
作者:r = a (1-sinθ)
链接:https://blog.csdn.net/weixin_42361804/article/details/104142712