Atlas Robotics
Lesson 2/6 · about 40 min

Scan 3D maps with FAST-LIO2

Three terminals: simulation, SLAM, driving. Drive the robot around the platform and then return to the starting point, the 3D map grows larger in RViz with each segment.

Map after a 52 m round: floor, two slopes, platform surface, boundary wall, barrel and column. The trajectory ends exactly where it started.

World ramp

Floor 24 × 24 mExterior wall 3 m high. 8 concrete boxes 0.6–2.2 m high and 4 columns spread around the floor.
Podium 6 × 4 m, 0.6 m highIn the middle of the floor, with a 0.3 m low railing, leaving access at both ends.
Two 6° slopes, 2 m wideAt the west and east ends of the platform, about 6 m long each.
Start placeSouthwest corner, robot nose facing north. The foot of the western slope is in front, off to the left.

World is small, with few objects, so SLAM runs lightly and quickly. Platforms and ramps make the robot actually go up and down, so the map is 3D rather than flat.

1. Simulation

Terminal 1

ros2 launch atlas3d_bringup bringup.launch.py world:=ramp.sdf wheel_odom_tf:=false rviz:=false
  • wheel_odom_tf:=false: turn off TF of wheel odometry. When running SLAM, FAST-LIO2 is the place to broadcast the robot position; If two sources transmit the same TF edge, RViz and Nav2 receive position jumping back and forth. M02 explains the TF tree.
  • rviz:=false: SLAM automatically opens RViz separately in the following step.
  • Add headless:=true if the device is weak. The simulation still runs fine, just doesn't draw the Gazebo window.

Wait for line Configured and activated diff_drive_controller (dev machine: 5 s).

2. SLAM

Terminal 2

ros2 launch atlas3d_slam fastlio2.launch.py

One command runs both parts: FAST-LIO2 pairs each LiDAR scan with the IMU to know where the robot is and builds a map, PGO selects locations about 0.5 m apart as keyframes, finds where the robot returns to the old area to adjust the map to match. Log must have:

[pgo.pgo_node]: Optimized map publisher: /atlas3d_map (every 2 seconds)

Let the robot stand still for a few seconds for FAST-LIO2 to sample the IMU while standing still, wait for RViz to scan before driving.

RViz by SLAM

DisplayTopic
3D Map/atlas3d_mapComposite map from all keyframes, updated every 2 s
Scan now Latest/fastlio2/world_cloudScan, placed in frame map
trajectory FAST-LIO/fastlio2/lio_pathThe robot path followed FAST-LIO2
trajectory PGO (optimized)/pgo/optimized_pathLine connecting keyframes after PGO straightening
Camera RGB/camera/color/image_rawFront camera photo

Fixed Frame is map: the origin is where the robot stands when SLAM is turned on, the x axis is in the direction of the robot's nose at that time. Therefore, the coordinates on the map are different from the coordinates in the Gazebo (lesson 2 uses this again).

3. Drive around

Terminal 3

ros2 run teleop_twist_keyboard teleop_twist_keyboard

Route as shown in the scene at the beginning of the article:

  1. Go straight north for about 3 m, turn widely left (west) then turn right to enter west slope straight east. The slope is 2 m wide, the robot is 0.56 m wide: if you go wrong, the wheel will easily slide off the edge.
  2. Go uphill, walk along the platform, downhill east.
  3. Turn south, go along the row of columns and crates, and return to the starting point.

Keep the default teleop speed (0.5 m/s, 1.0 rad/s), slow motion. Spinning quickly on the spot causes blurry scans, which is the most common cause of skewed maps.

Check before saving

  • The platform surface and two slopes are seamless, with no overlapping floor layers
  • The wall is straight, not forming two parallel lines
  • trajectory PGO closes at the starting point
  • Can see both the north and south sides of the platform (lesson 4 explains why it is necessary)

Measurements on dev machine

The above route is driven automatically by the repo's test script, comparing the SLAM position with the ground truth taken from Gazebo:

QuantityValue
Distance / time52.5 m / 90 s
Keyframe107
Position error compared to true (ATE, root mean square)1.1 cm, largest 4.7 cm
CPU processes (100 % = 1 thread)Gazebo 91 %, FAST-LIO2 39 %, bridge + IMU filter 27 %, PGO 5 %, remaining 9 %
RAM processes1.2 GB (Gazebo 0.7 GB)

1 cm error over 52 m is due to clean simulation: no vibrations, no moving objects. The real robot's error is many times larger. M06 instructs how to measure this error using ground truth.

Common errors

RViz has no mapPGO only broadcasts the map after the first keyframe, that is, after the robot starts walking. If you stand still, you will only see the current scan.
Map rotates, drifts right at startDrive before FAST-LIO2 finishes sampling IMU. Turn off Terminal 2, turn it back on, stand still for a few seconds.
"No transform from [odom]" in RVizTerminal 2 is not running or turned off: wheel_odom_tf:=false so only SLAM publishes frame odom.
Map with two layers of wallsEach sensor topic must have exactly 1 publisher (M00 lesson 4). While the old simulation runs, the data is duplicated.
Scan a 3D map with FAST-LIO2 · Module 1: One full loop: scan → save → localize → drive — Atlas Robotics