一、代码地址:
代码官网:https://github.com/rubengooj/pl-slam
注释:最终成功运行的是20180406提交的版本,不是最新的版本。
二、安装过程
1、安装依赖:
1)OpenCV 3.x.x
http://opencv.org
2)Eigen3 (tested with 3.2.92)
http://eigen.tuxfamily.org
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
7)mrpt
https://github.com/MRPT/mrpt/tree/0c3d605c3cbf5f2ffb8137089e43ebdae5a55de3
2、编译生成
Executing the file build.sh will configure and generate the line_descriptor and DBoW2 modules, uncompress the vocabulary files, and then will
configure and generate the PL-SLAM library for which we generate: libplslam.so in the lib folder, and the application plslam_dataset that works
with our dataset format (explained in the next section).
运行文件build.sh,安装生成line_descriptor和DBoW2模块,解压vocabulary文件,会安装生成PL-SLAM库,有lib文件夹下的libplslam.so文件,以及plslam_dataset可执行文件。
解压vocabulary文件
chmod a+x build.sh
./build.sh
3、遇到问题
1)运行./build.sh时出现:
CMake Error at CMakeLists.txt:12 (find_package):
By not providing "FindG2O.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "G2O", but
CMake did not find one.
Could not find a package configuration file provided by "G2O" with any of
the following names:
G2OConfig.cmake
g2o-config.cmake
Add the installation prefix of "G2O" to CMAKE_PREFIX_PATH or set "G2O_DIR"
to a directory containing one of the above files. If "G2O" provides a
separate development package or SDK, be sure it has been installed.
-- Configuring incomplete, errors occurred!
解决:
更改CMakeLists中寻找FindG2O的语句
#list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake_modules")
更改为
list(APPEND CMAKE_MODULE_PATH /home/lexiaoxia/soft/lib/g2o_160424/g2o/cmake_modules)
config/kitti.yaml
vocabulary_p : "/home/lexiaoxia/Codes/20210401/PLSLAM/pl-slam-20180406/vocabulary/mapir_orb.yml"
vocabulary_l : "/home/lexiaoxia/Codes/20210401/PLSLAM/pl-slam-20180406/vocabulary/mapir_lsd.yml"
src/slamconfig.cpp:
vocabulary_p = "/home/lexiaoxia/Codes/20210401/PLSLAM/pl-slam-20180406/vocabulary/mapir_orb.yml";
vocabulary_l = "/home/lexiaoxia/Codes/20210401/PLSLAM/pl-slam-20180406/vocabulary/mapir_lsd.yml";
2)
/usr/bin/ld: 找不到 -lg2o_ext_csparse
collect2: error: ld returned 1 exit status
CMakeFiles/plslam.dir/build.make:255: recipe for target '../lib/libplslam.so' failed
make[2]: *** [../lib/libplslam.so] Error 1
CMakeFiles/Makefile2:99: recipe for target 'CMakeFiles/plslam.dir/all' failed
make[1]: *** [CMakeFiles/plslam.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
解决:
在/usr/local/lib中看到啦相应的文件,所以应该是未更新库文件导致失败
sudo ldconfig -v//更新重新载入刚安装的g2o库文件
4、运行介绍
1)数据集配置:
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.
我们利用环境变量${DATASETS_DIR},指向包含我们数据集的目录。数据集中的每一个序列都必须在它的根目录中包含一个文件dataset_params.yaml,
该文件表示至少相机模型和带有左右图像的子文件夹。我们也给一些数据集和相机提供了xxxx_params.yaml格式的数据集参数文件。
2)配置文件:
For running SLAM we can load the default parameters file or employ the config_xxxx.yaml files provided for every dataset.
我们可以下载默认的参数文件或者利用给每个数据集提供的config_xxxx.yaml文件
3)使用说明:
SLAM Application
Usage: ./plslam_dataset <dataset_name> [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.
使用说明:
./plslam_dataset <dataset_name> [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)
如:./plslam_dataset kitti/00 -c ../config/config_kitti.yaml -o 100 -s 2 -n 1000
我们运行的是数据集文件夹在的KITTI数据集,利用惯例的配置文件,参数-c允许跳过前100张图像的偏移,参数-s考虑每2张图像只考虑1个,使用参数-n只考虑1000对输入图像对。
4)实际操作:
设置环境变量
sudo gedit ~/.bashrc
添加:
export DATASETS_DIR=/home/lexiaoxia/Datasets/hjydataset/kitti/data_odometry_gray/dataset/sequences
在build文件夹内运行:
./plslam_dataset 00 -c ../config/config_kitti.yaml -o 100 -s 2 -n 1000
5、遇到问题:
1)
Initializing PL-SLAM.... ... done.
[ INFO:0] Initialize OpenCL runtime...
[ INFO:7] Initialize OpenCL runtime...
beignet-opencl-icd: no supported GPU found, this is probably the wrong opencl-icd package for this hardware
(If you have multiple ICDs installed and OpenCL works, you can ignore this message)
beignet-opencl-icd: no supported GPU found, this is probably the wrong opencl-icd package for this hardware
(If you have multiple ICDs installed and OpenCL works, you can ignore this message)
plslam_dataset: /usr/local/include/eigen3/Eigen/src/Core/DenseStorage.h:128: Eigen::internal::plain_array<T, Size, MatrixOrArrayOptions, 32>::plain_array() [with T = double; int Size = 16; int MatrixOrArrayOptions = 0]: Assertion `(reinterpret_cast<size_t>(eigen_unaligned_array_assert_workaround_gcc47(array)) & (31)) == 0 && "this assertion is explained here: " "http://eigen.tuxfamily.org/dox-devel/group__TopicUnalignedArrayAssert.html" " **** READ THIS WEB PAGE !!! ****"' failed.
已放弃 (核心已转储)
解决:
sudo apt install ocl-icd-libopencl1
sudo apt install opencl-headers
sudo apt install clinfo
sudo apt install ocl-icd-opencl-dev
2)
Initializing PL-SLAM.... ... done.
plslam_dataset: /usr/local/include/eigen3/Eigen/src/Core/DenseStorage.h:128: Eigen::internal::plain_array<T, Size, MatrixOrArrayOptions, 32>::plain_array() [with T = double; int Size = 16; int MatrixOrArrayOptions = 0]: Assertion `(reinterpret_cast<size_t>(eigen_unaligned_array_assert_workaround_gcc47(array)) & (31)) == 0 && "this assertion is explained here: " "http://eigen.tuxfamily.org/dox-devel/group__TopicUnalignedArrayAssert.html" " **** READ THIS WEB PAGE !!! ****"' failed.
已放弃 (核心已转储)
解决:重新下载早期的20180406版本
3)在下载的20180406的PLSLAM版本
Initializing PL-SLAM.... ... done.
[ INFO:7] Initialize OpenCL runtime...
[ INFO:0] Initialize OpenCL runtime...
beignet-opencl-icd: no supported GPU found, this is probably the wrong opencl-icd package for this hardware
(If you have multiple ICDs installed and OpenCL works, you can ignore this message)
beignet-opencl-icd: no supported GPU found, this is probably the wrong opencl-icd package for this hardware
(If you have multiple ICDs installed and OpenCL works, you can ignore this message)
------------------------------------------ Frame #1 ----------------------------------------
VO Runtime: 86.4519
No new KF needed: 1 -32.6602 -32.6602 1.72525e-36 0.680963 0.279471 0
段错误 (核心已转储)
解决:
用带有参数的选项的命令运行
三、总结:
还是下载了早期版本运行成功,注意一些库文件的安装先后顺序。