Skip to main content
Open In Colab In the occupancy grid section, scans placed at odometry poses produced a distorted map. Estimating the poses from the measurements requires knowing which part of the map each measurement comes from. EKF localization assumed this was known: the correspondence variable ctic^i_t was given, for example by a fiducial marker ID. A laser scanner or a camera does not provide it. Correspondence estimation assigns each measurement to a part of the map, or marks it as new. The filter then uses the assignment as if it were correct. A wrong assignment moves the pose estimate, and in SLAM it also moves the wrong landmark. Thrun, Burgard and Fox (2005, Section 7.6) note that a filter that keeps only the most likely correspondence tends to diverge when that correspondence is wrong. The form of the problem depends on the map:
  • Landmark maps: assign each detection to a landmark. This is data association, and it applies to any sensor that detects landmarks.
  • Point maps, as in lidar scan matching: pair points between two scans.
  • Image feature maps: match keypoints by appearance.

Landmark data association

Maximum likelihood correspondence

The robot has a predicted pose belief N(μˉt,Σˉt)\mathcal{N}(\bar\mu_t, \bar\Sigma_t) and a map of landmarks mkm_k. For a measurement ztiz^i_t and landmark kk, the predicted measurement is z^tk=h(μˉt,k,m)\hat z^k_t = h(\bar\mu_t, k, m), as on the EKF localization page. If ztiz^i_t came from landmark kk, the innovation zti−z^tkz^i_t - \hat z^k_t is approximately Gaussian with zero mean and covariance Ψk=Htk Σˉt Htk⊤+Qt.\Psi_k = H^k_t \, \bar\Sigma_t \, H^{k\top}_t + Q_t. The first term is the pose uncertainty mapped into measurement space and QtQ_t is the sensor noise. The maximum likelihood correspondence is the landmark under which the measurement is most likely: c^ti=arg⁡max⁡k  det⁡(2πΨk)−1/2exp⁡ ⁣(−12Dik2),Dik2=(zti−z^tk)⊤Ψk−1(zti−z^tk).\hat c^i_t = \arg\max_k \; \det(2\pi\Psi_k)^{-1/2} \exp\!\left(-\tfrac{1}{2} D^2_{ik}\right), \qquad D^2_{ik} = (z^i_t - \hat z^k_t)^\top \Psi_k^{-1} (z^i_t - \hat z^k_t). Dik2D^2_{ik} is the Mahalanobis distance. Taking −2ln⁡-2\ln of the likelihood and dropping the constant gives the equivalent rule c^ti=arg⁡min⁡k  (Dik2+ln⁡det⁡Ψk).\hat c^i_t = \arg\min_k \; \left( D^2_{ik} + \ln\det\Psi_k \right). The determinant term matters because Ψk\Psi_k differs from landmark to landmark: the Jacobian HtkH^k_t depends on where the landmark is. A landmark with a large Ψk\Psi_k gets a small Mahalanobis distance for almost any measurement, and ln⁡det⁡Ψk\ln\det\Psi_k charges it for that spread. Thrun, Burgard and Fox (2005, Section 7.6.2) derive the likelihood by integrating the measurement model over the predicted belief. Each measurement is decided separately, which assumes the measurements are conditionally independent given the pose.

Gating

The minimum always names a landmark, also for a measurement of something that is not in the map. A gate rejects these. For a correct correspondence, Dik2D^2_{ik} is chi-squared distributed with two degrees of freedom (range and bearing). A measurement is accepted for landmark kk only if Dik2D^2_{ik} is below the 99th percentile of χ22\chi^2_2, which is 9.21. A measurement that passes no gate is an outlier or a new landmark. EKF SLAM starts a new landmark when the distance to every landmark in the map exceeds a threshold α\alpha (Thrun, Burgard and Fox, 2005, Section 10.3.1). Spurious measurements would then create false landmarks, so practical systems keep new landmarks on a provisional list until they have been seen several times (Section 10.3.3). The code defines a map of six landmarks and the range-bearing model, and computes Dik2D^2_{ik} for four measurements.
Case 1: the predicted heading is off by 2 degrees, and the covariance reflects that. The landmarks are far apart compared to the uncertainty.
Each row has one entry below the gate, at the true landmark. The next smallest entry in any row is 29.7. All four measurements are assigned correctly. Case 2: the predicted heading is off by 15 degrees. The covariance is consistent with this error, with standard deviations of 10 degrees in heading and 0.5 m in position. Seen from the robot, landmarks 0 and 1 are about 15 degrees apart.
Output from cell 5 Blue dots are the measurements placed in the world from the predicted pose. Lines join each measurement to its assigned landmark, green if correct and red if wrong. With the 15 degree error, all measurements are rotated about the robot by the same angle. The measurement of landmark 0 falls near landmark 1 and is assigned to it, so landmark 1 gets two measurements. The larger covariance also lowers every distance. For the first measurement both landmark 0 (1.4) and landmark 1 (0.7) pass the gate, so the gate does not catch the error. The six values of ln⁡det⁡Ψk\ln\det\Psi_k lie between −4.7-4.7 and −4.5-4.5, so the determinant term barely changes the scores, and the likelihood also picks landmark 1.

Joint compatibility

The measurements share one pose error. A heading error rotates all of them by the same angle, so a set of assignments is plausible only if one pose explains all of it. The joint compatibility test checks this. For a hypothesis that pairs measurements i1,…,ini_1, \ldots, i_n with landmarks k1,…,knk_1, \ldots, k_n, stack the innovations and Jacobians: ν=[zti1−z^tk1⋮ztin−z^tkn],H=[Htk1⋮Htkn],S=HΣˉtH⊤+diag⁡(Qt,…,Qt).\nu = \begin{bmatrix} z^{i_1}_t - \hat z^{k_1}_t \\ \vdots \\ z^{i_n}_t - \hat z^{k_n}_t \end{bmatrix}, \qquad H = \begin{bmatrix} H^{k_1}_t \\ \vdots \\ H^{k_n}_t \end{bmatrix}, \qquad S = H \bar\Sigma_t H^\top + \operatorname{diag}(Q_t, \ldots, Q_t). The off-diagonal blocks of HΣˉtH⊤H \bar\Sigma_t H^\top couple the measurements through the shared pose. The hypothesis is jointly compatible if ν⊤S−1ν\nu^\top S^{-1} \nu is below the χ2\chi^2 threshold for 2n2n degrees of freedom. Neira and Tardós (2001) find the largest jointly compatible hypothesis with joint compatibility branch and bound (JCBB). With four measurements, the code enumerates all hypotheses instead. A measurement may stay unassigned. The code keeps the jointly compatible hypothesis with the most pairings and breaks ties by the smaller joint distance.
Joint compatibility assigns all four measurements correctly, with a joint distance of 6.9 against a threshold of 20.1 for 8 degrees of freedom. The individual assignment uses landmark 1 twice and is not a valid hypothesis. Enumeration grows as (K+1)n(K+1)^n for nn measurements and KK landmarks; JCBB prunes this search.

Scan registration with ICP

A lidar map can also be a set of raw points. The motion between two scans is then estimated by aligning them, which again needs correspondences: which point in one scan is the same surface point as a given point in the other. The scans do not provide this, and from two poses the beams hit the walls at different points anyway. The iterative closest point algorithm (ICP) of Besl and McKay (1992) repeats four steps:
  1. Transform the new scan with the current motion estimate.
  2. Pair each point with its nearest point in the reference scan.
  3. Compute the rotation and translation that minimize the sum of squared distances between the pairs. For point pairs, the solution comes in closed form from the singular value decomposition of their cross-covariance matrix.
  4. Update the estimate. Stop when it no longer changes.
The correspondences are recomputed in every iteration from the current alignment. From a good initial estimate most nearest neighbors are correct pairs and the alignment improves. From a poor one most pairs are wrong, and ICP can converge to a wrong alignment, a local minimum of the error. The initial estimate usually comes from odometry or an IMU. Variants of ICP measure a different error between pairs, such as the distance from a point to the local surface, but form the pairs the same way. The code simulates a 2D lidar in a room with a box and a partition, takes two scans 1.2 m and 20 degrees apart, and aligns the second scan to the first.
Output from cell 9 From the odometry guess, 0.36 m and 8 degrees off, ICP ends within 0.01 m and 0.2 degrees of the true pose. The mean distance between paired points drops from 0.29 m to 0.06 m. It stays above zero because the two scans sample the walls at different points. From the 70 degree heading error, ICP stops at 111 degrees, 91 degrees from the true heading, with a mean pair distance of 0.67 m. A large residual like this points to a failed registration. In a room with repeated structure, a wrong alignment can also have a small residual.

Lidar features and loop closure

LOAM (Zhang and Singh, 2014) does not pair every point. It selects points on sharp edges and points on flat surfaces, using the curvature of the scan line around each point, and matches edge points to edge lines and surface points to planar patches in the map. The features are defined by local geometry. Loop closure is a correspondence at the scale of a place. A robot that returns to a mapped area has to recognize it so that the loop in the map can be closed. Scan Context (Kim and Kim, 2018) summarizes a lidar scan in a descriptor that is compared with stored scans. A false loop closure merges two different places and can distort the whole map. Landmark data association also applies to lidar. The Victoria Park dataset of Guivant and Nebot (2001), recorded from a vehicle in a park in Sydney, uses tree trunks detected in laser scans as landmarks. It is widely used to compare landmark-based SLAM algorithms.

Image feature matching

A detector finds keypoints, such as corners, that are likely to be detected again from another viewpoint. A descriptor encodes the image patch around each keypoint as a vector. Keypoints in two images are matched by descriptor distance, and the matches are checked with a geometric model, for example with RANSAC as in the homographies section. The descriptor has the role of the signature ss in the landmark measurement z=(r,ϕ,s)z = (r, \phi, s) of Probabilistic Robotics. Distinct signatures make landmarks easier to tell apart. Torralba, Isola and Freeman (2024, Section 44.3.3) cover hand-designed detectors and descriptors such as SIFT and ORB, and learned ones such as SuperPoint with the SuperGlue matcher. The stereo vision section uses matching for depth.

References


Found an error on this page? Report an issue.