ROBOTICS 101Concept explainer

Gaussians and Covariance Ellipses

Robots describe uncertainty with Gaussians. In 2D, a Gaussian is a cloud of likely positions, and its covariance matrix sets how wide the cloud is and which way it leans. The ellipses you see around robots in RViz are drawn from exactly this.

The 2D Gaussian

A Gaussian with mean \(\boldsymbol{\mu}\) and covariance \(\Sigma\) has density

$$p(\mathbf{x}) = \frac{1}{2\pi\sqrt{\det \Sigma}}\exp\!\left(-\tfrac{1}{2}\,(\mathbf{x}-\boldsymbol{\mu})^\top \Sigma^{-1} (\mathbf{x}-\boldsymbol{\mu})\right), \qquad \Sigma = R \begin{bmatrix} \sigma_1^2 & 0 \\ 0 & \sigma_2^2 \end{bmatrix} R^\top$$

The term inside the exponent is the squared Mahalanobis distance. Every point on one ellipse has the same Mahalanobis distance from the mean.

What to notice

In 2D, about 39 percent of samples fall inside the 1σ ellipse, 86 percent inside 2σ, and 99 percent inside 3σ. That is different from the 68, 95, and 99.7 rule you may know from 1D. When a robot draws a "1 sigma" ellipse, most of the time it is actually outside it.

Rotating the ellipse creates off-diagonal terms in \(\Sigma\), which means the two coordinates are correlated. A robot that drove forward with an uncertain heading has exactly this kind of tilted, stretched ellipse.