ubuntu16 配置 RGBD-SLAM V2

一、安装RGBD-SLAM V2

下面介绍两种安装方式:

安装方法一:

git clone https://github.com/felixendres/rgbdslam_v2.git
cd rgbdslam_v2
source install.sh

接着会提示

This script puts all code into ‘/home/damon/Code’. Edit this script to change the location.
Press enter to continue, Ctrl-C to cancel

编译完成后,将安装在 ~/Code/rgbdslam_catkin_ws

然后需要将此路径加入到bash中

source ~/Code/rgbdslam_catkin_ws/devel/setup.bash 

此时,rgbdslam_v2已经安装成功

 

安装方式二:

1、创建ros工作空间

mkdir -p ~/rgbdslam_catkin_ws/src
cd ~/rgbdslam_catkin_ws/src
catkin_init_workspace
cd ~/rgbdslam_catkin_ws/
catkin_make
echo "source /home/XXXX/rgbdslam_ws/devel/setup.bash" >> ~/.bashrc
source ~/.bashrc

2、下载 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 

3、编译

$ cd rgbdslam_ws
$ catkin_make

等待编译完成就可以了。

 

二、测试

打开第一个终端

$ roscore

打开第二个终端

$ roslaunch rgbdslam rgbdslam.launch

如果显示如下图,表示安装成功:

ubuntu16 配置 RGBD-SLAM V2_第1张图片

 

运行数据集:

打开第三个终端:

$ rosbag play rgbd_dataset.bag

注意:修改rgbdslam.launch中节点的对应关系。

 

三、报错处理

报错一:在运行 roslaunch rgbdslam rgbdslam.launch  时报错

报错信息如下:

ubuntu16@ubuntu16:~$ roslaunch rgbdslam rgbdslam.launch
... logging to /home/ubuntu16/.ros/log/d425a142-8ec0-11ea-856f-e09d31fca5a8/roslaunch-ubuntu16-3448.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://ubuntu16:38461/

SUMMARY
========

PARAMETERS
 * /rgbdslam/config/backend_solver: pcg
 * /rgbdslam/config/cloud_creation_skip_step: 2
 * /rgbdslam/config/cloud_display_type: POINTS
 * /rgbdslam/config/detector_grid_resolution: 3
 * /rgbdslam/config/feature_detector_type: ORB
 * /rgbdslam/config/feature_extractor_type: ORB
 * /rgbdslam/config/max_keypoints: 600
 * /rgbdslam/config/max_matches: 300
 * /rgbdslam/config/min_sampled_candidates: 4
 * /rgbdslam/config/neighbor_candidates: 4
 * /rgbdslam/config/optimizer_skip_step: 1
 * /rgbdslam/config/pose_relative_to: largest_loop
 * /rgbdslam/config/predecessor_candidates: 4
 * /rgbdslam/config/ransac_iterations: 100
 * /rgbdslam/config/topic_image_depth: /camera/depth_reg...
 * /rgbdslam/config/topic_image_mono: /camera/rgb/image...
 * /rgbdslam/config/topic_points: 
 * /rosdistro: kinetic
 * /rosversion: 1.12.14

NODES
  /
    rgbdslam (rgbdslam/rgbdslam)

ROS_MASTER_URI=http://localhost:11311

process[rgbdslam-1]: started with pid [3465]
================================================================================REQUIRED process [rgbdslam-1] has died!
process has died [pid 3465, exit code -11, cmd /home/ubuntu16/rgbdslam_ws/devel/lib/rgbdslam/rgbdslam __name:=rgbdslam __log:=/home/ubuntu16/.ros/log/d425a142-8ec0-11ea-856f-e09d31fca5a8/rgbdslam-1.log].
log file: /home/ubuntu16/.ros/log/d425a142-8ec0-11ea-856f-e09d31fca5a8/rgbdslam-1*.log
Initiating shutdown!
================================================================================
[rgbdslam-1] killing on exit
shutting down processing monitor...
... shutting down processing monitor complete
done

原因分析:PCL与g2o不兼容导致,下载pcl1.8版本替换系统的1.7
解决办法如下:

cd 到某个路径,存放pcl
wget https://github.com/PointCloudLibrary/pcl/archive/pcl-1.8.0.tar.gz
tar -zxvf pcl-1.8.0.tar.gz 
cd pcl-pcl-1.8.0/
vim CMakeLists.txt 
在146行加插入  SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
mkdir build&&cd build
cmake ..
make VERBOSE=1 -j8
sudo make install
# 2000 years later

接下来做以下操作:

  1. 修改rgbdslam_v2的 :修改第 79 行:find_package(PCL 1.7 REQUIRED COMPONENTS common io) 为 find_package(PCL 1.8 REQUIRED COMPONENTS common io)
  2. 修改 /opt/ros/kinetic/share/pcl_ros/cmake/pcl_rosConfig.cmake文件,将所有/usr/lib/x86_64-linux/libpcl开头的内容改成/usr/local/lib/libpcl
    修改完成之后重新source install.sh 编译一下

再次运行roslaunch rgbdslam rgbdslam.launch
会出现以下界面(这就说明你已经安装成功了):
在这里插入图片描述

 

你可能感兴趣的:(SLAM,RGBD-SLAM,Ubuntu)