What is SLAM? The chicken-and-egg problem in robotics
Atlasbot · 17/8/2026 · 12 min read
The article Localization in Navigation assumes map availability. But where does that map come from? SLAM (Simultaneous Localization and Mapping) is the answer — and the name speaks to the essence of the problem: localization and mapping have to solve simultaneously, which is inseparable.
Key concepts
An EXISTING map is needed for accurate localization (as in AMCL)
but
An ACCURATE pose is needed to build a correct map (each LiDAR measurement
needs a known measurement origin to be placed correctly in the map)
This is the canonical —-dependent loop with no "clean" starting point to start with. SLAM resolves by estimating simultaneously both, accepting both to have initial errors, and then continuously refining them together as more data becomes available.
How it works
Every modern SLAM system, regardless of the specific algorithm (slam_toolbox, Cartographer — two subsequent articles), separates processing into two tiers:
- Front-end — Scan Matching — the current LiDAR scan matching the constructed local map, instantaneous location estimation. This is a real - time job, running every time there's a scan.
- Back-end — Global optimizations— periodically look back the entire trajectory has passed and the constraints have collected, re-adjusted so that everything is consistent with each other — which is especially important when there is loop closure.
When the robot makes a turn and comes back to the same spot it went through, the SLAM system recovers from that spot (compare the current scan with the stored old scan) — which is called loop closure. Detection of loop closure allows the back - end to "pull" the entire passed trajectory to its true position, eliminating much of the drift error that has accumulated during the passage.
In summary: The front - end answers "what is the position right now" fast but can have cumulative bias; the back - end answers "is the entire trajectory so far consistent" slower but corrects for that bias. The two complementary levels — only front - end drifts as pure odometry (article Odometry ), only back - end is not fast enough to use real time.
Technical details
Formulas
Without loop closure: drift accumulates without bound and the map gradually distorts
With loop closure: error is constrained whenever the robot revisits a location
The computational cost of the back - end increases with the number of constraints collected, almost the ratio to the square of the number of poses in the worst - case pos - graph — this is why the larger the map, the longer it travels, the more processing time the back - end takes per global optimal, although the front - end still runs fast and stable at fixed frequencies.
Parameters
| Floor | frequency | Handling range | Fix what |
|---|---|---|---|
| Front-end (scan matching) | Every new scan (typically 5 - 10Hz) | Local, compared to nearest map/scan | Immediate Location |
| Back - end | Periodically, when there are enough new constraints | The entire trajectory has gone | Accumulation drift error, especially when there is a loop closure |
Practical applications
This is why the real-world map scanning process (the Mapping real-world ) always encourages going in closed loops instead of just going one - dimensional straight lines — the more opportunities loop closure, the more accurate the final map. In real-world AMR deployment in warehouses, planning the initial scan route (going through corridors and returning to the starting point in a closed loop) not only saves time but also directly improves the final map quality used for AMCL later.
Practical example
Compare 2 scans of the same rectangular 20m x 15m area:
Scenario A — follow a one-way zigzag without returning to the start:
→ no loop closures
→ drift accumulates throughout the ~150m traveled
→ the final map may be slightly distorted, especially far from the start
Scenario B — follow the perimeter and return to the exact starting point:
→ at least 1 major loop closure on returning to the start
→ the back-end pulls the whole trajectory into consistency with that loop closure constraint
→ the final map is considerably more accurate despite a similar distance traveled
Common mistakes
- Focusing on the front-end alone and neglecting the back-end — role leads to the misinterpretation that SLAM is only "continuous scanning matching", while the final map quality critically depends on the global optimization step.
- Scanning the map in one-dimensional straight lines, unintentionally creating loop closure— as in Scenario A example above, misses the opportunity to correct cumulative drift errors, although not a technical error but an operational process error.
- SLAM expectation corrects instantaneous errors as the back-end is running continuously— the back-end runs periodically, not per scan, so the instantaneous position can still drift slightly between optimizations.
- Differentiating the SLAM phase (no map) from the AMCL phase (available map) — as learned in Localization in Navigation, the two phases have significantly different computational costs and operating practices.
Conclusion
SLAM solves the chicken-egg problem using a Front-end/Back-end two-tier architecture, with loop closure as the key mechanism to suppress the accumulated drift error. Properly understanding this framework prior to specific learning slam_toolbox or Cartographer helps distinguish "this is the general principle every SLAM has" from "this is how a particular package implements it". This column continues with the two most common SLAM systems in ROS2 —slam_toolbox and Cartographer — both of which implement the right frameworks, differing only in algorithm details and usage experience.
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.