You are on page 1of 16

ECE5463: Introduction to Robotics

Lecture Note 9: Trajectory Generation

Prof. Wei Zhang

Department of Electrical and Computer Engineering


Ohio State University
Columbus, Ohio, USA

Spring 2018

Lecture 9 (ECE5463 Sp18) Wei Zhang(OSU) 1 / 16


Outline

• Trajectory Generation Problem

• Point-to-Point Trajectories

• Time Scaling of Straight-Line Path

• Trajectory Generation Using Via Points

Outline Lecture 9 (ECE5463 Sp18) Wei Zhang(OSU) 2 / 16


Path and Time Scaling
• Roughly, a trajectory is a specification of the robot position (configuration)
as a function of time.

• It is often useful to view a trajectory as a combination of a path, a purely


geometric description of the sequence of configurations achieved by the
robot, and a time scaling, which specifies the times when those
configurations are reached.

• Path: a function θ : [0, 1] → Θ that maps a scalar path parameter s to a


point in the robot configuration space Θ
- s = 0: the start of the path
- s = 1: the end of the path

• Time scaling: a function s : [0, T ] → [0, 1] that maps each time instant to a
value of the geometric path parameter.

Trajectory Generation Problem Lecture 9 (ECE5463 Sp18) Wei Zhang(OSU) 3 / 16


Trajectory Generation Problem
• Trajectory: θ(s(t)) or θ(t) for short.

• Velocity and acceleration along a trajectory θ(s(t)):

dθ dθ d2 θ
θ̇ = ṡ; θ̈ = s̈ + 2 ṡ2
ds ds ds

• Trajectory Generation: Construct a trajectory (path + time scaling) so that


the robot reaches a sequence of points in a given time

• Trajectory should be sufficiently smooth and respect limits on joint variables,


velocities, accelerations, or torques

• Some of the joint limits can be “state-dependent”

• Due to time limit, we will not formally discuss path planning problems
(design path to avoid obstacles).

Trajectory Generation Problem Lecture 9 (ECE5463 Sp18) Wei Zhang(OSU) 4 / 16


Straight-Line Path
Chapter 9. Trajectory Generation 327

• Straight-line path in joint space:


θ2 (deg)
180
θ(s) = θstart + s(θend − θstart )
θend
90
• Straight lines in joint space generally do not yield straight-line motion of the
Chapter 9. Trajectory Generation 327
end-effector in task space θstart
θ2 (deg)
θ2 −90 180 90 180 θ1 (deg)
θend
−90 90

θstart
θ1 θθ22 (deg)
−90 90 180 θ1 (deg)
180 −90

• We may prefer to have


θ1 straight-line
θ2 (deg) θend in task space that connects
path 90
Tstart ∈ SE(3) to Tend ∈ SE(3).
180

θ
90 start
θend

• There are two ways to −90


design a “straight-line”
90 path in task space: using
180 θ1 (deg) θstart
minimum representation and
−90using screw
90 180motion
θ1 (deg)
−90
−90
Figure 9.1:Figure (Left) A 2R robot with joint limits 0◦ ≤ θ1 ≤ 180◦ , 0◦ ≤ θ2 ≤ 150◦ . (Top
9.1: (Left) A 2R robot with joint limits 0◦ ≤ θ1 ≤ 180◦ , 0◦ ≤ θ2 ≤ 150◦ . (Top
center)
Point-to-Point A straight-line
Trajectories path path
center) A straight-line inLecture
joint 9space
in joint(ECE5463and
space and (top
Sp18)
(top right)
right) the corresponding
the corresponding motion
motion Wei Zhang(OSU) 5 / 16
Straight-Line Path in Task Space: Approach 1
• Let x(s) be some minimum representation of the end-effect frame (e.g.
location + Euler angles)
Chapter 9. Trajectory Generation 327

θ2 (deg) as x(s) = xstart + s(xend − xstart )


• The straight line can be defined
180
Chapter 9. Trajectory Generation 327
θend
• Use inverse kinematics to find90the corresponding joint space path θ(s)
θ2 (deg) θstart
180
• Even when xstart and xθ2end−90
are both 90reachable,
180 θ1 (deg)some points along the straight
θend
line in task space may not90be−90reachable
θ1 θ2 (deg)
θstart
180
θ2 −90 90 180 θ1 (deg)
θend
90
−90
θstart
−90 90 180 θ1 (deg)
θ1 θ2 (deg)
180 −90

Figure 9.1: (Left) A 2R robot withθjoint limits 0◦ ≤ θ1 ≤ 180◦ , 0◦ ≤ θ2 ≤ 150◦ . (Top


end
center) A straight-line90path in joint space and (top right) the corresponding motion
of the end-effector in task space (dashed line). The reachable endpoint configurations,
subject to joint limits, are indicated in gray. (Bottom center) This curved line in joint
Point-to-Point Trajectories
space and (bottom right) the θLecture
start 9 (ECE5463
corresponding Sp18)
straight-line path in task space (dashed Wei Zhang(OSU) 6 / 16
Straight-Line Path in Task Space: Approach 2
• How do define “straight line” in SE(3)? Note that: Tstart + s(Tend − Tstart )
may not lie in SE(3)
• Straight line motion in Euclidean space ↔ Screw motion in SE(3)

• Let X(s) be the screw motion path with constant twist such that
X(0) = Tstart and X(1) = Tend .
−1
 
X(s) = Tstart exp log Tstart Tend s

• The translational and rotational parts of X(s) = (R(s), p(s)) are:

T
 
p(s) = pstart + s(pend − pstart ), R(s) = Rstart exp log Rstart Rend s

Point-to-Point Trajectories Lecture 9 (ECE5463 Sp18) Wei Zhang(OSU) 7 / 16


Time Scaling: Cubic Polynomial
• We can design scaling function s : [0, T ] → [0, 1] to ensure a “smooth”
motion along the path θ(s) and all the velocity and acceleration constraints
are satisfied.

• We often require zero velocity at the start and the end of a path. This leads
to the following constraint:

s(0) = 0, s(T ) = 1, ṡ(0) = ṡ(T ) = 0

• We can use a cubic polynomial to meet these constraints:

s(t) = a0 + a1 t + a2 t2 + a3 t3

Time Scaling Lecture 9 (ECE5463 Sp18) Wei Zhang(OSU) 8 / 16


Figure 9.2: A path following a constant screw motion versus a decoupled path where
Time the
Scaling:
frame originCubic Polynomial
follows a straight line and the angular velocity is constant.

s ṡ s̈
3 6
1 2T T2

0
T t

T t T t

• Assume straight-line
Figure 9.3: Plots of path in joint
s(t), ṡ(t), space
and s̈(t) for a (other cases
third-order are similar)
polynomial time scaling.

9.2.2.1 θ(s)
Polynomial Time = θstart
Scaling + s(θend − θstart )
Third-order
• Max Polynomials
joint velocities A convenient
are achieved form forpoint
at the halfway the time scaling
of the s(t) ista= T /2
motion
cubic polynomial of time,

s(t) = a0 + a1 t + a2 t2 + a3 t3 . (9.9)
• Max joint accelerations
A point-to-point and
motion in decelerations
time T imposes the are achieved
initial t = =0 ṡ(0)
at s(0)
constraints and=t 0= T :
and the terminal constraints s(T ) = 1 and ṡ(T ) = 0. Evaluating Equation (9.9)
and its derivative
ṡ(t) = a1 + 2a2 t + 3a3 t2 (9.10)
• Joint constraints θ̇limit and θ̈limit can be checked at these critical times to
at t = 0 and t = T and solving the four constraints for a0 , . . . , a3 , we find
ensure feasibility
3 2
a0 = 0, a1 = 0, a2 = ,
2
a3 = − .
Time Scaling T
Lecture 9 (ECE5463 Sp18) T3 Wei Zhang(OSU) 9 / 16
Time Scaling: Fifth-Order Polynomial
• We may also want to have zero accelerations at t = 0 and t = T , which leads
to the following constraints:

s(0) = 0, s(T ) = 1, ṡ(0) = ṡ(T ) = s̈(0) = s̈(T ) = 0

• These can be met with a fifth-order polynomial:

s(t) = a0 + a1 t + a2 t2 + a3 t3 + a4 t4 + a5 t5

• We canChapter
use the9. Trajectory Generation
6 constraints to solve uniquely for the coefficients. 331

s ṡ s̈
15 10
1 8T

T2 3

0
T t

T t T t
Figure 9.4: Plots of s(t), ṡ(t), and s̈(t) for a fifth-order polynomial time scaling.

Time Scaling
s Lecture 9 (ECE5463ṡSp18) Wei Zhang(OSU) 10 / 16
T t T t
Time Scaling: Trapezoidal Figure 9.4: Plots of s(t), ṡ(t), and s̈(t) for a fifth-order polynomial time scaling.

s ṡ
1 v

slo
e=

pe
p

=−
slo

a
T t ta T − ta T t

Figure 9.5: Plots of s(t) and ṡ(t) for a trapezoidal motion profile.
• Trapezoidal time scaling:
The point-to-point motion consists of a constant acceleration phase s̈ = a of
- t ∈ [0, ta ]: constant acceleration
time ta , followed by a constant phase s̈ =ṡ =a v of time tv = T − 2ta,
velocity phase
followed by a constant deceleration phase s̈ = −a of time ta . The resulting ṡ
- t ∈ (ta , T − 2tprofile
segment,
is a trapezoid and the s profile is the concatenation of a parabola, linear
a ]: constant velocity
and parabola as phase
a function of ṡ =9.5).v
time (Figure
The trapezoidal time scaling is not as smooth as the cubic time scaling, but it
- t ∈ (T − 2ta , has
T ]:the∈constant
θ̇
advantage that deceleration
if there are known constant
phase
Rn and on the joint accelerations θ̈
s̈ on=the−a
limits joint velocities
∈ Rn then the trapezoidal
limit limit
motion using the largest v and a satisfying

• Not very smooth, but allows for


|(θend easy incorporation
− θstart )v| ≤ θ̇limit , of joint
(9.14) velocity and
|(θend − θstart )a| ≤ θ̈limit (9.15)
acceleration limits.
is the fastest straight-line motion possible. (See Exercise 9.8.)
If v 2 /a > 1, the robot never reaches the velocity v during the motion (Ex-
• For example, a and v can be chosen to be the largest ones satisfying
ercise 9.10). The three-phase accelerate–coast–decelerate motion becomes a
two-phase accelerate–decelerate “bang-bang” motion, and the trapezoidal pro-
file ṡ(t) in Figure 9.5 becomes a triangle.
|(θend − θstart )v| ≤ θ̇limit and |(θend − θstart )a| ≤ θ̈limit
May 2017 preprint of Modern Robotics, Lynch and Park, Cambridge U. Press, 2017. http://modernrobotics.org

Time Scaling Lecture 9 (ECE5463 Sp18) Wei Zhang(OSU) 11 / 16


Chapter 9. Trajectory Generation 333
Time Scaling: S-Curve

v
a slo
= pe
pe =
slo −
a

1 2 3 4 5 6 7
T t
Figure 9.6: Plot of ṡ(t) for an S-curve motion profile consisting of seven stages: (1)
• Trapezoidal scaling causes discontinuities in acceleration at
constant positive jerk, (2) constant acceleration, (3) constant negative jerk, (4) con-
t = stant , T − 2t
0, tavelocity, a ,constant
(5) T negative jerk, (6) constant deceleration, and (7) constant
positive jerk.

• An improved version is the S-curve time scaling. It consists of 7 phases.


• Choose a and T such that aT 2 ≥ 4, ensuring that the motion is completed
- (1) constant jerk d3 s/dt3 = J; (2) constant acceleration s̈ = a;
in time, and solve s(T ) = 1 for v:
1 
√ p 2 constant v; 
- (3) constant negative jerk v−J;
= (4)
aT coasting
− a aTat −4 .
2
- (5) constant
9.2.2.3 negative
S-Curve Timejerk; (6) constant deceleration; (7) constant positive jerk
Scalings
Just as cubic polynomial time scalings lead to infinite jerk at the beginning
and end of the motion, trapezoidal motions cause discontinuous jumps in ac-
Time Scaling at t ∈ {0, ta , T − ta Lecture
celeration , T }. 9 A solution
(ECE5463 Sp18) is a smoother S-curve
Wei time
Zhang(OSU) 12 / 16
Trajectory Generation Using Via Points
• Suppose that the robot joints need to pass through a series of via points at
specified times

• Suppose that there are no strict specifications on the shape of the path
between consecutive points

• In this case, we can directly construct the trajectory θ(t) instead of finding a
path θ(s) and then a time scaling s(t),

• Since the trajectory for each joint can be designed individually, we focus on a
single joint variable and call it β(t) to simplify notation

Polynomial Via Points Trajectory Lecture 9 (ECE5463 Sp18) Wei Zhang(OSU) 13 / 16


Trajectory Generation Using Via Points
• Suppose there are k via points (βi , β̇i , Ti ), i = 1, . . . , k, where βi and β̇i are
the specified desired position and velocity, and Ti is the specified time to
reach the ith via point.

• We can use a cubic polynomial to generate the ith trajectory segment.


Polynomial: β(Ti + ∆t) = ai,0 + ai,1 ∆t + ai,2 ∆t2 + ai,3 ∆t2
Constraints: β(Ti ) = βi , β(Ti+1 ) = βi+1 , β̇(Ti ) = β̇i , β̇(Ti+1 ) = β̇i+1

• We can solve for all the coefficients for each segment (see page 286 of
textbook)

• This approach can be easily extended to 5th-order polynomial

Polynomial Via Points Trajectory Lecture 9 (ECE5463 Sp18) Wei Zhang(OSU) 14 / 16


334 9.
Trajectory Generation Using Via Points
via 2 via 3 vi
Example:
• Time instants: T1 = 0, T2 = 1, T3 = 2, T4 = 3;
• Via points: (0, 0), (0, 1), (1, 1), and (1, 0) ŷ
• Velocities: (0, 0), (1, 0), (0, −1), and (0, 0)

start end
334 (a)Point Trajectories
9.3. Polynomial Via
Figure 9.7: Two paths in an (x, y) space corres
interpolating four via points, including a start p
at the start and end are zero, and the velocitie
via 2 via 3 via 2
dashed via shape
tangent vectors. The 3 of the path
the via points.

• Change via point velocities to (0, 0), (1, 1),


9.3 Polynomial Via Point T
(1, −1), and (0, 0) will result in a different If the
ŷ ŷ goal is to have the robot joints pass
trajectory specified times, without a strict specificati
consecutive points, a simple solution is to u
x̂ x̂ θ(t) directly without first spe
joint histories
start end scaling
start s(t) (Figure 9.7). end
(a) Let the trajectory
(b) be specified by k via p
at T1 = 0 and the final point at Tk = T . Sin
individually,
Figure 9.7: Two paths in an (x, y) space corresponding we focus ontrajectories
to piecewise-cubic a single joint variab
interpolating four via points, including a start point andsubscripts.
tion of an end point.
AtThe
eachvelocities
via point i ∈ {1, .
at the start and end are zero, and the velocitiesposition
at vias 2β(T
and)3=areβ indicated
and by theβ̇(T ) = β̇ .
velocity
i i i i
dashed tangent vectors. The shape of the path depends on the velocities specified at
and the duration of segment j ∈ {1, . . . , k −
the via points.
trajectory during segment j is expressed as
Polynomial Via Points Trajectory Lecture 9 (ECE5463 Sp18) Wei Zhang(OSU) 15 / 16
More Discussions

Polynomial Via Points Trajectory Lecture 9 (ECE5463 Sp18) Wei Zhang(OSU) 16 / 16

You might also like