A range sensor that sees a landmark at from a robot at returns the Euclidean distanceplus noise. This is the landmark measurement model of Probabilistic Robotics (Thrun, Burgard and Fox, Section 6.6.2, Equation 6.41). The square root makes a nonlinear function of the robot’s position, so a Gaussian belief about the position does not give a Gaussian prediction of the range. The EKF localization section uses this model and its Jacobian. The beam model gets the expected range by ray casting through the map instead.
A Gaussian through a U-shaped function
Take a belief and pass it through the obviously non-linear U-shaped function whose lowest point sits exactly at the mean of the Gaussian. The two halves of the input fold onto the same output: and both give . This function produces positive numbers and the majority of the probability mass is near zero, where the input is most likely. To find the distribution of , draw many samples of , apply to each one, and look at the histogram of the results.Linearizing the function
The EKF keeps the belief Gaussian by replacing the nonlinear function with its tangent line at the mean of the belief. A first-order Taylor expansion of around a point gives The right-hand side is linear in . If the input is , the output of the tangent line is Gaussian again: The slope stretches or shrinks the spread of the belief. With a vector state the slope becomes a Jacobian matrix , and the variance becomes the covariance .The Jacobian of a vector function is the matrix of its first partial derivatives, with entries . Row is the gradient of the output , and the whole matrix is the best linear approximation of near the point where it is evaluated. We have seen Jacobians in backpropagation in deep networks and the references therein.
Write with . For this the expansion ends at the second-order term and is exact:Because and , the mean of is . The linear and quadratic terms are uncorrelated, since , and a Gaussian has , soThe tangent line keeps only and , so it misses in the mean and in the variance wherever the belief is centered. At the slope is zero, so the curvature terms are the whole output: mean and variance . At with the slope is , and the same terms are small next to it: the exact moments are and , against the linearized and . For a general the expansion goes on, and the third- and higher-order terms add further errors.
In robots a Jacobian is rarely zero in every direction. More often it is flat in some directions of the state, or its slope is small compared with how much the model bends across the belief.Measurement models:
- GPS. A GPS position fix does not depend on the heading, so the heading column of is zero. The heading becomes observable only through motion, by comparing successive fixes or through the GPS velocity . That velocity has derivative with respect to , which vanishes when the robot stands still.
- Terrain-aided navigation underwater. An autonomous underwater vehicle can fix its position by matching multibeam echosounder soundings to a stored depth map of the seabed. Over a flat ocean floor every nearby position predicts the same depths, so is flat in both horizontal directions and the soundings give no position information. The terrain navigation module of the Kongsberg HUGIN vehicles therefore needs “a certain degree of terrain variation” (Ånonsen et al.). A 2022 study of bathymetric SLAM on HUGIN 3000 survey data includes such a flat stretch of seabed (Torroba et al., 2022).
- Range sensors (lidar, sonar, ultra-wideband). A single range does not change as the robot moves on a circle around the landmark, so that direction is flat.
- Bearing sensors and cameras. Moving along the line of sight changes neither the bearing nor the pixel, so depth is flat. The bearing derivative also shrinks with distance, so far landmarks give a nearly flat .
- Saturated readings. A lidar return at maximum range or a saturated pixel stays the same when the state changes a little.
- Contact and limits. A robot pushed against a wall, a joint at its limit, or a saturated actuator. In the blocked direction the next state does not depend on the current one, so that part of is zero.
- Wide heading uncertainty. After startup or after the robot is moved by hand, the heading can be almost anywhere. The terms and in the motion model bend strongly across the belief, and the tangent at the mean describes them poorly.
Nonlinearity and uncertainty
Probabilistic Robotics (Thrun, Burgard and Fox, Section 3.3) names two factors that decide how good the EKF’s linearization is: the degree of local nonlinearity of the function, and the degree of uncertainty in the belief. The comparison above varied the first factor. It kept the width of the belief fixed and moved it from the arm, where is nearly straight, to the bottom of the U, where bends sharply. The comparison below varies the second factor. Both beliefs are centered at on the arm, where the tangent line worked well, and only their standard deviations differ: and .The extended Kalman filter algorithm
Write the state as , the action as and the measurement as . The motion model and the measurement model are now nonlinear functions with additive Gaussian noise: and From here on, is the motion model and no longer the U-shaped function above. The EKF linearizes around the previous mean and around the predicted mean . The two Jacobians are One step of the filter takes the previous belief , the action and the measurement , and returns the new belief : In this notation is the motion noise covariance and is the measurement noise covariance. Compared with the Kalman filter:- The means pass through the nonlinear functions themselves, in lines 1 and 4.
- The covariances pass through the Jacobians and , which take the place of the fixed matrices of the linear model.
A differential-drive robot with an uncertain heading
The U-shaped function we used for the state transition was synthetic and was used to illustrate the EKF but it was not accidental. The same fold appears in the motion model of a differential-drive robot such as the TurtleBot. As in wheeled robots, two wheels of radius sit at distance on either side of the chassis origin. The action is the pair of wheel speeds , which set the forward speed and the turning rate: With the state and a time step , the motion model and its Jacobian are Let the robot start at the origin and drive straight down the page, , with its heading known only roughly. Write the heading as , where is the heading error. After the drive the robot is at and . The forward coordinate is the U-shaped function from the start of this section, with its lowest point at : a heading error of or shortens the progress by the same amount, and the two halves of the heading belief fold together. The Jacobian entry is zero at , so the EKF passes none of the heading uncertainty into . Sideways, is close to linear, and the EKF handles well. The code below uses the geometry of a TurtleBot3 Waffle and drives it straight down the page at 0.25 m/s for 4 s, starting from a belief that knows the position to 2 cm but the heading only to . It predicts the new pose twice: by pushing samples of the starting pose through , and with one prediction step of theEKF class above. To isolate the effect of the heading, the motion noise is left out.
Found an error on this page? Report an issue.

