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

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

1. GEM && GEM Dependencies install

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

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 
          ^~~~~~~~~~~~~~~~~~~~~~~~~
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。如图
四足机器人 | GEM(elevation map) + Fast_lio(odometry) 环境部署记录_第1张图片

2)Kindr

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

git clone https://github.com/ANYbotics/kindr.git
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版本下载

#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

查询结果:
四足机器人 | GEM(elevation map) + Fast_lio(odometry) 环境部署记录_第2张图片
因此,本机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

四足机器人 | GEM(elevation map) + Fast_lio(odometry) 环境部署记录_第3张图片

问题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对点云着色),会省掉很多算力
如图
注释掉就能跑起来了
四足机器人 | GEM(elevation map) + Fast_lio(odometry) 环境部署记录_第4张图片

问题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安装说明

https://github.com/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 
          ^~~~~~~~~~~~~~~~~~~
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 
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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

你可能感兴趣的:(github)