openvSLAM安装笔记

openvSLAM安装笔记

1.安装依赖

apt update -y
apt upgrade -y --no-install-recommends
//basic dependencies
apt install -y build-essential pkg-config cmake git wget curl unzip
//g2o dependencies
apt install -y libatlas-base-dev libsuitesparse-dev
//OpenCV dependencies
apt install -y libgtk-3-dev
apt install -y ffmpeg
apt install -y libavcodec-dev libavformat-dev libavutil-dev libswscale-dev libavresample-dev
//eigen dependencies
apt install -y gfortran
//other dependencies
apt install -y libyaml-cpp-dev libgoogle-glog-dev libgflags-dev

//(if you plan on using PangolinViewer)
//Pangolin dependencies
apt install -y libglew-dev

//(if you plan on using SocketViewer)
//Protobuf dependencies
apt install -y autogen autoconf libtool
//Node.js
curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
apt install -y nodejs

2.从源码下载并安装Eigen

cd /path/to/working/dir
wget -q https://gitlab.com/libeigen/eigen/-/archive/3.3.7/eigen-3.3.7.tar.bz2
tar xf eigen-3.3.7.tar.bz2
rm -rf eigen-3.3.7.tar.bz2
cd eigen-3.3.7
mkdir -p build && cd build
cmake \
    -DCMAKE_BUILD_TYPE=Release \
    -DCMAKE_INSTALL_PREFIX=/usr/local \
    ..
make -j4
make install

3.从源代码下载,构建和安装Opencv

cd /path/to/working/dir
wget -q https://github.com/opencv/opencv/archive/3.4.0.zip
unzip -q 3.4.0.zip
rm -rf 3.4.0.zip
cd opencv-3.4.0
mkdir -p build && cd build
cmake \
    -DCMAKE_BUILD_TYPE=Release \
    -DCMAKE_INSTALL_PREFIX=/usr/local \
    -DENABLE_CXX11=ON \
    -DBUILD_DOCS=OFF \
    -DBUILD_EXAMPLES=OFF \
    -DBUILD_JASPER=OFF \
    -DBUILD_OPENEXR=OFF \
    -DBUILD_PERF_TESTS=OFF \
    -DBUILD_TESTS=OFF \
    -DWITH_EIGEN=ON \
    -DWITH_FFMPEG=ON \
    -DWITH_OPENMP=ON \
    ..
make -j4
make install

4.从源代码下载,构建和安装自定义DBoW2

cd /path/to/working/dir
git clone https://github.com/shinsumicco/DBoW2.git
cd DBoW2
mkdir build && cd build
cmake \
    -DCMAKE_BUILD_TYPE=Release \
    -DCMAKE_INSTALL_PREFIX=/usr/local \
    ..
make -j4
make install

5.下载并安装g2o

cd /path/to/working/dir
git clone https://github.com/RainerKuemmerle/g2o.git
cd g2o
git checkout 9b41a4ea5ade8e1250b9c1b279f3a9c098811b5a
mkdir build && cd build
cmake \
    -DCMAKE_BUILD_TYPE=Release \
    -DCMAKE_INSTALL_PREFIX=/usr/local \
    -DCMAKE_CXX_FLAGS=-std=c++11 \
    -DBUILD_SHARED_LIBS=ON \
    -DBUILD_UNITTESTS=OFF \
    -DBUILD_WITH_MARCH_NATIVE=ON \
    -DG2O_USE_CHOLMOD=OFF \
    -DG2O_USE_CSPARSE=ON \
    -DG2O_USE_OPENGL=OFF \
    -DG2O_USE_OPENMP=ON \
    ..
make -j4
make install

6.使用PangolinViewer

下载源代码构建和安装

cd /path/to/working/dir
git clone https://github.com/stevenlovegrove/Pangolin.git
cd Pangolin
git checkout ad8b5f83222291c51b4800d5a5873b0e90a0cf81
mkdir build && cd build
cmake \
    -DCMAKE_BUILD_TYPE=Release \
    -DCMAKE_INSTALL_PREFIX=/usr/local \
    ..
make -j4
make install

7.编译openvSLAM

在支持PangolinViewer的情况下进行构建时,请指定以下cmake选项:-DUSE_PANGOLIN_VIEWER=ON-DUSE_SOCKET_PUBLISHER=OFF

源码下载地址:https://github.com/xdspacelab/openvslam

cd /path/to/openvslam
mkdir build && cd build
cmake \
    -DBUILD_WITH_MARCH_NATIVE=ON \
    -DUSE_PANGOLIN_VIEWER=ON \
    -DUSE_SOCKET_PUBLISHER=OFF \
    -DUSE_STACK_TRACE_LOGGER=ON \
    -DBOW_FRAMEWORK=DBoW2 \
    -DBUILD_TESTS=ON \
    ..
make -j4

注意:如果cmake找不到任何依赖项,请直接设置环境变量。例如,何时CMAKE_INSTALL_PREFIX/usr/local

  • Eigen3_DIR=/usr/local/share/eigen3/cmake
  • OpenCV_DIR=/usr/local/share/OpenCV
  • DBoW2_DIR=/usr/local/lib/cmake/DBoW2
  • g2o_DIR=/usr/local/lib/cmake/g2o
  • Pangolin_DIR=/usr/local/lib/cmake/Pangolin (已安装)
  • sioclient_DIR=/usr/local/lib/cmake/sioclient (已安装)

8.检查是否编译成功

 ./run_kitti_slam -h

输出如下内容:

在这里插入图片描述

到此openvSLAM就安装成功了!

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值