Professional Documents
Culture Documents
Basic Concepts in Control: 393R: Autonomous Robots Peter Stone
Basic Concepts in Control: 393R: Autonomous Robots Peter Stone
Control
393R: Autonomous Robots
Peter Stone
Slides Courtesy of
Benjamin Kuipers
Good Afternoon
Colleagues
⎛x˙ ⎞ u x ⎛v ⎞
• Acceleration control:
(rocket) x˙ = ⎜⎜ ⎟⎟ = F (x,u) = ⎜⎜ ⎟⎟
– let x = (x v)T ⎝v˙ ⎠ ⎝u⎠
v˙ = x˙˙ = u
The Bang-Bang
Controller
• Push back, against the direction of
the error
– with constant action u
• Error is e = x - xset
e<0 ⇒ u := on ⇒ x˙ = F (x,on) > 0
e>0 ⇒ u := off ⇒ x˙ = F (x,off ) < 0
• To prevent chatter around e = 0,
e < −ε ⇒ u := on
e > +ε ⇒ u := off
• Household thermostat. Not very
subtle.
Bang-Bang Control in
Action
x˙ = F(x,u) + d
• The P-controller cannot stabilize at e =
0.
– if ub is defined so F(xset,ub) = 0
– then F(xset,ub) + d 0, so the system
changes
• Must adapt ub to different disturbances
d.
Adaptive Control
• Sometimes one controller isn’t
enough.
• We need controllers at different
u = −k P
time scales.
e + u b
u˙ b = −k I e where k I << kP
• Therefore
€ t
u(t) = −kP e(t) − k I ∫ e dt + u b
0
• The Proportional-Integral (PI)
Controller.
Nonlinear P-control
• Generalize proportional control to
+
u = − f (e) + ub where f ∈M 0
• Nonlinear control laws have advantages
– f has vertical asymptote: bounded error e
– f has horizontal asymptote: bounded effort
u
– Possible to converge in finite time.
– Nonlinearity allows more kinds of
composition.
Stopping Controller
• Desired stopping point: x=0.
– Current position: x
d = | x | +ε
– Distance to obstacle:
v = x˙ = − f (x)
• Simple P-controller:
f (x) =for
• Finite stopping time k | x | sgn(x)
Derivative Control
• Damping friction is a force
opposing motion, proportional to
velocity.
• Try to prevent overshoot by damping
controller response.
u = −kP e − kD e˙
• Estimating a derivative from
measurements is fragile, and
amplifies noise.
Derivative Control in
Action
• A controller is defined to
change the coupled robot and
x˙ = F(x,u) into a desired
environment
˙
x
dynamical system. = F(x,H i (G(x)))
y = G(x)
u = H i (y) x˙ = Φ(x)
Two views of dynamic
behavior
• Time
plot
(t,x)
• Phase
portrai
t (x,v)
Phase Portrait: (x,v)
space
• Shows the trajectory (x(t),v(t)) of the system
– Stable attractor here
In One Dimension
• Simple linear
x˙
x˙ = kx
system
• Fixed point
x =0 ⇒ x˙ = 0 x
• Solution
kt
x(t) = x 0 e
– Stable if k < 0
– Unstable if k > 0
In Two Dimensions
• Often, we have position and
T
velocity:
x = (x,v) where v = x˙
• If we model actions as
forces, which cause
⎛x˙ ⎞ ⎛x˙ ⎞ ⎛ v ⎞
x˙ = ⎜ ⎟ = ⎜ ⎟ =then
acceleration,
⎜ ˙ ⎟ ⎜˙˙⎟ ⎜ ⎜ we⎟get:
⎟
⎝v ⎠ ⎝x ⎠ ⎝ forces⎠
The Damped Spring
• The spring is defined by Hooke’s
Law: F = ma = m&x&= −k x 1
x&= −k x friction
&
• Includemdamping
1−k x& 2
x&+and
&
• Rearrange bx&+redefine
cx= 0 constants
⎛x˙ ⎞ ⎛x˙ ⎞ ⎛ v ⎞
x˙ = ⎜⎜ ⎟⎟ = ⎜⎜ ⎟⎟ = ⎜⎜ ⎟⎟
⎝v˙ ⎠ ⎝x˙˙⎠ ⎝−bx˙ − cx ⎠
Node
Behavi
or
Focus
Behavi
or
Saddle
Behavi
or
Spiral
Behavi
or
(stabl
e
attrac
tor)
Center
Behavio
r
(undamp
ed
oscilla
tor)
The Wall Follower
(x,
y) θ
The Wall Follower
• Our robot model:
⎛x˙ ⎞ ⎛v cosθ ⎞
⎜ ⎟ ⎜ ⎟
x˙ = ⎜y˙ ⎟ = F (x,u) = ⎜v sinθ ⎟
⎜˙⎟ ⎜ ⎟
⎝θ ⎠ ⎝ ω ⎠
• Solve for
The Wall Follower
˙e˙ + k1 e˙ + k2 e = 0
• To get the damped spring
• We get the constraint
v 0 ω + k1 v 0 θ + k 2 e = 0
• Solve for . Plug into u.
⎛ v ⎞
⎛v ⎞ ⎜ 0
€ u = ⎜ ⎟ = −k θ − k 2 e⎟ = H i (e,θ)
⎝ω ⎠ ⎜ 1 v ⎟
⎝ 0 ⎠
– This makes the wall-follower a PD
controller.
– Because:
€
Tuning the Wall
Follower
• The system˙e˙ is
+ k1 e˙ + k2 e = 0
2
• Critical damping requires k1 − 4k 2 = 0
k1 = 4k 2
• Slightly underdamped performs
better.
4k2
– Set k2 by experience.
– Set k1 a bit less than
An Observer for
Distance to Wall
• Short sonar returns are
reliable.
– They are likely to be
perpendicular reflections.
Alternatives
• The wall follower is a PD control
law.
• A target seeker should probably be a
PI control law, to adapt to motion.
d T K
Tuning the PID
Controller
• We have described it as:
t
u(t) = −kP e(t) − kI ∫ e dt − k
D e˙(t)
0
• Another standard form is:
⎡ t ⎤
u(t) = −P ⎢e(t) + TI ∫ e dt + TD e˙(t)⎥
⎣ 0 ⎦
• Ziegler-Nichols says:
1.5 ⋅T
P= TI = 2.5 ⋅ d TD = 0.4 ⋅ d
€ K ⋅d
Ziegler-Nichols Closed
Loop
1. Disable D and I action (pure P
control).
2. Make a step change to the
setpoint.
3. Repeat, adjusting controller
gain until achieving a stable
oscillation.
• This gain is the “ultimate gain” Ku.
• The period is the “ultimate period”
Pu.
Closed-Loop Z-N PID
Tuning
• A standard form of PID is:
⎡ t ⎤
u(t) = −P ⎢e(t) + TI ∫ e dt + TD e˙(t)⎥
⎣ 0 ⎦
• For a PI controller:
Pu
P = 0.45 ⋅K u TI =
1.2
€
• For a PID controller:
Pu Pu
€ P = 0.6 ⋅K u TI = TD =
2 8
Summary of Concepts
• Dynamical systems and phase portraits
• Qualitative types of behavior
– Stable vs unstable; nodal vs saddle vs
spiral
– Boundary values of parameters
• Designing the wall-following control
law
• Tuning the PI, PD, or PID controller
– Ziegler-Nichols tuning rules
– For more, Google: controller tuning
Followers
now
• At time t,
– Sensor data tells us about the world at
t1 < t.
– Motor commands take effect at time t2 >
t.
– The lag is dt = t2 t1.
• To compensate for lag time,
– Predict future sensor value at t2.
– Specify motor command for time t2.
Predicting Future
Sensor Values
• Later, observers will help us make
better predictions.
• Now, use a simple prediction
method:
– If sensor s is changing at rate ds/dt,
– At time t, we get s(t1), where t1 < t,
– Estimate s(t2) = s(t1) + ds/dt * (t2 -
t1).
• Use s(t2) to determine motor signal
u(t) that will take effect at t2.
Static Friction
(“Stiction”)
• Friction forces oppose the direction of
motion.
• We’ve seen damping friction: Fd = f(v)
• Coulomb (“sliding”) friction is a
constant Fc depending on force against
the surface.
– When there is motion, Fc =
– When there is no motion, Fc = +
• Extra force is needed to unstick an
object and get motion started.
Why is Stiction Bad?
• Non-zero steady-state error.
• Stalled motors draw high current.
– Running motor converts current to
motion.
– Stalled motor converts more current to
heat.
• Whining from pulse-width
modulation.
– Mechanical parts bending at pulse
frequency.
Pulse-Width Modulation
• A digital system works at 0 and 5
volts.
– Analog systems want to output control
signals over a continuous range.
– How can we do it?
• Switch very fast between 0 and 5 volts.
– Control the average voltage over time.
• Pulse-width ratio = ton/tperiod. (30-50
sec)
ton
tperiod
Pulse-Code Modulated
Signal
• Some devices are controlled by the
length of a pulse-code signal.
– Position servo-motors, for example.
0.7ms
20ms
1.7ms
20ms
Integrator Wind-Up
• Suppose we have a PI controller
t
u(t) = −kP e(t) − k I ∫ e dt + u
b
0
• Motion might be blocked, but the
integral is winding up more and more
control action.