本文主要是介绍在ubuntu20.04下编译并运行Point-LIO、FAST_LIO2、Faster-LIO、DLO、LeGO-LOAM、LIO-SAM(即部分问题解决),希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
源码下载:
https://github.com/engcang/SLAM-application
在运行算法建图的步骤:
1、将源码下载到ros的工作环境中;
2、根据系统配置修改源码:
比如:在ubuntu20.04中运行LeGO-LOAM和LIO-SAM需要将源码CMakeList.txt中修改为c++14;
3、只有发布和接收的话题相同才会出现点云。
一、Point-LIO
cd ~/your_workspace/src
git clone https://github.com/Livox-SDK/livox_ros_driver.git
cd ..
catkin build -DCMAKE_BUILD_TYPE=Release
cd ~/your_workspace/src
git clone --recursive https://github.com/hku-mars/Point-LIO.git
cd ..
catkin build -DCMAKE_BUILD_TYPE=Release
然后打开~/projects/lidarslam_ws/src/Point-LIO/config/avia.yaml
将lid_topic和imu_topic修改为自己雷达的话题
雷达话题通过rosbag info xxx.bag 查看
二、FAST_LIO2
cd ~/your_workspace/src
git clone https://github.com/Livox-SDK/livox_ros_driver.git
cd ..
catkin build -DCMAKE_BUILD_TYPE=Releasecd ~/your_workspace/src
git clone --recursive https://github.com/hku-mars/FAST_LIO.git
cd ..
catkin build -DCMAKE_BUILD_TYPE=Release
在~/projects/fastlio2_ws/src/FAST_LIO/config/avia.yaml中修改话题
三、Faster-LIO
$ cd ~/your_workspace/src
$ git clone https://github.com/gaoxiang12/faster-lio.git
$ cd faster-lio/thirdparty
$ tar -xvf tbb2018_20170726oss_lin.tgz
libmetis
$ cd ~/your_workspace
$ catkin build -DCUSTOM_TBB_DIR=$(pwd)/src/faster-lio/thirdparty/tbb2018_20170726oss -DCMAKE_BUILD_TYPE=Release
在/home/zhong/projects/lidarslam_ws/src/faster-lio/config/avia.yaml中修改话题
在~/projects/lidarslam_ws/src/faster-lio/config/avia.yaml中修改话题
四、DLO
$ sudo apt install libomp-dev libpcl-dev libeigen3-dev
$ cd ~/your_workspace/src
$ git clone https://github.com/vectr-ucla/direct_lidar_odometry.git
$ cd ..
$ catkin build -DCMAKE_BUILD_TYPE=Release
在~/projects/lidarslam_ws/src/direct_lidar_odometry/ dlo.launch中修改话题
安装LeGO-LOAM与LIO-SAM:
安装gtsam:
wget -O ~/Downloads/gtsam.zip https://github.com/borglab/gtsam/archive/4.0.0-alpha2.zip
cd ~/Downloads/ && unzip gtsam.zip -d ~/Downloads/
cd ~/Downloads/gtsam-4.0.0-alpha2/
mkdir build && cd build
cmake ..
sudo make install
如果后续报错gtsam,注意版本问题
这里需要注意,ubuntu20.04的需要选择GTSAM >= 4.0.3 的版本,否则会报“The “debug” argument must be followed by a library.”之类的错误。目前网上的解决方法都是说注释掉报错的部分,但这种操作本身风险就很大,在之后的cmake 和 install 时又会出现其他错误。因此,只要选择这时间之后的版本基本上都没问题。
五、LeGO-LOAM
cd ~/your_workspace/src
git clone https://github.com/RobustFieldAutonomyLab/LeGO-LOAM.git
cd ..
catkin build -DCMAKE_BUILD_TYPE=Release
六、LIO-SAM
$ cd ~/your_workspace/src
$ git clone https://github.com/TixiaoShan/LIO-SAM.git
$ cd ..
$ catkin build -DCMAKE_BUILD_TYPE=Release
如果系统为ubuntu20.04则需要进行以下修改(LeGO-LOAM与LIO-SAM相似):
1、安装依赖项:
Ubuntu20.04下的编译与运行LIO-SAM【问题解决】_lio-sam 20.04_学无止境的小龟的博客-CSDN博客
(1)Boost >= 1.65
sudo apt-get install libboost-all-dev
(2) CMake >= 3.0
sudo apt-get install cmake
(3)gcc大于4.7.3就行
查看版本
gcc –version
(4)安装MKL
sudo bash
cd /tmp
wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS-2019.PUB
apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS-2019.PUB
rm GPG-PUB-KEY-INTEL-SW-PRODUCTS-2019.PUB
exit
之后关闭root终端,重开一个终端
sudo wget https://apt.repos.intel.com/setup/intelproducts.list -O /etc/apt/sources.list.d/intelproducts.list
sudo sh -c 'echo deb https://apt.repos.intel.com/mkl all main > /etc/apt/sources.list.d/intel-mkl.list'
(5)找到utility.h中的:#include<opencv/cv.h>,修改为#include <opencv2/imgproc.hpp>
(6)C++14环境
主要是让LeGO-LOAM支持C++14,所以只需要修改下载下来的源码中CMakeList.txt:
set(CMAKE_CXX_FLAGS "-std=c++14")
(7)在CMakeLists中加入:
find_package(Boost REQUIRED COMPONENTS timer thread serialization chrono)
(8)如果在编译过程中报错找不到livox_ros_driver文件的问题
在文件终端source livox_ros_driver的bash文件,如:
source ~/xxx/livox_ros_driver/dever/setup.bash
(9)如果报错:"/usr/local/lib/libmetis.so"
gedit /usr/local/lib/cmake/GTSAM/GTSAMConfig.cmake
若无法进行修改则:
cd /usr/local/lib/cmake/GTSAM/
sudo chmod a+w GTSAMConfig.cmake
gedit GTSAMConfig.cmake
将/usr/local/lib/cmake/GTSAM/GTSAMConfig.cmake:20行的include改成find_package,GTSAMConfig.cmake里面的代码如下:
# - Config file for GTSAM
# It defines the following variables
# GTSAM_INCLUDE_DIR - include directories for GTSAM# Compute paths
get_filename_component(OUR_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
if(EXISTS "${OUR_CMAKE_DIR}/CMakeCache.txt")# In build treeset(GTSAM_INCLUDE_DIR /home/robot/gtsam CACHE PATH "GTSAM include directory")
else()# Find installed libraryset(GTSAM_INCLUDE_DIR "${OUR_CMAKE_DIR}/../../../include" CACHE PATH "GTSAM include directory")
endif()# Find dependencies, required by cmake exported targets:
include(CMakeFindDependencyMacro)
find_dependency(Boost 1.43 COMPONENTS serialization;system;filesystem;thread;program_options;date_time;timer;chrono;regex)# Load exports
find_package(${OUR_CMAKE_DIR}/GTSAM-exports.cmake)# Load project-specific flags, if present
if(EXISTS "${OUR_CMAKE_DIR}/gtsam_extra.cmake")include("${OUR_CMAKE_DIR}/gtsam_extra.cmake")
endif()message(STATUS "GTSAM include directory: ${GTSAM_INCLUDE_DIR}")
文章参照:
Ubuntu20.04下的编译与运行LIO-SAM【问题解决】_lio-sam 20.04_学无止境的小龟的博客-CSDN博客
lego-loam运行常见错误_等下完这场yu的博客-CSDN博客
这篇关于在ubuntu20.04下编译并运行Point-LIO、FAST_LIO2、Faster-LIO、DLO、LeGO-LOAM、LIO-SAM(即部分问题解决)的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!