Guidance, Navigation and Control · Theory · M4
M4-T3 — Observers and the Separation Principle
An observer runs a copy of the vehicle and nudges it with the sensor. How hard it nudges is a trade between trusting the model and trusting the sensor.
State feedback needs the whole state, and Hopper measures only the position of its beacons. The remedy is an observer: a simulation of the vehicle running on board, fed the same commands as the real one, and corrected by the difference between what the sensor says and what the simulation predicts. This lesson builds it, shows that its error obeys an equation that the controller does not touch, and uses that fact to prove that controller and observer can be designed apart and then joined. It also shows the question the separation principle does not answer: how fast the observer should be, and why the answer is neither as fast as possible nor as slow.
Learning objectives
After this lesson, you should be able to:
- Write the equations of a Luenberger observer and its estimation-error dynamics.
- Place the poles of an observer by duality with state feedback.
- Explain why the observer speed trades model error against sensor noise, and compute the trade with a covariance equation.
- State and prove the separation principle for a linear model.
The intuition
The controller of the last lesson used , which needs all four states. Hopper's beacons give the position. The other three are not measured, but they are observable from the position (the rank test of M4-T2: Controllability, Observability and Pole Placement), which means they can be reconstructed from the position and the known input over time. The reconstruction is an observer.
A copy of the vehicle, corrected
The idea is the oldest one in estimation. Run a model of the vehicle on board, driven by the same gimbal commands as the real one. Left alone, the model's states would drift away from the real ones because the model is imperfect and starts from the wrong state. So compare the sensor reading with what the model predicts for it, and use the difference to correct the model's states:
the estimate evolves as : a prediction by the model, plus a correction proportional to the surprise. The gain says how much to correct. This is the structure of the Kalman filter of the Probability course (the Kalman filter in one dimension is the scalar case, written for the discrete-time model), and it is the structure of every navigation filter in this course.
The error has its own dynamics
The key fact is what the estimation error does. Subtract the observer from the vehicle: the input appears in both and cancels, and what remains is . The error decays or grows independently of the input, at the poles of . The designer chooses to put those poles where wanted, which is the pole-placement problem of the last lesson with the matrices transposed.
Separation: design the two apart
The controller acts on the estimate, . One might fear that the quality of the estimate would spoil the controller, or the controller the estimator. For a linear model it does neither. The poles of the combined system are the poles of the controller (those of ) together with the poles of the observer (those of ). Choose as if the state were known, choose as if the controller did not exist, and put them together. This is the separation principle.
How fast?
The principle says the observer's poles may be placed anywhere. It does not say where. The figure shows what happens as the observer is sped up. A slow observer trusts its model: the unmodelled accelerations and torques of the real vehicle push the state away, and the slow correction cannot keep up, so the error is large. A fast observer trusts the sensor: every bit of sensor noise passes through the large gain and appears in the estimate, amplified when the state must be reconstructed by differentiating the position. Between the two is a minimum.
The best pole placement of the figure has its slowest pole at −5, about four times faster than the slowest pole of the controller (−1.16): the usual rule of thumb that the observer should be several times faster than the loop it feeds, but not much more. The Kalman gain is the gain that minimizes the error variance for given noise levels. It beats every placement by a factor of two here, because it chooses the shape of the correction and not only the speed.
An observer is a model corrected by a sensor. Its error obeys its own equation, which the controller cannot affect, so the two can be designed separately. How fast to make it is the trade between model error and sensor noise.
Definitions
- Observer (Luenberger)
- A model of the vehicle run on board with a correction from the sensor: .
- Observer gain
- A column of numbers that says how strongly each state estimate is corrected by the innovation .
- Estimation error
- , the difference between the true and the estimated state. (The sign is the opposite of the convention of module 1; both are common.)
- Process and measurement noise
- Unmodelled forces with power spectral density , and sensor noise with density . Hopper: for beacon fixes at 5 Hz.
- Kalman gain
- The observer gain that minimizes the steady-state error variance for given and : with from a Riccati equation.
The estimation error satisfies an equation that does not involve the input, and the gain is chosen to place its poles:
Choosing the controller to act on the estimate gives the combined system in the coordinates a block-triangular form:
With noise, the error covariance of the observer solves a Lyapunov equation. Its trace is the total variance used in the figure:
Derivation: the error equation, the separation principle and the noise trade
Three short calculations give the structure.
The vehicle and the observer, driven by the same input .
Subtract. The input cancels, and so does the part of the correction that equals the output of the true state. The error evolves by itself.
The separation principle
The controller acts on the estimate, which differs from the state by the error.
Substitute into the state equation. The error enters as a disturbance on the state, through .
The determinant of a block-triangular matrix is the product of the determinants of its diagonal blocks, so the characteristic polynomial is the product of the controller's and the observer's.
The noise trade
Add the unmodelled forces to the vehicle and the sensor noise to the measurement. Both now drive the error.
The covariance of a linear system driven by white noise evolves by this Lyapunov equation, the two noise sources adding their intensities ( and ).
In steady state the covariance stops changing, which is the equation of the definitions. A large makes strongly stable (small from ) but enlarges the term . The sum has a minimum: the Kalman gain.
The error obeys its own equation, so the controller and the observer have independent poles. What the principle does not give is any guarantee about margins: it concerns poles, which are the nominal behaviour, not robustness (next lesson).
A worked example
Build observers for Hopper's lateral channel from the beacon position alone, and examine their error and the combined loop.
- The model. The lateral channel of M4-T1: State-Space Models, Modes and Stability, with , beacon noise (5 cm at 5 Hz), and small unmodelled acceleration and torque, .
- Place the observer poles by Ackermann's formula on the transposed model, at times (−1, −1.5, −2, −2.5), and solve the covariance equation for each. The total error variance is 7.24 at , 0.268 at 1, 0.152 at 2, 0.517 at 3, 1.59 at 4 and 68.4 at 8. The minimum is near : position error 7.1 cm, velocity 0.35 m/s, pitch 5.1° and rate 0.12 rad/s.
- Too fast. At the pitch error is 2.4 rad: the observer reconstructs the pitch by differentiating the noisy position twice, and a gain that fast turns 5 cm of noise into an estimate that is useless.
- The Kalman gain for the same noise levels gives errors of 5.9 cm, 0.25 m/s, 0.067 rad and 0.11 rad/s, a total variance of 0.082: 1.9 times lower than the best pole placement. Its poles are a complex pair at −2.36 ± 1.09j and another at −1.15 ± 2.28j, not a simple scaling of a pattern.
- Separation. Join the LQR controller of the next lesson (poles −5.87, −1.61 ± 1.25j, −1.16) to an observer with poles −4, −6, −8, −10. The eight-state closed loop has exactly these eight eigenvalues.
import math
import gnckit as g
gr, lam, b = 9.81, 0.7, 19.62
A = [[0, 1, 0, 0], [0, 0, gr, 0], [0, 0, 0, 1], [0, 0, lam ** 2, 0]]
B = [0, gr, 0, b]
C = [1, 0, 0, 0] # only the beacon position is measured
W = [[0, 0, 0, 0], [0, 0.01, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0.01]] # unmodelled acceleration and torque (power per hertz)
V = 5e-4 # beacon position noise power: (5 cm)^2 per fix, 5 fixes per second
def error_rms(L):
"""RMS estimation error of each state for the observer gain L: solve (A - L C) P + P (A - L C)' + W + L V L' = 0."""
ALC = [[A[i][j] - L[i] * C[j] for j in range(4)] for i in range(4)]
P = g.lyap(g.mat_T(ALC), [[W[i][j] + L[i] * L[j] * V for j in range(4)] for i in range(4)])
return [math.sqrt(P[i][i]) for i in range(4)]
print('observer poles at s x (-1, -1.5, -2, -2.5): RMS error in position, velocity, pitch, pitch rate; total variance')
for s in (0.5, 1, 2, 3, 4, 8):
L = g.acker(g.mat_T(A), C, [-p * s for p in (1.0, 1.5, 2.0, 2.5)])
r = error_rms(L)
print(f' s = {s:3.1f}: {r[0]:.3f} m, {r[1]:.3f} m/s, {r[2]:.3f} rad, {r[3]:.3f} rad/s; {sum(x * x for x in r):8.3f}')
Lk, Pk = g.kalman_gain(A, [C], W, [[V]])
Lk = [row[0] for row in Lk]
r = error_rms(Lk)
print(f' Kalman : {r[0]:.3f} m, {r[1]:.3f} m/s, {r[2]:.3f} rad, {r[3]:.3f} rad/s; {sum(x * x for x in r):8.3f}')
# separation principle: the eigenvalues of controller plus observer are the union of the two sets
K = g.lqr(A, [[v] for v in B], [[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 25, 0], [0, 0, 0, 4]], [[1 / 0.15 ** 2]])[0][0]
L = g.acker(g.mat_T(A), C, [-4.0, -6.0, -8.0, -10.0])
M = [[0.0] * 8 for _ in range(8)] # states: x and the estimation error e = x - xhat
Acl = g.ss_closed_loop(A, B, K)
for i in range(4):
for j in range(4):
M[i][j] = Acl[i][j]
M[i][4 + j] = B[i] * K[j]
M[4 + i][4 + j] = A[i][j] - L[i] * C[j]
print('controller poles:', sorted(round(complex(p).real, 2) for p in g.mat_eigvals(Acl)))
print('closed loop with observer:', sorted(round(complex(p).real, 2) for p in g.mat_eigvals(M)))observer poles at s x (-1, -1.5, -2, -2.5): RMS error in position, velocity, pitch, pitch rate; total variance s = 0.5: 0.725 m, 2.547 m/s, 0.366 rad, 0.303 rad/s; 7.238 s = 1.0: 0.082 m, 0.471 m/s, 0.122 rad, 0.155 rad/s; 0.268 s = 2.0: 0.071 m, 0.352 m/s, 0.089 rad, 0.124 rad/s; 0.152 s = 3.0: 0.087 m, 0.622 m/s, 0.210 rad, 0.279 rad/s; 0.517 s = 4.0: 0.100 m, 0.954 m/s, 0.423 rad, 0.698 rad/s; 1.587 s = 8.0: 0.142 m, 2.692 m/s, 2.368 rad, 7.454 rad/s; 68.431 Kalman : 0.059 m, 0.248 m/s, 0.067 rad, 0.111 rad/s; 0.082 controller poles: [-5.87, -1.61, -1.61, -1.16] closed loop with observer: [-10.0, -8.0, -6.0, -5.87, -4.0, -1.61, -1.61, -1.16]
In robotics
Every navigation system on a vehicle is an observer, and the trade of this lesson is its main design decision.
- Navigation filters. The extended Kalman filter of PX4 (UAV M6-T5: PX4 state estimation and EKF2) is an observer with a gain that changes with the estimated uncertainty, and its noise parameters are the and of this lesson. The process noise sets how much it trusts the model, the measurement noise how much it trusts the sensors. Tuning them is choosing the observer speed.
- Complementary filters. The simple attitude filters of module 7 are observers with a fixed, hand-chosen gain: the gyroscope is the model and the accelerometer the correction.
- The Kalman filter. The Probability course derives the Kalman filter for the discrete-time model in The Kalman Filter in One Dimension and the lessons that follow it. The result of this lesson is its continuous-time, steady-state form: the Kalman gain is the dual of the LQR gain, found from a Riccati equation.
- Observer speed in practice. A rule of thumb is that the observer should be 2 to 5 times faster than the controller. The figure shows why it is a range: below it the model's errors dominate, above it the noise does, and the minimum is flat enough to be forgiving between them.
- Where separation fails. The principle holds for a linear model with a known plant. Saturation, delays, model errors and nonlinearities all break it, and even for a linear model it gives no promise about margins. The next lesson shows how bad that can be.
This lesson used the output of the measurement as if it were instantaneous and continuous. The 5 Hz beacon fixes of Hopper are a sampled measurement, which the estimators of module 7 handle with their update steps; the Kalman filter of module 7 is the discrete version.
Common misconceptions
“The faster the observer, the better the estimate.”
A fast observer passes sensor noise with a large gain. Hopper's error variance falls from 7.2 to 0.15 as the observer is sped up and then rises to 68 at eight times that speed. There is an optimum set by the noise and the model errors, and the minimum is specific to the problem.
“The estimation error depends on what the controller does.”
It does not, for a linear model: the input cancels from the error equation. The controller can ruin the vehicle's state but not the observer's error, which is why the two can be tested apart.
“Separation means the combined loop is as robust as the controller alone.”
Separation is about the poles, the nominal behaviour. It guarantees nothing about margins, and the next lesson shows an optimal controller and an optimal observer that combine into a loop with almost no gain margin.
“An observer can recover any state.”
Only the observable ones. The velocity sensor of the last lesson could not see the position at any observer speed. An observer for an unobservable mode simply carries the initial error forever (if the mode is neutral) or diverges (if it is unstable).
“Kalman filters are only for Gaussian noise.”
The Kalman gain is the best linear observer for any noise with the stated covariances, and the best of all observers if the noise is Gaussian. Heavy-tailed noise is handled by other means, but the gain is still a sound choice of the speed and shape of the correction.
Key takeaways
- An observer is a copy of the model driven by the input and corrected by the sensor: .
- The error obeys , independent of the input; its poles are placed by duality with state feedback.
- Separation principle: the poles of controller plus observer are the union of the two sets, so the two can be designed apart.
- The speed of an observer trades model error against sensor noise; the error is U-shaped in the speed, and the best placement for Hopper has its slowest pole near −5.
- The Kalman gain minimizes the error variance for given noise levels and beats every pole placement; for Hopper it is 1.9 times lower in variance.
- Separation says nothing about margins, which the next lesson shows.
References and further reading
Each source is marked free or paid. Free to read does not mean free to reuse: the course resources page lists every source with its licence.
- K. J. Åström and R. M. Murray, Feedback Systems, 2nd edition, Princeton University Press, 2021 , the chapters on output feedback and on Kalman filtering. Free to read as the authors' PDF; the book is copyrighted.
- S. Brunton, “Control Bootcamp” (video series) , the lectures on observability, observers and the Kalman filter. Free to watch.
- MATLAB Tech Talks, “Understanding Kalman Filters” (video series) . Free to watch.
- D. G. Luenberger, “An introduction to observers”, IEEE Transactions on Automatic Control 16(6), 1971, 596 to 602. The original observer paper. Paid.
Knowledge check
Three questions. Write an answer, then reveal the explanation. Your answers stay in your browser.
Question 1
A controller has closed-loop poles at −2, −3, −4 and −5, and an observer has poles at −8, −10, −12 and −14. What are the poles of the combined system, and what happens to the estimation error if the controller is retuned?
Explanation
The poles are the union: −2, −3, −4, −5, −8, −10, −12 and −14, eight in all. Retuning the controller changes the first four and leaves the observer poles, and the estimation error, exactly as they were, since the error obeys ė = (A − LC)e with no input in it. The two designs can be changed independently, which is the practical content of the separation principle.
Question 2
At an observer speed factor of 8, Hopper's pitch estimate has an RMS error of 2.4 rad. What does this say about the design, and what two changes would reduce it?
Explanation
The observer is far too fast for the noise: it reconstructs pitch by differentiating the beacon position twice, and a gain this high multiplies the 5 cm noise into radians of error, so the estimate is unusable. The two remedies are to slow the observer (the minimum is near a speed factor of 2) or to use the Kalman gain, which weights the correction by the noise levels and reaches an error of 0.067 rad. A better remedy for the vehicle is another sensor: a gyroscope measures the pitch rate directly, so that the pitch need not be obtained from the position by differentiation.
Question 3
Show that the estimation error of an observer does not depend on the input u.
Explanation
The vehicle is ẋ = Ax + Bu and the observer is x̂̇ = Ax̂ + Bu + L(y − Cx̂), with y = Cx. Subtract: ė = A(x − x̂) + Bu − Bu − LC(x − x̂) = (A − LC)e. The terms Bu cancel exactly because both the vehicle and the observer receive the same input, so the error depends only on its initial value and on A − LC. This holds only if the observer's B and A match the vehicle's: with a model error the cancellation is incomplete, and the input then does enter the error.
What’s next
Related content
Nothing below is required to finish this lesson.
- BeforeM4-T2: Controllability, Observability and Pole Placement
Test whether a model can be controlled and observed, and place the closed-loop poles of a controllable model by state feedback.
- LabM4-L2: The Observer That Spoils the Loop
Pitch rate is no longer measured. Add an observer, find the observer bandwidth at which the margins collapse, and choose one that keeps them.
Other courses on this site treat neighbouring topics from their own angle:
- UAV M5-T7: LQR control
- UAV M5-L2: Implement LQR
- Navigation M5-T6: LQR and MPC for Path Tracking
- UAV M3-T4: Kalman Filter
- UAV M3-T12: Observability and consistency
- Linear Algebra M6-T1: Eigenvalues and Eigenvectors
- Linear Algebra M6-T4: Positive Definite Matrices
- Linear Algebra M9-T7: Linear Kalman Filter Mathematics
- Robot Learning M4-T4: Dynamic Programming and Value Iteration
- Probability for Robotics (module 7 derives the Kalman filter)
This course leaves the following to the pages that already teach them:
Get notified when the next lesson and new labs are released.
One email per new lesson or lab.