Robot Localization: AMCL / EKF / SLAM
Comparing three indoor-localization strategies on a TurtleBot3 in simulation, each measured against Gazebo ground-truth trajectories.
The problem
A mobile robot has to know where it is. There are three common answers: AMCL (a particle filter over a known map), an Extended Kalman Filter (fusing odometry and sensors), and Hector SLAM (building the map while localizing). Each makes different trade-offs, and the goal was to quantify them on identical runs rather than argue them in the abstract.
Approach
- TurtleBot3 driven over identical paths in a Gazebo world, under each of the three methods.
- Logged estimated pose against Gazebo ground truth, Euclidean position error and orientation error, across 1,100+ samples.
- Analysed error over time, error distributions and trajectory overlay to understand where and why each method drifts.
Results
The EKF was the most accurate, with a mean position error of 0.0047 m. Its tight fusion of wheel odometry and sensor updates kept drift low on this well-behaved map. AMCL stayed robust but coarser (particle spread), while Hector SLAM carried a scan-matching offset from building the map online. Practically: AMCL for known-map deployment, SLAM when no map exists, EKF when odometry is trustworthy.




What I took away
- "Best" depends on the assumption you can satisfy: a known map, trustworthy odometry, or neither.
- Always validate against ground truth; in simulation that's free, so there's no excuse.
- Looking at error over time reveals failure modes that a single mean hides.