ubuntu16.04安装RGBD-SLAM V2运行

一.建立rgbdslam_ws空间

$ cd ~/rgbdslam_ws/src 
$ cd rgbdslam_ws 
$ catkin_make 
$ source devel/setup.bash 

二.下载并安装PCL1.8  EIGEN3.0   G20

1.下载安装PCL1.8

$ cd ~/rgbdslam_vs/src
$ wget https://github.com/PointCloudLibrary/pcl/archive/pcl-1.8.0.tar.gz
$ tar -xvzf pcl-1.8.0.tar.gz

修改cmakelist.txt,在其第146行加入并保存

SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")

编译

$  cd ~/rgbdslam_ws/src/pcl-pcl-1.8.0
$ mkdir build
$ cd build
$ cmake ..
$ make VERBOSE=1
$ sudo make install 

2.安装 EIGEN3.0和G2O

a.下载eigen3.0

$ cd rgbdslam_vs/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

b.配置G2O

将G2O中CMakelistis.txt的251中的

SET(G2O_EIGEN3_INCLUDE ${EIGEN3_INCLUDE_DIR} CACHE PATH "Directory of Eigen3")

改为

SET(G2O_EIGEN3_INCLUDE "你的Eigen3的绝对路径" CACHE PATH "Directory of Eigen3")

安装G2O

$ cd rgbdslam_vs/src
$ git clone https://github.com/felixendres/g2o.git
$ cd ~/rgbdslam/src/g2o
$ mkdir build
$ cd build
$ cmake ..
$ make 
$ sudo make install

3.安装opencv3.3.1(网上找教程)

4.安装RGBD-SLAM V2

$ cd ~/rgbdslam_ws/src 
$ wget -q http://github.com/felixendres/rgbdslam_v2/archive/kinetic.zip 
$ unzip -q kinetic.zip 
$ cd ~/rgbdslam_ws/ 
$ rosdep update 
$ rosdep install rgbdslam 

catkin_make之前rgbdslam_v2包的cmakelists.txt文件下的第6行加入

add_compile_options(-std=c++11)

将rgbdslam_v2包下的cmakelist.txt文件的第79行

find_package(PCL 1.7 REQUIRED COMPONENTS common io)

改为

find_package(PCL 1.8 REQUIRED COMPONENTS common io)

编译RGBD-SLAM V2

注意:如果是在ARM环境下则需要进入rgbdslam-v2/external/siftgpu/makefile并注释第19行和第20行。ARM没有这些扩展的浮点指令。此外,在顶级目录的cmakelists.txt中取消第31行的注释。

$ cd rgbdslam_ws
$ catkin_make

5.添加rgbdslam_ws工作空间到.bashrc文件下

$ echo "source /home/XXXX/rgbdslam_ws/devel/setup.bash" >> ~/.bashrc
$ source ~/.bashrc

6.测试数据集

打开第一个终端

$ roscore

打开第二个终端

$ rosbag play rgbd_dataset.bag

注意:修改rgbdslam.launch中13.14行的SIFTGPU为ORB

打开第三个终端

$ roslaunch rgbdslam rgbdslam.launch

打开kinetic v2

新建rgbdslam_kinect2.launch

<launch>
<node pkg="rgbdslam" type="rgbdslam" name="rgbdslam" cwd="node" required="true" output="screen"> 
<!-- Input data settings-->
<param name="config/topic_image_mono"              value="/kinect2/qhd/image_color_rect"/>  
<param name="config/camera_info_topic"             value="/kinect2/qhd/camera_info"/>

<param name="config/topic_image_depth"             value="/kinect2/qhd/image_depth_rect"/>

<param name="config/topic_points"                  value=""/> <!--if empty, poincloud will be reconstructed from image and depth -->

<!-- These are the default values of some important parameters -->
<param name="config/feature_extractor_type"        value="SIFTGPU"/><!-- also available: SIFT, SIFTGPU, SURF, SURF128 (extended SURF), ORB. -->
<param name="config/feature_detector_type"         value="SIFTGPU"/><!-- also available: SIFT, SURF, GFTT (good features to track), ORB. -->
<param name="config/detector_grid_resolution"      value="3"/><!-- detect on a 3x3 grid (to spread ORB keypoints and parallelize SIFT and SURF) -->

<param name="config/optimizer_skip_step"           value="15"/><!-- optimize only every n-th frame -->
<param name="config/cloud_creation_skip_step"      value="2"/><!-- subsample the images' pixels (in both, width and height), when creating the cloud (and therefore reduce memory consumption) -->

<param name="config/backend_solver"                value="csparse"/><!-- pcg is faster and good for continuous online optimization, cholmod and csparse are better for offline optimization (without good initial guess)-->

<param name="config/pose_relative_to"              value="first"/><!-- optimize only a subset of the graph: "largest_loop" = Everything from the earliest matched frame to the current one. Use "first" to optimize the full graph, "inaffected" to optimize only the frames that were matched (not those inbetween for loops) -->

<param name="config/maximum_depth"           value="2"/>
<param name="config/subscriber_queue_size"         value="20"/>

<param name="config/min_sampled_candidates"        value="30"/><!-- Frame-to-frame comparisons to random frames (big loop closures) -->
<param name="config/predecessor_candidates"        value="20"/><!-- Frame-to-frame comparisons to sequential frames-->
<param name="config/neighbor_candidates"           value="20"/><!-- Frame-to-frame comparisons to graph neighbor frames-->
<param name="config/ransac_iterations"             value="140"/>

<param name="config/g2o_transformation_refinement"           value="1"/>
<param name="config/icp_method"           value="gicp"/>  <!-- icp, gicp ... -->

<!--
<param name="config/max_rotation_degree"           value="20"/>
<param name="config/max_translation_meter"           value="0.5"/>

<param name="config/min_matches"           value="30"/>   

<param name="config/min_translation_meter"           value="0.05"/>
<param name="config/min_rotation_degree"           value="3"/>
<param name="config/g2o_transformation_refinement"           value="2"/>
<param name="config/min_rotation_degree"           value="10"/>

<param name="config/matcher_type"         value="SIFTGPU"/>
 -->
</node>
</launch>

打开一个终端

roslaunch kinect2_bridge kinect2_bridge.launch

注意:若出现failed to open Kinect V2 Access denied的错误,libfreenect2/platform/linux/udev/90-Kinect2.rules

文件复制到/etc/udev/rules.d/文件夹下

sudo cp  ~/libfreenect2/platform/linux/udev/90-kinect2.rules /etc/udev/rules.d/

打开另一个终端


roslaunch rgbdslam rgbdslam_kinect2.launch

注意:打开终端后,执行source ~/rgbdslam_ws/devel/setup.bash,否则会报以下错误:

[rgbdslam_kinect2.launch] is neither a launch file in package [rgbdslam] nor is [rgbdslam] a launch file name 
The traceback for the exception was written to the log file

  • 7
    点赞
  • 19
    收藏
    觉得还不错? 一键收藏
  • 8
    评论
评论 8
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值