cds 101/110a: lecture 5-1 output feedbackmacmardg/courses/cds101/fa12/pdf/l5... · 2012. 10....

15
CDS 101/110a: Lecture 5-1 Output Feedback Richard M. Murray 29 October 2012 Goals: Review state space design pattern, introducing the need for estimation Define observability and give testable conditions for linear control systems Introduce state estimation problem and show how to design full state observers Provide examples of state estimation in the context of closed loop design (If time) Preview adv’d techniques for state fbk design: LQR, gain scheduling Reading: Åström and Murray, Feedback Systems, Sections 7.1-7.3

Upload: others

Post on 21-Sep-2020

4 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: CDS 101/110a: Lecture 5-1 Output Feedbackmacmardg/courses/cds101/fa12/pdf/L5... · 2012. 10. 29. · CDS 101/110, 29 Oct 2012 Richard M. Murray, Caltech CDS 5 Proof of Observability

CDS 101/110a: Lecture 5-1Output Feedback

Richard M. Murray29 October 2012

Goals:• Review state space design pattern, introducing the need for estimation• Define observability and give testable conditions for linear control systems• Introduce state estimation problem and show how to design full state observers• Provide examples of state estimation in the context of closed loop design• (If time) Preview adv’d techniques for state fbk design: LQR, gain scheduling

Reading:• Åström and Murray, Feedback Systems, Sections 7.1-7.3

Page 2: CDS 101/110a: Lecture 5-1 Output Feedbackmacmardg/courses/cds101/fa12/pdf/L5... · 2012. 10. 29. · CDS 101/110, 29 Oct 2012 Richard M. Murray, Caltech CDS 5 Proof of Observability

Richard M. Murray, Caltech CDSCDS 101/110, 29 Oct 2012

Trajectory generation: r → xd, uff where dxd/dt = f(xd, uff), r = h(xd)• Given a desired reference trajectory, determine the desired state and nominal input• Typically solved via online or offline numerical algorithms (eg, optimal control)• Advanced versions (eg, autonomous driving): include environment and replanning

• Special case: linear sys & r = constant ⇒ u = -K (x - xe) + kr r ⇒ uff = kr r + K(xd - xe)

Observer (state estimation): u, y → x• Given input and output to the process, estimate the current state

Feedback control: ufb = -K(x - xd) (or equivalently u = -K (x - xe) + kr r )• Determine corrective signal to apply to account for uncertainty • Sources of uncertainty: disturbances (d), noise (n), model error (Δ)

Modern (State Space) Control System Design

2

Environment

^

^ ^

Δ

x = f(x, u, d)

y = h(x) + n

}Use linearized dynamics

near (xe, ue):

z = Az +Bv

w = Cz

Page 3: CDS 101/110a: Lecture 5-1 Output Feedbackmacmardg/courses/cds101/fa12/pdf/L5... · 2012. 10. 29. · CDS 101/110, 29 Oct 2012 Richard M. Murray, Caltech CDS 5 Proof of Observability

Richard M. Murray, Caltech CDSCDS 101/110, 29 Oct 2012

Problem Setup• Given a dynamical system with noise and uncertainty, estimate the state

• is called the estimate of x

Remarks• Several sources of uncertainty: noise, disturbances, process, initial condition

- Model disturbances and noises as random processes (ACM 116/CDS 110b)• Uncertainties are unknown, except through their effect on measured output• First question: when is this even possible?

3

The State Estimation Problem

Process ControllerObserver

Δ disturbances noise

estimator

expected value

˙x = ↵(x, y, u)

limx!1

E(x� x) = 0

x = Ax+Bu+ Fw

y = Cx+Du+ v

Page 4: CDS 101/110a: Lecture 5-1 Output Feedbackmacmardg/courses/cds101/fa12/pdf/L5... · 2012. 10. 29. · CDS 101/110, 29 Oct 2012 Richard M. Murray, Caltech CDS 5 Proof of Observability

Richard M. Murray, Caltech CDSCDS 101/110, 29 Oct 2012 4

ObservabilityDefn A dynamical system of the form

is observable if for any T > 0 it is possible to determine the state of the system x(T) through measurements of y(t) and u(t) on the interval [0,T]

Remarks• Observability must respect causality: only get to look at past measurements

• We have ignored noise, disturbances for now ⇒ estimate exact state

• Intuitive way to check observability:

Thm A linear system is observable if and only if the observability matrix Wo is full rank

Page 5: CDS 101/110a: Lecture 5-1 Output Feedbackmacmardg/courses/cds101/fa12/pdf/L5... · 2012. 10. 29. · CDS 101/110, 29 Oct 2012 Richard M. Murray, Caltech CDS 5 Proof of Observability

Richard M. Murray, Caltech CDSCDS 101/110, 29 Oct 2012 5

Proof of Observability Rank Condition, 1/2Thm A linear system is observable if and only if the observability matrix Wo is full rank.

Proof (sufficiency) Write the output in terms of the convolution integral

Since we know u(t), we can subtract off its contribution and write

Now differentiate the (new) output and evaluate at t = 0

Finally, invert to solve for x(0). To find x(T), use x(T) = eAT x(0).

Page 6: CDS 101/110a: Lecture 5-1 Output Feedbackmacmardg/courses/cds101/fa12/pdf/L5... · 2012. 10. 29. · CDS 101/110, 29 Oct 2012 Richard M. Murray, Caltech CDS 5 Proof of Observability

Richard M. Murray, Caltech CDSCDS 101/110, 29 Oct 2012 6

Proof of Observability Rank Condition, 2/2Thm A linear system is observable if and only if the observability matrix Wo is full rank.

Proof (necessity) Again, we start with the convolution integral

Subtracting off the input as before and expanding the exponential, we have

By the Cayley-Hamilton theorem, we can write An in terms of lower powers of A and so we can write

If Wo is not full rank, then can choose x(0) ≠ 0 such that = 0 ⇒ not observable (since we x(0) = 0 would produce the same output).

Page 7: CDS 101/110a: Lecture 5-1 Output Feedbackmacmardg/courses/cds101/fa12/pdf/L5... · 2012. 10. 29. · CDS 101/110, 29 Oct 2012 Richard M. Murray, Caltech CDS 5 Proof of Observability

Richard M. Murray, Caltech CDSCDS 101/110, 29 Oct 2012 7

State Estimation: Full Order ObserverGiven that a system is observable, how do we actually estimate the state?• Key insight: if current estimate is correct, follow the dynamics of the system

• Modify the dynamics to correct for error based on a linear feedback term• L is the observer gain matrix; determines how to adjust the state due to error• Look at the error dynamics for to determine how to choose L:

Thm If the pair (A, C) is observable (associated Wo is full rank), then we can place the eigenvalues of A-LC arbitrarily through appropriate choice of L.

Proof Note that the transpose of A - LC is AT - CT LT and in this form, this is the same as the eigenvalue placement problem for state space controllers (A - B K).

Remarks: • In MATLAB, use L’ = place(A’, C’, eigs) to determine L

• Generally choose eigenvalues of observer to be “faster” than eigenvalues for control

prediction (copy of dynamics)

correction (basedon output error)

Page 8: CDS 101/110a: Lecture 5-1 Output Feedbackmacmardg/courses/cds101/fa12/pdf/L5... · 2012. 10. 29. · CDS 101/110, 29 Oct 2012 Richard M. Murray, Caltech CDS 5 Proof of Observability

Richard M. Murray, Caltech CDSCDS 101/110, 29 Oct 2012 8

Example: Ducted Fan

Equations of motion (lateral dynamics: x, θ)

Estimator design: see dfan_est.m• Place eigenvalues at -10 ± 1j, -5 ± 0.5j

• Initial condition response: 1 sec settling time

• Optimal estimator (Kalman filter): longer settling time, but much smaller transients

Estimation:• Given the xy position of

the fan and the inputs (f1, f2), determine the full state of the system:

• For simplicity, focus on lateral dynamics (x, θ)

Page 9: CDS 101/110a: Lecture 5-1 Output Feedbackmacmardg/courses/cds101/fa12/pdf/L5... · 2012. 10. 29. · CDS 101/110, 29 Oct 2012 Richard M. Murray, Caltech CDS 5 Proof of Observability

Richard M. Murray, Caltech CDSCDS 101/110, 29 Oct 2012 9

Separation Principle

What happens when we apply state space controller using estimate of x?• We assumed we measured x directly in analyzing controller; extra dynamics in the

estimator could cause closed loop to go unstable

Thm If K is a stabilizing compensator for (A, B) and L gives a stable estimator for (A, C), then the control law is stable (for xd, ud an equil pt)

• This is an example of a separation principle: design the controller and estimator separately, then combine them and everything is OK

• Be careful with signs on gains (MATLAB vs LQR vs AM08)

Process Controller

Δ

EstimatorTrajectoryGeneration

Page 10: CDS 101/110a: Lecture 5-1 Output Feedbackmacmardg/courses/cds101/fa12/pdf/L5... · 2012. 10. 29. · CDS 101/110, 29 Oct 2012 Richard M. Murray, Caltech CDS 5 Proof of Observability

Richard M. Murray, Caltech CDSCDS 101/110, 29 Oct 2012 10

Proof of Separation TheoremProof. Write down the dynamics for the complete system (assuming WLOG that xd, ud = 0):

Rewrite in terms of the error dynamics and combined state :

Since the dynamics matrix is block diagonal, we find that the characteristic polynomial of the closed loop system is

This polynomial is a product of two terms, where the first is the characteristic polynomial of the closed loop system obtained with state feedback and the other is the characteristic polynomial of the observer error.

Since each was designed to be stable ⇒ the entire system is stable

• Note: stability does not imply good performance! Lots of tradeoffs between estimator response, noise propagation and closed loop performance.

Page 11: CDS 101/110a: Lecture 5-1 Output Feedbackmacmardg/courses/cds101/fa12/pdf/L5... · 2012. 10. 29. · CDS 101/110, 29 Oct 2012 Richard M. Murray, Caltech CDS 5 Proof of Observability

Richard M. Murray, Caltech CDSCDS 101/110, 29 Oct 2012 11

Trajectory Tracking and Gain SchedulingGoal: design local controller to track xd:

Approach: regulate the error dynamics• Let e = x - xd, v = u - ud and assume f(x, u) = f(x) + g(x) u (simplifies notation)

• Now linearize the dynamics around e = 0 and design controller v = -K e

• Final control law will be u = -K (x - xd) + ud

• Note: in general, linearization will depend on xd ⇒ u = K(xd) x

xdProcess Controller

Δ

EstimatorTrajectoryGeneration

uff

-x

ve

← “gain scheduling”

Page 12: CDS 101/110a: Lecture 5-1 Output Feedbackmacmardg/courses/cds101/fa12/pdf/L5... · 2012. 10. 29. · CDS 101/110, 29 Oct 2012 Richard M. Murray, Caltech CDS 5 Proof of Observability

Richard M. Murray, Caltech CDSCDS 101/110, 29 Oct 2012 12

Preview: Optimal Control using LQRFormulate control design as linear quadratic regulator (LQR) problem:

• Find u = -K x such that we minimize the cost function

Solution: same form, but can show P is constant

Remarks• In MATLAB, K = lqr(A, B, Q, R)

• Require R > 0 but Q ≥ 0 + must satisfy “observability” condition

• Alternative form: minimize “output” y = H x

• Require that (A, H) is observable. Intuition: if not, dynamics may not affect cost ⇒ ill-posed. We will study this in more detail when we cover observers

Algebraic Riccati equation

State feedback (constant gain)

Page 13: CDS 101/110a: Lecture 5-1 Output Feedbackmacmardg/courses/cds101/fa12/pdf/L5... · 2012. 10. 29. · CDS 101/110, 29 Oct 2012 Richard M. Murray, Caltech CDS 5 Proof of Observability

Richard M. Murray, Caltech CDSCDS 101/110, 29 Oct 2012 13

Example: Ducted Fan

Equations of motion

LQR design: see dfan_lqr.m (available on course web page)

Stabilization: • Given an equilibrium

position (xd, yd) and equilibrium thrust f2d, maintain stable hover• Full state available for

feedback

Tracking:• Given a reference

trajectory (xr(t), yr(t)), find a feasible trajec-tory and a controller u = α(x, xd, ud) such that x → xd

Page 14: CDS 101/110a: Lecture 5-1 Output Feedbackmacmardg/courses/cds101/fa12/pdf/L5... · 2012. 10. 29. · CDS 101/110, 29 Oct 2012 Richard M. Murray, Caltech CDS 5 Proof of Observability

Richard M. Murray, Caltech CDSCDS 101/110, 29 Oct 2012

Observer: estimate the current state given the measure inputs and outputs• For linear system, must satisfy the observability rank condition

• Estimator consists of prediction + correction terms; design L by eigenvalue placement

Separation principle: combine state feedback control with state estimator• Resulting system is guaranteed to be stable (near equilibrium point for linearization)

Summary: Output Feedback

14

Environment

Δ

x = f(x, u, d)

y = h(x) + n

Page 15: CDS 101/110a: Lecture 5-1 Output Feedbackmacmardg/courses/cds101/fa12/pdf/L5... · 2012. 10. 29. · CDS 101/110, 29 Oct 2012 Richard M. Murray, Caltech CDS 5 Proof of Observability

Richard M. Murray, Caltech CDSCDS 101/110, 22 Oct 2012

Announcements

HW #4 due on 31 Oct (Wed) by 5 pm

MIDTERM will be handed out in class on Wed, 10/31. Due 5 pm Tue, 11/6• Midterm will not be posted on the web; pick up in class or from 107 Steele• HW #4 will not be graded before midterm is due => keep a copy of what you hand in• Midterm must be turned in to Anissa Scott, 109 Steele or CDS homework slot

Office hours• Monday 3-5 pm in 121 Annenberg, except 29 Oct (218 SFL)• Tuesday 6-8 pm in 328 SFL (respond to poll to vote for OH on Fri, Sat or Sun)

Recitation: midterm review, Friday 2-3• CDS 110: 213 Annenberg• CDS 101: 110 Steele

Please pick up copy of lecture notes at back of lecture hall

15