Atlas Robotics
AMR Software ArchitectureIntermediate

The localization layer in AMRs: how local EKF and AMCL work together

Atlasbot · 22/8/2026 · 11 min read

The localization layer in AMRs: how local EKF and AMCL work together
2 layers of serial EKF: local EKF merge odom+imu, AMCL map drift correction

The ROS2 Navigation section has its own article explaining in detail EKF and AMCL. This article does not repeat Kalman Filter or Monte Carlo Localization math — it stands in the exact position of the Localization Layer in the 5-layer model: This layer receives data from the ROS2 Layer, returning a reliable location estimate for the Navigation Layer to use.

Key concepts

The Localization Layer in a real AMR almost always consists of 2 serial processing layers, not a single algorithm:

  • local EKF (package robot_localization) — merge /odom and /imu continuous, high frequency, publish /odometry/filtered — mentioned in article IMU in AMR
  • AMCL — matches /scan data to existing static map, lower frequency, fixes local EKF layer cumulative drift

How it works

These two layers solve two different but complementary problems: the local EKF runs fast and smoothly but drifts over time (exactly the nature of dead reckoning learned in the lesson Odometry for AMR) because it has no absolute external reference; AMCL runs slower but is capable of drift correction because it matches the map directly — an absolute reference that the local EKF does not have.

The result of this coordination is shown through the TF tree (Transform Tree, learned in lesson TF Tree): frame odom (local EKF output, smooth but drifting) and frame map (absolute coordinate system of the map) are connected together through a transformation (map → odom) which AMCL continuously updates to properly compensate for the accumulated drift. The robot always knows the smooth instantaneous position (odom frame), and at the same time has a periodic correction to not deviate too far from the actual position in the map (map frame).

In short: Don't think of AMCL as a local EKF "replacement" or vice versa — they operate at two different frequencies, serving two complementary purposes: one for immediate smoothness, one for long-term precision.

Technical details

Formulas

The effective delay of "knowing the correct position in the map" depends on the update frequency of the AMCL, not the frequency of the local EKF:

If AMCL updates the map→odom transformation every 500ms (2Hz, typical),
and the robot moves at 0.5 m/s, then in the time between two AMCL updates:

Maximum_cumulative_drift_error ≈ Velocity × Time_between_2_times_AMCL
                              × Drift_odometry ratio (usually 1-5% of distance)

For example: 0.5 m/s × 0.5s = 0.25m distance traveled between 2 AMCL times,
The cumulative drift error in that range is estimated to be 1-5% × 0.25m ≈ 0.25-1.25cm

Parameters

FloorTypical frequencyRole
Local EKF (robot_localization)30-50HzSmooth, instantaneous position estimation, used for control loop
AMCL1-5Hz (every time there is a new significant scan)Correct cumulative drift by map matching

Practical applications

In practical implementation, the Navigation Layer (next article) mainly relies on the high-frequency output of the local EKF (/odometry/filtered) for instantaneous decisions (local obstacle avoidance), while the absolute position in the map (AMCL result) is more important for global path planning. This is why this two-tier architecture exists — not as unnecessary complexity, but as a solution to the difficulty of an algorithm being both fast and absolutely accurate at the same time.

Practical example

# Check the actual frequency of each localization layer on the running robot
ros2 topic hz /odometry/filtered   # should be ~30-50Hz
ros2 topic hz /amcl_pose            # frequency ~1-5Hz

# View the current TF tree to confirm the map -> odom -> base_link structure is correct
ros2 run tf2_tools view_frames

If /amcl_pose is almost not updated (frequency ~0), there is a high possibility that AMCL has not converged to the correct position (the robot is "lost" in the map) or /scan data is not arriving correctly — this is the first debugging step before suspecting the Navigation Layer above is going the wrong way.

Common mistakes

  • Consider /odometry/filtered the exact absolute location in the map — this is still a driftable local estimate, only periodically calibrated by AMCL, not a continuous source of absolute truth.
  • Not checking that the AMCL has converged before starting navigation — if the robot starts at a position that does not match the initial guess of the AMCL, it will take time to travel for the AMCL to converge properly, starting navigation too early can easily lead the robot in the wrong direction.
  • Confused frames odom and map when debugging — the positions in these 2 frames are exactly as different as the accumulated drift, comparing the wrong frame causing an incorrect conclusion about whether the robot has the correct localization or not.
  • The AMCL frequency is too low compared to the robot's moving speed — as calculated in the Formula section, the robot moves fast but the AMCL updates sparsely, causing the accumulated drift error between 2 updates to be larger than desired, the scan matching parameters need to be rebalanced.

Conclusion

The Localization Layer in AMR is actually not a single algorithm but a combination of local EKF (fast, smooth, gradual drift) and AMCL (slower, map drift correction) — shown through the TF tree with 2 separate frames odom and map. The next article in the category goes into the Navigation Layer — where this position estimate is used to calculate the actual path and avoid obstacles.

Get new articles and lessons by email

When a new technical article or course module is published, Atlas Robotics sends you a short email. No spam.

Unsubscribe any time with the link in each email. See our Privacy policy.

The localization layer in AMRs: how local EKF and AMCL work together — Atlas Robotics