ubuntu20.04下slam十四讲环境安装(ubuntu22.04可用)

第0章,安装c++与cmake,建立环境
#安装c++支持

sudo apt install build-essential

#安装cmake

sudo apt install cmake

第3章,包括eigen3,opengl,opencv以及pangolin

#安装eigen3

sudo apt install libeigen3-dev
#安装opengl

安装必要的依赖以及opengl本体

sudo apt-get install libgl1-mesa-dev
sudo apt-get install freeglut3-dev
sudo apt-get install libglew-dev libsdl2-dev libsdl2-image-dev libglm-dev libfreetype6-dev

#安装pangolin
安装pangolin需要cpp, eighen3, opengl,安装完成之后,正式安装pangolin
git clone https://github.com/stevenlovegrove/Pangolin

直接链接github较慢,请自行寻找github的镜像站。

安装其他依赖

 sudo apt-get install wayland-protocols

然后进行源码的编译。

#########################################

时隔两个月,我发现如何编译我已经忘了。现在补充在这里。

cd /xxx/Pangolin

mkdir build

cd build

cmake ..

make -j4

sudo make install

#########################################

编译结束后,sudo vim /etc/ld.so.conf

并在文件中加入/usr/local/lib

保存退出后,运行sudo ldconfig

 第四章,包括fmt,sophus

4.1 安装fmt,在下面网站下载安装包并编译安装(方法同pangolin)

https://fmt.dev/8.1.1/index.html

4.2 安装sophus

sophus需要安装依赖:fmt

git clone https://github.com/strasdat/Sophus

第四章案例运行成功,如fmt报错,则需要在CMakeLists.txt中加入target_link_libraries(trajectoryError ${Sophus_LIBRARIES} fmt)
提供fmt支持。第四章完结。

第五章,包括opencv

 安装opencv的依赖(注意,此处必须先装)

sudo apt install libgtk2.0-dev

sudo apt install pkg-config

安装opencv

#######################################################

编译错误:

Built target opencv_test_core error2

解决:

在编译过程中,将cmake ..换为 cmake -D BUILD_TESTS=OFF CMAKE_INSTALL_PREFIX=/home/liang/.programdata/slam_build/opencv-4.5.5/release/installed -DCMAKE_BUILD_TYPE="Release" ..
注意最后的“..”
make -j 16

sudo make install

安装完毕

#######################################################

如果提示缺少组件,安装下面内容

sudo apt-get install libcanberra-gtk-module

sudo apt-get install libboost-all-dev

 

安装ffmpeg使opencv支持视频

sudo apt install ffmpeg

sudo apt install libavcodec-dev libavformat-dev libswscale-dev libavutil-dev

 

第六章,ceres-solver, gflags, glog and so on

安装ceres-solver

需要依赖glog,gflags,suitparse

sudo apt-get install liblapack-dev libsuitesparse-dev libcxsparse3 libgflags-dev libgoogle-glog-dev libgtest-dev

sudo apt-get install libsuitesparse-dev

###############bug fix###############

sudo apt-get install libmetis-dev

###############bug fix done###########

下载ceres-solver开始安装

git clone https://ceres-solver.googlesource.com/ceres-solver

安装g2o

需要依赖

sudo apt-get install qt5-qmake libqglviewer-dev-qt5 libsuitesparse-dev libcxsparse3 libcholmod3

下载g2o并安装

git clone https://github.com/RainerKuemmerle/g2o

#############################################

安装过程中q5报错,经过分析,应该是安装的anaconda干扰。将anaconda从环境变量中去除,使用系统安装的qt5,编译通过。

#############################################

第七章 视觉里程计1

在3d2d转换时,出现了bug,偿试解决。

####################################################

编译文件pose_estimation_3d2d.cpp得到错误:

`fmt::v8::detail::error_handler::on_error(char const*)' follow collect2: error: ld returned 1 exit status

####################################################

安装fmt*

sudo apt install libfmt*

然后在CMakeLists.txt中加入如下内容:

find_package( FMT REQUIRED )

target_link_libraries( 可执行文件的名称 fmt::fmt)

####################################################

posted @ 2022-02-13 15:29  angbors  阅读(2081)  评论(1编辑  收藏  举报