Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
2 views

Lecture4_std

The document discusses linear systems in the context of cyber-physical computing and robotics, focusing on state-space representation and control of point masses. It provides examples of linear time-invariant (LTI) systems, including models for a car, pendulum, and simple robots, while also addressing the process of linearization for non-linear systems. The document emphasizes the importance of systematic approaches to understanding and controlling these systems.

Uploaded by

pangunpark
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Lecture4_std

The document discusses linear systems in the context of cyber-physical computing and robotics, focusing on state-space representation and control of point masses. It provides examples of linear time-invariant (LTI) systems, including models for a car, pendulum, and simple robots, while also addressing the process of linearization for non-linear systems. The document emphasizes the importance of systematic approaches to understanding and controlling these systems.

Uploaded by

pangunpark
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 64

Cyber Physical Computing Systems

Linear Systems

Pangun Park

Chungnam National University

pgpark@cnu.ac.kr

Pangun Park (CNU) 1 / 64


A Simple Robot

So far we have seen


Controls Basics
Mobile Robots

Need to be a bit more systematic in our discussion

Rich class of models:


General enough
Simple enough
Expressive enough
Relevant enough

LINEAR SYSTEMS!!

Pangun Park (CNU) 2 / 64


“Controlling” a Point Mass

Given a point mass on a line whose acceleration is directly controlled:

u
p̈ = u
p

Want to write this on a compact/general form

x1 = p ẋ1 = x2
−→
x2 = ṗ ẋ2 = u

Pangun Park (CNU) 3 / 64


On State Space Form

! "
ẋ1 = x2 x1
x=
ẋ2 = u x2

Store these variables in a single, 2-dimensional “state” variable

! " ! " ! "! " ! "


ẋ1 x2 0 1 x1 0
ẋ = = = + u
ẋ2 u 0 0 x2 1
# $
y = p = x1 = 1 0 x

Pangun Park (CNU) 4 / 64


On State Space Form

! " ! " ! "! " ! "


ẋ1 x2 0 1 x1 0
ẋ = = = + u
ẋ2 u 0 0 x2 1

# $
y = p = x1 = 1 0 x

Or, even more generally

! " ! "
0 1 0 # $
A= ,B = ,C = 1 0 ,
0 0 1

ẋ = Ax + Bu
y = Cx

Pangun Park (CNU) 5 / 64


A 2D Point-Mass

p̈x = ux
p̈y = uy u = (ux , uy )

p = (px , py )
⎡ ⎤
0 1 0 0
⎢ 0 0 0 0 ⎥ ẋ = Ax + Bu
x 1 = px A=⎢ ⎥
y = Cx
⎣ 0 0 0 1 ⎦
x2 = ṗx 0 0 ⎤0 0
x 3 = py ⎡
0 0
x4 = ṗy ⎢ 1 0 ⎥
B=⎢ ⎥
u1 = ux ⎣ 0 0 ⎦
u2 = uy ' 0 1 (
y 1 = px 1 0 0 0
C=
y 2 = py 0 0 1 0

Pangun Park (CNU) 6 / 64


LTI Systems

ẋ = Ax + Bu
y = Cx

This is a so-called LTI (Linear Time-Invariant) System on State-Space form!!


⎧ ⎧
n
⎨x ∈ R
⎪ ⎨A : n × n

u ∈ Rm −→ B :n×m

⎩ ⎪

y ∈ Rp C :p×n

Check the size of the matrix!!

ẋ = Ax + Bu
y = Cx

Pangun Park (CNU) 7 / 64


State-Space Models

The general LTI model is


x: State
y : Output
u: Input

u ẋ = Ax + Bu y
y = Cx

Main Question: How should the input be selected?

But First: How can such systems be understood? And where do they come from?

Pangun Park (CNU) 8 / 64


Example 1: The Car Model

Recall our old friend, the car model


c
v̇ = u − γv
m
If we care about/can measure the velocity:

ẋ = Ax + Bu
y = Cx

where
c
A = −γ, B = ,C = 1
m
If we care about/can measure the position we have the same general equation with
different matrices:

! " ! "
0 1 0 # $
A= ,B = c ,C = 1 0 ,
0 −γ m

Pangun Park (CNU) 9 / 64


Example 2: Pendulum

Newton’s 2nd tells us that


• Newton’s 2nd tells us that
Not linear!
θ ℓ g
θ̈ = − sin(θ) + cu

θ ≪ 1 ⇒ sin θ ≈ θ

For small angles we get

ẋ = Ax + Bu
y = Cx

! " ! "
0 1 0 # $
A= ,B = ,C = 1 0 ,
−g /l 0 c

Pangun Park (CNU) 10 / 64


Example 3: Two Simple “Robots”

Consider two “robots” on a line


! "
ẋ1 = u1 ẋ2 = u2 1 0
ẋ = u
0 1
x1 x2 (A = 0)

The Rendezvous Problem: Have them meet at the same location

Idea: Have them aim towards each other:


) ! "
u1 = x2 − x1 −1 1
ẋ = x
u2 = x1 − x2 1 −1

A closed-loop feedback law!!

Pangun Park (CNU) 11 / 64


Rendezvous

Pangun Park (CNU) 12 / 64


Example 4: Unicycle Robot

Not Linear

ẋ = v cos φ ≈ 1
φ ẏ = v sin φ ≈ φ
φ̇ = ω
(x, y)

ẋ = v
We need to be more systematic/ clever
ẏ = v φ when it comes to generating LTI models
φ̇ = ω from nonlinear systems!

Still not linear!

Pangun Park (CNU) 13 / 64


Linearizations

Given a non-linear model

ẋ = f (x, u)
y = h(x)

We want to find a “local”, linear model around an operating point

(xo , uo ) −→ (x = xo + δx , u = uo + δu )

The new equations of motion become

δ̇x = ẋ − ẋo = ẋ = f (xo + δx , uo + δu )

Pangun Park (CNU) 14 / 64


Linearizations

Taylor expansion!!

δ̇x = f (xo + δx , uo + δu )
∂f ∂f
= f (xo , uo ) + (xo , uo ) δx + (xo , uo ) δu + H.O.T
∂x
* +, - ∂u
* +, -
A B
∂h
y = h(xo + δx ) = h(xo ) + (xo ) δx + H.O.T
∂x
* +, -
C

Assumptions:

f (xo , uo ) = 0
h(xo ) = 0

Pangun Park (CNU) 15 / 64


Linearizations


⎧ ⎪ δ̇x = Aδx + Bδu

⎪ ẋ = f (x, u) x = xo + δx




⎪ ⎪
⎪ y = C δx


⎨ y = h(x) u = u o + δu ⎪


,-*+
−→ ∂f

⎪ ⎪
⎪ A= ∂x
(xo , uo )

⎪ f (xo , uo ) = 0 ⎪
⎪ ∂f





⎪ B= ∂u
(xo , uo )
h(xo ) = 0 ⎪
⎩ ∂h
C = ∂x
(xo )

Pangun Park (CNU) 16 / 64


Computing the Jacobians

⎡ ⎤ ⎡ ⎤
f1 h1
⎢f2 ⎥ ⎢ h2 ⎥
x ∈ Rn , u ∈ Rm , y ∈ Rp , f = ⎢ . ⎥ , h = ⎢ . ⎥
⎢ ⎥ ⎢ ⎥
⎣ .. ⎦ ⎣ .. ⎦
fn hm

⎡ ∂f1 ∂f1 ∂f1



∂x ∂x2
... ∂xn
⎢ ∂f21 ∂f2
... ∂f2 ⎥
∂f ⎢ ∂x1 ∂x2 ∂xn ⎥
=⎢
⎢ .. .. .. .. ⎥
∂x ⎣ . . .

. ⎦
∂fn ∂fn ∂fn
∂x1 ∂x2
... ∂xn
* +, -
n×n

Pangun Park (CNU) 17 / 64


Computing the Jacobians

⎡ ⎤ ⎡ ⎤
f1 h1
⎢f2 ⎥ ⎢ h2 ⎥
x ∈ Rn , u ∈ Rm , y ∈ Rp , f = ⎢ . ⎥ , h = ⎢ . ⎥
⎢ ⎥ ⎢ ⎥
⎣ .. ⎦ ⎣ .. ⎦
fn hm

⎡ ∂f1 ∂f1 ∂f1



∂u ∂u2
... ∂um
⎢ ∂f21 ∂f2
... ∂f2 ⎥
∂f ⎢ ∂u1 ∂u2 ∂um ⎥
=⎢
⎢ .. .. .. .. ⎥
∂u ⎣ . . .

. ⎦
∂fn ∂fn ∂fn
∂u1 ∂u2
... ∂um
* +, -
n×m

Pangun Park (CNU) 18 / 64


Computing the Jacobians

⎡ ⎤ ⎡ ⎤
f1 h1
⎢f2 ⎥ ⎢ h2 ⎥
x ∈ Rn , u ∈ Rm , y ∈ Rp , f = ⎢ . ⎥ , h = ⎢ . ⎥
⎢ ⎥ ⎢ ⎥
⎣ .. ⎦ ⎣ .. ⎦
fn hm

⎡ ∂h1 ∂h1 ∂h1



∂x ∂x2
... ∂xn
⎢ ∂h12 ∂h2
... ∂h2 ⎥
∂h ⎢ ∂x1 ∂x2 ∂xn ⎥
=⎢
⎢ .. .. .. .. ⎥
∂x ⎣ . . .

. ⎦
∂hn ∂hn ∂hn
∂x1 ∂x2
... ∂xn
* +, -
p×n

Pangun Park (CNU) 19 / 64


Example: Inverted Pendulum

g
θ̈ = sin θ + u cos θ
l

x1 = θ, x2 = θ̇, y = x1

θ
u ! "
x2
f (x, u) = g
l
sin(x1 ) + u cos(x1 )
h(x) = x1

(xo , uo ) = (0, 0)
4 5 ! " ! "
∂f1 ∂f1
∂x1 ∂x2 0 1 0 1
A= ∂f2 ∂f2 = g =
∂x1 ∂x2 l
cos(x1 ) 0 (0,0) g /l 0
0,0

Pangun Park (CNU) 20 / 64


Example: Inverted Pendulum

g
θ̈ = sin θ + u cos θ
l

x1 = θ, x2 = θ̇, y = x1

θ
u ! "
x2
f (x, u) = g
l
sin(x1 ) + u cos(x1 )
h(x) = x1

(xo , uo ) = (0, 0)
! ∂f1 " ! " ! "
∂u
0 0
B = ∂f = =
∂u
2
0,0
cos(x1 ) (0,0)
1

Pangun Park (CNU) 21 / 64


Example: Inverted Pendulum

g
θ̈ = sin θ + u cos θ
l

x1 = θ, x2 = θ̇, y = x1

θ
u ! "
x2
f (x, u) = g
l
sin(x1 ) + u cos(x1 )
h(x) = x1

(xo , uo ) = (0, 0)
6 7 # $
∂h ∂h
C = ∂x 1 ∂x2 = 1 0
(0,0)

Pangun Park (CNU) 22 / 64


Example: Unicycle

ẋ = v cos φ
ẏ = v sin φ
φ̇ = ω

φ ⎧
⎪ x1 = x, x2 = y , x3 = φ


⎨ y1 = x1 , y2 = x2 , y3 = x3
(x, y)


⎪ u1 = v , u2 = ω

(xo , uo ) = (0, 0)

⎡ ⎤ ⎡ ⎤
1 0 1 0 0
A = 0, B = ⎣0 0⎦ , C = ⎣0 1 0⎦
0 1 0 0 1

ẋ2 = 0

????
Pangun Park (CNU) 23 / 64
Punchlines

Some times the linearizations give reasonable models and sometimes they do not...

Despite the fact that they are only local approximations, they are remarkably useful
(when they work...)

Pangun Park (CNU) 24 / 64


LTI Systems

u ẋ = Ax + Bu y
y = Cx

Let’s figure out how such systems behave.

Start by ignoring the input term:

ẋ = Ax
x(t0 ) = x0

What is the solution to this system?

Pangun Park (CNU) 25 / 64


Solving the ODE

If everything is scalar:

ẋ = ax, x(t0 ) = x0 −→ x(t) = e a(t−t0 ) x0

How do we know?
Initial conditions

x(t0 ) = e a(t0 −t0 ) x0 = e 0 x0 = x0

Dynamics
d
x(t) = ae a(t−t0 ) x0 = ax
dt

For higher-order systems, we just get a matrix version of this


0)
ẋ = Ax, x(t0 ) = x0 −→ x(t) = e* A(t−t
+, - x0
Matrix exponential

Pangun Park (CNU) 26 / 64


Matrix Exponentials

The definition is just like for scalar exponentials

∞ ∞
8 ak t k 8 Ak t k
e at = e At =
k! k!
k=0 k=0

Derivative:
∞ ∞ ∞ ∞
d 8 Ak t k 8 kAk t k−1 8 Ak−1 t k−1 8 Ak t k
=0+ =A =A
dt k=0 k! k=1
k! k=1
(k − 1)! k=0
k!

d At
e = Ae At
dt

Pangun Park (CNU) 27 / 64


Solving the Controlled Equation

The matrix exponential plays such an important role that it has its own name:
The State Transition Matrix

e A(t−t0 ) = Φ(t, t0 )

x = Ax −→ x(t) = Φ(t, τ )x(τ )


)
d
dt
Φ(t, t0 ) = AΦ(t, t0 )
Φ(t, t) =I

But what if we have the controlled system

ẋ = Ax + Bu

Claim:
9 t
x(t) = Φ(t, t0 )x(t0 ) + Φ(t, τ )Bu(τ )dτ
t0

Pangun Park (CNU) 28 / 64


Solving the Controlled Equation

Claim
9 t
x(t) = Φ(t, t0 )x(t0 ) + Φ(t, τ )Bu(τ )dτ
t0
9 t0
x(t0 ) = Φ(t0 , t0 ) x(t0 ) + Φ(t0 , τ )Bu(τ )dτ
* +, - t0
I * +, -
0

x(t0 ) = x(t0 )

Pangun Park (CNU) 29 / 64


Solving the Controlled Equation

Claim
9 t
x(t) = Φ(t, t0 )x(t0 ) + Φ(t, τ )Bu(τ )dτ
t0
9 t
d d
x(t) = AΦ(t, t0 )x(t0 ) + Φ(t, τ )Bu(τ )dτ
dt dt t0

9 t 9 t
d d
f (t, τ )dτ = f (t, t) + f (t, τ )dτ
dt t0 dt t0
9 t
Φ(t, t)Bu(t) + AΦ(t, τ )Bu(τ )dτ
t0

Pangun Park (CNU) 30 / 64


Solving the Controlled Equation

Claim
9 t
x(t) = Φ(t, t0 )x(t0 ) + Φ(t, τ )Bu(τ )dτ
t0
9 t
d d
x(t) = AΦ(t, t0 )x(t0 ) + Φ(t, τ )Bu(τ )dτ
dt dt t0
: 9 t ;
d
x(t) = A Φ(t, t0 )x(t0 ) + Φ(t, τ )Bu(τ )dτ + Bu(t)
dt t0
d
x(t) = Ax + Bu
dt

Pangun Park (CNU) 31 / 64


In Summary

ẋ = Ax + Bu, y = Cx

9 t
y (t) = C Φ(t, t0 )x(t0 ) + C Φ(t, τ )Bu(τ )dτ
t0

Φ(t, τ ) = e A(t−τ )

Pangun Park (CNU) 32 / 64


Stability

First order of business is always trying to figure out if the system “blows up” or not

Recall the control design objectives:


Stability
Tracking
Robustness
Other objectives

Pangun Park (CNU) 33 / 64


Scalar Systems
It is useful to start with scalar systems to get some intuition about what is going on

ẋ = ax −→ x(t) = e at x(0)

For a > 0
150

100

50

0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5

Pangun Park (CNU) 34 / 64


Scalar Systems
It is useful to start with scalar systems to get some intuition about what is going on

ẋ = ax −→ x(t) = e at x(0)

For a < 0
1

0.9

0.8

0.7

0.6

0.5

0.4

0.3

0.2

0.1

0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5

Pangun Park (CNU) 35 / 64


Scalar Systems
It is useful to start with scalar systems to get some intuition about what is going on

ẋ = ax −→ x(t) = e at x(0)

For a = 0
2

1.8

1.6

1.4

1.2

0.8

0.6

0.4

0.2

0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5

Pangun Park (CNU) 36 / 64


Three Cases

Asymptotically Stable:

x(t) → 0, ∀x(0)

Unstable:

∃x(0) :∥ x(t) ∥→ ∞

Critically Stable: in-between (doesn’t blow up but doesn’t go to zero either)


⎨a > 0 :
⎪ Unstable
at
ẋ = ax −→ x(t) = e x(0) a < 0 : Asymptotically stable


a=0: Critically stable

Pangun Park (CNU) 37 / 64


From Scalars to Matrices?

ẋ = Ax −→ x(t) = e At x(0)

We cannot say that A > 0, but we can do the next best thing - eigenvalues!!

Av = λv

λ : eigenvalue ∈ C
v : eigenvector ∈ Rn

The eigenvalues tell us how the matrix A“acts” in different directions (eigenvectors)

In MATLAB:
>> eig(A)

Pangun Park (CNU) 38 / 64


Example

! "
1 0
A=
0 −1

λ1 = 1, λ2 = −1

! " ! "
1 0
v1 = , v2 =
0 1

Pangun Park (CNU) 39 / 64


Stability

ẋ = Ax −→ x(t) = e At x(0)

Asymptotically Stable (if and only if):


Re(λ) < 0, ∀λ ∈ eig(A)

We will design for this!

Unstable(if):
∃λ ∈ eig(A) : Re(λ) > 0

Critically Stable (only if):

Re(λ) ≤ 0, ∀λ ∈ eig(A)

Critically Stable (if): one eigenvalue is 0 and the rest have negative real part OR two
purely imaginary eigenvalues and the rest have negative real part
Pangun Park (CNU) 40 / 64
A Tale of Two Pendula

! "
0 1
A=
−1 0
λ1 = j, λ2 = −j

Critically stable!
Oscillates!

! "
0 1
A=
1 0
λ1 = −1, λ2 = 1

Unstable!

Pangun Park (CNU) 41 / 64


Swarm Robotics

Let’s use the stability results to solve the so-called Rendezvous Problem in swarm
robotics

The setup:
Given a collection of mobile agents who can only measure the relative displacement
of their neighbors (no global coordinates)

This is what agent i can measure

Problem: Have all the agents meet at the same (unspecified) position

Pangun Park (CNU) 42 / 64


The Two-Robot Case

We have already seen the two-robot case (scalar does not matter...)

ẋ1 = u1 ẋ2 = u2

x1 x2

If the agents simply aim towards each other:


) ! "
u1 = x2 − x1 −1 1
ẋ = x
u2 = x1 − x2 1 −1

Pangun Park (CNU) 43 / 64


The Two-Robot Case

Critically stable case


! "
−1 1
A=
1 −1
λ1 = 0, λ2 = −2

Fact: If one eigenvalue is 0 and all others have negative real part, then the state will end
up in the so-called null-space of A

null(A) = {x : Ax = 0}

For this particular A, the null-space is


! "
α
null(A) = {x : x = , α ∈ R}
α

Pangun Park (CNU) 44 / 64


The Two-Robot Case

We have that

x1 → α, x2 → α ⇔ (x1 − x2 ) → 0

Rendezvous is achieved!

If there are more than two agents, they should probably aim towards the centroid of their
neighbors (or something similar)

8
ẋi = (xj − xi )
j∈Ni

Pangun Park (CNU) 45 / 64


The Multi-Robot Case

8
ẋi = (xj − xi ) ẋ = −Lx
j∈Ni

Fact: If the underlying graph is


⎡ ⎤ connected then the graph Laplacian L
x1 has one zero eigenvalues and the rest
x = ⎣ ... ⎦ are positive
⎢ ⎥

xN Critically Stable!

⎡ ⎤
α
null(L) = {x : x = ⎣ ... ⎦}
⎢ ⎥

Pangun Park (CNU) 46 / 64


The Multi-Robot Case

8
ẋi = (xj − xi ) ẋ = −Lx
j∈Ni

xi → α, ∀i ⇔ (xi − xj ) → 0, ∀i, j

Rendezvous is achieved!

Pangun Park (CNU) 47 / 64


Rendezvous

Pangun Park (CNU) 48 / 64


Beyond Rendezvous

Pangun Park (CNU) 49 / 64


And Now For Real

2 Robots

Same PID go-to-goal controller as before

The proposed “high-level” controllers are used to pick a intermediary goal-points

Robots keep track of position using odometry

Positions are communicated rather than sensed (later...)

Pangun Park (CNU) 50 / 64


Output Feedback

So now we know that the first order of business is to stabilize the system such that all
the eigenvalues have negative real part

u ẋ = Ax + Bu y
y = Cx

Pangun Park (CNU) 51 / 64


Back to the World’s Simplest Robot

u
p̈ = u
p

Idea: Move towards the origin!


! " ! "
0 1 0
ẋ = x+ u
0 0 1
# $
y= 1 0 x

)
u>0 if y <0
u = −y
u<0 if y >0

Pangun Park (CNU) 52 / 64


Or, In General

u = −Ky = −KCx
ẋ = Ax + Bu = Ax − BKCx = (A − BKC )x

Pick, if possible, K such that

Re(λ) < 0 ∀λ ∈ eig(A − BKC )

Pangun Park (CNU) 53 / 64


Back to the Robot

:! " ! " ;
0 1 0 # $
ẋ = + 1 1 0 x
0 0 1

! "
0 1
ẋ = x
−1 0

eig(A − BKC ) = ±j

Critically stable!

Pangun Park (CNU) 54 / 64


Back to the Robot

Pangun Park (CNU) 55 / 64


What’s The Problem?

The problem is that we do not take the velocity into account!

We need to use the full state information in order to stabilize this system!

Problem 1 (How to do that?)

Problem 2 (But we do not know x, we know y?)

Next Module! (and some next lecture...)

Pangun Park (CNU) 56 / 64


State Feedback

Need to stabilize the system such that all the eigenvalues have negative real part Using
state feedback!

u ẋ = Ax + Bu y
y = Cx

Pangun Park (CNU) 57 / 64


Closing the Loop

ẋ = Ax + Bu
u = −Kx
ẋ = Ax + Bu = Ax − BKx = (A − BK ) x
* +, -
closed−loop dynamics

Pick, if possible, K such that the closed-loop system is stabilized, i.e.,

Re(eig(A − BK )) < 0

Next lecture

Pangun Park (CNU) 58 / 64


Back to the Robot

u ∈ R, x ∈ R2 , K : 1 × 2
# $
K = k1 k2

:! " ! " ;
0 1 0 # $
ẋ = + k1 k2 x
0 0 1
! "
0 1
ẋ = x
−k1 k2

Pangun Park (CNU) 59 / 64


Picking the Gains

In the next lecture, we will pick gains in a systematic manner, but for now, let’s try

k1 = k2 = 1

! "
0 1
A − BK =
−1 −1
eig(A − BK ) = −0.5 ± 0.866j

Asymptotically stable!

Damped oscillations

Pangun Park (CNU) 60 / 64


Attempt 1

Pangun Park (CNU) 61 / 64


Another Attempt

k1 = 0.1, k2 = 1

! "
0 1
A − BK =
−0.1 −1
eig(A − BK ) = −0.1127, −0.8873

Asymptotically stable!

No oscillations

Pangun Park (CNU) 62 / 64


Attempt 2

Pangun Park (CNU) 63 / 64


Eigenvalues Matter

It is clear that some eigenvalues are better than others. Some cause oscillations, some
make the system respond too slowly, and so forth...

In the next module we will see how to select eigenvalues and how to pick control laws
based on the output rather than the state.

Pangun Park (CNU) 64 / 64

You might also like