Transcript Control 1

IVR: Control Theory
Overview:
• PID control
• Steady-state error and the integral method
• Overshoot and ringing in system with time
delay
• Overshoot and ringing in second order
systems
• The derivative method
IVR 30/10/2009 Herrmann
1
PID control
• P = Proportional error
• I = Integral
• D = Derivative
A standard and very useful method for
augmenting simple feedback control E.g. used in
- wheel position/speed control in the Khepera
IVR 30/10/2009 Herrmann
2
Proportional error control
Desired
output
Control
Law
Actual
output
Motor
command
Robot in
environment
Disturbances
Measurement
• Same as servo, i.e. using a control signal
proportional to the difference between the
actual (measured) output and the desired
(target) output.
• I.e. want to make large change when error
is large, small change if error is small
IVR 30/10/2009 Herrmann
3
Steady state error
Servo control law:
Battery
voltage
VB  K p (sgoal  s)
VB
New process:
K p sgoal
MR ds
 ( K p  k1 ) s 
k2 dt
s
gain=K
sgoal
s
With steady state (ds/dt=0): s 
Steady state error:
sgoal  s  sgoal 
?
K p sgoal
Vehicle
speed
K p  k1
K p sgoal

K p  k1
K p sgoal  k1sgoal  K p sgoal
K p  k1
k1

sgoal
K p  k1
IVR 30/10/2009 Herrmann
4
Steady state error
Battery
voltage
k1
sgoal  s 
sgoal
K p  k1
VB
?
Vehicle
speed
s
gain=K
sgoal
s
k1 is determined by the motor physics: e= k1 s
Can choose Kp: to reach target want K p  
But we can’t put an infinite voltage into our
motor!
IVR 30/10/2009 Herrmann
5
Steady state error
For any sensible Kp the system will undershoot
the target velocity.
s
sgoal
t
IVR 30/10/2009 Herrmann
6
Proportional Integral (PI) Control
If we could estimate this error we could add it
to the control signal:
VB  K p (sgoal  s)  
The best way to estimate it is to integrate the
error over time:
   ( sgoal  s)dt
Obtain new control law:
VB  K p ( sgoal  s )  K i  ( sgoal  s )dt
Basically, this sums some fraction of the error
until the error is reduced to zero.
With careful choice of Kp and Ki this can
eliminate the steady state error.
IVR 30/10/2009 Herrmann
7
Feedback with time delays
Desired
output
Control
Law
Actual
output
Motor
command
Robot in
environment
Disturbances
Measurement
• Imagine trying to move a robot to some zero
position with the simple control law:
– If xt < -δ move forward at 1cm/second,
– If xt > δ move backward at 1cm/second,
– If -δ < xt < δ stop
• What happens if there is a 1 second delay in
feedback?
IVR 30/10/2009 Herrmann
8
Feedback with time delays
• In general, a time-lag in a feedback loop will
result in overshoot and oscillation.
• Depending on the dynamics, the oscillation
could fade out, continue or increase.
• Sometimes we want oscillation, e.g. CPG
IVR 30/10/2009 Herrmann
9
Central Pattern Generators
• Many movements in animals, and robots,
are rhythmic, e.g. walking
• Rather than explicitly controlling position,
can exploit an oscillatory process, e.g.
If A is tonically active, it will excite B
A
B
When B becomes active it inhibits A
When A is inhibited, it stops exciting B
When B is inactive it stops inhibiting A
IVR 30/10/2009 Herrmann
10
www.sarcos.com
Auke Ijspeert: Bastian
IVR 30/10/2009 Herrmann
11
Feedback with time delays
• In general, a time-lag in a feedback loop will result
in overshoot and oscillation.
• Depending on the dynamics, the oscillation could
fade out, continue or increase.
• Sometimes we want oscillation, e.g. CPG
• Note that integration introduces a time delay.
• Time delays are equivalent to energy storage e.g.
inertia will cause similar effects.
IVR 30/10/2009 Herrmann
12
Second order system
Need more sophisticated model for oscillations
θgoal
error
Amplification
K of current I
Output
torque T
θ
θ
Want to move to desired postion θgoal
2
d
d
For a DC motor on a robot joint T  J
F
dt
dt
where J = joint inertia, F = joint friction
Proportional control:
T  K p (goal   )
IVR 30/10/2009 Herrmann
13
Second order system solution
g  0
For simplicity let
d
d
Then the system process is K p ( g   )  J
F
dt
dt
• The solution to this equation has the form
 e

 F
2J
 t
 c1e

t
2
2
 c2 e
 F 2   4K p 
where    2   
 J   J 


 
 t
2


[May be complex]
The system behaviour depends on J, F, Kp as follows:
IVR 30/10/2009 Herrmann
14
Over and Under Damping
 e
F2
F2
F2
4K p
4K p
4K p

F
t
2J 
 c1e

t
2
 c2 e
 t
2


 F 2   4K p 

   2   
J   J 
J
The system returns to the goal  e
(critical damping)
J
The system returns to the
goal with over-damping
J
The system returns to the
goal with under-damped,
sinusoidal behaviour
IVR 30/10/2009 Herrmann

F
2J
t
15
Steady state error – Load Droop
• If the system has to hold a load against
gravity, it requires a constant torque
• But P controller cannot do this without
error, as torque is proportional to error (so,
needs some error)
• If we knew the load L could use
T  L  K p
• But in practice this is not often possible
IVR 30/10/2009 Herrmann
16
Proportional integral (PI) control
• As before, we integrate the error over
time, i.e.
L  Ki  goal   t dt
t
0
• Effectively this gradually increases L until
it produces enough torque to compensate
for the load
• PI copes with Load Droop
IVR 30/10/2009 Herrmann
17
Proportional derivative (PD) control
• Commonly, inertia is large and friction small
• Consequently the system overshoots, reverses
the error and control signal, overshoots again…
• To actively brake the motion, we want to apply
negative torque when error is small and velocity
high
2
d
d
d
• Make T  K p ( g   )  K d
J
F
dt
Artificial
friction:
dt
dt
d 2
d
K p ( g   )  J
 F  K d 
dt
dt
IVR 30/10/2009 Herrmann
18
Combine as PID control
d (t )
T (t )  K p  g   t   K d
 K i   g   t dt
dt
t0
t
Ki
θg
error
Kp
Torque
θ
Kdd/dt
IVR 30/10/2009 Herrmann
19
PID control demo
d (t )
T (t )  K p  g   t   K d
 K i   g   t dt
dt
t0
t
d 2
d
T (t )  J 2  F
dt
dt
Rearranging becomes (almost) solvable as:
   b   c  d  0
b  ( F  Kd ) / J , c  K p / J ,
where
t
d  [ Ki  ( g   )dt  K p g ] / J
0
IVR 30/10/2009 Herrmann
20
PID control demo II
Pure proportional control  g  5.5 with friction & inertia
Overdamped, overshoot, oscillate
Choosing Kp, Kd, Ki a bit tricky
IVR 30/10/2009 Herrmann
21
PID control demo III
Use Kp=0.003
Add integral control
Less overdamped, overshoot, oscillate
IVR 30/10/2009 Herrmann
22
PID control demo IV
Add derivative control
Less overdamped, overshoot, oscillate
IVR 30/10/2009 Herrmann
23
PID control demo V
Goal: track oscillating goal position (red)
Original Kp=0.003 gain lags, undershoots
Kp=0.006 ok, but lags.
Kp=0.03 tracks better but overshoots
IVR 30/10/2009 Herrmann
24
Limitations of PID control
• Tuning: largely empirical e.g. by Ziegler–
Nichols method
• Delays: Combine with Feedforward
• Non-linearities: gain scheduling, multi-point
controller, fuzzy logic
• Noise: D-term particularly sensitive:
use low-pass filter (May cancel out D → PI)
• Often PI or PD is sufficient
IVR 30/10/2009 Herrmann
25
Further reading:
Most standard control textbooks discuss PID control.
For the research on robot juggling see:
Rizzi, A.A. & Koditschek, D.E. (1994) Further progress in
robot juggling: Solvable mirror laws. IEEE International
Conference on Robotics and Automation 2935-2940
S. Schaal and C.G. Atkeson. Open Loop Stable Control
Strategies for Robot Juggling. In Proc. IEEE Conf. Robotics
and Automation, pages 913 -- 918, Atlanta, Georgia, 1993.
CPGs are used in many more recent examples of walking
robots.
IVR 30/10/2009 Herrmann
26
Bose suspension
IVR 30/10/2009 Herrmann
27
Next time: Bob Fisher
IVR 30/10/2009 Herrmann
28