SLAM 常用库环境配置

1. 概述

简单介绍在Ubuntu下进行SLAM所需要的常用库,希望能帮助大家,同时供自己以后参考.

2. Opencv

OpenCV下载地址:

https://opencv.org/releases.html

OpenCV-Contrib下载地址:

https://github.com/opencv/opencv_contrib/releases

如果使用Opencv_contrib需要单独下载一些文件,如果报错,首先查看是否下载完成,然后查看是否放到正确位置,如果一直提示未定义未声明的错误,并且文件已经放置正确,可以试试重新换个版本

  • 下面的opencv3.4.7根据自己的Opencv目录定义
  • OPENCV_EXTRA_MODULES_PATH=/具体目录/opencv_contrib-3.4.7/modules,如果不指定,可以把Opencv_Contrib放在Opencv目录下,自己试试就知道了
sudo apt-get install build-essential libgtk2.0-dev libvtk6-dev libjpeg-dev libtiff5-dev libopenexr-dev libtbb-dev
sudo add-apt-repository "deb http://security.ubuntu.com/ubuntu xenial-security main"
sudo apt update
sudo apt install libjasper1 libjasper-dev

以下为安装contrib所需的依赖项:
sudo apt-get install git cmake pkg-config libjpeg8-dev libavcodec-dev libavformat-dev libswscale-dev libv4l-dev libatlas-base-dev gfortran

///

cd opencv3.4.7
mkdir build
cd build

cmake配置:
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D OPENCV_EXTRA_MODULES_PATH=/具体目录/opencv_contrib-3.4.7/modules ..

make
sudo make install

安装后配置:
sudo gedit /etc/ld.so.conf.d/opencv.conf
在打开的文件末尾添加:/usr/local/lib
使得上面的配置生效:
sudo ldconfig
sudo gedit /etc/bash.bashrc
在打开的文件末尾添加:
PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig
export PKG_CONFIG_PATH
使得上面的配置生效:
source /etc/bash.bashrc
更新:
sudo updatedb

后面把Opencv需要下载的内容放上来

3. PCL

sudo apt-get install libpcl-dev pcl-tools

建议自己下载合适的版本编译安装
PCL

4. Sophus

下面的命令在ubuntu1804下会报错unit_complex_.real() = 1.; unit_complex_.imag() = 0. ;
解决办法
在sophus/so2.cpp文件中,将

unit_complex_.real() = 1. ;
unit_complex_.imag() = 0. ;

改为

unit_complex_.real(1.) ;
unit_complex_.imag(0.) ;

然后重新编译

git clone https://github.com/strasdat/Sophus.git
cd Sophus
git checkout a621ff
mkdir build
cd build
cmake ..
make

5. Pangolin

sudo apt-get install libglew-dev libboost-dev libboost-thread-dev libboost-filesystem-dev
git clone https://github.com/stevenlovegrove/Pangolin.git
cd Pangolin
mkdir build
cd build
cmake -DCPP11_NO_BOOST= 1 ..
make
sudo make install

6. Eigen

sudo apt-get install libeigen3-dev

建议自己下载编译安装
官网源地址

tar -zxvf eigen-*.*.*.tar.gz
mkdir ./build
cd ./build/
cmake ../
make 
sudo make install

7. Ceres

sudo apt-get install liblapack-dev libsuitesparse-dev libgflags-dev libgoogle-glog-dev libgtest-dev
git clone https://github.com/ceres-solver/ceres-solver.git
cd ceres-solver
mkdir build
cd build
cmake ..
make
sudo make install

官网教程
如果出现问题,首先可以考虑换个版本,例如这个版本链接
试试这个版本ceres-solver-1.14.0.tar.gz

8. g2o

sudo apt-get install libsuitesparse-dev qtdeclarative5-dev qt5-qmake libqglviewer-headers
git clone https://github.com/RainerKuemmerle/g2o.git
cd g2o
mkdir build
cd build
cmake ..
make
sudo make install

9. DBoW3

    git clone https://github.com/rmsalinas/DBow3.git
    cd DBow3
    mkdir build
    cd build
    cmake ..
    make
    sudo make install

10. 参考链接

ubuntu18.04搭建SLAM环境
Ubuntu18.04系统搭建SLAM环境

©️2020 CSDN 皮肤主题: 游动-白 设计师:上身试试 返回首页