Troubleshooting · SLAM and localization
SLAM drifts
Measure drift as a percentage of distance, then change one thing at a time.
1. Symptoms
- Maps are bent or corridors do not close.
- The estimated position slides while the robot is still or turning.
- The loop-closure gap grows with route length.
2. Possible causes
- Wheel slip or a poor odometry model.
- Time offset between sensors, wrong extrinsics.
- Too few features (visual) or too little structure (LiDAR).
- Thresholds that skip scans.
- Loop closure disabled or mis-tuned.
- Dynamic objects.
3. Measurements to collect
- Loop-closure gap ÷ path length.
- Where along the route the error grows.
- Odometry versus IMU consistency while turning.
- Per-scan processing time and dropped scans.
4. Diagnostic commands
Commands are not executed by the site’s automated tests (they need a ROS 2 Jazzy installation or the robot).
ros2 topic hz /scan
ros2 run tf2_ros tf2_echo map odom
ros2 bag record /scan /odom /imu/data /tf /tf_static5. Step-by-step investigation
- Fix a route and measure the loop gap.
- Check odometry on a straight run and a turn.
- Check time and calibration (see the timing and calibration guides).
- Check features or structure in the drifting section.
- Check thresholds and dropped scans.
- Check loop closure settings.
6. Corrective actions
- Fuse IMU with odometry; correct the odometry model.
- Calibrate time and extrinsics.
- Add a second modality or constraint.
- Tune travel thresholds and loop closure.
7. Validation after the fix
- Drift on the reference route is below the requirement on three repeated runs.
References
- See the drift and tracking loss guide.