ubuntu14.04配置PL-SLAM并运行

前言

在视觉SLAM中,前端一般分为特征点法和直接法。
在弱纹理环境中,可靠点特征的缺乏会降低系统的性能,针对该问题,陆续有学者提出联合点、线特征的视觉SLAM系统,从而更加稳定地应用于点特征缺乏或分布不均的场景。
论文《PL-SLAM: a Stereo SLAM System through the Combination of Points and Line Segments》便是一项十分杰出的工作,可在https://arxiv.org/abs/1705.09479下载阅读。
更关键的是作者开源了代码,大赞,Github地址为https://github.com/rubengooj/pl-slam。
本博客暂不做理论分析,先对开源项目进行实现,这花费了我一天的时间,遇到很多问题,不过最终还是成功了。

配置PL-SLAM

主要参考项目主页的 README.md。

安装依赖

OpenCV 3.x.x

It can be easily found at http://opencv.org.
建议安装OpenCV 3.1.0,否则编译过程中会出现一些.so文件的错误,推测作者可能用的这个版本。

Eigen3 (tested with 3.2.92)

http://eigen.tuxfamily.org
or

$ sudo apt-get install libeigen3-dev

Boost

$ sudo apt-get install libboost-dev

g2o - General Graph Optimization

It can be found at:
https://github.com/RainerKuemmerle/g2o.git
这里在编译时可能会出现错误,将安装好的g2o文件夹中的cmake_modules文件夹复制到~/pl-slam文件夹中即可。

YAML (tested with 0.5.2)

Installation on Ubuntu:

$ sudo apt-get install libyaml-cpp-dev

我按照这种方式安装,在编译过程中出现错误,建议去https://github.com/jbeder/yaml-cpp下载源码进行安装。

stvo-pl

It can be found at:

https://github.com/rubengooj/stvo-pl
这个项目同样是作者的工作,必须安装这个项目,因为会用到这个项目的东西。

MRPT

https://github.com/MRPT/mrpt/tree/0c3d605c3cbf5f2ffb8137089e43ebdae5a55de3

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会一并安装。
但是这里值得特别注意,一般情况下我们安装OpenCV就够用了,但是为了使用line_descriptor,必须安装opencv_contrib,而且最好同时安装,否则会可能出现一些错误。

git clone https://github.com/opencv/opencv/tree/3.1.0
git clone https://github.com/opencv/opencv_contrib/tree/3.1.0
unzip opencv-3.1.0.zip
unzip opencv_contrib.zip
cd ~/opencv-3.1.0
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

Configuration and generation

cd ~/pl-slam
./build.sh

如果按照以上步骤操作,这里应该不会再出现错误,如果有,请百度或谷歌。
印象中有一些.so文件的错误,都可百度找到解决方案。
比如:

Linking CXX shared library ../lib/libplslam.so
/usr/bin/ld: can not find -lg2o_ext_csparse

解决方法:

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

Usage

Datasets configuration

We employ an environment variable, ${DATASETS_DIR}, pointing the directory that contains our datasets. Each sequence from each dataset must contain in its root folder a file named dataset_params.yaml, that indicates at least the camera model and the subfolders with the left and right images. We provide dataset parameters files for several datasets and cameras with the format xxxx_params.yaml.
关键是设置数据集路径的环境变量,阅读~/pl-slam/app/plslam-dataset.cpp可以加深理解。

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

在KITTI下载kitti/00数据,并将其放到~/KITTI目录下。
~/pl-slam/config/dataset_params/kitti00-02.yaml复制到~/KITTI/kitti/00,然后将kitti00-02.yaml改为dataset_params.yaml.
~/pl-slam/config/config/config_kitti.yamlvocabulary_pvocabulary_l的路径改为自己的。

SLAM Application

./plslam_dataset kitti/00

最终运行截图如下

ubuntu14.04配置PL-SLAM并运行_第1张图片

总结

从效果来看,比较惊艳,关键是融合点线特征的词袋提高了回环检测的效果。
可视化工具只显示了关键帧和轨迹,没有地图,如果想在此基础上开发,还需增加轨迹保存、地图保存和加载等模块。
接下来,会配置ROS版,毕竟不能只停留在跑数据集,要能实时在线的使用。
安装期间遇到很多问题,记忆有限,不能面面俱到,如有问题,欢迎留言交流。

你可能感兴趣的:(SLAM)