git挂梯子
https://blog.csdn.net/qq_33349365/article/details/101514412
如果各位终端无法挂梯子,直接下载我在码云上整理好的代码:
第一种编译方式:
git clone https://gitee.com/ma_yu_armor/svo2_build.git
第二种编译方式:
git clone -b method2 https://gitee.com/ma_yu_armor/svo2_build.git
The code has been tested on
Ubuntu 18.04 with ROS Melodic
Ubuntu 20.04 with ROS Melodic
Install catkin tools and vcstools if you haven't done so before. Depending on your operating system, run
# For Ubuntu 18.04 + Melodic
sudo apt-get install python-catkin-tools python-vcstool
or
# 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
Create a workspace and clone the code (ROS-DISTRO=melodic/noetic):
意思是将下面出现的
创建工作空间
mkdir svo_ws && cd svo_ws
catkin相关配置
# see below for the reason for specifying the eigen path
catkin config --init --mkdirs --extend /opt/ros/ --cmake-args -DCMAKE_BUILD_TYPE=Release -DEIGEN3_INCLUDE_DIR=/usr/include/eigen3
下载原码
cd src
git clone [email protected]:uzh-rpg/rpg_svo_pro_open.git
vcs-import < ./rpg_svo_pro_open/dependencies.yaml
#这样可以不编译,如果要打开全局重定位功能需要删除,后面有交代,先这么写
touch minkindr/minkindr_python/CATKIN_IGNORE
注意:git clone [email protected]: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: [email protected]:catkin/catkin_simple.git~~
url: https://github.com/catkin/catkin_simple.git
version: master
cmake_external_project_catkin:
type: git
#url: [email protected]:zurich-eye/cmake_external_project_catkin.git~~
url: https://github.com/zurich-eye/cmake_external_project_catkin.git
version: 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 [email protected]:dorian3d/DBoW2.git
GIT_REPOSITORY https://github.com/dorian3d/DBoW2.git
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${CATKIN_DEVEL_PREFIX}
BUILD_COMMAND CXXFLAGS=-i${CATKIN_DEVEL_PREFIX}/include make
INSTALL_COMMAND make install
)
至此安装工作完成
这里有两种编译方式,建议按照顺序都尝试一下,这样一旦出问题,更好解决。
catkin build -j6
缺少两个库
缺少库:
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
该开源项目是基于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
至此编译通过:
小编这里共38个包。
首先把上面提到的阻止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")
注意两处更改是不同的文件(见注释)。
gtsam 与boost
这种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
终于编译通过!
如果觉得文章内容有帮助的话,点赞关注评论转发吧。 (请喝奶茶也是可以的)