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)

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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM