Professional Documents
Culture Documents
Lecture outline
1. Review
LQ control
completing the squares
dynamic programming
2. Kalman filtering
3. Linear quadratic Gaussian control
Note: These slides are partly inspired by the slides for this course developed at the Department
of Automatic Control, Lund Institute of Technology (see http://www.control.lth.se/kursdr)
acs kf lqg.1
acs kf lqg.2
1. Review
1.1 LQ control
Minimize
N1
J = xT(k)Q1x(k) + 2xT(k)Q12u(k) + uT(k)Q2u(k) + xT(N)Q0x(N)
k=0
acs kf lqg.3
acs kf lqg.4
t3
2. Kalman filtering
LQ control requires full state information
In practice: only output measured
how to estimate states from noisy measurements of output?
Consider system
x(k + 1) = x(k) + u(k) + v(k)
y(k) = Cx(k) + e(k)
with v, e Gaussian zero-mean white noise process with
T
T
T
E v(k)v (k) = R1, E e(k)e (k) = R2, E v(k)e (k) = R12
and x(0) Gaussian distributed with
E x(0) = m0
h
T i
cov (x(0)) := E x(0) E [x(0)] x(0) E [x(0)]
= R0
acs kf lqg.6
acs kf lqg.7
Some history
1)
with x(k
+ 1|k) estimate of state x at sample step k + 1 using information available at step k
Error dynamics x = x x governed by
x(k
+ 1) = x(k + 1) x(k
+ 1|k)
= x(k) + u(k) + v(k) x(k|k
1)
= x(k) + v(k) x(k|k
1)
= ( K(k)C)x(k)
+ v(k) K(k)e(k)
acs kf lqg.8
= E x(0) x(0)
= E x(0) m0 = 0 and
m0, then E x(0)
thus E x(k)
= 0 for all k
How to choose K(k)? minimize covariance of x(k)
We have
h
T i
cov (x(k))
= E x(k)
E [x(k)]
x(k)
E [x(k)]
T
= E x(k)
x (k)
T
So if we define P(k) = E x(k)
x (k) , then we have to determine
Kalman gain such that P(k) is minimized
acs kf lqg.9
P(k + 1) = E x(k
+ 1)x (k + 1)
T
= E ( K(k)C)x(k)
+ v(k) K(k)e(k) ( K(k)C)x(k)
+ v(k) K(k)e(k)
Since x(k)
is independent of v(k) and e(k), this results in
h
P(k + 1) = E ( K(k)C)x(k)
xT(k)( K(k)C)T
T
+ v(k)v (k) + K(k)e(k)e (k)K (k) v(k)e (k)K (k) K(k)e(k)v (k)
T
= ( K(k)C) E x(k)
x (k) ( K(k)C)T + R1 + K(k)R2K T(k)
|
{z
}
P(k)
R12K T(k) K(k)RT12
acs kf lqg.10
T
Q1
Q
u
xu
= CP(k)C + R2
1
P(k)C R12
T
Furthermore,
P(k + 1) = Qx LTQuL
T
T
T
= P(k) + R1 K(k) CP(k)C + R2 K (k)
1
1
T
CP(k)
+ RT12
acs kf lqg.12
x(0) x(0)
h
T i
= E x(0) m0 x(0) m0
= cov (x(0)) = R0
Overall solution:
x(k
+ 1|k) = x(k|k
1)
1
T
T
K(k) = P(k)C + R12 CP(k)C + R2
P(k + 1) = P(k)T + R1 K(k) CP(k)CT + R2)K T(k)
P(0) = R0
x(0|
1) = m0
acs kf lqg.13
acs kf lqg.14
= x(k|k
1))
1
T
T
K(k) = P(k|k 1)C CP(k|k 1)C + R2
P(k|k) = P(k|k 1) K(k)CP(k|k 1)
Update estimate with y(k), compute Kalman gain, update error
covariance.
Step 2. (One-step predictor)
x(k
+ 1|k) = x(k|k)
+ u(k)
P(k + 1|k) = P(k|k)T + R1
Project the state and error covariance ahead.
Iterate Step 1 and 2, increase k.
acs kf lqg.15
acs kf lqg.16
= E [x(k|k
1)] = E [x(k)]
If the noise is uncorrelated with x(0), then the Kalman filter is
optimal, i.e., no other linear filter gives a smaller variance of the
estimation error.
(For non-Gaussian assumptions, nonlinear filters, particle filters
or moving-horizon estimators do a much better job.)
acs kf lqg.17
2.6 Example
Discrete-time system x(k + 1) = x(k)
y(k) = x(k) + e(k)
constant state, to be reconstructed from noisy measurements
Measurement noise e has standard deviation (so R2 = 2)
x(0) has covariance R0 = 0.5
No process noise v, so R1 = 0 and R12 = 0
Kalman filter is given by
x(k
+ 1|k) = x(k|k
1)
P(k)
K(k) =
P(k) + 2
2
P(k)
2
T
P(k + 1) = P(k) K(k)(P(k) + )K (k) =
P(k) + 2
P(0) = R0 = 0.5
x(0|
1) = m0 = 0
acs kf lqg.18
0
1
100
200
300
400
500
600
0
0
0.5
100
200
300
400
500
600
0
0
100
200
300
400
500
600
P(k)
K(k)
2
0
0.5
acs kf lqg.19
K = 0.05
0
1
2
0
100
200
300
400
500
600
400
500
600
400
500
600
x(k)
K = 0.01
0
1
2
0
100
200
300
x(k)
Optimal gain
0
1
2
0
100
200
300
k
acs kf lqg.20
4. In practice, R1, R2, and R0 are often tuning parameters. What are
their influence on the estimate?
acs kf lqg.21
K = 0.05
0
1
2
0
100
200
300
400
500
600
400
500
600
x(k)
K = 0.01
0
1
2
0
100
200
300
x(k)
Optimal gain
0
1
2
0
100
200
300
400
500
600
k
Large fixed K rapid initial convergence, but large steady-state variance
Small fixed K slower convergence, but better performance in steady state
acs kf lqg.22
+ R1 PC
+ R12 CPC
+ R2
P = P
T
1
1
CP(k)
+ RT12
CP
+ RT12
Duality
Equivalence between LQ control problem and Kalman filter state
estimation problem
LQ
k
Q0
Q1
Q12
S
L
Kalman
N k
T
CT
R0
R1
R12
P
KT
E{vv} = RN,
E{wv} = NN,
(Riccati solution)
acs kf lqg.23
acs kf lqg.24
1)
(so u(k) = Lx(k) + Lx(k))
acs kf lqg.25
1) + K(k) y Cx(k|k
1)
|
{z
}
w(k)
It can be shown that for optimal K(k), w(k) is white noise
So dynamics become
x(k
+ 1|k) = ( L(k))x(k|k
1) + K(k)w(k)
T
T
T
x
Q
x
+
2x
Q
u
+
u
Q2u
12
1
k=0
"
min E
L
N1
= min E
L
T
T
T T
(
x
+
x)
Q
(
x
+
x)
+
2(
x
+
x)
Q
L
x
+
x
L Q2Lx
1
12
k=0
T
Since it can be shown that E x Qx = 0, we get
"
N1
min E
L
T
T
T
T T
x
Q
x
+
x
Q
x
+
2
x
Q
L
x
+
x
L Q2Lx
1
1
12
k=0
T
E x Qx does not depend on L and is in fact minimal for Kalman
gain K
"
N1
T
T
T T
x
Q
x
+
2
x
Q
L
x
+
x
L Q2Lx
12
1
k=0
subject to
x(k
+ 1|k) = ( L(k))x(k|k
1) + K(k)w(k)
= stochastic LQ problem (but with x instead of x and
with u = Lx already filled in)
L(k) as computed before still optimal
y
System
State feedback
LQ gain
L(k)
State estimator u
Kalman gain
K(k)
Measurement
noise
LQG controller
acs kf lqg.26
u(k) = Lx(k|k
1)
with
x(k
+ 1|k) = x(k|k
1)
Closed-loop dynamics (with error state x(k),
I
K
dynamics of closed-loop system determined by dynamics of
LQ controller and of optimal filter
acs kf lqg.27
acs kf lqg.28
acs kf lqg.29
Summary
Kalman filtering
state estimator such that error covariance is minimized
LQG control
separation principle LQ + Kalman
acs kf lqg.30