3D mapping using ROS (Robot Operating System) for localization involves creating a detailed three-dimensional map of an environment while simultaneously determining the robot's position within it. This process, known as SLAM (Simultaneous Localization and Mapping), uses sensors like LiDAR, cameras, or depth sensors to collect environmental data, which ROS processes in real-time to build a map and track the robot's movement. By integrating packages such as Fast-LIO, Cartographer, or OPT-SC-F-LOAM, ROS enables robots to autonomously navigate and adapt to dynamic environments, making it essential for applications in autonomous vehicles, robotics, and industrial automation.
For this project the following hardware was used:
Robotnik Summit XL (Skid type robot).
Velodyne 16.
IMU LPMS-IG1.
Cartographer is a system that provides real-time simultaneous localization and mapping (SLAM) in 2D and 3D across multiple platforms and sensor configurations.
Cartographer is no longer actively maintained. On rare occasions critical pull requests may be merged, but no new development is currently taking place, including issue response. If you are installing Cartographer in ROS 1 / ROS 2 using a binary package that package is a fork of this repository. The ROS fork of Cartographer is only maintained in a limited capacity. No new development takes place on this fork, but pull requests may be merged at the maintainers' discretion.
These are some of the recommended practices/configurations that I gathered and had the must significative impact when solving random or hard to debug issues.
The TF transform can be provided by the URDF, thus the "/tf" topic must be filter out from the rosbag.
Cartographer requires IMU to be in standard ROS frame convention (z-axis pointing up).
Cartographer is VERY dependent on good IMU data (No bias or drift).
The IMU should be fast, at around 100 Hz.
The IMU and Lidar frames TF should be precise.
A general advice, tune for 2D first. 2D is easier to tune perfectly, and then you only change a few things to do 3D.
It is recommended to record the rosbag on the device that is connected to the sensors.
These are some of the easiest mistakes that can happen if you are not careful when configuring your hardware. But they are the easiest one to fix, os it is worthy to check your configuration if you are facing one of the problem shown on the videos below.
If the IMU is using the wrong frame convention, Z is pointing down as shown in the first video.
If the dual return mode is set on the velodyne web interface, it must be also adjusted on the driver.cc file (packet_rate = 754 Packets/Second for Last or Strongest mode 1508 for dual) . Otherwise, the pointcloud will flicker as shown on the second video.
Also, if the rpm are set on the velodyne web interface, it must be also adjusted on the velodyne_pointcloud VLP16_points.launch file (<arg name="rpm" default="600.0" />) . Otherwise, the pointcloud will flicker as shown on the second video.
IMU wrong frame convention.
Velodyne wrong settings.
These are a collection of the parameters that in my opinion are the must important ones:
provide_odom_frame: This should be false if using another package to generate odom (like ekf_localization) => false
odom_frame: Only active when provide_odom_frame is true.
use_odometry: True if odom is generated by other package. => true
TRAJECTORY_BUILDER_3D.num_accumulated_range_data : How many cloud does Cartographer needs to accumulate to complete 1 rotation (Velodyne ROS driver is one cloud per sweep by default). => 1
TRAJECTORY_BUILDER_3D.use_online_correlative_scan_matching: The correlative scan matcher matches each new scan to the existing submap. Defaults off. If off, should tune for more loop closure (inter) constraints and use smaller voxels and filter less.
TRAJECTORY_BUILDER_3D.submaps.high_resolution: Resolution of the submap (in mts).
TRAJECTORY_BUILDER_3D.submaps.low_resolution: Resolution of the submap (in mts).
TRAJECTORY_BUILDER_3D.submaps.high_resolution_max_range: How often to slam (in mts) if the robots moves fast it should be decreased.
POSE_GRAPH.matcher_rotation_weight: This variable determines the penalty for rotating each new submap. I.e. the higher it is, the less the new submap will be rotated to fit. Defaults is 1.6e3. If the IMU data is not stable it is recommended to increase this value (example 1.6e5), otherwise each new submap might be added at a ridiculous angle.
POSE_GRAPH.optimize_every_n_nodes : How often try to close the loop. There is little point in trying more than once per submap.
POSE_GRAPH.constraint_builder.max_constraint_distance: Max distance (mts) to close the loop.
POSE_GRAPH.constraint_builder.fast_correlative_scan_matcher_3d.linear_xy_search_window: Max distance (mts) to search on the X & Y axis when closing the loop, increasing this value can decrease horizontal drift.
POSE_GRAPH.constraint_builder.fast_correlative_scan_matcher_3d.linear_z_search_window: Max distance (mts) to search on the Z axis when closing the loop, increasing this value can decrease vertical drift.
POSE_GRAPH.constraint_builder.fast_correlative_scan_matcher_3d.angular_search_window: Max angle (rad) to search the rotation when closing the loop.
POSE_GRAPH.constraint_builder.ceres_scan_matcher_3d.ceres_solver_options.max_num_iterations: Max number of iteartion when closing the loop.
Top View.
Lateral View.
Top View.
Lateral View.
Indoor.
Outdoor.
Fast LIO (Lightweight and Inertial Odometry) is a real-time, efficient framework for 3D localization and mapping that combines LiDAR data with IMU measurements. It uses a tightly-coupled iterated Extended Kalman Filter (EKF) to fuse the high-frequency IMU data with LiDAR point clouds, compensating for motion distortion and improving robustness. Designed for computational efficiency, Fast LIO delivers accurate state estimation on platforms with limited resources, making it ideal for mobile robots and drones requiring fast and reliable odometry in dynamic environments.
3D View
3D View
OPT-SC-F-LOAM (Optimized Scan Context and Feature-based LiDAR Odometry and Mapping) is an advanced SLAM algorithm that combines LiDAR data with optimized loop closure techniques for accurate and robust 3D localization and mapping. It integrates scan context, a global descriptor method, to improve loop closure detection, and uses feature-based LiDAR odometry to maintain high precision in pose estimation. By leveraging optimization and feature extraction, OPT-SC-F-LOAM enhances mapping accuracy and reduces drift, making it particularly effective in large-scale and complex environments where traditional SLAM methods may struggle.
3D View
3D View
Ouster - Building Maps Using Google Cartographer and the OS1 Lidar Sensor
Git Commit - Changes to make it work for the sensor.bag file.
ROS - Tuning Google Cartographer to work with a Velodyne HDL-32
Git - Correctly Configuring your Velodyne for use with Cartographer
Git - VLP16 + IMU tuning issue, and question for Z value drift