【SVO2.0 安装编译】Ubuntu 20.04 + Noetic
ways one
鏈接: https://pan.baidu.com/s/1ZAkeD64wjFsDHfpCm1CB1w
提取碼: kxx2 (downloads and use idirectly)
ways two:
[SVO2-OPEN: https://github.com/uzh-rpg/rpg_svo_pro_open](https://github.com/DEARsunshine/rpg_svo_pro_open)
git掛梯子
如果各位終端無法掛梯子,直接下載我在碼云上整理好的代碼:
第一種編譯方式:
git clone https://gitee.com/ma_yu_armor/svo2_build.git
第二種編譯方式:
git clone -b method2 https://gitee.com/ma_yu_armor/svo2_build.git
Install
The code has been tested onUbuntu 20.04 with ROS MelodicInstall dependencies
Install catkin tools and vcstools if you haven't done so before. Depending on your operating system, run
For Ubuntu 20.04 + Noetic
sudo apt-get install python3-catkin-tools python3-vcstool python3-osrf-pycommon
Install system dependencies and dependencies for Ceres Solver
system dep.
sudo apt-get install libglew-dev libopencv-dev libyaml-cpp-dev
Ceres dep.
sudo apt-get install libblas-dev liblapack-dev libsuitesparse-dev
Clone and compile
Create a workspace and clone the code (ROS-DISTRO=melodic/noetic):
意思是將下面出現的替換成你ROS的名稱(18為"melodic",20為"noetic")
創建工作空間
mkdir svo_pro_ws && cd svo_pro_ws
catkin相關配置
see below for the reason for specifying the eigen path
catkin config --init --mkdirs --extend /opt/ros/<ROS-DISTRO> --cmake-args -DCMAKE_BUILD_TYPE=Release -DEIGEN3_INCLUDE_DIR=/usr/include/eigen3
下載原碼
cd src
?
git clone git@github.com:uzh-rpg/rpg_svo_pro_open.git
vcs-import < ./rpg_svo_pro_open/dependencies.yaml
?
#這樣可以不編譯,如果要打開全局重定位功能需要刪除,后面有交代,先這么寫
touch minkindr/minkindr_python/CATKIN_IGNORE
注意:git clone git@github.com:uzh-rpg/rpg_svo_pro_open.git…會失敗,原因是使用git@…方式克隆需要私鑰,人生苦短,不用配置,用https://github.com/uzh-rpg/rpg_svo_pro_open.git 代替。同理后面的…vcs-import < ./rpg_svo_pro_open/dependencies.yaml意思是clone dependencies.yaml里面羅列的地址的一系列庫,但是打開會發現也是用git@寫的,將地址按如下方式替換:
repositories:catkin_simple:type: git#url: git@github.com:catkin/catkin_simple.git~~url: https://github.com/catkin/catkin_simple.gitversion: mastercmake_external_project_catkin:type: git#url: git@github.com:zurich-eye/cmake_external_project_catkin.git~~url: https://github.com/zurich-eye/cmake_external_project_catkin.gitversion: master
......
將這個文件復制出來(置于src/中),刪除其他文件,重新執行命令。終端需要掛梯子!!!
如果實在不行,可以到我的gitee上下載(見開頭),里面包含了所有庫(包括后面要用的gtsam)
git clone https://github.com/uzh-rpg/rpg_svo_pro_open.git
vcs-import < dependencies.yaml
繼續安裝
vocabulary for place recognition 這句不需要代理,新開終端,下完關掉
cd rpg_svo_pro_open/svo_online_loopclosing/vocabularies && ./download_voc.sh
cd ../../..
在開始編譯之前,可以發現src/dbow2_catkin/CmakeList.txt中這樣寫道(同樣的需要修改git地址):
ExternalProject_Add(dbow2_src#GIT_REPOSITORY git@github.com:dorian3d/DBoW2.gitGIT_REPOSITORY https://github.com/dorian3d/DBoW2.gitCMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${CATKIN_DEVEL_PREFIX}BUILD_COMMAND CXXFLAGS=-i${CATKIN_DEVEL_PREFIX}/include makeINSTALL_COMMAND make install
)
至此安裝工作完成
編譯
這里有兩種編譯方式,建議按照順序都嘗試一下,這樣一旦出問題,更好解決。
- 直接編譯 Build without the global map (front-end + sliding window back-end + loop closure/pose graph)
catkin build -j8
缺少庫:
cd src/
git clone https://github.com/ethz-asl/catkin_boost_python_buildtool.git
git clone https://github.com/ethz-asl/numpy_eigen.git
該開源項目是基于Opencv3寫的,本人電腦里裝了4(ros自帶3),故在src/rpg_svo_open/svo_ros/CmakeList.txt中,修改如下內容:
find_package(catkin_simple REQUIRED)
find_package(rostest REQUIRED)
catkin_simple()
#find_package(OpenCV REQUIRED) #會默認找到Opencv4
find_package(OpenCV 3 REQUIRED) #指定OpenCv3
2.第二種編譯方式Build with the global map using iSAM2 (all functionalities)
首先把上面提到的阻止svo_global_map編譯的CATKIN_IGNORE刪除
rm rpg_svo_pro_open/svo_global_map/CATKIN_IGNORE
并且在svo_cmake/cmake/Modules/SvoSetup.cmake中:
SET(USE_GLOBAL_MAP TRUE)
克隆GTSAM (與其他pkg在同一目錄內)
git clone --branch 4.0.3 https://github.com/borglab/gtsam.git
修改cmakelist
1. gtsam/CMakelists.txt: use system Eigen
-option(GTSAM_USE_SYSTEM_EIGEN "Find and use system-installed Eigen. If 'off', use the one bundled with GTSAM" OFF)
+option(GTSAM_USE_SYSTEM_EIGEN "Find and use system-installed Eigen. If 'off', use the one bundled with GTSAM" ON)
2. gtsam/cmake/GtsamBuildTypes: disable avx instruction set
below the line `list_append_cache(GTSAM_COMPILE_OPTIONS_PUBLIC "-march=native")
list_append_cache(GTSAM_COMPILE_OPTIONS_PUBLIC "-mno-avx")
這種boost報錯的問題一般大家是不會有的,因為我之前裝了很多boost版本才會導致這樣的問題。將boost全部刪除干凈,使用ros-melodic中自帶的boost(version 1.65)即可。但是某些小伙伴可能會出現找不到boost的情況。首先檢查是否安裝。
sudo apt-get install libboost-all-dev
如果問題還不能夠解決,那就是gtsam在找boost的時候路徑出了問題。它默認到/usr/local/中去找,然而ros中的boost位于/usr中。與gtsam的CmakeList中指定boost路徑如下(大約在165行):
Store these in variables so they are automatically replicated in GTSAMConfig.cmake and such.
set(BOOST_FIND_MINIMUM_VERSION 1.43)
set(BOOST_FIND_MINIMUM_COMPONENTS serialization system filesystem thread program_options date_time timer chrono regex)
set(BOOST_ROOT "/usr/include") #加上這行
set(BOOST_LIBRARYDIR "/usr/include/lib") #和這行
#add_definitions(-DBOOST_ERROR_CODE_HEADER_ONLY)#myk
終于編譯通過!
總結
以上是生活随笔為你收集整理的【SVO2.0 安装编译】Ubuntu 20.04 + Noetic的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 好听的药房名字大全
- 下一篇: 一首儿童开头啊哈哈哈哈是什么歌啊