Overview
Curated: · Written: · Reviewed:
Perception & SLAM
In one line
SLAM estimates the robot's pose and a map of an unknown environment together, because each depends on the other. Reach for it when no trusted map exists. If a static, trusted map exists, run localization only.
Key definitions
- Gauge freedom: the global position and yaw an unanchored graph can slide and rotate without changing the cost.
- Data association: deciding which observation refers to which landmark or place. This is where SLAM most often fails.
- Loop closure: a long-range constraint from revisiting a place that corrects accumulated drift. A false one deforms the map.
- Marginalization: dropping old states to keep cost bounded. The remaining prior becomes dense, which makes loop closure hard in a filter.
- Degeneracy: geometry that leaves some motion directions unconstrained, such as a corridor with parallel walls for scan matching.
- ATE and RPE: absolute trajectory error after a declared alignment, and relative pose error over fixed intervals.
Formulas and complexity
Huber loss with threshold delta:
Correlation from a covariance block:
Constant accelerometer bias b drifts position by (0.02 m/s^2 over 10 s gives 1.0 m).
Timing offset dt at speed v shifts a measurement by (1.5 m/s with 30 ms gives 4.5 cm).
Scan skew during rotation at omega for a return at range r: (5 m, 90 deg/s, 50 ms gives about 0.39 m).
Monocular trajectories are known only up to scale: , so the scale constant multiplies every translation.
EKF update cost grows with the square of the state dimension. Incremental smoothing keeps per-update cost near constant.
How it works
- Odometry gives a short-horizon constraint that seeds the optimizer. A bad seed lands in a bad local minimum.
- Observations are associated to map elements through gates. Wrong associations become confident, wrong constraints.
- The back end minimizes covariance-weighted residuals, with a robust loss on suspect edges.
- Verified revisits add loop closures that correct pose and map together.
- Publish the odom frame as continuous and the map frame as corrected, so loop closure does not jerk the controller.
When to use and when not to
| Situation | Choose | Why |
|---|---|---|
| Static, mapped site | Localization only | No map to build, no map drift |
| Unknown site, long run | SLAM with loop closure | Drift needs revisit corrections |
| Short motion horizon | Odometry | Cheap, no map to maintain |
| Monocular camera, no metric reference | Add IMU or wheel odometry | Scale is unobservable otherwise |
| Long corridor or repeated aisles | Degeneracy checks plus non-geometric cues | Geometry alone under-constrains motion |
| Tight compute, small state | EKF | Cost per step is low, but loop closure is awkward |
| Long online trajectory | Incremental smoothing | Near-constant update, relinearizes affected variables |
Traps interviewers probe
- Fixing drift with more particles. Particles approximate the same posterior and add no new information. Fix: estimate landmarks jointly with pose, so revisits correct both.
- Trusting a low covariance. Covariance only states what the model believes. Fix: check residuals and inlier spread, and compare against independent ground truth.
- Calling a timing offset an extrinsic error. A constant error that grows with speed and flips with direction is timing. Fix: estimate the time offset or sync the hardware. A constant image offset with clean intrinsics points to the lidar-to-camera extrinsic.
- Accepting a loop closure on match score alone. Fix: verify geometrically, check consistency with odometry, use a robust kernel, and reject or roll back edges that disagree with the chain.
- Reading a good residual as a good estimate. A corridor can show 2 cm RMS while sliding along its axis. Fix: inspect the Hessian eigenvalues for unconstrained directions and add constraints or features.
Interview tips
Open by naming the circular dependency between pose and map, then say which mode you are in (localization, mapping or SLAM) and which failure you watch first.
Expect these follow-ups:
- What is your marginalization policy, and what does it cost in loop closure?
- How do you reject a false loop closure without losing a true one?
- How do you detect a calibration or time offset in the field?
- How do you check that reported covariance is calibrated?
- How do you relocalize after a kidnapped-robot event, and how do you keep the robot safe meanwhile?
- Why does a monocular system need Sim(3) evaluation, and what does the gap between SE(3) and Sim(3) error tell you?
30-second answer outline:
- Sensors, their timestamps and extrinsics, and the failure envelope of each.
- Odometry seeds the estimate, associations are gated, and the back end uses a robust loss.
- Loop closures are verified before they enter the graph.
- Metrics: ATE with the alignment stated, pose jumps, time to relocalize, and inlier spread.
- Safety: low confidence slows the robot or stops it before it commits to a hypothesis.
Feedback on this overview
Log in free to save your progress and keep bookmarks and notes for a quick revision before your interview.