第二版的SLAM十四讲
完整的例程我都有复现,其中有好多都是我踩的坑,希望对你有帮助!!!!
Ubuntu 18.04
sudo apt install git
sudo apt install g++
sudo apt install build-essential libssl-dev
wget https://github.com/Kitware/CMake/releases/download/v3.18.4/cmake-3.18.4.tar.gz
tar -zxvf cmake-3.18.4.tar.gz
cd cmake-3.18.4
./bootstrap
make
sudo make install
# 查看版本
cmake -version
sudo apt-get install kdevelop
# 版本不是很高,后续有高版本的方法
sudo apt-get install libeigen3-dev
sudo ln -s /usr/include/eigen3/Eigen /usr/include/Eigen
安装Pangolin所需依赖
sudo apt install libgl1-mesa-dev
sudo apt install libglew-dev
sudo apt install cmake //注意以前装了就不需要安装了
sudo apt install libpython2.7-dev
sudo apt install python-pip
sudo python -mpip install numpy pyopengl Pillow pybind11
sudo apt install pkg-config
sudo apt install libegl1-mesa-dev libwayland-dev libxkbcommon-dev wayland-protocols
sudo apt install ffmpeg libavcodec-dev libavutil-dev libavformat-dev libswscale-dev libavdevice-dev
sudo apt install libdc1394-22-dev libraw1394-dev
sudo apt install libjpeg-dev libpng-dev libtiff5-dev libopenexr-dev
# 默认git版本为0.6
git clone https://github.com/stevenlovegrove/Pangolin.git
cd Pangolin
mkdir build && cd build
cmake ..
make -j
sudo make install
# 安装eigen3.3以上版本
# 去官网下载安装,具体步骤如下:http://eigen.tuxfamily.org/index.php?title=Main_Page
# 1.下载安装包:eigen-版本号.tar.bz2 ,然后提取到此处
# 2.进入文件夹eigen-版本号,右键在终端打开。
# 3.进行安装
mkdir build
cd build
cmake ..
sudo make install
git clone https://github.com/strasdat/Sophus.git
cd Sophus/
mkdir build
cd build
cmake ..
make
sudo make install
git clone https://github.com/fmtlib/fmt.git
cd fmt
mkdir build
cd build
cmake ..
make
sudo make install
sudo add-apt-repository "deb http://security.ubuntu.com/ubuntu xenial-security main"
sudo apt update
sudo apt upgrade
sudo apt install libjasper1 libjasper-dev
# 依赖项
sudo apt-get install build-essential libgtk2.0-dev libvtk6-dev libjpeg-dev libtiff5-dev libopenexr-dev libtbb-dev
# 下载opecv包,并提取到某位置,进行安装
# https://codeload.github.com/opencv/opencv/zip/3.2.0
# 安装
mkdir build
cd build
cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local/opencv3 ..
make -j4
sudo make install
具体安装过程看我的另外一篇博客
sudo apt-get install liblapack-dev libsuitesparse-dev libcxsparse3 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 -j4
sudo make install
sudo apt-get install qt5-qmake qt5-default libqglviewer-dev-qt5 libsuitesparse-dev libcxsparse3 libcholmod3
git clone https://github.com/RainerKuemmerle/g2o # 克隆最新版本g2o
cd g2o
mkdir build
cd build
cmake ..
make -j6 # 注意,这里尽量使用更多的j,否则g2o安装很慢(-j4 -j6等等)
sudo make install
# 安装opencv4(与opencv3共存的情况下)
sudo apt-get install build-essential libgtk2.0-dev libgtk-3-dev libavcodec-dev libavformat-dev libjpeg-dev libswscale-dev libtiff5-dev
sudo apt install python3-dev python3-numpy
sudo apt install libgstreamer-plugins-base1.0-dev libgstreamer1.0-dev
sudo apt install libpng-dev libopenexr-dev libtiff-dev libwebp-dev
#下载安装包:https://opencv.org/releases/
# 提取,然后进入解压后的文件夹,在终端打开
mkdir build
cd build
cmake -D CMAKE_BUILD_TYPE=Release -D OPENCV_GENERATE_PKGCONFIG=ON -D CMAKE_INSTALL_PREFIX=/usr/local/opencv4 ..
make -j4
sudo make install
sudo add-apt-repository ppa:zarquon42/meshlab
##### 然后按Enter键,继续
sudo apt-get install meshlab
sudo apt-get install libeigen3-dev libsuitesparse-dev qtdeclarative5-dev qt5-qmake libqglviewer-dev
进入到g2o/build下面,打开终端:
cmake ..
make -j4
sudo make install
git clone https://github.com/rmsalinas/DBow3
mkdir build
cd build
cmake ..
make -j4
sudo make install
sudo apt-get install libpcl-dev pcl-tools
sudo apt-get install liboctomap-dev octovis
运行如下指令:
git clone https://github.com/gflags/gflags.git
cd gflags
mkdir build && cd build
cmake -DCMAKE_INSTALL_PREFIX=/usr/local -DBUILD_SHARED_LIBS=ON -DGFLAGS_NAMESPACE=gflags ../
make -j4
sudo make install
git clone https://ghproxy.com/https://github.com/google/glog
sudo apt-get install autoconf automake libtool
cd glog
mkdir build
cd build
cmake ..
make
sudo make install
初次编译glog时如果出错,如下图所示,网上搜索解决方案,需要把glfag编译成动态库或者使用apt-get方法进行安装。
重新执行gflags的安装过程,将gflag编译成动态链接库
cmake -DGFLAGS_NAMESPACE=google -DCMAKE_CXX_FLAGS=-fPIC -DBUILD_SHARED_LIBS=ON -DBUILD_STATIC_LIBS=ON -DINSTALL_HEADERS=ON -DINSTALL_SHARED_LIBS=ON -DINSTALL_STATIC_LIBS=ON -DCMAKE_INSTALL_PREFIX=/usr/ ..
方法一:
查找是否存在gtest文件
cd /usr/src/gtest
sudo cmake CMakeLists.txt
sudo make
sudo cp *.a /usr/lib
方法二:
git clone https://ghproxy.com/https://github.com/google/googletest.git
cd googletest
mkdir build
cd build
cmake ..
make
sudo make install