ubuntu16.04 运行PL-SLAM

####仅作为笔记
算法实测效果不好,可能是环境没有配置好,如有测试效果复现论文的,可以一起交流。
环境:
OpenCV 3.x.x
Eigen3 (tested with 3.2.92)
Boost
g2o
YAML
stvo-pl
MRPT
Line Descriptor(已在第三方库,不用单独安装)

照例贴出build.sh内容:

#装好依赖,再执行build.sh即可,修改make -j*根据自己电脑配置
echo "Building 3rdparty/line_descriptor ... "
cd 3rdparty/line_descriptor
mkdir build
cd build
cmake ..
make -j4
cd ../../../

echo "Building 3rdparty/DBoW2 ... "
cd 3rdparty/DBoW2
mkdir build
cd build
cmake ..
make -j4
cd ../../../

echo "Uncompressing vocabulary ..."
cd vocabulary
tar -xf voc.tar.gz
cd ..

echo "Building PL-SLAM ... "
mkdir build
cd build
cmake ..
make -j4
  1. OpenCV3.4.5
sudo apt-get install build-essential libgtk2.0-dev libavcodec-dev libavformat-dev libjpeg.dev libtiff4.dev libswscale-dev libjasper-dev
#在http://opencv.org/releases.html下载指定版本的opencv,这里以opencv3.4.5举例
unzip opencv-3.4.5.zip
cd opencv-3.4.5
mkdir build && cd build
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_TBB=ON -D BUILD_NEW_PYTHON_SUPPORT=ON -D WITH_V4L=ON -D WITH_QT=ON -D WITH_OPENGL=ON ..
make -j4 && sudo make install
sudo gedit /etc/ld.so.conf.d/opencv.conf 文件内加入/usr/local/lib
sudo gedit ~/.bashrc  加入:
PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig  
export PKG_CONFIG_PATH
source ~/.bashrc
  1. Eigen3
sudo apt-get install libeigen3-dev
  1. Boost
sudo apt-get install libboost-dev
  1. YAML
sudo apt-get install libyaml-cpp-dev
  1. g2o
git clone https://github.com/RainerKuemmerle/g2o.git
git checkout ff647bd  #ff647bd7537860a2b53b3b774ea821a3170feb13
cd g2o
mkdir build && cd build
cmake .. && make -j4
sudo make install
#如果出现找不到g2o库文件的情况:
#cd /usr/local/lib 
#sudo ln -sv libg2o_csparse_extension.so libg2o_ext_csparse.so
  1. MRPT
git clone https://github.com/MRPT/mrpt.git
git branch cg_0c3d605 0c3d605c3cbf5f2ffb8137089e43ebdae5a55de3
git checkout cg_0c3d605
     
# install dependencies
sudo apt install libdc1394-22-dev libjpeg-dev libftdi-dev freeglut3-dev \
libwxgtk3.0-dev zlib1g-dev libusb-1.0-0-dev libudev-dev libfreenect-dev \
libavformat-dev libswscale-dev libassimp-dev libgtest-dev libpcap-dev
     
# build & install
mkdir build & cd build
cmake .. & make -j4
sudo make install
  1. stvo-pl
git clone https://github.com/rubengooj/stvo-pl.git
cd stvo-pl
chmod +x build.sh
./build.sh
  1. pl-slam
##注意最好将stvo-pl、pl-slam、mrpt装在同一目录下
git clone https://github.com/rubengooj/pl-slam.git
chmod +x build.sh
./build.sh

在pl-slam的编译过程会遇到很多错误,请参考大神们的博客进行修改:
https://blog.csdn.net/CSDN330/article/details/86749921
https://blog.csdn.net/u011178262/article/details/86562125
https://blog.csdn.net/warningm_dm/article/details/105425619?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-2.channel_param&depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-2.channel_param

  1. 测试
sudo gedit ~/.bashrc
#将自己数据集的路径加入里面:
export DATASETS_DIR=<path-to-data_odometry_gray>/sequences
#复制pl-slam/config/dataset_params/kitti00-02.yaml或者其他kitti数据集的配置文件到<path-to-data_odometry_gray>/sequences/00/
#还有注意需要将复制过来的kitti00-02.yaml重命名为dataset_params.yaml
#将~/pl-slam/config/config/config_kitti.yaml中vocabulary_p和vocabulary_l的路径改为自己的路径。
#运行:
./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 00 -c ../config/config/config_kitti.yaml -o 100 -s 1 -n 1000
./plslam_dataset 00 -c ../config/config/config_kitti.yaml -o 100 -s 1
  1. 测试结果
    ubuntu16.04 运行PL-SLAM
上一篇:SLAM综述-Lidar SLAM


下一篇:[学习SLAM]超声波控制小车避障