Skip to content
Tech Interview Prep
Technical interview guide

Perception & SLAM

How a robot builds a map of an unknown environment while simultaneously figuring out its own location within it.

Minutes to read
4
Practice MCQs
25
Interview Q&A
25
Edition
v5
Editorial status
Reviewed
Relevant for
Robotics Engineer

Scope: ORB-SLAM3, Cartographer, GTSAM, Ceres, OpenCV 4.x, ROS 2 Rolling, Kalibr, PCL, Nav2, TUM RGB-D, KITTI, and evo references reviewed 2026-09-04.

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

min⁡x∑iρ(∥ri(x)∥Σi2)\min_x \sum_i \rho\big(\lVert r_i(x)\rVert^2_{\Sigma_i}\big)

Huber loss with threshold delta:

ρδ(r)={r2∣r∣≤δ2δ∣r∣−δ2∣r∣>δ\rho_\delta(r)=\begin{cases} r^2 & |r|\le\delta \\ 2\delta|r|-\delta^2 & |r|>\delta \end{cases}

Correlation from a covariance block: ρxy=PxyPxxPyy\rho_{xy}=\frac{P_{xy}}{\sqrt{P_{xx}P_{yy}}}

Constant accelerometer bias b drifts position by Δx=12bt2\Delta x=\tfrac{1}{2}bt^2 (0.02 m/s^2 over 10 s gives 1.0 m).

Timing offset dt at speed v shifts a measurement by Δp=v Δt\Delta p = v\,\Delta t (1.5 m/s with 30 ms gives 4.5 cm).

Scan skew during rotation at omega for a return at range r: δ=r ω Δt\delta = r\,\omega\,\Delta t (5 m, 90 deg/s, 50 ms gives about 0.39 m).

Monocular trajectories are known only up to scale: pathmetric=s⋅pathest\text{path}_{\text{metric}} = s\cdot\text{path}_{\text{est}}, 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

Timestamped sensors with extrinsics Front end: features or scan matching Data association with gating Back end: factor graph or filter Pose in continuous odom frame Map in corrected map frame Loop closure candidate Geometric verification
  1. Odometry gives a short-horizon constraint that seeds the optimizer. A bad seed lands in a bad local minimum.
  2. Observations are associated to map elements through gates. Wrong associations become confident, wrong constraints.
  3. The back end minimizes covariance-weighted residuals, with a robust loss on suspect edges.
  4. Verified revisits add loop closures that correct pose and map together.
  5. 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

SituationChooseWhy
Static, mapped siteLocalization onlyNo map to build, no map drift
Unknown site, long runSLAM with loop closureDrift needs revisit corrections
Short motion horizonOdometryCheap, no map to maintain
Monocular camera, no metric referenceAdd IMU or wheel odometryScale is unobservable otherwise
Long corridor or repeated aislesDegeneracy checks plus non-geometric cuesGeometry alone under-constrains motion
Tight compute, small stateEKFCost per step is low, but loop closure is awkward
Long online trajectoryIncremental smoothingNear-constant update, relinearizes affected variables

Traps interviewers probe

  1. 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.
  2. Trusting a low covariance. Covariance only states what the model believes. Fix: check residuals and inlier spread, and compare against independent ground truth.
  3. 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.
  4. 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.
  5. 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:

  1. Sensors, their timestamps and extrinsics, and the failure envelope of each.
  2. Odometry seeds the estimate, associations are gated, and the back end uses a robust loss.
  3. Loop closures are verified before they enter the graph.
  4. Metrics: ATE with the alignment stated, pose jumps, time to relocalize, and inlier spread.
  5. 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.