Ubuntu16.04中PL-SLAM编译运行、遇到的问题,保存轨迹并进行评价

前言

《PL-SLAM: a Stereo SLAM System through the Combination of Points and Line Segments》是点、线特征结合的双目视觉SLAM方法,该方法在少、弱纹理环境例如地面、墙面等,即使点特征稀少,也能够依赖线特征进行很好的工作。在视觉SLAM领域,是一项十分杰出的工作,并且作者开源了代码,开源代码工作效果很好。
开源代码地址:https://github.com/rubengooj/pl-slam/
文章地址:https://arxiv.org/abs/1705.09479

PL-SLAM配置

1、OpenCV 3.x.x +OpenCV_contrib 3.x.x

下载OpenCV3.x.x以及对应版本的contrib,编译安装。
OpenCV github:https://github.com/opencv/opencv
OpenCV_contrib github:https://github.com/opencv/opencv_contrib
本人用的是opencv.3.2.0+opencv_contrib3.2.0。

git clone https://github.com/opencv/opencv/tree/3.2.0
git clone https://github.com/opencv/opencv_contrib/tree/3.2.0
unzip opencv-3.2.0.zip
cd ~/opencv-3.2.0
git clone https://github.com/opencv/opencv_contrib/tree/3.2.0
unzip opencv_contrib-3.2.0.zip
mkdir build
cd build
cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local -D OPENCV_EXTRA_MODULES_PATH=../opencv_contrib/modules/ ..
make -j8 #线程视电脑性能而定
sudo make install

2、Eigen3 (tested with 3.2.92)

http://eigen.tuxfamily.org
本人使用Eigen3.2.9
或者直接使用命令行安装:

$ sudo apt-get install libeigen3-dev

eigen3遇到了各种问题,之后会介绍如何解决。

3、Boost

$ sudo apt-get install libboost-dev

4、g2o - General Graph Optimization

https://github.com/RainerKuemmerle/g2o.git

5、YAML (tested with 0.5.2)

sudo apt-get install libyaml-cpp-dev

6、stvo-pl

https://github.com/rubengooj/stvo-pl
这个也是作者的项目,必须要安装,将stvo-pl放到pl-slam的同级目录下,pl-slam的CMakeLists.txt中可以配置stvo-pl的位置,安装步骤按照项目GitHub中README.md

7、MRPT

建议安装作者建议的版本:
https://github.com/MRPT/mrpt/tree/0c3d605c3cbf5f2ffb8137089e43ebdae5a55de3

8、line_descriptor

We have modified the line_descriptor module from the OpenCV/contrib library (both BSD) which is included in the 3rdparty folder.
这里在后面的脚本build.sh会一并安装。

编译

cd ~/pl-slam
./build.sh

运行

将数据集文件夹路径添加到~/.bashrc中:

gedit ~/.bashrc
export DATASETS_DIR=~/Datasets
source ~/.bashrc

下载相应数据集,比如下载KITTI 05 数据集放在Datasets文件夹中的kitti文件夹,将 /pl-slam/config/dataset_params/kitti04-10.yaml 复制到 05 文件夹下,重命名 dataset_params.yaml
pl-slam/config/config/config_kitti.yamlvocabulary_pvocabulary_l 路径改为自己的。
运行:

   ./plslam_dataset <dataset_name> [options]
eg ./plslam_dataset kitti/05 [options]

Options:
-c Config file
-o Offset (number of frames to skip in the dataset directory
-n Number of frames to process the sequence
-s Parameter to skip s-1 frames (default 1)
A full command would be:

./plslam_dataset kitti/00 -c ../config/config_kitti.yaml -o 100 -s 2 -n 1000

where we are processing the sequence 00 from the KITTI dataset (in our dataset folders) with the custom config file, with an offset -c allowing to skip the first 100 images, a parameter -s to consider only one every 2 images, and a parameter -n to only consider 1000 input pairs.
如果想要用自己的数据集也按照如上方式,本人用的ZED双目摄像头采集双目影像数据,用matlab相机标定工具进行参数标定,将dataset_params.yaml 中相应参数换为自己标定的相机参数。
运行结果截图如下:
在这里插入图片描述

遇到的问题

1、eigen3相关报了许多错,无论怎么修改按照相应版本eigen3均无效,可能是电脑太多东西,相关依赖环境有点乱。直接在usr/中将带有eigen3字样的文件夹删除,之后重新安装eigen3.2.9,问题解决。
2、报无法找到<Eigen/Dense>错误,解决方法:

    cd /usr/local/include
    sudo ln -sf eigen3/Eigen Eigen
    sudo ln -sf eigen3/unsupported unsupported

3、
报错:

/usr/bin/ld:cannot find -lg2o_ext_csparse 
 collect2: error :ld return 1 exit status

解决方法:

 cd /usr/local/lib
 sudo ln -sv libg2o_csparse_extension.so libg2o_ext_csparse.so

4、编译时g2o,mrpt等找不到
本人直接在Cmakelist.txt中set相关的路径
set(CMAKE_MODULE_PATH “pl-slam/g2o/cmake_modules”)
set(OpenCV_DIR “opencv-3.2.0/build”)
SET(MRPT_DIR “mrpt-0c3d605c3cbf5f2ffb8137089e43ebdae5a55de3/build”)

轨迹保存

这部分PL-SLAM中作者并未给出,需要自己编写,本人对源代码进行了改写,将轨迹保存成txt格式输出,因为本文使用的SLAM评价工具为evo,evo中有规定相应的格式,可以按要求来,本文以Euroc数据集为例。
另外助于Euroc数据集有几个序列数据cam0和cam1的影像数量不对应,会报错:
在这里插入图片描述
将对应序列里面多出来的影像移出即可,有如下序列需要修改:
MH-04数据集中左右影像数目不对应,cam0/data左边影像最后多1张。
V1-02数据集中左右影像数目不对应,cam1/data右边影像最后多1张。
V2-03数据集中左右影像数目不对应,cam1/data右边影像最后多414张。

误差计算

Euroc数据集在evo中采用的格式为TUM trajectory file格式,txt文件中每行分别为:timestamp,x,y,z四元数表示的角度,PL-SLAM中输出的旋转角度为欧拉角yaw-pitch-roll,转化为四元数时需要注意,groundtruth为相应Euroc数据集中state_groundtruth_estimate0文件夹中的data.csv。本文计算 relative pose error:

evo_rpe euroc data.csv CameraTrajectory.txt 

其他数据集和其他种误差计算类似,evo中还有许多功能,比如可视化显示轨迹、可视化比较等,感兴趣的读者可以尝试。
本人在全部Euroc数据集中对PL-SLAM进行了误差分析,结果来看PL-SLAM总体表现很好,明显优于ORB-SLAM等基于点特征的SLAM方法。

  • 2
    点赞
  • 44
    收藏
    觉得还不错? 一键收藏
  • 37
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 37
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值