激光SLAM:Faster-Lio 算法编译与测试

激光SLAM:Faster-Lio 算法编译与测试

前言

Faster-LIO是基于FastLIO2开发的。FastLIO2是开源LIO中比较优秀的一个,前端用了增量的kdtree(ikd-tree),后端用了迭代ESKF(IEKF),流程短,计算快。Faster-LIO则把ikd-tree替换成了iVox,顺带优化了一些代码逻辑,实现了更快的LIO。在典型的32线激光雷达中可以取得100-200Hz左右的计算频率,在固态雷达中甚至可以达到1000-2000Hz,能够达到FastLIO2的1.5-2倍左右的速度。当然具体数值和计算平台相关。

FasterLIO使用了一种基于稀疏体素的近邻结构iVox(incremental voxels)。我们会发现这种结构用来做LIO更加合适,可以有效的降低点云配准时的耗时,也不会影响LIO的精度表现。

iVox也可以被集成到其他LO或LIO里,但是大部分方案里,最近邻并不是主要的计算瓶颈,gtsam/ceres什么的耗时相比最近邻那可太多了。把iVox集成到Lego-LOAM里,、主要只是省了增量地图构建那部分时间,优化方面没什么变化(点少)。所以iVox与FastLIO倒是相性更好一些。

编译

部署系统:ubuntu20.04

ROS版本: noetic

github 地址:https://github.com/gaoxiang12/faster-lio

下载源码

c 复制代码
git clone https://github.com/gaoxiang12/faster-lio

正克隆到 'faster-lio'...

remote: Enumerating objects: 224, done.

remote: Counting objects: 100% (108/108), done.

remote: Compressing objects: 100% (43/43), done.

remote: Total 224 (delta 76), reused 65 (delta 65), pack-reused 116

接收对象中: 100% (224/224), 38.13 MiB | 1.49 MiB/s, 完成.

处理 delta 中: 100% (97/97), 完成.

将原文件拷入ros工作空间

依赖

  • ROS (melodic or noetic)
  • glog: sudo apt-get install libgoogle-glog-dev
  • eigen: sudo apt-get install libeigen3-dev
  • pcl: sudo apt-get install libpcl-dev
  • yaml-cpp: sudo apt-get install libyaml-cpp-dev

编译

c 复制代码
catkin_make

报错1:

CMake Error at /home/jk-jone/jone_ws/build/livox_ros_driver/livox_ros_driver/cmake/livox_ros_driver-genmsg.cmake:14 (add_custom_target):

add_custom_target cannot create target "livox_ros_driver_generate_messages"

because another target with the same name already exists. The existing

target is a custom target created in source directory

"/home/jk-jone/jone_ws/src/faster-lio/thirdparty/livox_ros_driver". See

documentation for policy CMP0002 for more details.

Call Stack (most recent call first):

/opt/ros/noetic/share/genmsg/cmake/genmsg-extras.cmake:307 (include)

livox_ros_driver/livox_ros_driver/CMakeLists.txt:46 (generate_messages)

如果工作空间中之前编译了 livox_ros_driver 的功能包,则需要删掉 faster-lio/thirdparty/livox_ros_driver 这个文件夹

再次编译

CMake Error at faster-lio/CMakeLists.txt:15 (add_subdirectory):

add_subdirectory given source "thirdparty/livox_ros_driver" which is not an

existing directory.

电锯惊魂10

因为把那个文件删了,所以找不到路径

将 faster-lio/CMakeLists.txt 文件的第15行注释掉

c 复制代码
add_subdirectory(thirdparty/livox_ros_driver)
改为
#add_subdirectory(thirdparty/livox_ros_driver)

再次编译

[100%] Linking CXX shared library /home/jk-jone/jone_ws/devel/lib/libfaster_lio.so

[100%] Built target faster_lio

Scanning dependencies of target run_mapping_offline

Scanning dependencies of target run_mapping_online

[100%] Building CXX object faster-lio/app/CMakeFiles/run_mapping_online.dir/run_mapping_online.cc.o

[100%] Building CXX object faster-lio/app/CMakeFiles/run_mapping_offline.dir/run_mapping_offline.cc.o

[100%] Linking CXX executable /home/jk-jone/jone_ws/devel/lib/faster_lio/run_mapping_online

[100%] Built target run_mapping_online

[100%] Linking CXX executable /home/jk-jone/jone_ws/devel/lib/faster_lio/run_mapping_offline

[100%] Built target run_mapping_offline

编译成功

测试

Faster-lio支持离线的测试与在线测试

离线测试

首先下载rosbag数据包到电脑

百度云盘下载地址:

BaiduYun: https://pan.baidu.com/s/1ELOcF1UTKdfiKBAaXnE8sQ?pwd=feky access code: feky

OneDrive下载地址:

OneDrive:https://1drv.ms/u/s!AgNFVSzSYXMahcEZejoUwCaHRcactQ?e=YsOYy2

Call run_mapping_offline with parameters to specify the bag file and the config file like:

通过下面的指令 运行 run_mapping_offline 文件 并且加载对应的rosbag文件 和对应的配置文件

bash 复制代码
./build/devel/lib/faster_lio/run_mapping_offline --bag_file your_avia_bag_file --config_file ./config/avia.yaml

其中 your_avia_bag_file 路径需要更换为下载的数据包路径

同样对于nclt数据包可以运行下面的指令。数据是机械式激光雷达velodyne的数据

bash 复制代码
./build/devel/lib/faster_lio/run_mapping_offline --bag_file your_nclt_bag_file --config_file ./config/velodyne.yaml

your_nclt_bag_file 路径需要更换为下载的数据包路径

运行FasterLIO,然后退出的时候 会在终端打印FPS和time

像下面这样:

shell 复制代码
I0216 17:16:05.286536 26492 run_mapping_offline.cc:89] Faster LIO average FPS: 1884.6
I0216 17:16:05.286549 26492 run_mapping_offline.cc:91] save trajectory to: ./src/fast_lio2/Log/faster_lio/20120615.tum
I0216 17:16:05.286706 26492 utils.h:52] >>> ===== Printing run time =====
I0216 17:16:05.286711 26492 utils.h:54] > [     IVox Add Points ] average time usage: 0.0147311 ms , called times: 6373
I0216 17:16:05.286721 26492 utils.h:54] > [     Incremental Mapping ] average time usage: 0.0271787 ms , called times: 6373
I0216 17:16:05.286731 26492 utils.h:54] > [     ObsModel (IEKF Build Jacobian) ] average time usage: 0.00745852 ms , called times: 25040
I0216 17:16:05.286752 26492 utils.h:54] > [     ObsModel (Lidar Match) ] average time usage: 0.0298004 ms , called times: 25040
I0216 17:16:05.286775 26492 utils.h:54] > [ Downsample PointCloud ] average time usage: 0.0224052 ms , called times: 6373
I0216 17:16:05.286784 26492 utils.h:54] > [ IEKF Solve and Update ] average time usage: 0.342008 ms , called times: 6373
I0216 17:16:05.286792 26492 utils.h:54] > [ Laser Mapping Single Run ] average time usage: 0.530618 ms , called times: 6387
I0216 17:16:05.286800 26492 utils.h:54] > [ Preprocess (Livox) ] average time usage: 0.0267813 ms , called times: 6387
I0216 17:16:05.286808 26492 utils.h:54] > [ Undistort Pcl ] average time usage: 0.0810455 ms , called times: 6375
I0216 17:16:05.286816 26492 utils.h:59] >>> ===== Printing run time end =====

默认点云会以pcd文件的格式保存下来

在线测试

用之前建立的仿真环境下的 mid360雷达的数据进行一个初步在线测试

打开仿真环境

faster-lio 里面没有 mid360 雷达的 配置文件和启动文件 ,有avia的,都是livox的固态雷达,基本雷达,仿照avia的写一个就行

mid360.yaml 如下

c 复制代码
common:
    lid_topic:  "/livox/lidar"
    imu_topic:  "/livox/imu"
    time_sync_en: false         # ONLY turn on when external time synchronization is really not possible
    time_offset_lidar_to_imu: 0.0 # Time offset between lidar and IMU calibrated by other algorithms, e.g. LI-Init (can be found in README).
                                  # This param will take effect no matter what time_sync_en is. So if the time offset is not known exactly, please set as 0.0

preprocess:
    lidar_type: 1                # 1 for Livox serials LiDAR, 2 for Velodyne LiDAR, 3 for ouster LiDAR, 
    scan_line: 4
    blind: 0.5

mapping:
    acc_cov: 0.1
    gyr_cov: 0.1
    b_acc_cov: 0.0001
    b_gyr_cov: 0.0001
    fov_degree:    360
    det_range:     100.0
    extrinsic_est_en:  false      # true: enable the online estimation of IMU-LiDAR extrinsic
    extrinsic_T: [ -0.011, -0.02329, 0.04412 ]
    extrinsic_R: [ 1, 0, 0,
                   0, 1, 0,
                   0, 0, 1]

publish:
    path_en:  false
    scan_publish_en:  true       # false: close all the point cloud output
    dense_publish_en: true       # false: low down the points number in a global-frame point clouds scan.
    scan_bodyframe_pub_en: true  # true: output the point cloud scans in IMU-body-frame

pcd_save:
    pcd_save_en: true
    interval: -1                 # how many LiDAR frames saved in each pcd file; 
                                 # -1 : all frames will be saved in ONE pcd file, may lead to memory crash when having too much frames.

launch文件如下

c 复制代码
<launch>
<!-- Launch file for Livox MID360 LiDAR -->

	<arg name="rviz" default="true" />

	<rosparam command="load" file="$(find fast_lio)/config/mid360.yaml" />

	<param name="feature_extract_enable" type="bool" value="0"/>
	<param name="point_filter_num_" type="int" value="3"/>
	<param name="max_iteration" type="int" value="3" />
	<param name="filter_size_surf" type="double" value="0.5" />
	<param name="filter_size_map" type="double" value="0.5" />
	<param name="cube_side_length" type="double" value="1000" />
	<param name="runtime_pos_log_enable" type="bool" value="1" />
    <node pkg="faster_lio" type="run_mapping_online" name="laserMapping" output="screen" /> 

	<group if="$(arg rviz)">
	<node launch-prefix="nice" pkg="rviz" type="rviz" name="rviz" args="-d $(find faster_lio)/rviz_cfg/loam_livox.rviz" />
	</group>

</launch>

运行该launch文件

c 复制代码
roslaunch faster_lio mapping_mid360.launch

初始位置的情景和点云模型

飞一圈后整个地图模型

相关推荐
huapiaoy5 分钟前
Redis中数据类型的使用(hash和list)
redis·算法·哈希算法
冷白白18 分钟前
【C++】C++对象初探及友元
c语言·开发语言·c++·算法
鹤上听雷27 分钟前
【AGC005D】~K Perm Counting(计数抽象成图)
算法
一叶祇秋39 分钟前
Leetcode - 周赛417
算法·leetcode·职场和发展
武昌库里写JAVA44 分钟前
【Java】Java面试题笔试
c语言·开发语言·数据结构·算法·二维数组
ya888g44 分钟前
GESP C++四级样题卷
java·c++·算法
Funny_AI_LAB1 小时前
MetaAI最新开源Llama3.2亮点及使用指南
算法·计算机视觉·语言模型·llama·facebook
NuyoahC1 小时前
算法笔记(十一)——优先级队列(堆)
c++·笔记·算法·优先级队列
jk_1011 小时前
MATLAB中decomposition函数用法
开发语言·算法·matlab
penguin_bark2 小时前
69. x 的平方根
算法