A lightweight CLI tool and Python library for evaluating SLAM trajectory accuracy against ground truth.
Computes APE (Absolute Pose Error) and RPE (Relative Pose Error) from TUM-format trajectory files, with clean publication-ready plots.
pip install slam-evalOr from source:
git clone https://github.com/your-username/slam-eval
cd slam-eval
pip install -e .Requirements: Python ≥ 3.8, numpy, matplotlib, scipy — no ROS required.
# Basic evaluation (SE3 alignment by default)
slam-eval estimated.tum ground_truth.tum
# Save a 4-panel figure
slam-eval estimated.tum ground_truth.tum --plot results.png
# Sim3 alignment (for monocular visual SLAM)
slam-eval estimated.tum ground_truth.tum --align sim3 --delta 5Output:
Loaded 'FAST-LIO2': 1240 poses, 62.0s, 48.32m
Loaded 'Ground Truth': 3720 poses, 62.0s, 48.18m
slam-eval results
Estimated : FAST-LIO2
Ground truth: Ground Truth
Poses : 1240
Alignment : se3
APE (translation):
RMSE: 0.0312 m
Mean: 0.0271 m
Median: 0.0244 m
Std: 0.0163 m
Min: 0.0011 m
Max: 0.0981 m
RPE (translation, delta=1):
RMSE: 0.0088 m
...
from slam_eval import load_tum, compute_rpe, AlignmentMethod, plot_trajectories
estimated = load_tum("fast_lio2_run01.tum", name="FAST-LIO2")
ground_truth = load_tum("mocap_run01.tum", name="MoCap GT")
result = compute_rpe(estimated, ground_truth, alignment=AlignmentMethod.SE3)
print(f"APE RMSE: {result.ape_translation.rmse:.4f} m")
print(f"RPE RMSE: {result.rpe_translation.rmse:.4f} m")
plot_trajectories(result, output_path="eval.png")Comparing multiple algorithms:
from slam_eval import load_tum, compute_rpe
gt = load_tum("ground_truth.tum", name="MoCap")
algorithms = {"FAST-LIO2": "fast_lio2.tum", "DLIO": "dlio.tum", "RKO-LIO": "rko_lio.tum"}
print(f"{'Algorithm':<14} {'APE RMSE (m)':>14} {'RPE RMSE (m)':>14}")
print("-" * 44)
for name, path in algorithms.items():
result = compute_rpe(load_tum(path, name=name), gt)
print(f"{name:<14} {result.ape_translation.rmse:>14.4f} {result.rpe_translation.rmse:>14.4f}")timestamp tx ty tz qx qy qz qw
Lines starting with # are comments. Compatible with evo and natively output by most ROS2 SLAM packages.
| Option | Default | Description |
|---|---|---|
--align |
se3 |
none | se3 | sim3 | yaw_only |
--delta |
1 |
RPE step size in poses |
--max-diff |
0.02 |
Max timestamp diff for pose association (s) |
--plot PATH |
— | Save 4-panel evaluation figure |
--heatmap PATH |
— | Save standalone APE heatmap |
evo is the standard tool for SLAM evaluation and slam-eval is not a replacement. slam-eval is for cases where you want a single pip-installable dependency with a clean Python API — no ROS, no system dependencies, easy to embed in your own evaluation pipeline.
MIT
