Left Half-Plane
state estimation · Kalman filtering · observability

Blind

The same machine, the same balancing gains, but the controller no longer sees the state. It sees whichever sensors you leave plugged in, each noisy by an amount nobody told it, and a Kalman filter fills in the rest. You choose the sensors and how much the filter trusts them. During the scored run the machine is hidden; you watch the ghost, which is what the controller believes. Then the fog lifts.

world —runs today 0best today —Kalman with today's noise —
Where you stand today

The controller is the lab's balancing LQR, u = −K x̂, acting on an estimate from a steady-state Kalman filter of the model linearised at upright, run at 240 Hz on the sensors you leave in: the cart's position, the first joint's angle, the second's. The filter is built from two doubts, the model's (fixed) and the sensors' (the trust dial; nominal assumes 5 mm and 2 mrad, each step of the dial is a factor of ten). Gusts arrive on today's schedule and grow. Cost is ∫(10θ₁² + 10θ₂² + x² + ½(u/umax)²) dt over thirty seconds, plus five per second after a fall. Hidden today: how noisy each sensor really is. Par is the Kalman filter that knows today's noise exactly, on the sensors you chose. It can be beaten, because the gusts are not the Gaussian noise the filter was told about.

The trick

What it cannot measure, it can still know

Unplug the camera and the machine still balances: the filter integrates the angles it does see through the model and keeps a belief about the cart, and the belief is wrong in one particular way, because nothing it sees depends on where the cart is. The ghost stands still while the machine drifts; that is what unobservable looks like. Unplug the first joint's encoder instead and it balances for a while, inferring the first angle from how the second one moves, until the gusts grow. Unplug the second joint's encoder and it falls within seconds: the second link is the fastest unstable thing in the machine and the cart barely feels it, so no filter is fast and quiet enough to reconstruct it. Observable is a yes or no; how well is a number, and the number is what the game is about. The trust dial is the other half: believe the sensors too much and their noise becomes the controller's command; believe the model too much and the estimate arrives late.

Cards
What you cannot measure you can still know, if the model says how it moves what you do measure.observer
x̂⁻ = Ad x̂ + Bd u, x̂ = x̂⁻ + L (y − C x̂⁻)predict with the model, correct with the measurement; the error obeys e⁺ = (I − LC) Ad e

An observer runs the model alongside the machine and nudges its copy toward whatever it can measure. If the pair (A, C) is observable, a gain L exists that makes the copy's error decay however fast you like; the state the controller needs is then the copy's, not the machine's. Feedback from an estimate is how nearly every real controller works: velocities are estimated, not measured, and the angle of a link with no encoder is estimated from the ones that have one.

The catch is the same as everywhere in this series. Fast convergence means a large L, and a large L multiplies sensor noise and model error into the estimate. Luenberger's observer picks L by placing the error's poles; Kalman's picks it from the two noises. Both are the same equation with a different reason for the number.

Where this game · every sensor-poor robot
Deeper Luenberger, Observing the state of a linear system, 1964 · Åström & Murray, Feedback Systems, ch. 8

The best estimate is a weighted disagreement, and the weight is the ratio of two doubts.kalman
P⁻ = Ad P Adᵀ + Q, L = P⁻ Cᵀ (C P⁻ Cᵀ + R)⁻¹, P = (I − LC) P⁻the filter Riccati recursion: Q is how much the model is doubted, R how much the sensors are; iterate and L settles

Given how much to doubt the model (process noise Q) and how much to doubt each sensor (R), the Kalman filter is the linear estimator with the smallest error variance, and its gain follows from the same Riccati recursion that gives the LQR, run on the transposed problem. Here the recursion runs in your browser each time you touch a sensor or the dial, iterated until the gain stops changing, a few dozen to a few hundred steps. The trust dial scales R: one step is a factor of ten in assumed noise.

The filter is optimal for the noise it was told about. Today's gusts are impulses, not white noise, and the fixed Q is one guess, so the textbook filter with the true R is par and not a ceiling. Too much trust and the cart chases every millimetre of camera jitter; too little and the belief lags a gust by the time the machine has already fallen. The dial's sweet spot moves with the day's noise, which is hidden until the fog lifts.

Where this game · Time Machine, where the same machinery predicts instead of filters · lqr, its dual
Deeper Kalman, A new approach to linear filtering and prediction problems, 1960 · Anderson & Moore, Optimal Filtering · Simon, Optimal State Estimation

Design the controller as if you knew the state, the estimator as if there were no controller, and together they are stable.separation
eig([A − BK, BK; 0, A − LC]) = eig(A − BK) ∪ eig(A − LC)the closed loop with u = −K x̂ has the controller's poles and the observer's, and nothing else

The separation principle is the small miracle that makes output feedback tractable: with a linear model, the poles of the loop that feeds back an estimate are exactly the poles you designed for the controller plus the poles you designed for the estimator. Neither design needs to know about the other. Kalman's filter and the LQR together are LQG, the optimal output-feedback controller for a linear plant with Gaussian noise.

It is a statement about the model. On the real machine the two designs interfere through everything the model omits: saturation turns a noisy estimate into a chattering motor, and an estimator tuned for speed can undo a controller's margins. LQG has no guaranteed margins at all, which Doyle showed in one page in 1978, and it is why the game lets you feel the coupling rather than trust the theorem.

Where this game · the lab, whose six states are measured exactly, which is the assumption being dropped here
Deeper Doyle, Guaranteed margins for LQG regulators, 1978 · Åström & Murray ch. 8.3

A state that affects no measurement cannot be known, and one that barely does cannot be known in time.observability
rank [C; CA; CA²; …; CA⁵] = 6observable: every state leaves a trace in the measurements, eventually; the Gramian's smallest singular value says how faint

Nothing in the angles depends on where the cart is, so from the encoders alone the cart's position is unobservable: the observability matrix drops rank, the filter's belief about x is never corrected, and the ghost stands centred while the machine wanders. The game warns you when your sensor set has this hole. Everything else is observable in the yes-or-no sense: from the camera alone, in principle, all six states can be reconstructed.

In practice the second joint's angle appears in the cart's acceleration only through the first joint's, twice removed, and its unstable mode is the fastest in the machine. Reconstructing it needs a fast filter, a fast filter needs a large gain, and a large gain turns the camera's millimetres and the model's small lies into radians per second. Observable, yes; knowable in time, no. Ask instead how much information a sensor carries about the mode you most need, which is what the Gramian measures, and which is why the encoder on the second joint is the one you should never unplug.

Where this game, the sensor checkboxes · Kick, whose controller assumed all six states were known
Deeper Kalman, 1960, where the word was coined · Åström & Murray ch. 8.1 · Hespanha, Linear Systems Theory, ch. 15

References
  1. R. E. Kalman, "A new approach to linear filtering and prediction problems," ASME Journal of Basic Engineering, vol. 82, no. 1, pp. 35–45, 1960.
  2. R. E. Kalman and R. S. Bucy, "New results in linear filtering and prediction theory," ASME Journal of Basic Engineering, vol. 83, no. 1, pp. 95–108, 1961.
  3. R. E. Kalman, "On the general theory of control systems," in Proc. First International Congress of the IFAC, Moscow, 1960.
  4. D. G. Luenberger, "Observing the state of a linear system," IEEE Transactions on Military Electronics, vol. 8, no. 2, pp. 74–80, 1964.
  5. D. G. Luenberger, "An introduction to observers," IEEE Transactions on Automatic Control, vol. 16, no. 6, pp. 596–602, 1971.
  6. P. D. Joseph and J. T. Tou, "On linear control theory," Transactions of the AIEE, Part II: Applications and Industry, vol. 80, no. 4, pp. 193–196, 1961.
  7. W. M. Wonham, "On the separation theorem of stochastic control," SIAM Journal on Control, vol. 6, no. 2, pp. 312–326, 1968.
  8. B. D. O. Anderson and J. B. Moore, Optimal Filtering. Prentice Hall, 1979; Dover reprint, 2005.
  9. D. Simon, Optimal State Estimation: Kalman, H∞, and Nonlinear Approaches. Wiley, 2006.