You are on page 1of 42

12

Trajectory Planning, Setpoint Generation


and Feedforward for Motion Systems
Paul Lambrechts

Digital Motion Control (4K410), 2003

Faculty of Mechanical Engineering, Control Systems Technology Group 1/42


12
Overview
• Industrial motion control
– Motion control and factory automation;
– Current methods for feedforward control
– Performance characteristics for trajectory planning
– Second order trajectory planning algorithm

• Fourth order feedforward for electromechanical motion systems


• Fourth order trajectory planning algorithm
• (Further) implementation aspects
– Architecture
– Switching times
– Discrete time integration and synchronization
– First order filter implementation

• Simulation results
• Conclusions

Faculty of Mechanical Engineering, Control Systems Technology Group 2/42


12
Industrial motion control
• Robots
• Pick-and-place units
• Wafersteppers

Motion Control Tasks:


• Safety, Communication, etc.
• System compensation
• Trajectory planning
• Feedforward control
• Feedback control Industrial Robot

Faculty of Mechanical Engineering, Control Systems Technology Group 3/42


12
Main digital control functions

Error Application
handling interface

+
I/F Setpoints Hc I/F
-

Integrated I/F
functions Hardware
interfaces
An introduction to Digital Control #10

Faculty of Mechanical Engineering, Control Systems Technology Group 4/42


12
‘Simple’ rigid-body feedforward
x

F
m

k
1 DOF rigid-body model

mẍ + k ẋ = F ⇒ Fff = ma + kv
x is position, m is (equivalent) mass or inertia, k is viscous damp-
ing, F is actuator force and Fff is feedforward force.

Faculty of Mechanical Engineering, Control Systems Technology Group 5/42


12

Feedforward based on inverse model

ms 2

xs 1 x
K p  Kv s
ms 2

Digital Motion Control 8


Feedforward design

Faculty of Mechanical Engineering, Control Systems Technology Group 6/42


12
Trajectory profiles for rigid-body feedforward
Second order trajectory profiles
5
a [m/s2]

−5
0 0.2 0.4 0.6 0.8 1
1.5
v [m/s]

1
0.5 Fff = ma + kv
0
0 0.2 0.4 0.6 0.8 1
1
x [m]

0.5

0
0 0.2 0.4 0.6 0.8 1
time [s]

Faculty of Mechanical Engineering, Control Systems Technology Group 7/42


12
General controller implementation
Kfst
static feedforward
Setpoint
+
direction
Kfc +
Setpoint Coulomb friction compensation
+
velocity
Kfv +
velocity feedforward
Setpoint
+
acceleration
Kfa
Setpoint acceleration feedforward +
position +
Kp
Setpoint + + +
-2 +1
generator +
- +
d + + LowPass
dt Kv Ki ³ LeadLag Notch /
Saturation
LeadLag
measured position
integrator anti-windup

An introduction to Digital Control #38

Faculty of Mechanical Engineering, Control Systems Technology Group 8/42


12
Second order feedforward:

a
m

Acceleration v
k
profile generator
F
1 1 1
PD x
s s m.s2+k.s
Velocity Position Controller 2nd order model

Faculty of Mechanical Engineering, Control Systems Technology Group 9/42


12
Trajectory planning performance (p2p)
Second order trajectory profiles
5 • Timing: minimal trajectory
a [m/s2]

execution time
0
• Realizability: constrained
−5
0 0.2 0.4 0.6 0.8 1 dynamics (ā and v̄)
1.5
• Accuracy: trajectory ends at
v [m/s]

1
0.5 desired end position (x̄)
0
0 0.2 0.4 0.6 0.8 1
• Complexity: calculation time
1 • Reliability: always
x [m]

0.5 valid solution


0 • Implementation:
0 0.2 0.4 0.6 0.8 1
time [s] discretization, quantization
Faculty of Mechanical Engineering, Control Systems Technology Group 10/42
12
Profiles given ā, v̄ and x̄:
q
1. Forget v̄ : x̄ = 2 × 12 āt2 ⇒ tā = x̄ ⇒ t = 2t
ā x̄ ā

2. Calculate maximal velocity: v̂ := ā · tā

3. v̂ > v̄ ?; true: tā = āv̄ , false: tā = 12 tx̄

4. xā := 2 × 21 āt2ā ≤ x̄
(x̄−xā)
5. tv̄ = v̄

Faculty of Mechanical Engineering, Control Systems Technology Group 11/42


12
Properties of trajectory planning algorithm
Second order trajectory profiles
5
ta • Timing: minimal,
a [m/s2]

tv
0 determined by tā and tv̄
ta
−5 • Realizablity: guaranteed
0 0.2 0.4 0.6 0.8 1
1.5
by ā and v̄
v [m/s]

1 • Accuracy: exact within


0.5
machine accuracy
0
0 0.2 0.4 0.6 0.8 1 • Complexity: low
1
• Reliability: always valid
x [m]

0.5
solution
0
0 0.2 0.4 0.6 0.8 1 • Implementation: later
time [s]

Faculty of Mechanical Engineering, Control Systems Technology Group 12/42


12
Extensions of rigid body feedforward
• Smoothing and shaping
– third order trajectories with rigid body feedforward ?
– filtering of second order trajectories and feedforwards ?
• Model inversion
– using second or third order trajectories ?
– focus on frequency domain properties ?
– learning techniques ?

→ back to basics !

Faculty of Mechanical Engineering, Control Systems Technology Group 13/42


12
4th order model for electro-mechanical motion
system
x 1 x 2

c
F
m 1 m 2

k 1 2

k 1 k 2

1 DOF 4th order model

x1 and x2 are actuator and load position, m1, m2 masses, k1, k2


viscous damping, c spring stiffness, k12 internal viscous damping,
F is actuator force.

Faculty of Mechanical Engineering, Control Systems Technology Group 14/42


12
4th order feedforward
Equations of motion:

m1ẍ1 = −k1ẋ1 − c(x1 − x2) − k12(ẋ1 − ẋ2) + F
m2ẍ2 = −k2ẋ2 + c(x1 − x2) + k12(ẋ1 − ẋ2)

Laplace transform and substitution:





 q1 = m1 m2
q1 s 4 + q2 s 3 + q3 s 2 + q4 s q2 = (m1 + m2)k12 + m1k2 + m2k1

F = ·x2
k12s + c 
 q3 = (m1 + m2)c + k1k2 + (k1 + k2)k12

q
4 = (k1 + k2)c

Feedforward force calculation:


1
Fff = · {q1d + q2 + q3a + q4v}
k12s + c
Faculty of Mechanical Engineering, Control Systems Technology Group 15/42
12 1000
Trajectory profiles
d [m/s4]

−1000
0 0.2 0.4 0.6 0.8 1 1.2
for 4th order
50
feedforward
j [m/s3]

−50
0 0.2 0.4 0.6 0.8 1 1.2
5
a [m/s2]

−5
0 0.2 0.4 0.6 0.8 1 1.2 q1 d + q2  + q3 a + q4 v
1.5 Fff =
1
k12s + c
v [m/s]

0.5
0
0 0.2 0.4 0.6 0.8 1 1.2

1
x [m]

0.5

0
0 0.2 0.4 0.6 0.8 1 1.2

Faculty of Mechanical Engineering, Control Systems Technology Group 16/42


12
4th order feedforward: Fff =
q1 d + q2  + q3 a + q4 v
k12s + c
d
q1

Derivative of jerk
profile generator q2

Rigid Body Feedforward

q3

q4

1
k12.s+c

F
1 1 1 1 Motion
PD x
s s s s System
Jerk Acceleration Velocity Position Controller 4th order model

Faculty of Mechanical Engineering, Control Systems Technology Group 17/42


12 1000

d [m/s4]
4th order trajectory 0

−1000
planner ?? 50
0 0.2 0.4 0.6 0.8 1 1.2

j [m/s3]
0
• Point-to-point move
(all derivatives zero −50
0 0.2 0.4 0.6 0.8 1 1.2

at start and end) 5

a [m/s2]
0
• Given: displacement x̄
and bounds d,¯ ̄, ā and v̄ −5
0 0.2 0.4 0.6 0.8 1 1.2

1.5
• Performance criteria !? 1
v [m/s]
0.5
0
0 0.2 0.4 0.6 0.8 1 1.2

1
x [m]

0.5

0
0 0.2 0.4 0.6 0.8 1 1.2

Faculty of Mechanical Engineering, Control Systems Technology Group 18/42


12
4th order trajectory specification:
Second order trajectory profiles: 3 time periods, 2 sizes and max a
5
ta
tv
a [m/s2]

ta
−5
0 0.2 0.4 0.6 0.8 1
Fourth order trajectory profiles: 15 time periods, 4 sizes and max d
1000
t t t t
500 d d d d
t t t t t t t
d [m/s4]

j a j v j a j
0

−500 td td td td
−1000
0 0.2 0.4 0.6 0.8 1
time [s]

Faculty of Mechanical Engineering, Control Systems Technology Group 19/42


12
Fourth order trajectory profiles

4th order calculations 1000


d0

d [m/s4]
500

0
0.39 0.4 0.41 0.42 0.43 0.44 0.45 0.46
d(t) = d0 0

j [m/s3]
−20
−40 j0
(t) = d0t + 0 0.39 0.4 0.41 0.42 0.43 0.44 0.45 0.46
2

a [m/s2]
1 2 1 a0
a(t) = 2 d0 t + 0t + a0
0
0.39 0.4 0.41 0.42 0.43 0.44 0.45 0.46

1 1.5
v(t) = 6 d0 t
3
+ 12 0t2 + a0t + v0 v
v [m/s]
0

1.45
0.39 0.4 0.41 0.42 0.43 0.44 0.45 0.46
1 4 1 3
x(t) = 24 d0 t + 6 0 t + a0t2 0.35
x [m]

0.3
x0
+v0t + x0 0.25
0.39 0.4 0.41 0.42 0.43 0.44 0.45 0.46
time [s]

Faculty of Mechanical Engineering, Control Systems Technology Group 20/42


12
Fourth order trajectory profiles, no bounds on j, a or v
1000
4th order planning t
d
t
d
t
d
t
d

d [m/s4]
0

calculate td¯ −1000


t
d
t
d
t
d
t
d
0 0.2 0.4 0.6 0.8 1 1.2
100

j [m/s3]
td¯ only depends on d¯ and x̄ 0

−100
q 0 0.2 0.4 0.6 0.8 1 1.2

⇒ td¯ = 4
8d¯
10

a [m/s2]
0

−10
q
3 v̄
v̄ violated: td¯ = 2d¯
0 0.2 0.4 0.6 0.8 1 1.2

v [m/s]
1
q

ā violated: td¯ = d¯ 0
0 0.2 0.4 0.6 0.8 1 1.2
1
̄
̄ violated: td¯ =
x [m]

d¯ 0.5

0
0 0.2 0.4 0.6 0.8 1 1.2
time [s]

Faculty of Mechanical Engineering, Control Systems Technology Group 21/42


12
Fourth order trajectory profiles, final td
1000
4th order planning t
d
t
d
t t
d d

d [m/s4]
0

final td¯ −1000


t t
d d
t
d
t
d
0 0.2 0.4 0.6 0.8 1 1.2
50

j [m/s3]
0

−50
0 0.2 0.4 0.6 0.8 1 1.2
Note:
2

a [m/s2]
• No bounds violated 0

−2
• Final td¯ always ≤ first td¯ 0 0.2 0.4 0.6 0.8 1 1.2

0.2
• Consequently: x̄ not reached
v [m/s]
0.1
0
0 0.2 0.4 0.6 0.8 1 1.2

0.04
x [m]

0.02
0
0 0.2 0.4 0.6 0.8 1 1.2
time [s]

Faculty of Mechanical Engineering, Control Systems Technology Group 22/42


12
Fourth order trajectory profiles, no bounds on a or v
1000
4th order planning t
d tj tj
t
d tj
t t
d d tj

d [m/s4]
0

calculate t̄ −1000


t t
d d
t
d
t
d
0 0.2 0.4 0.6 0.8 1 1.2
50

j [m/s3]
Add periods of constant jerk 0

until x̄ is reached again −50


0 0.2 0.4 0.6 0.8 1 1.2
10

a [m/s2]
t̄ follows from: 0

t3̄ + (5td¯)t2̄ + (8t2d¯)t̄ + (4t3d¯ − 2dtx̄¯ ¯) = 0 −10


0 0.2 0.4 0.6 0.8 1 1.2
d
2

v [m/s]
1

0
v̄ violated: t2̄ + 3td¯t̄ + 2t2d¯ − dt¯v̄ ¯ =0 1
0 0.2 0.4 0.6 0.8 1 1.2
d
x [m]

0.5

ā violated: t̄ = − td¯
̄ 0
0 0.2 0.4 0.6 0.8 1 1.2
time [s]

Faculty of Mechanical Engineering, Control Systems Technology Group 23/42


12
Fourth order trajectory profiles, final td and tj
1000
4th order planning t
d tj tj
t
d tj
t t
d d tj

d [m/s4]
0

final td¯ and t̄ −1000


t t
d d
t
d
t
d
0 0.2 0.4 0.6 0.8 1 1.2
50

j [m/s3]
0

−50
0 0.2 0.4 0.6 0.8 1 1.2
Note: 5

a [m/s2]
• No bounds violated 0

−5
• Final t̄ always ≤ first t̄ 0 0.2 0.4 0.6 0.8 1 1.2
0.8
0.6
• Consequently: x̄ not reached
v [m/s]
0.4
0.2
0
0 0.2 0.4 0.6 0.8 1 1.2

0.2
x [m]

0.1

0
0 0.2 0.4 0.6 0.8 1 1.2
time [s]

Faculty of Mechanical Engineering, Control Systems Technology Group 24/42


12
Fourth order trajectory profiles, no bounds on v
1000
4th order planning t
d tj ta tj
t
d tj
t
d ta
t
d tj

d [m/s4]
0

calculate tā −1000


t
d
t
d
t
d
t
d
0 0.2 0.4 0.6 0.8 1 1.2
50

j [m/s3]
Add periods of constant 0

acceleration until x̄ reached −50


0 0.2 0.4 0.6 0.8 1 1.2
5
tā follows from:

a [m/s2]
0
{t2d¯ + td¯t̄} t2ā +
−5
0 0.2 0.4 0.6 0.8 1 1.2
{6t3d¯ + 9t2d¯t̄ + 3td¯t2̄ } tā + 2

v [m/s]
1
{8t4d¯ + 16t3d¯t̄ + 10t2d¯t2̄ + 2td¯t3̄ − x̄d¯} = 0
0
0 0.2 0.4 0.6 0.8 1 1.2
1
¯ 3 −3dt
¯ 2 t̄ −dt
¯ ¯t2
x [m]

v̄−2dtd¯ d¯ d ̄ 0.5
v̄ violated: tā = ¯ 2 ¯
dt +dt ¯t̄
d¯ d 0
0 0.2 0.4 0.6 0.8 1 1.2
time [s]

Faculty of Mechanical Engineering, Control Systems Technology Group 25/42


12
Fourth order trajectory profiles, final ta, td and tj
1000
4th order planning t
d tj ta tj
t
d tj
t
d ta
t
d tj

d [m/s4]
0

final td¯, t̄ and tā −1000


t
d
t
d
t
d
t
d
0 0.2 0.4 0.6 0.8 1 1.2
50

j [m/s3]
0

−50
0 0.2 0.4 0.6 0.8 1 1.2
Note: 5

a [m/s2]
• No bounds violated 0

−5
• Final tā always ≤ first tā 0 0.2 0.4 0.6 0.8 1 1.2
1.5
• Consequently: x̄ not reached
v [m/s]
1
0.5
0
0 0.2 0.4 0.6 0.8 1 1.2

0.6
For final step:
x [m]

0.4
determine obtained position xā 0.2
0
0 0.2 0.4 0.6 0.8 1 1.2
time [s]

Faculty of Mechanical Engineering, Control Systems Technology Group 26/42


12
Fourth order trajectory profiles, final tv, ta, td and tj
1000
4th order planning t
d tj ta tj
t
d tv tj
t
d ta
t
d tj

d [m/s4]
0

calculate tv̄ −1000


t
d
t
d
t
d
t
d
0 0.2 0.4 0.6 0.8 1 1.2
50

j [m/s3]
Final step: add period of 0

constant velocity until x̄ reached −50


0 0.2 0.4 0.6 0.8 1 1.2
5

a [m/s2]
0
x̄ − xā
tv̄ = −5
v̄ 0 0.2 0.4 0.6 0.8 1 1.2
1.5

v [m/s]
1
0.5
0
Finished: trajectory completely 0 0.2 0.4 0.6 0.8 1 1.2
1
determined by 5 parameters !
x [m]

0.5

0
0 0.2 0.4 0.6 0.8 1 1.2
time [s]

Faculty of Mechanical Engineering, Control Systems Technology Group 27/42


12
(Further) Implementation aspects
• Architecture
• Switching times
• Discrete time integration and synchronization
• First order filter implementation

Faculty of Mechanical Engineering, Control Systems Technology Group 28/42


12
How to deliver setpoint data?(cont.)
Solution 3: Split off setpoint interpolation

Trajectory setpoint
GUI controller
generation interpol.

?? CPU
CPU

Additional requirement : Datalink CPU1 to CPU2

An introduction to Digital Control #17

Faculty of Mechanical Engineering, Control Systems Technology Group 29/42


12
Architecture
1
Force
1
p 2
Reference
1
v
Derivative of jerk
5 p,v,a,j,d
a t,d t,d djerk djerk FF Demux
Jerk
45 Ts Ts
enable start Generate
j Plan Trajectory
Feedforward Acceleration
1000 Generate Profile
d
Velocity
0
1
Position
Trigger/Enable
Step Profiles

Faculty of Mechanical Engineering, Control Systems Technology Group 30/42


12
Fourth order trajectory profiles: intervals
1000
Switching 500
td td td td
tj ta tj tv tj ta tj

d [m/s4]
times 0

−500 td td td td
−1000
0 0.2 0.4 0.6 0.8 1
Switching times
1000

500
d [m/s4]

t2 t3 t4 t5 t8 t9 t14 t15
0
t0 t1 t6 t7 t10 t11 t12 t13
−500

−1000
0 0.2 0.4 0.6 0.8 1
Synchronisation with sampling instances at 100Hz?
1000

500
tj
d [m/s4]

t8 t9
0
t10
−500 td
−1000
0.65 0.7 0.75 0.8
time [s]

Faculty of Mechanical Engineering, Control Systems Technology Group 31/42


12
Switching times synchronization
Make sure that each interval is a multiple of the sampling time Ts

Example: r

td¯ = 4 ¯
8d
 

t0d¯ = ceil d × Ts
Ts

Correct d¯

d¯0 = 0 4
8td¯

Note that with t0d¯ ≥ td¯ we must have d¯0 ≤ d¯

Faculty of Mechanical Engineering, Control Systems Technology Group 32/42


12
4th order feedforward in discrete time ?
d
q1

Derivative of jerk
profile generator q2

Rigid Body Feedforward

q3

q4

1
k12.s+c

F
1 1 1 1 Motion
PD x
s s s s System
Jerk Acceleration Velocity Position Controller 4th order model

Faculty of Mechanical Engineering, Control Systems Technology Group 33/42


12
d d

Discrete time Derivative of Jerk


profile generator
Ts
-----
----
j Ts
-----
----
a Ts
-----
----
v Ts
-----
---- x
z-1 z-1 z-1 z-1
integration Jerk Acceleration Velocity Position

Normalized discrete time fourth order profiles, compared with continuous time profiles
a: not synchronized b: synchronized, delayed by 2Ts
Synchronization of
profiles:
d
d with 2Ts,
j with 1 12 Ts,
j

a with Ts,
v with 12 Ts.
a

→ 12 Ts ?
v

1
In1
1
0.5
z
Unit Delay 1
x

Out1

0 0.2 0.4 0.6 0.8 1 0 0.2 0.4 0.6 0.8 1


time [s] time [s]

Faculty of Mechanical Engineering, Control Systems Technology Group 34/42


12 1
u y
k12.s+c

First order filter Continuous time

1
implementation u 1/k12
s
y

c/k12

Algebraic loop !!
Ts(z+1)
u 1/k12 --------
------- y
2(z-1)
ZOH
Discrete-Time
Integrator: Trapezoidal

c/k12

Algebraic loop !!
1
u 1/k12 Ts 1/2 y
z
ZOH
Transfer function:
c/k12
Ts
2k12 +cTs (z + 1) NO algebraic loop !!
y= 2k12 −cTs
u 1
z − 2k12+cTs u -K-
z
y

ZOH Ts/(2*k12+c*Ts)

-K-

(2*k12-c*Ts)/(2*k12+c*Ts)

Faculty of Mechanical Engineering, Control Systems Technology Group 35/42


12
Digital 4th order feedforward

[d] derivative of jerk


d position
Demux
ZOH1 T [j] T [a] T [v] T [p1]
Profile Generator Position
dJerk with error correction z-1 z-1 z-1 z-1
[p2]
jerk acceleration velocity position

position correction Quantizer prevent


negative
ZOH2

derivative of jerk [d] 1/z 1/z -K- -K-


[d]
m1*m2 1/c
jerk
[j] [j] 1/z 0.5*Ts -K- Feedforward Force
(m1+m2)*k12+m1*k2+m2*k1 1
acceleration -K- 1
[a] z
[a] 1/z -K- 1/k12*Ts/(2+c/k12*Ts) Force
Unit Delay4
velocity (m1+m2)*c+k1*k2+(k1+k2)*k12
[v]
[v] 0.5*Ts -K- -K-
[p1] position (k1+k2)*c
(2-c/k12*Ts)/(2+c/k12*Ts)
[p2]
Trajectory
Profiles
[p2] 0.5*Ts 2
Ref

Faculty of Mechanical Engineering, Control Systems Technology Group 36/42


12
Bound selection
• Velocity:
– back EMF smaller than power supply voltage
– motor or gearbox specification (temperature)
• Acceleration:
– maximum power supply or motor current
– mechanical restrictions
• Jerk:
– power amplifier rise time
– mechanical restrictions
̄
• Derivative of jerk upper bound: Ts
Faculty of Mechanical Engineering, Control Systems Technology Group 37/42
12
Open loop fourth order feedforward response of servo error with plant variations
Simulation x 10
−5 Dashed line gives nominal rigid body FF response
8
results Parameter Value Unit Variation
m1 20 Kg m1 ∈ {15· · ·25},
6 m2 10 Kg m2 =30−m1
Robustness k1 10 Ns/m k1 ∈ {5· · ·15},
k2 10 Ns/m k2 =20−k1
against variations 4 c 6 ·105 N/m ±33 %
in additional k12 500 Ns/m ±100 %
Position error [m]

parameters 2

−2

−4

−6
0 0.5 1 1.5 2 2.5 3
time [s]

Faculty of Mechanical Engineering, Control Systems Technology Group 38/42


12
Open loop feedforward response of servo error
−5
x 10 Optimal second, third and fourth order feedforward
Simulation 8
second order FF
third order FF
results 6
fourth order FF

Position error [m] 4

2
Effect of order
of feedforward
0

−2

−4

−6
0 0.5 1 1.5 2 2.5 3
time [s]

Faculty of Mechanical Engineering, Control Systems Technology Group 39/42


12
−5
x 10 Digital ff response: 4th order, minimal c, Ts=5e−3
4
Simulation x 10
−6

8
results 3 6
4
2 2
Position error [m] 0
−2
1 −4
Discrete time 0.3 0.35 0.4 0.45
vs. continuous
0
time
−1

−2

−3
0 0.5 1 1.5 2 2.5 3
time [s]

Faculty of Mechanical Engineering, Control Systems Technology Group 40/42


12
Conclusions
• Superior performance of 4th order vs. rigid-body feedforward
• Algorithm no problem for state-of-the-art motion controllers
• Especially feedforward of djerk effective (for electro-mechanical
motion systems)
• Complete derivation (also for third order) available
• Simulink toolbox ‘motion’ available
• Report: ‘Trajectory planning and feedforward design for elec-
tromechanical motion systems’ available (DCT 2003-18)

Faculty of Mechanical Engineering, Control Systems Technology Group 41/42


12
Exercises
• .ZIP file available in OUTLOOK for Matlab release 12.1
• See exercises.pdf
– MAKE# and PROFILE# .M files
– The ‘motion’ library
– Feedforward in continuous and discrete time
– Real-time implementation

Faculty of Mechanical Engineering, Control Systems Technology Group 42/42

You might also like