四足机器人 | GEM(elevation map) + Fast_Lio(odometry) 环境部署记录

由于项目和科研需要,经常需要在不同的平台上(例如我的台式机和项目pc)部署 GEM(elevation map) + Fast_lio(odomtry) 的环境,因此记录下安装过程和过程中每次都会出现的和解决方案。
系统:
Ubuntu 18.04 CUDA10.2

1. GEM && GEM Dependencies install

GEM是ZJU Robotics Lab开源的建elevation map程序

@ARTICLE{9293017,  
author={Y. {Pan} and X. {Xu} and X. {Ding} and S. {Huang} and Y. {Wang} and R. {Xiong}},  
journal={IEEE Transactions on Instrumentation and Measurement},   
title={GEM: Online Globally Consistent Dense Elevation Mapping for Unstructured Terrain},   
year={2021},  
volume={70},  
number={},  
pages={1-13},  
doi={10.1109/TIM.2020.3044338}}

0) costmap 、octomap INSTALL

sudo apt install ros-melodic-costmap-2d

sudo apt-get install ros-melodic-octomap-msgs
sudo apt-get install ros-melodic-octomap-ros

1)Grid Map INSTALL

Addr: https://github.com/anybotics/grid_map
INSTALL

cd catkin_ws/src
git clone https://github.com/anybotics/grid_map.git
cd ../
catkin_make

可能会遇到问题:

In file included from /home/ysc/hedian_lib/grid_map_ws/src/grid_map-master/grid_map_filters/src/ThresholdFilter.cpp:9:0:
/home/ysc/hedian_lib/grid_map_ws/src/grid_map-master/grid_map_filters/include/grid_map_filters/ThresholdFilter.hpp:14:10: fatal error: filters/filter_base.hpp: 没有那个文件或目录
 #include <filters/filter_base.hpp>
          ^~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
grid_map-master/grid_map_filters/CMakeFiles/grid_map_filters.dir/build.make:62: recipe for target 'grid_map-master/grid_map_filters/CMakeFiles/grid_map_filters.dir/src/ThresholdFilter.cpp.o' failed
make[2]: *** [grid_map-master/grid_map_filters/CMakeFiles/grid_map_filters.dir/src/ThresholdFilter.cpp.o] Error 1
CMakeFiles/Makefile2:4940: recipe for target 'grid_map-master/grid_map_filters/CMakeFiles/grid_map_filters.dir/all' failed
make[1]: *** [grid_map-master/grid_map_filters/CMakeFiles/grid_map_filters.dir/all] Error 2
make[1]: *** 正在等待未完成的任务....

解决:
将grid_map中的所有的filter_base.hpp换成filter_base.h。如图
在这里插入图片描述

2)Kindr

Addr : https://github.com/anybotics/kindr

git clone https://github.com/ANYbotics/kindr.git
cd kindr/
mkdir build
cd build
cmake .. -DUSE_CMAKE=true
sudo make install

3) PCL

ROS已装背景下安装PCL和VTK
测试可用PCL版本:PCL-1.8

4) Eigen

由于fast lio需要Eigen 3.3.9,因此可以在已有Eigen的基础上再装一个3.3.9版本,使用时切换版本
Eigen 3.3.9版本下载
查看目前Eigen版本

gedit /usr/include/eigen3/Eigen/src/Core/util/Macros.h

安装Eigen 3.3.9

#git clone https://github.com/libeigen/eigen.git
wget https://gitlab.com/libeigen/eigen/-/archive/3.3.9/eigen-3.3.9.zip
unzip eigen-3.3.9.zip

Eigen3多版本切换

4) CUDA

测试过的GEM可用的CUDA版本

CUDA Version 11.0.207
CUDA Version 10.2.89

首先检查cuda版本

 cat /usr/local/cuda/version.txt
 CUDA Version 10.2.89

查看CUDA计算能力(GEM中CUDA配置需要)

cd /usr/local/cuda-11.0/samples/1_Utilities/deviceQuery
2 sudo make
3 sudo ./deviceQuery

查询结果:
在这里插入图片描述
因此,本机CUDA计算能力
arch=compute_86,code=sm_86

5) GEM

cd catkin_workspace/src
git clone https://github.com/ZJU-Robotics-Lab/GEM.git
git clone https://github.com/ZJU-Robotics-Lab/slam_msg.git
git clone https://github.com/ANYbotics/kindr_ros.git
cd ../
catkin_make
问题1:
[  1%] Built target actionlib_generate_messages_eus
In file included from /usr/include/eigen3/Eigen/Core:42:0,
                 from /home/ysc/gem_test_0422/src/elevation_mapping_periodical/elevation_mapping/cuda/gpu_process.cu:15:
/usr/local/cuda-10.2/include/math_functions.hpp:54:2: warning: #warning "crt/math_functions.hpp is an internal header file and must not be used directly.  Please use cuda_runtime_api.h or cuda_runtime.h instead." [-Wcpp]
 #warning "crt/math_functions.hpp is an internal header file and must not be used directly.  Please use cuda_runtime_api.h or cuda_runtime.h instead."
  ^~~~~~~
In file included from /usr/local/cuda-10.2/include/cuda_runtime.h:115:0,
                 from <command-line>:0:
/usr/local/cuda-10.2/include/crt/common_functions.h:74:24: error: token ""__CUDACC_VER__ is no longer supported.  Use __CUDACC_VER_MAJOR__, __CUDACC_VER_MINOR__, and __CUDACC_VER_BUILD__ instead."" is not valid in preprocessor expressions
 #define __CUDACC_VER__ "__CUDACC_VER__ is no longer supported.  Use __CUDACC_VER_MAJOR__, __CUDACC_VER_MINOR__, and __CUDACC_VER_BUILD__ instead."
                        ^
/usr/local/cuda-10.2/include/crt/common_functions.h:74:24: note: in definition of macro ‘__CUDACC_VER__’
 #define __CUDACC_VER__ "__CUDACC_VER__ is no longer supported.  Use __CUDACC_VER_MAJOR__, __CUDACC_VER_MINOR__, and __CUDACC_VER_BUILD__ instead."
                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/cuda-10.2/include/crt/common_functions.h:74:24: error: token ""__CUDACC_VER__ is no longer supported.  Use __CUDACC_VER_MAJOR__, __CUDACC_VER_MINOR__, and __CUDACC_VER_BUILD__ instead."" is not valid in preprocessor expressions
 #define __CUDACC_VER__ "__CUDACC_VER__ is no longer supported.  Use __CUDACC_VER_MAJOR__, __CUDACC_VER_MINOR__, and __CUDACC_VER_BUILD__ instead."
                        ^
/usr/local/cuda-10.2/include/crt/common_functions.h:74:24: note: in definition of macro ‘__CUDACC_VER__’
 #define __CUDACC_VER__ "__CUDACC_VER__ is no longer supported.  Use __CUDACC_VER_MAJOR__, __CUDACC_VER_MINOR__, and __CUDACC_VER_BUILD__ instead."
                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[  1%] Built target tf_generate_messages_lisp
/

问题1解决:
 cd /usr/local/cuda-10.2/include/crt/common_functions.h 
 comment out line 74
 #define __CUDACC_VER__ "__CUDACC_VER__ is no longer supported.  Use __CUDACC_VER_MAJOR__, __CUDACC_VER_MINOR__, and __CUDACC_VER_BUILD__ instead.
问题2

在这里插入图片描述

问题2解决

这是CUDA Cmakelist中NVCC编译设置没设置对
CUDA用的是NVCC编译器,编译过程中不会在catkin_make窗口报错,但是会在GEM运行CUDA过程中报错

应该根据CUDA deviceQuery 查询得到的结果修改arch=compute_80,code=sm_80

src/elevation_mapping_periodical/elevation_mapping/cuda/CMakeLists.txt
project(gpu) # required cmake version 
cmake_minimum_required(VERSION 2.8) # packages 
find_package(CUDA REQUIRED) 
find_package(Eigen3 REQUIRED)
find_package(kindr)

# set(CUDA_NVCC_FLAGS -O3;-G;-g)  
SET(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS};-O3;-std=c++14 -gencode arch=compute_80,code=sm_80)
# SET(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS};-O3;-std=c++14 -gencode arch=compute_75,code=sm_75)
#include_directories(${EIGEN3_INCLUDE_DIRS})
file(GLOB_RECURSE CURRENT_HEADERS *.h *.hpp *.cuh) 
file(GLOB CURRENT_SOURCES *.cpp *.cu) 
source_group("Include" FILES ${CURRENT_HEADERS}) 
source_group("Source" FILES ${CURRENT_SOURCES}) 
cuda_add_library(gpu SHARED ${CURRENT_HEADERS} ${CURRENT_SOURCES})
问题3

这个是在一台性能较差的NX上跑的GEM,一跑起来就挂掉了,因为处理器性能太差了,处理不过来这么多点

在这里插入图片描述

问题4解决

把src/elevation_mapping_periodical/elevation_mapping/src/ElevationMapping.cpp中对image的处理部分注释掉(image对点云着色),会省掉很多算力
如图
注释掉就能跑起来了
在这里插入图片描述

问题5
code ~/src/elevation_mapping_periodical/elevation_mapping_demos/config/robots/fxz_robot.yaml
camera_params_yaml: "/home/nickle/yq_intrinsic.yaml" 要改路径,这里源码里设置的是绝对路径

2. FAST-Lio && FAST-Lio Dependencies install

1) Livox-SDK

Livox-SDK安装说明

git clone https://github.com/Livox-SDK/Livox-SDK.git
cd Livox-SDK
cd build && cmake ..
make
sudo make install

2)livox_ros_driver

https://github.com/Livox-SDK/livox_ros_driver

git clone https://github.com/Livox-SDK/livox_ros_driver.git ws_livox/src
cd ws_livox
catkin_make

3)FAST -LIO

cd ~/$A_ROS_DIR$/src
git clone https://github.com/hku-mars/FAST_LIO.git
cd FAST_LIO
git submodule update --init
cd ../..
catkin_make
source devel/setup.bash
问题1
In file included from /home/ysc/GEM_ws/src/fast-lio/FAST_LIO_ws/src/FAST_LIO/src/IMU_Processing.hpp:11:0,
                 from /home/ysc/GEM_ws/src/fast-lio/FAST_LIO_ws/src/FAST_LIO/src/laserMapping.cpp:46:
/home/ysc/GEM_ws/src/fast-lio/FAST_LIO_ws/src/FAST_LIO/include/common_lib.h:8:10: fatal error: fast_lio/Pose6D.h: 没有那个文件或目录
 #include <fast_lio/Pose6D.h>
          ^~~~~~~~~~~~~~~~~~~
compilation terminated.
fast-lio/FAST_LIO_ws/src/FAST_LIO/CMakeFiles/fastlio_mapping.dir/build.make:62: recipe for target 'fast-lio/FAST_LIO_ws/src/FAST_LIO/CMakeFiles/fastlio_mapping.dir/src/laserMapping.cpp.o' failed
make[2]: *** [fast-lio/FAST_LIO_ws/src/FAST_LIO/CMakeFiles/fastlio_mapping.dir/src/laserMapping.cpp.o] Error 1
make[2]: *** 正在等待未完成的任务....
In file included from /home/ysc/GEM_ws/src/fast-lio/FAST_LIO_ws/src/FAST_LIO/src/preprocess.cpp:1:0:
/home/ysc/GEM_ws/src/fast-lio/FAST_LIO_ws/src/FAST_LIO/src/preprocess.h:4:10: fatal error: livox_ros_driver/CustomMsg.h: 没有那个文件或目录
 #include <livox_ros_driver/CustomMsg.h>
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
fast-lio/FAST_LIO_ws/src/FAST_LIO/CMakeFiles/fastlio_mapping.dir/build.make:110: recipe for target 'fast-lio/FAST_LIO_ws/src/FAST_LIO/CMakeFiles/fastlio_mapping.dir/src/preprocess.cpp.o' failed
make[2]: *** [fast-lio/FAST_LIO_ws/src/FAST_LIO/CMakeFiles/fastlio_mapping.dir/src/preprocess.cpp.o] Error 1
CMakeFiles/Makefile2:6324: recipe for target 'fast-lio/FAST_LIO_ws/src/FAST_LIO/CMakeFiles/fastlio_mapping.dir/all' failed
make[1]: *** [fast-lio/FAST_LIO_ws/src/FAST_LIO/CMakeFiles/fastlio_mapping.dir/all] Error 2
Makefile:140: recipe for target 'all' failed
make: *** [all] Error 2
Invoking "make -j6 -l6" failed

解决:
手动将livox_ros_driver生成的msg复制到ws/devel/include下

问题2

FASTlio适配的eigen是3.3.9
如果不是的话会产生大量的Eigen有关的报错,这时候可以按照上面的说明切换或者安装Eigen3-3-9

  • 4
    点赞
  • 25
    收藏
    觉得还不错? 一键收藏
  • 4
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值