Home

Awesome

lidarslam_ros2

humble
ros2 slam package of the frontend using OpenMP-boosted gicp/ndt scan matching and the backend using graph-based slam.

mobile robot mapping
<img src="./lidarslam/images/path_tukuba.png" width="640px">

Green: path with loopclosure
(the 25x25 grids in size of 10m × 10m)

<img src="./lidarslam/images/map_tukuba.png" width="640px">

Red and yellow: map

summary

lidarslam_ros2 is a ROS2 package of the frontend using OpenMP-boosted gicp/ndt scan matching and the backend using graph-based slam.
I found that even a four-core laptop with 16GB of memory could work in outdoor environments for several kilometers with only 16 line LiDAR.
(WIP)

requirement to build

You need ndt_omp_ros2 for scan-matcher

clone (If you forget to add the --recursive option when you do a git clone, run git submodule update --init --recursive in the lidarslam_ros2 directory)

cd ~/ros2_ws/src
git clone --recursive https://github.com/rsasaki0109/lidarslam_ros2
cd ..
rosdep install --from-paths src --ignore-src -r -y

build

colcon build --symlink-install --cmake-args -DCMAKE_BUILD_TYPE=Release

io

frontend(scan-matcher)

backend(graph-based-slam)

how to save the map

pose_graph.g2o and map.pcd are saved in loop closing or using the following service call.

ros2 service call /map_save std_srvs/Empty

params

NameTypeDefault valueDescription
registration_methodstring"NDT""NDT" or "GICP"
ndt_resolutiondouble5.0resolution size of voxel[m]
ndt_num_threadsint0threads using ndt(if 0 is set, maximum alloawble threads are used.)(The higher the number, the better, but reduce it if the CPU processing is too large to estimate its own position.)
gicp_corr_dist_thresholddouble5.0the distance threshold between the two corresponding points of the source and target[m]
trans_for_mapupdatedouble1.5moving distance of map update[m]
vg_size_for_inputdouble0.2down sample size of input cloud[m]
vg_size_for_mapdouble0.05down sample size of map cloud[m]
use_min_max_filterboolfalsewhether or not to use minmax filter
scan_max_rangedouble100.0max range of input cloud[m]
scan_min_rangedouble1.0min range of input cloud[m]
scan_perioddouble0.1scan period of input cloud[sec](If you want to compound imu, you need to change this parameter.)
map_publish_perioddouble15.0period of map publish[sec]
num_targeted_cloudint10number of targeted cloud in registration(The higher this number, the less distortion.)
debug_flagboolfalseWhether or not to display the registration information
set_initial_poseboolfalsewhether or not to set the default pose value in the param file
initial_pose_xdouble0.0x-coordinate of the initial pose value[m]
initial_pose_ydouble0.0y-coordinate of the initial pose value[m]
initial_pose_zdouble0.0z-coordinate of the initial pose value[m]
initial_pose_qxdouble0.0Quaternion x of the initial pose value
initial_pose_qydouble0.0Quaternion y of the initial pose value
initial_pose_qzdouble0.0Quaternion z of the initial pose value
initial_pose_qwdouble1.0Quaternion w of the initial pose value
publish_tfbooltrueWhether or not to publish tf from global frame to robot frame
use_odomboolfalsewhether odom is used or not for initial attitude in point cloud registration
use_imuboolfalsewhether 9-axis imu(Angular velocity, acceleration and orientation must be included.) is used or not for point cloud distortion correction.(Note that you must also set the scan_period.)
debug_flagboolfalseWhether or not to display the registration information
NameTypeDefault valueDescription
registration_methodstring"NDT""NDT" or "GICP"
ndt_resolutiondouble5.0resolution size of voxel[m]
ndt_num_threadsint0threads using ndt(if 0 is set, maximum alloawble threads are used.)
voxel_leaf_sizedouble0.2down sample size of input cloud[m]
loop_detection_periodint1000period of searching loop detection[ms]
threshold_loop_closure_scoredouble1.0fitness score of ndt for loop clousure
distance_loop_closuredouble20.0distance far from revisit candidates for loop clousure[m]
range_of_searching_loop_closuredouble20.0search radius for candidate points from the present for loop closure[m]
search_submap_numint2the number of submap points before and after the revisit point used for registration
num_adjacent_pose_cnstraintsint5the number of constraints between successive nodes in a pose graph over time
use_save_map_in_loopbooltrueWhether to save the map when loop close(If the map saving process in loop close is too heavy and the self-position estimation fails, set this to false.)

demo

trial environment

demo data(ROS1) is hdl_400.bag in hdl_graph_slam
The Velodyne VLP-32 was used in this data.
To use rosbag in ROS1, use rosbags

ros2 launch lidarslam lidarslam.launch.py
ros2 bag play hdl_400/
<img src="./lidarslam/images/path.png" width="640px">

Green: path with loopclosure, Yellow: path without loopclosure

<img src="./lidarslam/images/map.png" width="640px">

The larger environment

(This data is not available at the moment...) demo data(ROS1) by Autoware Foundation
https://data.tier4.jp/rosbag_details/?id=212
The Velodyne VLP-16 was used in this data.

ros2 launch lidarslam lidarslam_tukuba.launch.py
ros2 bag play tc_2017-10-15-15-34-02_free_download/ 
<img src="./lidarslam/images/path_tukuba.png" width="640px">

Green: path

<img src="./lidarslam/images/map_tukuba.png" width="640px">

Red and yellow: map

Used Libraries

Related packages