Skip to main content
Contents6 / 6 ▾
VI

Chapter six The three compared, and unified

Now that each method has been built from its own starting point, the differences are easy to state, because they all reduce to two decisions: how do you handle the curve, and how much of the past do you keep?

EKFUKFFactor graph
Handles the curve byOne tangent, at the current guessSampling 2n+1 points through the true functionRe-linearising repeatedly at improving guesses
Needs JacobiansYes, analytic, by handNoYes, but frameworks autodiff them
Accuracy order1st (mean), 2nd (covariance)3rd for Gaussian inputsLocal optimum of the true cost
Cost per stepLowest, one pass≈ 2n+1 model evaluationsHighest, tunable by window size
MemoryO(1)O(1)O(window) or O(trajectory)
Can revise the pastNoNoYes — this is the point
Loop closureCannot use it properlyCannot use it properlyNative
Typical homeFlight controllers, INS/GNSS fusionNonlinear models with ugly or absent derivativesSLAM, VIO, bundle adjustment, calibration

6.1 · The unifying statement

Proposition An extended Kalman filter is a factor graph in which every variable except the newest one has been marginalised out, and in which each factor is linearised exactly once, at the estimate available when it first arrived.

Once you see this, the whole taxonomy collapses into a single axis. Filtering and smoothing are not rival theories; they are the two ends of a spectrum, and fixed-lag smoothing is the dial in between. The UKF sits off to one side of that axis entirely — it is a filter, at the same point on the spectrum as the EKF, differing only in how it moves a Gaussian through a curve.

6.2 · How to choose

Reach for an EKF when you have a hard real-time deadline on constrained hardware, a high update rate that keeps the linearisation error small, and no need to ever revisit the past. Attitude and position estimation on a flight controller is the archetype.

Reach for a UKF when the nonlinearity is strong enough that a tangent misleads you, or when \(f\) is a lookup table, a simulation, or something else you cannot differentiate cleanly. It is a drop-in replacement with the same interface and a modest constant-factor cost.

Reach for a factor graph whenever the same place can be observed twice. Loop closures, multi-sensor calibration, offline trajectory refinement, anything where a measurement arriving now should be allowed to change your opinion about an hour ago. This is why every serious SLAM and visual-inertial system built in the last decade is a graph optimiser and not a filter.

In a real robot these coexist rather than compete. The autopilot runs an EKF at hundreds of hertz because it must. The companion computer runs a factor graph at a lazier rate because it can afford to think. Choosing between them is usually not a question of which is better, but of which layer of the stack you are standing in.

31