# EKF SLAM and Mahalanobis distance?

So far I have done EKF Localization (known and unknown correspondences) and EKF SLAM for only known correspondences that are stated in Probabilistic Robotics. Now I moved to EKF SLAM with unknown correspondences. In the algorithm in page 322,

16.     $\Psi_{k} = H^{k} \bar{\Sigma}[H^{k}]^{T} + Q$

17.     $\pi_{k} = (z^{i} - \hat{z}^{k})^{T} \Psi^{-1}_{k}(z^{i} - \hat{z}^{k})$

18.     $endfor$

19.     $\pi_{N_{t+1}} = \alpha$

20.     $j(i) = \underset{k}{argmin} \ \ \pi_{k}$

21.     $N_{t} = max\{N_{t}, j(i)\}$

I don't understand the line 19. In the book page 323, The authors state

Line 19 sets the threshold for the creation of a new landmark: A new landmark is created if the Mahalanobis distance to all existing landmarks in the map exceeds the value $\alpha$. The ML correspondence is then selected in line 20.

what is $\alpha$ in line 19 and how is it computed? Also, what is the Mahalanobis distance? I did research about Mahalanobis distance but still I can't understand its role in EKF SLAM.

Edit: I found another book in my university's library Robotic Navigation and Mapping with Radar The authors state

The Mahalanobis distance measure in SLAM is define as $d^{2}_{M}(z^{j}_{k}, \hat{z}^{i}_{k})$, which provides a measure on the spatial difference between measurement $z^{j}_{k}$ and predicted feature measurement $\hat{z}^{i}_{k}$, given by $$d^{2}_{M}(z^{j}_{k}, \hat{z}^{i}_{k}) = (z^{j}_{k} - \hat{z}^{i}_{k})^{T} S^{-1}_{k}(z^{j}_{k}, \hat{z}^{i}_{k})$$ This value has to be calculated for all possible $(z^{j}_{k}, \hat{z}^{i}_{k})$ combinations, for which $$d_{M}(z^{j}_{k},\hat{z}^{i}_{k}) \leq \alpha$$ Often referred to as a validation gate.

Leave me to the same question what is $\alpha$?

The value of $\alpha$ is just some threshold Mahalanobis distance.

Let's say you have four entries in your map. You take a measurement, then you calculate four predicted measurements (one for each map entry). You can calculate the Mahalanobis distance between your measurement and each of your predictions. You now have four Mahalanobis distances. The landmark that produced the smallest Mahalanobis distance is most likely the landmark that you have measured. However, what if this Mahalanobis distance is really large? Well then it's likely that your measurement actually was of a new, previously unmapped landmark. The value of $\alpha$ is simply the threshold Mahalanobis distance where you decide whether your smallest Mahalanobis distance is indeed a measurement of a landmark in your map, or it is actually a new landmark.

If you decide it is a new landmark (the smallest Mahalanobis distance was larger than the threshold), you need to add it to your state. This step is not shown in the algorithm you posted. See my answer to another question on how to do that.

• To implement EKF Slam for known correspondence,what kind of sensor data you used? It is camera sensor with range and bearing angle? – user20203 Jun 15 '18 at 17:13
• @Saswati That is only tangentially related to this question, but a quick answer is there is only "known correspondences" if you provide that information. That is, there is no algorithm that tells you exactly what the correspondences are, that is what data association attempts to estimate. A typical sensor used in this scenario is a laser scanner, which provides you with range and bearing to landmarks. – kamek Jun 18 '18 at 12:51