PL-SLAM是Ruben Gomez-Ojeda大神融合點和線特征SLAM的最新成果,並開放了源代碼,本博文記錄安裝運行PL-SLAM遇到的一些問題。
1源代碼地址
https://github.com/rubengooj/pl-slam
2編譯配置PL-SLAM
安裝依賴
OpenCV 3.x.x
It can be easily found at http://opencv.org.
建議安裝OpenCV 3.1.0,否則編譯過程中會出現一些.so文件的錯誤,推測作者可能用的這個版本。
參考教程
https://www.cnblogs.com/feifanrensheng/p/9042813.html
Eigen3 (tested with 3.2.92)
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
stvo-pl
It can be found at:
https://github.com/rubengooj/stvo-pl
這個項目同樣是作者的工作,必須安裝這個項目,因為會用到這個項目的東西。
MRPT
https://github.com/MRPT/mrpt/tree/0c3d605c3cbf5f2ffb8137089e43ebdae5a55de3
必須使用這個指定版本的MRPT,否則會編譯報錯
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,而且最好同時安裝,否則會可能出現一些錯誤。
Configuration and generation
cd ~/pl-slam
sh build.sh
編譯過程會出現找不到g2o庫文件的錯誤,通過以下方式解決
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=/home/zn(改為你的工作目錄) 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.yaml中vocabulary_p和vocabulary_l的路徑改為自己的。
SLAM Application
./build/plslam_dataset kitti/00 -c config/config/config_kitti.yaml -o 100 -s 2 -n 1000
至此,整個編譯測試過程完成。