Text Illustrations

Ch. 6 Single Variable Control
ES159/259
Single variable control
•
•
How do we determine the motor/actuator inputs so as to command the
end effector in a desired motion?
In general, the input voltage/current does not create instantaneous
motion to a desired configuration
– Due to dynamics (inertia, etc)
– Nonlinear effects
•
•
Backlash
Friction
– Linear effects
•
•
Compliance
Thus, we need three basic pieces of information:
1. Desired joint trajectory
2. Description of the system (ODE = Ordinary Differential Equation)
3. Measurement of actual trajectory
ES159/259
SISO overview
•
Typical single input, single output (SISO) system:
•
We want the robot tracks the desired trajectory and rejects external
disturbances
We already have the desired trajectory, and we assume that we can
measure the actual trajectories
Thus the first thing we need is a system description
•
•
ES159/259
SISO overview
•
•
Need a convenient input-output description of a SISO system
Two typical representations for the plant:
– Transfer function
– State-space
•
•
Transfer functions represent the system dynamics in terms of the
Laplace transform of the ODEs that represent the system dynamics
For example, if we have a 1DOF system described by:
 t   Jt   Bt 
•
We want the representation in the Laplace domain:
•
Therefore, we give the transfer function as:
 s 
1
1/ J
P s  


 s  s sJ  B  s s  B / J 
 s   s 2J s   sB s 
 s sJ  B  s 
ES159/259
Review of the Laplace transform
•
•
Laplace transform creates algebraic equations from differential
equations
The Laplace transform is defined as follows:

x s    e st x t dt
0
•
For example, Laplace transform of a derivative:
 dx t 
st dx t 
Lx t   L

e
dt
 
dt
 dt  0

– Integrating by parts:

 dx t 
st
st


L

e
x
t

s
e
x t dt


0
 dt 
0
 sx s   x 0

ES159/259
Review of the Laplace transform
•
Similarly, Laplace transform of a second derivative:
 d 2 x t   st d 2 x t 
Lxt   L
 e
dt  s 2 x s   sx 0  x 0
2 
2
dt
 dt  0
•
Thus, if we have a generic 2nd order system described by the following
ODE:
mxt   bx t   kxt   F t 
•
And we want to get a transfer function representation of the system,
take the Laplace transform of both sides:
mLxt   bLx t   kLx t   LF t 
m s 2 x s   sx 0  x 0  bsx s   x 0  kx s   F s 


ES159/259
Review of the Laplace transform
•
Continuing:
ms
•
•
•
2

 bs  k x s   F s   mx 0  ms  c x 0
The transient response is the solution of the above ODE if the forcing
function F(t) = 0
Ignoring the transient response, we can rearrange:
x s 
1

F s  ms2  bs  k
This is the input-output transfer function and the denominator is called
the characteristic equation
ES159/259
Review of the Laplace transform
•
Properties of the Laplace transform
– Takes an ODE to a algebraic equation
– Differentiation in the time domain is multiplication by s in the Laplace
domain
– Integration in the time domain is multiplication by 1/s in the Laplace domain
– Considers initial conditions
•
i.e. transient and steady-state response
– The Laplace transform is a linear operator
ES159/259
Review of the Laplace transform
•
for this class, we will rely on a table of Laplace transform pairs for
convenience
Time domain
Laplace domain

x s   Lx t    e st x t dt
xt 
0
x t 
sxs   x0
xt 
s 2 x s   sx 0  x 0
Ct
C
s2
1
s
s
2
s  2
step
cost 

sint 
s  2
2
ES159/259
Review of the Laplace transform
Time domain
Laplace domain
e s x s 
xt   H t   
e at x t 
x s  a
x at 
1 s
x 
a a
C t 
C
ES159/259
SISO overview
•
Typical single input, single output (SISO) system:
•
We want the robot tracks the desired trajectory and rejects external
disturbances
We already have the desired trajectory, and we assume that we can
measure the actual trajectories
Thus the first thing we need is a system description
•
•
ES159/259
SISO overview
•
•
Need a convenient input-output description of a SISO system
Two typical representations for the plant:
– Transfer function
– State-space
•
•
Transfer functions represent the system dynamics in terms of the
Laplace transform of the ODEs that represent the system dynamics
For example, if we have a 1DOF system described by:
 t   Jt   Bt 
•
We want the representation in the Laplace domain:
•
Therefore, we give the transfer function as:
 s 
1
1/ J
P s  


 s  s sJ  B  s s  B / J 
 s   s 2J s   sB s 
 s sJ  B  s 
ES159/259
System descriptions
•
A generic 2nd order system can be described by the following ODE:
•
And we want to get a transfer function representation of the system,
take the Laplace transform of both sides:
mLxt   bLx t   kLx t   LF t 
•
•
mxt   bx t   kxt   F t 


m s 2 x s   sx 0  x 0  bsx s   x 0  kx s   F s 
ms2  bs  k x s   F s   mx 0  ms  c x 0
Ignoring the transient response, we can rearrange:


x s 
1

F s  ms2  bs  k
This is the input-output transfer function and the denominator is called
the characteristic equation
ES159/259
Example: motor dynamics
•
•
•
DC motors are ubiquitous in robotics applications
Here, we develop a transfer function that describes the relationship
between the input voltage and the output angular displacement
First, a physical description of the most common motor: permanent
magnet…
torque on the rotor:
 m  K1i a
ES159/259
stator
Physical instantiation
commutator
rotor
(armature)
ES159/259
Motor dynamics
•
When a conductor moves in a magnetic field, a voltage is generated
– Called back EMF:
Vb  K 2m
– Where m is the rotor angular velocity
armature inductance
armature resistance
L
di a
 Ria  V  Vb
dt
ES159/259
Motor dynamics
•
Since this is a permanent magnet motor, the magnetic flux is constant,
we can write:
 m  K1i a  K m i a
•
Similarly:
torque constant
Vb  K 2m  K b
d m
dt
back EMF constant
•
Km and Kb are numerically equivalent, thus there is one constant
needed to characterize a motor
ES159/259
Motor dynamics
•
This constant is determined from torque-speed curves
– Remember, torque and displacement are work conjugates
–
0 is the blocked torque
ES159/259
Single link/joint dynamics
•
•
•
•
Now, lets take our motor and connect it to a link
Between the motor and link there is a gear such that: m  rL
Lump the actuator and gear inertias: J m  J a  J g
Now we can write the dynamics of this mechanical system:
d 2 m
d m
L
L
Jm

B




K
i

m
m
m a
dt 2
dt
r
r
ES159/259
Motor dynamics
•
Now we have the ODEs describing this system in both the electrical
and mechanical domains:
di a
d
 Ria  V  K b m
dt
dt
d 2 m
d m
L
Jm

B

K
i

m
m a
dt 2
dt
r
In the Laplace domain:
L
•
Ls  R Ia s   V s   Kbsm s 
Jms 2  Bms m s   K mIa s    L s 
r
ES159/259
Motor dynamics
•
These two can be combined to define, for example, the input-output
relationship for the input voltage, load torque, and output displacement:
ES159/259
Motor dynamics
•
Remember, we want to express the system as a transfer function from
the input to the output angular displacement
– But we have two potential inputs: the load torque and the armature voltage
– First, assume L = 0 and solve for m(s):
J
m

s 2  Bms  m s 
 Ia s 
Km
 m s 
V s 

Ls  R Jms 2  Bms  s   V s   K s s 
m
b
m
Km
Km
sLs  R J m s  Bm   K b K m 
ES159/259
Motor dynamics
•
Now consider that V(s) = 0 and solve for m(s):
 K b s m s 
Ia s  
Ls  R
J

2
s
 Bm s  m s  
m
 K m K bs m s   L s 

Ls  R
r
 m s 
 Ls  R  / r

 L s  sLs  R J m s  Bm   K bK m 
•
Note that this is a function of the gear ratio
– The larger the gear ratio, the less effect external torques have on the
angular displacement
ES159/259
Motor dynamics
•
In this system there are two ‘time constants’
– Electrical: L/R
– Mechanical: Jm/Bm
•
For intuitively obvious reasons, the electrical time constant is assumed
to be small compared to the mechanical time constant
– Thus, ignoring electrical time constant will lead to a simpler version of the
previous equations:
 m s 
V s 

Km / R
sJ m s  Bm  K bK m / R 
 m s 
 1/ r

 L s  sJ m s  Bm  K bK m / R 
ES159/259
Motor dynamics
•
 m s 
Rewriting these in the time domain gives:
Km / R
sJ m s  Bm  K bK m / R 
J mm t   Bm  K bK m / R m t   K m / R V t 
 m s 
 1/ r

 L s  sJ m s  Bm  K bK m / R 
J mm t   Bm  K bK m / R m t   1/ R  L t 
V s 
•

By superposition of the solutions of these two linear 2nd order ODEs:
J  t   B  K K / R  t   K / R V t   1/ R  t 
m m
J
m
b
m
m
m
L
ut 
B
ES159/259
d t 
Motor dynamics
•
Therefore, we can write the dynamics of a DC motor attached to a load
as:
Jt   Bt   u t   d t 
– Note that u(t) is the input and d(t) is the disturbance (e.g. the dynamic
coupling from motion of other links)
•
To represent this as a transfer function, take the Laplace transform:
Js
2

 Bs  s   U s   Ds 
ES159/259
Setpoint controllers
•
We will first discuss three initial controllers: P, PD and PID
– Both attempt to drive the error (between a desired trajectory and the actual
trajectory) to zero
•
The system can have any dynamics, but we will concentrate on the
previously derived system
ES159/259
Proportional Controller
•
Control law:
u t   K p et 
– Where e(t) = d(t) - (t)
•
in the Laplace domain:
U s   K p E t 
•
This gives the following closed-loop system:
Kp
ES159/259
PD controller
•
Control law:
u t   K pet   K d e t 
– Where e(t) = d(t) - (t)
•
in the Laplace domain:
U s   K p  sK d E t 
•
This gives the following closed-loop system:


ES159/259
PD controller
•
•
This system can be described by:
U s   Ds 
 s  
Js 2  Bs
Where, again, U(s) is:
•
Combining these gives us:


U s   K p  sKd   d s    s 
K
 s  
p

Js 2  Bs
Solving for  gives:
•

 sK d   d s    s   Ds 
Js  Bs  s   K  sK  s   K  sK  s   Ds 
 Js  B  K s  K  s   K  sK  s   Ds 
2
d
p
d
p
d
2
d

K
  s  
d
p
p
 sK d  d s   Ds 
Js 2  B  K d s  K p
p
d
ES159/259
PD controller
•
•
The denominator is the characteristic polynomial
The roots of the characteristic polynomial determine the performance of
the system
s2 
•
•
B  K d  s  K p
0
J
J
If we think of the closed-loop system as a damped second order
system, this allows us to choose values of Kp and Kd
s 2  2zs   2  0
Thus Kp and Kd are:
K p   2J
K d  2J  B
•
A natural choice is z = 1 (critically damped)
ES159/259
PD controller
•
Limitations of the PD controller:
– for illustration, let our desired trajectory be a step input and our disturbance
be a constant as well:
C
D
 d s   , Ds  
s
s
– Plugging this into our system description gives:
K p  sK d C  D
 s  
s Js 2  B  K d s  K p
– For these conditions, what is the steady-state value of the displacement?
K p  sK d C  D  K pC  D  C  D
s K p  sK d C  sD
 ss  lim

lim
s 0 s Js 2  B  K s  K
s 0 Js 2  B  K s  K
Kp
Kp
d
p
d
p
– Thus the steady state error is –D/Kp
– Therefore to drive the error to zero in the presence of large disturbances,
we need large gains… so we turn to another controller




ES159/259
PID controller
•
•
Control law:
u t   K pet   K d e t   K i  et dt
In the Laplace domain:
K

U s    K p  K d s  i
s


K s
 s  
d
2

E s 


 K ps  K i  d s   sDs 
Js 3  B  K d s 2  K ps  K i
ES159/259
PID controller
•
•
The integral term eliminates the steady state error that can arise from a
large disturbance
How to determine PID gains
1. Set Ki = 0 and solve for Kp and Kd
2. Determine Ki to eliminate steady state error
•
However, we need to be careful of the stability conditions
Ki 
B  K d K p
J
ES159/259
PID controller
•
Stability
– The closed-loop stability of these systems is determined by the roots of the
characteristic polynomial
– If all roots (potentially complex) are in the ‘left-half’ plane, our system is
stable
• for any bounded input and disturbance
– A description of how the roots of the characteristic equation change (as a
function of controller gains) is very valuable
• Called the root locus
ES159/259
Summary
•
Proportional
–
–
–
–
–
•
Integral
–
–
–
–
•
A pure proportional controller will have a steady-state error
Adding a integration term will remove the bias
High gain (Kp) will produce a fast system
High gain may cause oscillations and may make the system unstable
High gain reduces the steady-state error
Removes steady-state error
Increasing Ki accelerates the controller
High Ki may give oscillations
Increasing Ki will increase the settling time
Derivative
–
–
–
–
Larger Kd decreases oscillations
Improves stability for low values of Kd
May be highly sensitive to noise if one takes the derivative of a noisy error
High noise leads to instability
ES159/259