Localization & SLAM · Theory · M8
M8-T1 — Dynamic Environments
SLAM assumes the world stands still. Real worlds contain people, and a map that remembers every position they ever occupied is a wrong map.
Modules 1 to 7 assumed a static scene: the same wall seen from two places is the same wall. In a building with people, a car park with cars and a warehouse with forklifts, that assumption fails. Moving objects mislead scan matching, leave ghost obstacles in occupancy maps, and give visual systems false motion. This lesson separates what is established (clearing by ray tracing, robust estimation) from what is still active (removing dynamic points from large 3D maps, handling objects that move rarely), and cites the primary work.
Learning objectives
After this lesson, you should be able to:
- Explain how a moving object corrupts localisation, occupancy maps and visual tracking.
- Compute the effect of repeated hit and free observations on a log-odds occupancy cell.
- Describe the main approaches to dynamic handling: robust estimation, ray-tracing, consistency and visibility checks, and semantic masks.
- State which parts are established practice and which are active research, with the primary references.
The problem and the intuition
A map is a claim about the world that stays true. A person walking through a corridor makes no lasting claim: the cell where they stood is free a second later. A system that only ever adds evidence of occupancy will remember the person at every position they passed. The cure is symmetric evidence: whenever a sensor ray passes through a cell on its way to a farther hit, that cell was free at that moment, and the evidence for occupancy should shrink.
The second problem is for localisation. A scan matcher or feature tracker assumes that correspondences belong to rigid structure. If a bus fills half the camera image, the largest rigid group is the bus, and a robust estimator such as RANSAC (M6-T2) will confidently estimate the bus’s motion (M6-T9). Handling dynamics therefore needs two things: detecting what moves, and discounting it in estimation and mapping.
Static-world SLAM fails quietly in dynamic scenes: the map keeps ghosts and the pose follows the largest rigid group, which may be moving. Evidence must be symmetric (free as well as occupied) and estimation must be robust.
Problem, methods and what is established
Problem. Estimate the robot’s pose and build a map of the static structure from sensor data in which some parts of the scene move independently of the robot.
Assumptions of the methods below. A majority or at least a rigid, persistent part of the scene is static; moving objects are observed from several viewpoints and over time; for semantic methods, a detector recognises the classes that can move (people, vehicles).
1. Established: symmetric evidence and robust estimation
Log-odds occupancy with ray tracing. Each cell keeps l = log(p / (1 − p)). A hit adds locc = log(0.7 / 0.3) ≈ +0.85, a ray passing through adds lfree = log(0.4 / 0.6) ≈ −0.41, and the value is clamped to [lmin, lmax] so that a cell can change its mind. This is the standard occupancy-grid update (Elfes, 1989; Thrun et al., 2005) and the update used in OctoMap (Hornung et al., 2013). It removes slow-moving or briefly present objects as soon as free-space observations outweigh the hits.
Robust estimation. Treat points on moving objects as outliers: RANSAC, robust loss functions (Huber, Cauchy; M4-T5), and scan-matching with trimmed correspondences (M3-T3) all down-weight the minority that disagrees with the dominant motion. They work when the dynamic part is a minority; they fail when it is the majority.
2. Established: gating with other sensors
A gyroscope or wheel odometer gives a motion estimate that does not depend on what is in view. Checking that a visual or lidar estimate agrees with it (M6-T9) rejects a model fitted to a moving object.
3. Active research: removing dynamic points from large 3D maps
- Visibility-based removal. After mapping, compare each scan with the map by projecting into a range image: points of the map that lie in front of where the scan saw something farther were seen through, so they are dynamic. Removert (Kim and Kim, 2020) does this at several resolutions and then “reverts” wrongly removed static points; ERASOR (Lim et al., 2021) uses the ratio of occupancy between map and scan in polar bins to detect pseudo-occupancy.
- Learned moving-object segmentation. Networks trained on labelled sequences (for example SemanticKITTI moving classes) predict which points move; they are used as masks in LiDAR odometry (Chen et al., 2019, SuMa++).
- Dynamic-aware visual SLAM. DS-SLAM (Yu et al., 2018) and DynaSLAM (Bescos et al., 2018) combine semantic segmentation of potentially moving classes with geometric consistency checks, discard the features on them, and (DynaSLAM) inpaint the background.
4. Still open
Objects that are static for a while and then move (a parked car, a chair, a pallet): they are correct in the map when seen and wrong later. Long-term mapping (M8-T9) treats this as change detection rather than outlier removal. Another open problem is the case where the dynamic part is the majority of the view, and where the semantic detector is wrong or sees an unseen class.
- l
- log-odds of occupancy of a cell: l = log(p / (1 − p)).
- locc, lfree
- increments for a hit and for a pass-through; typical +0.85 and −0.41.
- dynamic point
- a measurement of an object that moved between observations.
- semi-static
- an object that is stationary for long periods and moves occasionally.
Strengths, limitations, failure modes
| Approach | Strength | Limitation / failure mode |
|---|---|---|
| Ray tracing + log-odds | Simple, online, handles transient objects | Needs several free-space observations; an object that stays is mapped; costs a ray traversal per beam |
| Robust estimation | No extra sensing; handles minority outliers | Fails when moving objects dominate the view |
| Visibility / consistency removal (Removert, ERASOR) | Cleans large 3D maps offline; no labels needed | Parameters sensitive to scene geometry; can remove thin static structure |
| Semantic masking (DynaSLAM, DS-SLAM) | Removes parked-but-movable objects by class and works from one frame | Depends on a detector; removes useful static features on “movable” classes |
A worked example: how many passes does a ghost survive?
- The numbers. A cell starts at l = 0 (p = 0.5). A person stands in it when a scan arrives: a hit, l = +0.85 (p = 0.70). The person walks on. Later scans from the same direction pass through the cell on the way to the wall behind it: each adds −0.41.
- Clearing. After one pass l = 0.85 − 0.41 = 0.44 (p = 0.61: still “probably occupied”). After two, l = 0.036 (p = 0.51). After three, l = −0.37 (p = 0.41): below 0.5 and now believed free. So a ghost from one hit is cleared after about three scans that look through it; a person lingering for ten scans (l clamped at, say, +3.5) needs about nine free passes.
- Why the clamp matters. Without a clamp, a wall hit 200 times would reach l = 170 and a door that is later opened would need 400 free observations to be believed. The clamp lets the map change; the price is that it also forgets thin evidence.
- Visibility check. A map point at range 5.0 m in a bearing bin is checked against a new scan that returns 8.0 m in the same bin from a different pose. The point lies 3 m in front of the new return: the beam passed through it, so it cannot be a static surface. If the same bin returns 4.95 m, the point is consistent and kept.
- The bus. A camera sees 90 features on a passing bus and 60 on the background; RANSAC finds the 90 as the largest inlier set. A gyroscope reading of 0.01 rad/s disagrees with the visual rotation of 0.15 rad/s by 14 times the gyroscope noise (taking σ = 0.01 rad/s), so the model is rejected. A semantic mask labelling the bus would have removed the 90 features before RANSAC.
The first lab of this module implements the counting version of this idea on 2D scans with people walking through a corridor.
Engineering implications and limitations
Engineering implications
- Use symmetric evidence by default. Ray-traced updates with a clamped log-odds are standard in occupancy mapping; do not use hit-only counting.
- Know your dynamic classes. In a warehouse the dynamic objects are forklifts and people; in a lab they are chairs. Choose the method (masking, change detection, temporal filtering) for what actually moves.
- Separate localisation from mapping. Robust estimation protects the pose; ray tracing or consistency removal protects the map. Both may be needed.
- Cross-check with inertial data. A visual or lidar estimate that contradicts the IMU or wheels is suspicious.
- Tune on data from the real flow of people. A clearing rate that works with sparse traffic can fail in a crowded hall.
- Keep a log of removed points. Visibility-based removal can delete thin static structure (poles, fences); review what was removed.
Limits
All of these methods are heuristics around a modelling assumption. No standard method handles every case: the dynamic majority, slow movers, sudden global changes (a rearranged room), and detector errors remain open. Benchmarks that include dynamic scenes (for example the TUM RGB-D dynamic sequences, SemanticKITTI moving-object challenge) show large differences between methods and between scenes; treat a single number with suspicion (M8-T8).
Common misconceptions
“RANSAC takes care of moving objects.”
Only while they are the minority; a large moving object can be the largest consistent set.
“A better detector solves dynamic SLAM.”
It removes classes that usually move, including parked cars that never do, and misses unusual moving objects.
“Occupancy grids are static by construction.”
The log-odds update with clamping and free-space evidence is what lets them handle change.
“Removing dynamic points is a pre-processing step.”
It interacts with registration and mapping; errors in either corrupt the other.
Engineering takeaways
- Static-world SLAM fails quietly: ghosts in the map and poses that follow the largest rigid group.
- Symmetric evidence (hit and pass-through) with a clamp lets a grid forget transient objects; about three free passes clear a single hit.
- Established: log-odds ray tracing, robust estimation, gating with inertial data. Active: removing dynamic points from large 3D maps, semi-static objects, learned masks.
- Semantic masks help but depend on the detector and remove useful static features of movable classes.
- Test dynamic handling on data with realistic traffic and report failures, not only averages.
References and further reading
Primary papers, with the established methods (first two) separated in the text from the active research (the rest).
- Elfes, A. (1989). Using occupancy grids for mobile robot perception and navigation. Computer 22(6).
- Hornung, A., Wurm, K. M., Bennewitz, M., Stachniss, C. and Burgard, W. (2013). OctoMap: An efficient probabilistic 3D mapping framework based on octrees. Autonomous Robots 34(3).
- Kim, G. and Kim, A. (2020). Remove, then revert: Static point cloud map construction using multiresolution range images. IEEE/RSJ IROS.
- Lim, H., Hwang, S. and Myung, H. (2021). ERASOR: Egocentric ratio of pseudo occupancy-based dynamic object removal for static 3D point cloud map building. IEEE Robotics and Automation Letters 6(2).
- Bescos, B., Fácil, J. M., Civera, J. and Neira, J. (2018). DynaSLAM: Tracking, mapping, and inpainting in dynamic scenes. IEEE Robotics and Automation Letters 3(4).
- Yu, C. et al. (2018). DS-SLAM: A semantic visual SLAM towards dynamic environments. IEEE/RSJ IROS.
- Chen, X. et al. (2019). SuMa++: Efficient LiDAR-based semantic SLAM. IEEE/RSJ IROS.
- Thrun, S., Burgard, W. and Fox, D. (2005). Probabilistic Robotics. MIT Press (occupancy grid mapping).
Knowledge check
Three conceptual questions. Write an answer, then reveal the explanation. Your answers stay in your browser.
Question 1
A cell has log-odds +0.85 after one hit by a person. Each later pass-through adds −0.41. After how many passes is the cell believed free?
Explanation
After three: 0.85 − 3 × 0.41 = −0.38, below zero (p ≈ 0.41). After two passes it is +0.03 (p ≈ 0.51), still marginally occupied.
Question 2
Why does RANSAC estimate the wrong motion when a bus fills most of the camera image, and what independent check would catch it?
Explanation
RANSAC returns the largest geometrically consistent set; if the bus provides the most features, that set is the bus, so the estimated camera motion is the bus’s relative motion. Comparing the visual rotation with a gyroscope (or masking the bus semantically) exposes the inconsistency.
Question 3
What is the difference between handling a transient object and a semi-static object, and which one does ray tracing fix?
Explanation
A transient object is present for a short time and is cleared by later free-space observations from ray tracing. A semi-static object stays for a long time and then moves (a parked car, a pallet), so it looks static when seen and wrong later; that needs change detection over long times, not outlier removal.
What’s next
Rather than only discarding what moves, a system can understand what it sees. The next lesson uses object and class information inside SLAM, for data association, for maps and for robustness.
Related content
Nothing below is required to finish this lesson.
- BeforeM7-T8: Real-Time Performance and Resource Constraints
Budget CPU, memory and latency, and tune a SLAM stack for a small robot.
- LabM8-L1: Handle Dynamic Objects in Mapping
Moving people leave ghost obstacles in the map: remove them with a consistency check.
Get notified when the next lesson and new labs are released.
One email per new lesson or lab.