AI Wiki中文/EN

SLAM: building a map while finding yourself on it

同时定位与地图构建

See why a robot in an unknown place must estimate its path and its map together, write the joint posterior and its filtering solutions, recast SLAM as sparse least squares over a pose graph, and watch one true and one false loop closure change a synthetic map.

On this pageIntuitionMathematics & methodImplementationLimitationsExercisesResearch connections

Two unknowns that must be solved together

Simultaneous localization and mapping (SLAM) is the task of building a map of an unknown place while working out where the robot is on that map. Neither the map nor the robot’s path is known at the start, so the two are estimated together. A typical example is a robot that drives a loop through a building. When it recognizes its starting point again, it can correct the drift that built up along the way.

Durrant-Whyte and Bailey state the question plainly. A robot starts at an unknown place in an unknown environment. Can it build a consistent map step by step and, at the same time, find its own location within that map? The SLAM question

Cadena and colleagues give a similar definition. SLAM estimates the state of a robot that carries its own sensors and builds a model of the environment, which is the map. The state is often just the pose, meaning position and orientation. It can also include velocity, sensor biases and calibration values. Definition

Why build a map at all? Cadena et al. give two reasons. First, other tasks need it, such as path planning or visualization. Second, a map keeps the robot’s own error in check. Dead reckoning means adding up measured motions step by step, and its error keeps growing. When the robot returns to a place it has mapped, it can “reset” that error. Recognizing such a return is called a loop closure. Why maps

Without loop closures, SLAM shrinks to odometry: estimating motion from the robot’s own sensors, such as wheel encoders or a camera, with no memory of places. Cadena et al. note that odometry sees the world as an “infinite corridor” that never comes back on itself. A loop closure reveals that the corridor was really a loop. In their terms, visual-inertial navigation (tracking motion with cameras and motion sensors) is a reduced SLAM system with place recognition switched off. Odometry and loop closure

Why not map first and localize second, or the other way around? Every landmark is placed relative to where the robot thought it was when it saw that landmark. So the same pose error enters every landmark estimate, and the landmark errors are correlated: they tend to be wrong together. The relative positions of landmarks can be known well even when their absolute positions are not. Treating pose and map as separate problems throws these correlations away and gives inconsistent, overconfident answers. Correlated landmark errors

This article sets up the probabilistic problem, outlines the two classical filtering solutions, and explains modern SLAM, which solves a large graph problem by minimizing squared errors (least squares). It then works through a small pose graph (a network of robot poses linked by measured motions) with one correct and one false loop closure. It builds on state estimation (the Bayes filter) and leaves the details of filters to extended Kalman filter and particle filter. Robot localization assumes the map is known, and occupancy grid maps assumes the poses are known; SLAM drops both assumptions. Useful background: factor graphs, MAP estimation and rigid transformations.

From a joint posterior to a sparse least-squares problem

This section writes SLAM as a probability problem, explains why the correlations are useful, sketches the two filtering solutions, and then derives the graph-based form used by most modern systems.

The joint posterior

Durrant-Whyte and Bailey use the following symbols. xkx_k is the robot pose at time kk. uku_k is the control or odometry input that moved it there. mm is the map, a set of landmark positions mim_i. zkz_k is the observation at time kk. Capital letters with ranges, such as Z0:kZ_{0:k} and U0:kU_{0:k}, are the full histories. The goal is the joint posterior: Formulation

P(xk,m∣Z0:k,U0:k,x0)P(x_k, m \mid Z_{0:k}, U_{0:k}, x_0)

In words: given every observation and control so far and the starting pose, how probable is each combination of current pose and map?

Two models feed it. The observation model P(zk∣xk,m)P(z_k\mid x_k,m) says what the robot should see from pose xkx_k in map mm. Observations are assumed independent of each other once the pose and map are known. The motion model P(xk∣xk−1,uk)P(x_k\mid x_{k-1},u_k) is Markov: the new pose depends only on the previous pose and the control. With these, the posterior is updated in two steps, the time update and the measurement update. Eqs. 1–5

P(xk,m∣Z0:k−1,U0:k,x0)=∫P(xk∣xk−1,uk) P(xk−1,m∣Z0:k−1,U0:k−1,x0) dxk−1P(x_k, m \mid Z_{0:k-1}, U_{0:k}, x_0)=\int P(x_k\mid x_{k-1},u_k)\,P(x_{k-1}, m \mid Z_{0:k-1}, U_{0:k-1}, x_0)\,dx_{k-1} P(xk,m∣Z0:k,U0:k,x0)=P(zk∣xk,m) P(xk,m∣Z0:k−1,U0:k,x0)P(zk∣Z0:k−1,U0:k)P(x_k, m \mid Z_{0:k}, U_{0:k}, x_0)=\frac{P(z_k\mid x_k,m)\,P(x_k, m \mid Z_{0:k-1}, U_{0:k}, x_0)}{P(z_k\mid Z_{0:k-1},U_{0:k})}

In words: the first line moves the belief forward with the motion model, averaging over the old pose; the second reweights it by how well each pose-and-map pair explains the new observation, and the denominator makes it sum to one. This is the Bayes filter of state estimation with the map added to the state. The map does not move, so the time update carries it along unchanged.

The two easier problems are special cases. Mapping alone asks for P(m∣X0:k,Z0:k,U0:k)P(m\mid X_{0:k},Z_{0:k},U_{0:k}) with the whole trajectory known. Localization alone asks for P(xk∣Z0:k,U0:k,m)P(x_k\mid Z_{0:k},U_{0:k},m) with the landmarks known. Mapping and localization

Why the correlations help

Durrant-Whyte and Bailey stress that the joint posterior cannot be split into a pose part times a map part. Such a split gives inconsistent estimates. Non-factorization Their key insight goes further. As observations accumulate, the correlations between landmarks grow monotonically. So the robot’s knowledge of the relative map never gets worse, even while its absolute position is uncertain. They picture the landmarks as joined by springs that stiffen with every observation. When one landmark is re-observed, the springs pull its neighbours along. A footnote adds that this result has been proved only for the linear-Gaussian case. Spring network and footnote 2

Two filtering solutions in outline

EKF-SLAM writes the motion as xk=f(xk−1,uk)+wkx_k=f(x_{k-1},u_k)+w_k and the observation as zk=h(xk,m)+vkz_k=h(x_k,m)+v_k, with zero-mean Gaussian noises. It then runs an extended Kalman filter on one big state vector that holds the pose and every landmark. EKF-SLAM Durrant-Whyte and Bailey list four issues. The map’s overall uncertainty shrinks steadily, but each landmark’s variance stops at a floor set by the robot’s initial uncertainty. The cost grows with the square of the number of landmarks if done naively. The filter is fragile when observations are matched to the wrong landmark, especially at loop closure. And linearization makes it inconsistent, sometimes dramatically. Convergence and consistency are guaranteed only in the linear case. Four issues The filter itself belongs to extended Kalman filter.

FastSLAM, by Montemerlo and colleagues as described by Durrant-Whyte and Bailey, takes a different route. It estimates the whole trajectory X0:kX_{0:k} instead of only the current pose, and splits the posterior: Rao-Blackwellized factorization, eq. 12

P(X0:k,m∣Z0:k,U0:k,x0)=P(m∣X0:k,Z0:k) P(X0:k∣Z0:k,U0:k,x0)P(X_{0:k}, m \mid Z_{0:k}, U_{0:k}, x_0)=P(m\mid X_{0:k}, Z_{0:k})\,P(X_{0:k}\mid Z_{0:k}, U_{0:k}, x_0)

In words: the probability of a path and a map equals the probability of the map given the path, times the probability of the path. Once a path is fixed, the landmarks no longer share a pose error, so they become independent. A particle filter samples paths; each particle then keeps one small Gaussian per landmark instead of one huge joint covariance. That turns quadratic cost into linear cost. FastSLAM 1.0 proposes new poses from the motion model. FastSLAM 2.0 also uses the current observation, which is locally optimal. Both eventually degenerate, because resampling wipes out the variety of past poses that the map depends on. FastSLAM 1.0 and 2.0 Particle filters themselves belong to particle filter.

SLAM as MAP estimation

Cadena et al. call maximum a posteriori (MAP) estimation the de-facto standard formulation of SLAM. MAP means choosing the single most probable set of variables. They trace it to Lu and Milios, followed by Gutmann and Konolige, and note that it is often expressed with factor graphs. MAP formulation Collect every unknown in X\mathcal{X}: poses, landmarks and possibly calibration values. Each measurement zkz_k is modelled as hk(Xk)+ϵkh_k(\mathcal{X}_k)+\epsilon_k. Here hkh_k is a known function of a small subset Xk\mathcal{X}_k of the variables, and ϵk\epsilon_k is Gaussian noise with information matrix Ωk\Omega_k, the inverse of its covariance. Then MAP becomes nonlinear least squares: Eqs. 1–4

X⋆=arg⁡min⁡X∑k=0m∥hk(Xk)−zk∥Ωk2,∥e∥Ω2=e⊤Ωe\mathcal{X}^\star=\arg\min_{\mathcal{X}}\sum_{k=0}^{m}\lVert h_k(\mathcal{X}_k)-z_k\rVert^2_{\Omega_k},\qquad \lVert e\rVert^2_{\Omega}=e^\top\Omega e

In words: pick the variables that make every predicted measurement as close as possible to the real one, where each squared mismatch is weighted by how much we trust that measurement. In this sum, mm simply counts the measurements; it is not the map. The k=0k=0 term carries the prior. With no prior term, the problem reduces to maximum likelihood.

Several remarks from Cadena et al. follow. Kalman filtering and MAP give the same estimate in the linear-Gaussian case, but not in general. MAP does not need to treat motion and observations differently; both are just factors. Other noise models change the cost: Laplace noise gives an absolute-value (ℓ1\ell_1) cost, and robust losses such as Huber or Tukey are used to resist outliers. Kalman versus MAP; robust costs The same formulation goes by many names: factor graph optimization, graph-SLAM, full smoothing, or smoothing and mapping (SAM). When the only variables are poses and each factor links two poses, it is called pose graph optimization. Names

Cadena et al. state that MAP estimation has been shown to be more accurate and efficient than the original nonlinear filters. They add a caveat: EKF-based systems such as MSCKF can also reach state-of-the-art performance, especially when the linearization points are accurate. MAP versus filtering

Pose graphs and Gauss–Newton

Grisetti and colleagues describe graph-based SLAM concretely. Each node is a robot pose. Each edge is a spatial constraint between two poses. It comes either from odometry between consecutive poses or from aligning two observations of the same area. Edge ⟨i,j⟩\langle i,j\rangle carries a measured relative pose zijz_{ij} and its information matrix Ωij\Omega_{ij}. Its error eij=zij−z^ij(xi,xj)e_{ij}=z_{ij}-\hat z_{ij}(x_i,x_j) compares the measurement with the relative pose implied by the current guesses. Graph-based SLAM, eqs. 2–5 Gauss–Newton minimizes the total error by repeatedly linearizing each eije_{ij} around the current guess and solving a linear system: Gauss–Newton, eqs. 6–16

F(x)=∑⟨i,j⟩∈Ceij⊤Ωijeij,H Δx⋆=−b,H=∑Jij⊤ΩijJij,b=∑Jij⊤ΩijeijF(x)=\sum_{\langle i,j\rangle\in\mathcal{C}} e_{ij}^\top\Omega_{ij}e_{ij},\qquad H\,\Delta x^\star=-b,\quad H=\sum J_{ij}^\top\Omega_{ij}J_{ij},\quad b=\sum J_{ij}^\top\Omega_{ij}e_{ij}

In words: FF adds up the weighted squared errors over the set C\mathcal{C} of constrained pairs. Each step builds the matrix HH and vector bb from the edge Jacobians JijJ_{ij}, which say how each error changes when the poses move. It then solves for the correction Δx⋆\Delta x^\star and adds it to the poses.

Three facts make this practical. First, HH is sparse. An edge only fills the blocks of the two poses it links, so the number of non-zero blocks is twice the number of constraints plus the number of nodes. Sparse Cholesky factorization then solves the system fast. Sparsity Cadena et al. call this sparsity, shaped by the graph’s topology, the key insight behind modern fast and incremental solvers. Sparse solvers

Second, every edge error depends only on relative poses. Moving or rotating the whole graph rigidly changes no error, so the system is under-determined. This is called gauge freedom. Common practice fixes one node, for example by adding the identity matrix to its block of HH. Gauge freedom, Algorithm 1

Third, angles wrap around, so poses do not live in ordinary Euclidean space. Grisetti et al. compute each increment in a local Euclidean parameterization and apply it with a special “box-plus” operator. In 2-D, normalizing the angle after each update is enough. Manifolds, eqs. 20–27

Grisetti et al. also separate two kinds of SLAM. Filtering, or online SLAM, estimates only the current pose and the map. Smoothing, or full SLAM, estimates the whole trajectory from all measurements, usually by least squares. Online and full SLAM

Front-end and back-end

A SLAM system has two halves. The front-end turns raw sensor data into constraints. It extracts features, decides which measurement belongs to which landmark or place (data association), detects loop closures and supplies initial guesses. The back-end runs the optimization above on those constraints, and can feed results back to loop-closure detection. Front-end and back-end Grisetti et al. restrict data association to the most likely arrangement of the graph, leave it to the front-end, and assume it is given and correct. Data association

A square loop with one true and one false closure

This section runs a tiny pose-graph SLAM to show drift, the effect of a loop closure, gauge freedom, and what a false loop closure does. The program is an original synthetic example, numpy only, seeded with default_rng(16). A robot drives counter-clockwise around a 5 m × 5 m square, 1 m per step, turning 90° at each corner. That is 20 moves and 21 poses, and pose 20 is back at pose 0. Odometry is the true motion plus Gaussian noise: 0.05 m per axis and 0.02 rad in heading. Each edge uses the matching information matrix. Gauss–Newton uses analytic Jacobians, checked against finite differences. The first pose is anchored by adding the identity to its block, and the linear system is solved with a short hand-written Cholesky routine. All numbers are toy values.

import numpy as np

# Synthetic 2-D pose-graph SLAM solved by Gauss-Newton (original toy, not real data).
# Pose = (x, y, theta). Edge (i, j, z_ij) says: pose j seen from pose i is z_ij.


def wrap(a):
    return (a + np.pi) % (2.0 * np.pi) - np.pi


def rot(t):
    c, s = np.cos(t), np.sin(t)
    return np.array([[c, -s], [s, c]])


def compose(a, b):
    p = a[:2] + rot(a[2]) @ b[:2]
    return np.array([p[0], p[1], wrap(a[2] + b[2])])


def relative(a, b):
    p = rot(a[2]).T @ (b[:2] - a[:2])
    return np.array([p[0], p[1], wrap(b[2] - a[2])])


def edge_error(xi, xj, z):
    return relative(z, relative(xi, xj))


def edge_jacobians(xi, xj, z):
    ri, rz = rot(xi[2]), rot(z[2])
    dri = np.array([[-np.sin(xi[2]), np.cos(xi[2])], [-np.cos(xi[2]), -np.sin(xi[2])]])
    dt = xj[:2] - xi[:2]
    A = np.zeros((3, 3))
    B = np.zeros((3, 3))
    A[:2, :2] = -rz.T @ ri.T
    A[:2, 2] = rz.T @ dri @ dt
    A[2, 2] = -1.0
    B[:2, :2] = rz.T @ ri.T
    B[2, 2] = 1.0
    return A, B


def chol_solve(H, rhs):
    L = np.linalg.cholesky(H)
    m = len(rhs)
    y = np.zeros(m)
    for k in range(m):
        y[k] = (rhs[k] - L[k, :k] @ y[:k]) / L[k, k]
    sol = np.zeros(m)
    for k in range(m - 1, -1, -1):
        sol[k] = (y[k] - L[k + 1:, k] @ sol[k + 1:]) / L[k, k]
    return sol


def cost(x, edges, omega):
    return sum(float(e @ omega @ e) for e in (edge_error(x[i], x[j], z) for i, j, z in edges))


def gauss_newton(x0, edges, omega, iters=10, anchor=True):
    x = x0.copy()
    n = len(x)
    history = [cost(x, edges, omega)]
    for _ in range(iters):
        H = np.zeros((3 * n, 3 * n))
        b = np.zeros(3 * n)
        for i, j, z in edges:
            e = edge_error(x[i], x[j], z)
            A, B = edge_jacobians(x[i], x[j], z)
            si, sj = slice(3 * i, 3 * i + 3), slice(3 * j, 3 * j + 3)
            H[si, si] += A.T @ omega @ A
            H[si, sj] += A.T @ omega @ B
            H[sj, si] += B.T @ omega @ A
            H[sj, sj] += B.T @ omega @ B
            b[si] += A.T @ omega @ e
            b[sj] += B.T @ omega @ e
        rank_free = np.linalg.matrix_rank(H)
        if anchor:
            H[:3, :3] += np.eye(3)
        dx = chol_solve(H, -b)
        x = x + dx.reshape(n, 3)
        x[:, 2] = wrap(x[:, 2])
        history.append(cost(x, edges, omega))
        if np.max(np.abs(dx)) < 1e-10:
            break
    return x, history, rank_free


def pos_rmse(x, truth):
    return float(np.sqrt(np.mean(np.sum((x[:, :2] - truth[:, :2]) ** 2, axis=1))))


# ground truth: a 5 m x 5 m square driven counter-clockwise, 1 m per step, 20 steps
moves = []
for side in range(4):
    for step in range(5):
        turn = np.pi / 2 if step == 4 else 0.0
        moves.append(np.array([1.0, 0.0, turn]))
truth = [np.zeros(3)]
for m in moves:
    truth.append(compose(truth[-1], m))
truth = np.array(truth)
n = len(truth)

rng = np.random.default_rng(16)
sig_t, sig_r = 0.05, 0.02
odom = [m + rng.normal(0.0, [sig_t, sig_t, sig_r]) for m in moves]
omega = np.diag([1 / sig_t**2, 1 / sig_t**2, 1 / sig_r**2])

dead = [truth[0].copy()]
for z in odom:
    dead.append(compose(dead[-1], z))
dead = np.array(dead)

print("== 1. dead reckoning (odometry only) ==")
print(f"poses: {n}, odometry noise sigma: {sig_t} m, {sig_r} rad")
print(f"true end pose: {np.round(truth[-1], 4) + 0.0}  (back at the start)")
print(f"dead-reckoned end pose: {np.round(dead[-1], 4)}")
print(f"end position error: {np.linalg.norm(dead[-1, :2] - truth[-1, :2]):.4f} m")
print(f"position RMSE over all poses: {pos_rmse(dead, truth):.4f} m")
err_dead = np.linalg.norm(dead[:, :2] - truth[:, :2], axis=1)
print(f"largest error: pose {int(np.argmax(err_dead))}, {err_dead.max():.4f} m")

# check analytic Jacobians against central differences
i, j, z = 3, 4, odom[3]
A, B = edge_jacobians(dead[i], dead[j], z)
num = np.zeros((3, 6))
h = 1e-6
for k in range(6):
    d = np.zeros(6)
    d[k] = h
    ep = edge_error(dead[i] + d[:3], dead[j] + d[3:], z)
    em = edge_error(dead[i] - d[:3], dead[j] - d[3:], z)
    num[:, k] = (ep - em) / (2 * h)
print(f"Jacobian check, max |analytic - numeric| < 1e-6: {np.max(np.abs(np.hstack([A, B]) - num)) < 1e-6}")

odom_edges = [(k, k + 1, odom[k]) for k in range(n - 1)]
x_o, hist_o, rank_o = gauss_newton(dead, odom_edges, omega)
print("\n== 2. optimise the odometry-only graph (a chain, no loop) ==")
print(f"initial and final cost below 1e-12: {hist_o[0] < 1e-12 and hist_o[-1] < 1e-12}")
print(f"max change from dead reckoning below 1e-9: {np.max(np.abs(x_o - dead)) < 1e-9}")
print(f"rank of H without anchor: {rank_o} of {3 * n} (3 gauge directions)")

z_loop = rng.normal(0.0, [sig_t, sig_t, sig_r])
loop_edges = odom_edges + [(n - 1, 0, z_loop)]
x_l, hist_l, rank_l = gauss_newton(dead, loop_edges, omega)
print("\n== 3. add one loop closure: pose 20 re-observes pose 0 ==")
print("Gauss-Newton cost per iteration: " + ", ".join(f"{c:.3f}" for c in hist_l))
print(f"rank of H without anchor: {rank_l} of {3 * n}")
print(f"end position error: {np.linalg.norm(x_l[-1, :2] - truth[-1, :2]):.4f} m")
print(f"position RMSE over all poses: {pos_rmse(x_l, truth):.4f} m")
k_worst = int(np.argmax(np.linalg.norm(x_l[:, :2] - truth[:, :2], axis=1)))
print(f"largest remaining error at pose {k_worst}: "
      f"{np.linalg.norm(x_l[k_worst, :2] - truth[k_worst, :2]):.4f} m")

z_false = np.zeros(3)
false_edges = loop_edges + [(10, 0, z_false)]
x_f, hist_f, _ = gauss_newton(dead, false_edges, omega, iters=30)
print("\n== 4. a false loop closure (perceptual aliasing): pose 10 claimed to equal pose 0 ==")
print(f"true distance pose 10 to pose 0: {np.linalg.norm(truth[10, :2] - truth[0, :2]):.4f} m")
print(f"cost: start {hist_f[0]:.1f}, after first step {hist_f[1]:.1f}, final {hist_f[-1]:.1f} "
      f"(vs {hist_l[-1]:.3f} with the correct graph)")
print(f"position RMSE over all poses: {pos_rmse(x_f, truth):.4f} m")
res = [float(edge_error(x_f[a], x_f[b], zz) @ omega @ edge_error(x_f[a], x_f[b], zz)) for a, b, zz in false_edges]
print(f"largest single-edge cost: edge {false_edges[int(np.argmax(res))][:2]} = {max(res):.1f}")

The program prints:

== 1. dead reckoning (odometry only) ==
poses: 21, odometry noise sigma: 0.05 m, 0.02 rad
true end pose: [0. 0. 0.]  (back at the start)
dead-reckoned end pose: [-0.082   0.3584 -0.0503]
end position error: 0.3676 m
position RMSE over all poses: 0.2529 m
largest error: pose 15, 0.4042 m
Jacobian check, max |analytic - numeric| < 1e-6: True

== 2. optimise the odometry-only graph (a chain, no loop) ==
initial and final cost below 1e-12: True
max change from dead reckoning below 1e-9: True
rank of H without anchor: 60 of 63 (3 gauge directions)

== 3. add one loop closure: pose 20 re-observes pose 0 ==
Gauss-Newton cost per iteration: 58.534, 1.408, 1.250, 1.250, 1.250, 1.250, 1.250
rank of H without anchor: 60 of 63
end position error: 0.1088 m
position RMSE over all poses: 0.2064 m
largest remaining error at pose 15: 0.3537 m

== 4. a false loop closure (perceptual aliasing): pose 10 claimed to equal pose 0 ==
true distance pose 10 to pose 0: 7.0711 m
cost: start 44285.8, after first step 95824.5, final 6850.8 (vs 1.250 with the correct graph)
position RMSE over all poses: 3.7813 m
largest single-edge cost: edge (10, 0) = 817.8

Part 1 shows drift. Integrating the noisy odometry ends at (−0.082,0.3584,−0.0503)(-0.082, 0.3584, -0.0503) instead of (0,0,0)(0,0,0). The end position is off by 0.3676 m, the position RMSE (root-mean-square error) over all poses is 0.2529 m, and the worst pose is pose 15, off by 0.4042 m. The analytic Jacobians agree with central differences.

Part 2 optimizes the odometry-only graph, which is a chain with no loop. Nothing changes: the cost is already essentially zero and no pose moves by more than 10−910^{-9}. A chain of relative constraints can always be satisfied exactly, so without a loop there is nothing to correct. Without the anchor, HH has rank 60 out of 63. The three missing directions are the gauge freedom: shifting the whole map in xx or yy, or rotating it.

Part 3 adds one loop closure: pose 20 re-observes pose 0, with the same noise level as odometry. The cost falls from 58.534 to 1.408 after one step and to 1.250 after two, then stays there. The rank without the anchor is still 60 of 63: a loop closure is a relative constraint, so it cannot fix the global frame. The end position error falls from 0.3676 m to 0.1088 m and the RMSE from 0.2529 m to 0.2064 m. The largest remaining error, 0.3537 m, is again at pose 15, far from the closure. One loop closure removes most of the error near the closure and spreads the correction along the loop. But the optimum given the data is still not the truth.

Part 4 adds a false loop closure on top of the correct graph. This mimics perceptual aliasing, where two different places look the same to the sensors. The graph is told that pose 10, the far corner 7.0711 m away, coincides with pose 0, with the same high confidence as every other edge. The cost starts at 44285.8 and rises to 95824.5 after the first Gauss–Newton step before settling at 6850.8, compared with 1.250 for the correct graph. The rise is our own observation: the first linearization point is very poor, and an undamped step overshoots. This is one motivation for damped solvers such as Levenberg–Marquardt, which the sources name but which we did not test. The final map has a position RMSE of 3.7813 m. The largest single-edge cost, 817.8, sits on the false edge (10, 0). That residual is the kind of cue that robust back-ends use to question a constraint.

Where SLAM goes wrong

This section lists the main ways SLAM fails, and what the example does and does not show.

Wrong loop closures. Perceptual aliasing produces wrong data associations. Cadena et al. warn that wrong loop closures can severely corrupt the MAP estimate, which motivates back-ends that reason about whether each constraint is valid from its residual. Perceptual aliasing Part 4 shows the effect at toy scale: one false edge turns a 0.2064 m RMSE into a 3.7813 m RMSE, and the optimizer still converges. A converged optimizer only means the constraints are satisfied as well as possible, not that they are true.

Local minima. SLAM is nonconvex. Iterative solvers such as Gauss–Newton guarantee only local convergence, and Cadena et al. note that a local minimum usually gives a completely wrong estimate. A lack of observability, meaning some quantity cannot be determined from the data, shows up as a rank-deficient linear system. They also report that, when strong duality holds, pose-graph optimization can be solved globally through semidefinite programming (SDP), and that candidate solutions can be verified. Theory, local minima, SDP We did not read or test those methods.

Linearization and inconsistency. EKF-SLAM linearizes, and Durrant-Whyte and Bailey call the resulting inconsistency inevitable and sometimes dramatic. Its convergence and consistency are guaranteed only in the linear case, and the “relative map never diverges” result is likewise proved only for linear-Gaussian systems. EKF-SLAM issues; footnote 2 FastSLAM avoids the joint covariance but degenerates through resampling. Degeneracy

A changing world. The formulation above treats the map as static. Cadena et al. note that current SLAM algorithms can easily be made to fail in highly dynamic environments, and they count such settings among the open problems. Static-world assumption

“Is SLAM solved?” The answer depends on who is asked and when. In 2006 Durrant-Whyte and Bailey called SLAM solved at a theoretical and conceptual level, with substantial practical issues remaining. Solved in theory In 2016 Cadena et al. said the answer depends on the robot, the environment and the performance required. They describe 2-D indoor mapping with wheel encoders and a laser scanner, at better than 10 cm accuracy, as largely solved. Fast motion, highly dynamic environments and strict performance requirements remain open. Is SLAM solved

This example is a toy. It has one seed, one square loop, perfect data association for the correct edges, and no real sensor. Its improvement from one loop closure should not be read as a typical figure for real systems.

Exercises

These exercises cover the correlation argument, a hand-solved pose graph, the gap between low cost and a correct map, method choice and gauge freedom.

  1. Why can a robot not simply localize first and then map, or map first and then localize, when neither the map nor the pose is known? Use the correlation argument.

    Answer: Each landmark estimate inherits the error of the robot pose at the moment it was observed. All landmarks seen from uncertain poses therefore share error components and are correlated. Splitting the problem into a pose part and a map part throws those correlations away and, according to Durrant-Whyte and Bailey, gives inconsistent estimates. Keeping the joint posterior lets one re-observed landmark correct the pose and, through the correlations, also landmarks that are not currently visible. Mapping alone assumes the trajectory is known, and localization alone assumes the map is known; neither assumption holds here.

  2. Three poses on a line, with x0x_0 fixed at 0. Odometry says x1−x0=1.0x_1-x_0=1.0 and x2−x1=1.0x_2-x_1=1.0, each with variance 0.01 (information 100). A loop-closure-like measurement says x2−x0=1.8x_2-x_0=1.8, also with variance 0.01. Find the least-squares x1x_1 and x2x_2 and the final residuals.

    Answer: Minimize 100[(x1−1)2+(x2−x1−1)2+(x2−1.8)2]100[(x_1-1)^2+(x_2-x_1-1)^2+(x_2-1.8)^2]. Setting the derivative with respect to x1x_1 to zero gives 2x1−x2=02x_1-x_2=0. Setting the derivative with respect to x2x_2 to zero gives −x1+2x2=2.8-x_1+2x_2=2.8. So x2=2x1x_2=2x_1, then 3x1=2.83x_1=2.8, giving x1=0.9333x_1=0.9333 and x2=1.8667x_2=1.8667. The residuals are −0.0667-0.0667, −0.0667-0.0667 and +0.0667+0.0667. The 0.2 disagreement is shared equally by the three equally weighted constraints. The problem is linear, so one Gauss–Newton step gives the exact answer. If x0x_0 were not fixed, adding the same constant to all three poses would leave the cost unchanged: that is gauge freedom in one dimension.

  3. A teammate says: “The optimizer reached a low cost, so the map is right.” Give counterexamples from this article.

    Answer: (i) In Part 4 Gauss–Newton converges with a false loop closure. The cost is minimized for that constraint set (6850.8), but the map is wrong by 3.7813 m RMSE. A cost far above the correct graph’s 1.250, and one edge dominating it (817.8 on the false edge), are the warning signs. (ii) SLAM is nonconvex; iterative solvers guarantee only local convergence, and Cadena et al. note that a local minimum usually gives a completely wrong estimate. (iii) Even with correct data, Part 3 still errs by 0.3537 m at pose 15: optimal given the data is not the same as true.

  4. Choose an approach and justify it: (a) a laser-equipped indoor robot that must build a 2-D map of an office floor offline, after a teleoperated run; (b) a robot that must track thousands of point landmarks while its pose uncertainty is strongly non-Gaussian early in the run; (c) a drone that needs only short-horizon motion estimates for control and never revisits a place.

    Answer: (a) Graph-based SLAM with pose-graph optimization: full smoothing over the whole trajectory using sparse least squares, as in Grisetti et al. Cadena et al. report MAP as more accurate and efficient than filtering, and describe 2-D indoor laser mapping as largely solved. (b) A Rao-Blackwellized particle filter such as FastSLAM. Particles can represent non-Gaussian pose hypotheses, and each carries independent landmark Gaussians, avoiding EKF-SLAM’s quadratic joint covariance. The caveat is particle degeneracy. (c) Odometry, for example visual-inertial, without loop closure. Cadena et al. note that without loop closures SLAM reduces to odometry; full SLAM adds cost without benefit if no place is revisited and no global map is needed. Details belong to particle filter and sensor fusion.

  5. In the example, HH without the anchor has rank 60 for 21 poses. Explain the number, and why adding a loop closure does not change it.

    Answer: 21 poses with 3 values each give 63 variables. Every edge error depends only on relative poses, so moving the whole graph rigidly in xx, yy or θ\theta leaves every error unchanged. That gives HH a three-dimensional null space, hence rank 63−3=6063-3=60. A loop closure is also a relative constraint, so it cannot fix the global frame either. Only an absolute measurement, such as a GPS fix or a prior on one pose, or an explicit anchor, removes the gauge freedom.

History and further reading

This section retells the history as the sources give it and points to related topics. According to Durrant-Whyte and Bailey, the probabilistic SLAM problem was born at the 1986 IEEE Robotics and Automation Conference in San Francisco. Work by Smith, Self and Cheeseman then showed that landmark estimates are necessarily correlated through the common error in the vehicle’s location. So a consistent solution needs one joint state for the vehicle and every landmark. History

At first, researchers assumed the map errors would not converge, and so they kept the landmark filters separate. Durrant-Whyte and Bailey describe the conceptual breakthrough as realizing that the joint problem does converge, and that the correlations between landmarks are the critical, helpful part. The structure of the problem, the convergence result and the acronym “SLAM” were first presented in a survey at the 1995 International Symposium on Robotics Research. A footnote mentions the older name CML, concurrent mapping and localization. History, footnote 1

The optimization view grew in parallel. Grisetti et al. point to Lu and Milios (1997) as the start of graph-based SLAM, and Cadena et al. call that work seminal for the MAP formulation. Lu and Milios Cadena et al. divide the field’s history into a classical age (1986–2004), an algorithmic-analysis age (2004–2015), and what they propose as a robust-perception age. They list software for sparse optimization such as GTSAM, g2o, Ceres, iSAM and SLAM++. Ages and solvers We did not read Smith, Self and Cheeseman, Lu and Milios, or any of these libraries’ documentation; the statements above are as given by the sources.

For related ideas, structure from motion solves a closely related least-squares problem called bundle adjustment, and Newton’s method is the root of Gauss–Newton. Within this volume, occupancy grid maps describes dense grid maps, a map type usually built from range sensors such as lasers, and robot localization covers what a robot does once a map exists. The overview of robot learning problems maps the wider robotics cluster that SLAM belongs to.

Make a prediction, then check

A 1-D pose graph: x₀ fixed at 0; odometry x₁ − x₀ = 1.0 and x₂ − x₁ = 1.0, plus a constraint x₂ − x₀ = 1.8, all with equal variance. What is the least-squares solution?

Choose one answer

Learning objectives

  • Write the SLAM joint posterior with its time and measurement updates, use the shared pose error to explain why landmark estimates are correlated and why localisation and mapping cannot be done separately, and state how EKF-SLAM and FastSLAM each represent this posterior and at what cost.
  • Formulate pose-graph SLAM as nonlinear least squares, carry out Gauss–Newton steps by hand or in code, explain gauge freedom, sparsity and the role of loop closures, and recognise failures caused by false loop closures and local minima.

Prerequisites & connections

Explore related knowledge →

References

  1. Simultaneous Localisation and Mapping (SLAM): Part I The Essential Algorithms — scoped
    Hugh Durrant-Whyte; Tim Bailey · 2006
  2. Past, Present, and Future of Simultaneous Localization and Mapping: Towards the Robust-Perception Age — scoped
    Cesar Cadena; Luca Carlone; Henry Carrillo; Yasir Latif; Davide Scaramuzza; José Neira; Ian Reid; John J. Leonard · 2016
  3. A Tutorial on Graph-Based SLAM — scoped
    Giorgio Grisetti; Rainer Kümmerle; Cyrill Stachniss; Wolfram Burgard · 2010

Version1 · Editorial status: Recorded technical checks completed

View technical check record (AI)

Claude · 2026-12-03 · Independent AI check (Claude subagent, not the author; not a human or expert review). Gemini-app style edits logged in gemini-edits-016a.json were applied to the opening sections before this check; research was done by a separate research subagent (facts.md) and the prose by a writer subagent. I ran example.py with the pinned interpreter (numpy 1.26.4) and diffed it against example.stdout.txt (identical), confirmed the python block in en.mdx and zh.mdx is byte-identical to example.py and the printed-output block matches the stdout, and matched every quoted number (end pose, 0.3676/0.2529/0.4042 m, rank 60 of 63, cost sequence 58.534/1.408/1.250, 0.1088/0.2064/0.3537 m, 44285.8/95824.5/6850.8, 3.7813 m, edge (10, 0) = 817.8). I re-derived the 1-D pose-graph exercise (x1 = 0.9333, x2 = 1.8667, residuals ±0.0667), the rank-60 gauge argument and the equation readings. I downloaded and re-read with pdftotext the Durrant-Whyte and Bailey preprint (abstract, §I 'solved at a theoretical and conceptual level', §II history incl. 1986 conference, Smith-Self-Cheeseman, 1995 ISRR survey, footnote 1 CML, footnote 2 linear-Gaussian, the four EKF-SLAM issues, FastSLAM), Cadena et al. arXiv v4 (§I: reset, infinite corridor, VIN as reduced SLAM, '< 10cm' largely solved, highly dynamic environments listed among settings where current algorithms fail; §II eqs. 2-4 incl. the k = 0 prior term, Kalman vs MAP, Laplace/Huber/Tukey, 'more accurate and efficient' with the MSCKF caveat, Lu and Milios 'seminal'; §III wrong loop closures and residual-based back-ends; §VII local minima and strong duality) and the Grisetti et al. preprint (Lu and Milios 1997, most likely topology, occupancy-grid figure caption). I did not re-read Grisetti's Gauss-Newton derivation line by line beyond facts.md, nor any original paper the sources cite (Smith-Self-Cheeseman, Lu-Milios, SLAM libraries). I compared zh and en section by section and checked data.json IDs against src/data/catalogue.txt and the quiz answer. The Gemini edits changed wording only; none changed a fact, hedge or attribution, and none needed reverting. The cost rise after the first Gauss-Newton step on the false loop closure is labelled as our own observation.

  • Program output under the pinned interpreter matches example.stdout.txt, both code blocks are byte-identical to example.py, and every quoted number matches the output.
  • Re-checked the Durrant-Whyte and Bailey preprint: the 1986 conference, the 1995 ISRR survey and the acronym, footnote 2's linear-Gaussian limit, the four EKF-SLAM issues, the FastSLAM factorization and degeneracy.
  • Re-checked Cadena et al.: MAP as the de-facto standard with the MSCKF caveat, the k = 0 prior term in eq. 4, wrong loop closures and residuals, local minima and strong duality, the 'is SLAM solved' and highly dynamic environment statements.
  • The 1-D pose-graph exercise, the rank-60 gauge argument and the equation readings are correct; the cost rise after the first step with the false loop closure is labelled as our own observation.
  • Gemini style edits changed wording only, not facts, hedges or attributions; zh and en still agree.

Source locations checked:

  • Simultaneous Localisation and Mapping (SLAM): Part I The Essential Algorithms — scoped · pdftotext of the 9-page author preprint (Creator: TeX output 2006.09.08). p. 1: abstract, §I (definition; 'solved at a theoretical and conceptual level'), §II start (1986 ICRA San Francisco). p. 2: Smith–Self–Cheeseman correlation result, quadratic scaling, assumed non-convergence, 1995 ISRR coining of 'SLAM', Csorba, ISRR'99, 2000/2002 ICRA workshops, footnote 1 (CML). p. 3: definitions x_k, u_k, m_i, z_ik; eqs. 1–5; mapping-only and localisation-only forms; §III-C non-factorisation, correlated landmark errors. p. 4: monotonic correlation growth, footnote 2 (proved only for linear Gaussian case), spring network Fig. 2, §IV intro, eqs. 6–7. p. 5: eqs. 8–11, convergence / computation / data association / non-linearity issues, Fig. 3. pp. 6–7: Rao-Blackwellisation, eq. 12, Fig. 4, SIS, eqs. 13–19, FastSLAM 1.0 vs 2.0, degeneration. pp. 7–8: Newman et al. explore-and-return, Guivant–Nebot Victoria Park, Tables 1–2. NOT read: p. 9 and full references; Part II.
  • Past, Present, and Future of Simultaneous Localization and Mapping: Towards the Robust-Perception Age — scoped · pdftotext of arXiv 1606.05830v4 (25 PDF pages; printed page = PDF page − 1). p. 1 abstract, §I (definition, two reasons for maps, loop closure, GPS/beacons). p. 2: classical age 1986–2004, algorithmic-analysis age 2004–2015, Table I, 'do robots need SLAM' (odometry, VIN as reduced SLAM, infinite corridor), 'is SLAM solved'. p. 3: Fig. 1, maturity examples (<10 cm 2-D laser indoor largely solved), robust-perception age requirements 1–4, footnote 1, Fig. 2, §II start. p. 4: MAP eqs. 1–4, Lu–Milios origin, Kalman vs MAP equivalence only in linear Gaussian case, factor graph Fig. 3, Laplace/robust losses, BA comparison. p. 5: Gauss–Newton/LM, sparsity, libraries, names (graph-SLAM, SAM), pose graph optimisation, MAP vs filtering, front-end and data association. pp. 5–6: §III opening, perceptual aliasing, static-world assumption, loop closure detection/validation, wrong loop closures corrupt MAP. pp. 8–10: §V opening (landmark vs occupancy grid in 2-D), spatial-partitioning paragraph. pp. 13–14: §VII (ML properties, nonconvexity, local minima, footnote 6 rank deficiency, SDP/duality, verification). NOT read: rest of §III open problems, §IV, §VI, §VIII, §IX, most of §X.
  • A Tutorial on Graph-Based SLAM — scoped · pdftotext of the 11-page preprint. p. 1: abstract, §I (filtering = online SLAM vs smoothing = full SLAM; Lu–Milios 1997), start of §II. p. 2: eq. 1, map representations, DBN Fig. 4. p. 3: transition/observation models, graph-based formulation, front-end vs back-end, Fig. 5. pp. 3–4: §III related work (Lu–Milios, Gutmann–Konolige, Dellaert–Kaess sparse factorisation, iSAM, χ² and joint compatibility tests). pp. 4–5: §IV (most likely topology, data association assumed given), eqs. 2–5, Fig. 7. p. 5: §IV-A eqs. 6–16 (sparse H, non-zero block count, sparse Cholesky, Euclidean assumption invalid for SLAM). p. 6: §IV-B eqs. 17–19, gauge invariance and fixing the first node, Algorithm 1. pp. 6–7: §IV-C manifold, ⊞ operator, eqs. 20–27. p. 8: start of Algorithm 2 only. NOT read: §V experiments beyond its first paragraph, conclusions, references (pp. 8–11).

Related topics

No matches. Try a synonym or acronym.

0 results shown

Wrap the whole query in double quotes for a phrase match.