Chương 06
Chương 06
Robotics
1
Tài liệu tham khảo
2
Contents
Topic 1: Introduction
Topic 2: Basic robotic concepts
Topic 3: Spatial Representations of Rigid Bodies
Topic 4: Forward Kinematics of Robot Manipulators
Topic 5: Inverse Kinematics of Robot Manipulators
Topic 6: Kinematic Trajectory Generation.
3
- Topic 6 -
• Kinematic Trajectory
Generation
Trajectory Generation
5
Outline
1. Trajectory Generation
2. Trajectories in the Joint Space
2.1. Point to point trajectories
2.2 Trajectories using waypoints
3. Trajectories in the Operational Space
Functional Scheme of a Robot
Interoceptive
Sensors
Exteroceptive External
Sensors environment
Trajectory generator:
• Inputs (IN): sequence of poses (for end effector) or joint configurations
• Outputs (OUT): references (continuous/discrete) for the robot controller
Motion planning
2. Path planning – Generating a feasible path from a start point to a goal Trajectory
point. A path usually consists of a set of connected waypoints. planning
3. Trajectory planning – Generating a time schedule for how to follow a
path given constraints such as position, velocity, and acceleration. Trajectory Following
4. Trajectory following – Once the entire trajectory is planned, there needs Controller
to be a control system that can execute the trajectory in a sufficiently
accurate manner. Robot
Sensor
8
Motion planning
Robot
Sensor
9
Trajectory Generation
Introduction
1. Objective: from points to (Cartesian/joint) trajectories
A A B
Cartesian Cartesian
trajectory trajectory
C C
11
Trajectory Generation
Trajectory vs Path
1. Path (geometric):
• Set of points (in the joint or in the Cartesian space) that the robot must follow B
p( s ) = x( s ) y(s) z (s)
T
q = q ( ) = (t ) Joint space
Trajectory
• Natural parameterization: s = t
• Derivatives: dp ( s ) dp ( s ) d 2 p(s) 2
p (t ) = s (t) p (t ) = s (t ) + 2
s (t )
ds ds ds
2. Timing law:
• It is based on specifications (velocities, where to stop, etc.)
• Constraints imposed by actuators or tasks (max torque, max velocity)
• Sometimes optimization criteria (minimum time, minimum energy, etc.)
Trajectory Generation
Example of Path
1. Objective:
• Pass through the Cartesian points A, B, C Using inverse kinematics
• Avoid discontinuities
3 dof robot
Example of Path
1. Steps:
Desired geometric path p(s), where s is a parameter
3 dof robot
Example of Path
1. Steps:
Equivalent in the joint
Sampling the Cartesian path to find the desired points space
3 dof robot
Example of Path
1. Steps:
Geometric path in the joint space: q1(λ), q2(λ), q3(λ)
3 dof robot
1. Typical Procedure
Tasks
19
Trajectory Generation
21
Trajectory Generation
Classification of Trajectories
1. According to the space:
• Cartesian (operational) trajectories
• Joint trajectories
2. According to the type of task:
• Point-to-point trajectories
• Multiple-point trajectories (“knots”)
• Continuous trajectories (continuity of speed, acceleration)
• Concatenated trajectories (example: “overfly”)
3. According to the path geometry:
• Linear trajectories
• Polynomial trajectories
• Exponential trajectories
• Cicloid trajectories, etc.
Trajectory Generation
4. According to the time law:
• Bang-bang (on/off) trajectories in acceleration
• Trapezoidal trajectories in velocity
• Polynomial trajectories, etc.
1. Trajectory Generation
2. Trajectories in the Joint Space
2.1. Point to point trajectories
2.2 Trajectories using waypoints
3. Trajectories in the Operational Space
(Review: polynomials)
4. Degree 4: q = a4t 4 + a3t 3 + a2t 2 + a1t + a0 5 parameters (a4, a3, a2, a1, a0)
5 equations are needed
5. Degree 5: q = a5t 5 + a4t 4 + a3t 3 + a2t 2 + a1t + a0 6 parameters (a5, a4, a3,
a2, a1, a0), 6 equations
are needed
6. Degree n: q = ant n + an −1t n −1 + + a1t + a0 n+1 parameters (an, an-1, …, a1, a0)
n+1 equations are needed
(Review: polynomials)
Example:
Interpolate the points shown in the figure using a line, where t0 = 2 [s], q0 = 16 [°], tf = 10 [s], qf = 40 [°]
Solution q
qf
Generic equation: q (t ) = a1t + a0
- Point 1: q0 = a1t0 + a0 16 = 2a1 + a0 q0
- Point 2: q f = a1t f + a0 40 = 10a1 + a0 t0 tf
t
2 1 a1 16
Ax = b 10 1 a = 40
0 Velocity (𝑞)ሶ
a1 1 1 −1 16 3
a = −8 −10 2 40 = 10
−1
x=A b
0
Equation of the line:
q (t ) = 3t + 10 How would acceleration look like?
%% Programmed by Tran Duc Thien
function q = poly1st(t,q0,t0,qf,tf)
b=[q0,qf]';
A=[t0,1;...
tf,1];
x=inv(A)*b;
q=x(1)*t+x(2);
end
28
Examples
29
Examples
30
Trajectories in the Joint Space
q6final
Example for joint 6
Final q6
q6final
q6init
q6init
Initial
tinit tfinal t
1. Trajectory Generation
2. Trajectories in the Joint Space
2.1. Point to point trajectories
2.2 Trajectories using waypoints
3. Trajectories in the Operational Space
Point to Point Trajectories
qf
Interpolations
between qi and qf
qi
Cubic Polynomial
1. We specify: Analytic expression
• Initial and final time: t0, tf
Position: q (t ) = a3t 3 + a2t 2 + a1t + a0
• Initial and final point: q0, qf
• Initial and final velocity: 𝑞ሶ 0 , 𝑞ሶ 𝑓 Velocity: q (t ) = 3a3t 2 + 2a2t + a1
2. System of equations:
q0 = a3t03 + a2t02 + a1t0 + a0 t03 t02 t0 1 a3 q0
3
q f = a3t 3f + a2t 2f + a1t f + a0 tf t 2f tf 1 a2 q f
=
q0 = 3a3t02 + 2a2t0 + a1 3t02 2t0 1 0 a1 q0
2
q f = 3a3t 2f + 2a2t f + a1 3t f 2t f 1 0 a0 q f
3. Note:
• Only (initial/final) positions and velocities can be specified
• Acceleration cannot be specified
Point to Point Trajectories
Cubic Polynomial
Example
Determine the cubic trajectory of a joint from q(2)=10° to q(4)=60° with null initial and final velocities. Plot the
position, velocity and acceleration.
System of equations:
10 = 23 a3 + 22 a2 + 2a1 + a0 0 = 3(22 )a3 + 2(2)a2 + a1
60 = 43 a3 + 42 a2 + 4a1 + a0 0 = 3(42 )a3 + 2(4)a2 + a1
Solution:
23 22 2 1 a3 10 a3 −12.5
3 a 112.5
4 42 4 1 a2 60 2 =
= a1 −300
3(22 ) 2(2) 1
0 a1 0
2
3(4 ) 2(4) 1 0 a0 0 0
a 260
Trajectory:
q (t ) = −12.5t 3 + 112.5t 2 − 300t + 260
%% Programmed by Tran Duc Thien
function q = QHQD(t,t0,q0,v0,tf,qf,vf)
if (t<=t0)
q=q0;
elseif (t<=tf)
b=[q0,qf,v0,vf]';
A=[t0^3,t0^2,t0,1;...
tf^3,tf^2,tf,1;...
3*t0^2,2*t0,1,0;...
3*tf^2,2*tf,1,0];
x=inv(A)*b;
q=x(1)*t^3+x(2)*t^2+x(3)*t+x(4);
else
q=qf;
end
end
37
Point to Point Trajectories
2. System of equations:
q0 = a5t05 + a4t04 + a3t03 + a2t02 + a1t0 + a0
t05 t04 t03 t02 t0 1 a5 q0
q f = a t + a t + a t + a t + a1t f + a0
5 4 3 2
5
5 f 4 f 3 f 2 f
tf t 4f t 3f t 2f tf 1 a4 q f
q0 = 5a t + 4a t + 3a t + 2a2t0 + a1
4
5 0
3
4 0
2
3 0 5t04 4t03 3t02 2t0 1 0 a3 q0
q f = 5a t + 4a t + 3a t + 2a2t f + a1
4 3 2 4 3 =
5 f 4 f 3 f f5t 4 t f 3t 2f 2t f 1 0 a2 q f
q0 = 20a5t03 + 12a4t02 + 6a3t0 + 2a2 20t 12t 2
3
6t0 2 0 0 a1 q0
03 0
20t f 12t f
2
6t f 2 0 0 a0 q f
q f = 20a5t 3f + 12a4t 2f + 6a3t f + 2a2
Point to Point Trajectories
Quintic Polynomial (5th degree)
Example
Determine the quintic trajectory of a joint from q(2)=10° to q(4)=60° with null initial and final velocity and
acceleration.
System of equations:
25 24 23 22 2 1 a5 10
5 4 3 2
4 4 4 4 4 1 a4 60
5(24 ) 4(23 ) 3(22 ) 2(2) 1 0 a3 0
4 3 2 =
5(4 ) 4(4 ) 3(4 ) 2(4) 1 0 a2 0
20(23 ) 12(22 ) 6(2) 2 0 0 a1 0
a0 0
3 2
20(4 ) 12(2 ) 6(2) 2 0 0
Trajectory:
q (t ) = 9.375t 5 − 140.625t 4 + 812.5t 3 − 2250t 2 + 3000t − 1540
Examples
function q = TPp2p(t0,q0,tf,qf,t)
A=[t0^3 t0^2 t0 1;... tf^3 tf^2 tf 1;... 3*t0^2 2*t0 1 0;... 3*tf^2 2*tf 1 0];
b=[q0;... qf; 0 0];
if (t<=t0)
q=q0;
elseif (t<=tf)
x=inv(A)*b;
q=x(1)*t^3+x(2)*t^2+x(3)*t+x(4);
else
q=qf;
end
end
40
Example
1. Generate trajectory planning between two points A and B. Pass through the Cartesian points A(10,10) with
𝑡𝐴 = 0𝑠, and B(-20,-20) with 𝑡𝐵 = 2𝑠. Velocities at these points are zeros.
2. Generate trajectory planning between two points A and B. Pass through the Cartesian points A(10,10) with
𝑡𝐴 = 2𝑠, and B(-20,-20) with 𝑡𝐵 = 4𝑠. Velocities at these points are zeros.
3. Generate trajectory planning between A, B and C. Pass through the Cartesian points A(10,10) with 𝑡𝐴 = 0𝑠,
B(-20,-20) with 𝑡𝐵 = 2𝑠, C(10,-20) with 𝑡𝐶 = 4s, and A(10,10) with t=6s. Velocities at these points are zeros.
4. Generate trajectory planning between A, B and C. Pass through the Cartesian points A(10,10) with 𝑡𝐴 = 2𝑠,
B(-20,-20) with 𝑡𝐵 = 4𝑠, C(10,-20) with 𝑡𝐶 = 6s, and A(10,10) with t=8s. Velocities at these points are zeros.
9/11/2024 41
Example
9/11/2024 42
Example
function [x,y] = TrajectoryPlanning(t,P0,v0,Pf,vf,tf)
a10=P0(1);
a20=P0(2);
a11=v0(1);
a21=v0(2);
a12=3/tf^2*(Pf(1)-P0(1))-2/tf*v0(1)-1/tf*vf(1);
a22=3/tf^2*(Pf(2)-P0(2))-2/tf*v0(2)-1/tf*vf(2);
a13=-2/tf^3*(Pf(1)-P0(1))+1/tf^2*(vf(1)+v0(1));
a23=-2/tf^3*(Pf(2)-P0(2))+1/tf^2*(vf(2)+v0(2));
if (t<=2)
x=a10+a11*t+a12*t^2+a13*t^3;
y=a20+a21*t+a22*t^2+a23*t^3;
Else
x=Pf(1);
Y=Pf(2);
end
9/11/2024 43
Example
9/11/2024 44
Example
9/11/2024 45
Example
function [x,y] = if t<=t0
TrajectoryPlanning(t,P0,v0,t0,Pf,vf,tf) x=P0(1);
a10=P0(1); y=P0(2);
a20=P0(2); elseif t<=tf
a11=v0(1); tt=t-t0;
a21=v0(2); x=a10+a11*tt+a12*tt^2+a13*tt^3;
a12=3/(tf-t0)^2*(Pf(1)-P0(1))-2/(tf-t0)*v0(1)- y=a20+a21*tt+a22*tt^2+a23*tt^3;
1/(tf-t0)*vf(1); else
a22=3/(tf-t0)^2*(Pf(2)-P0(2))-2/(tf-t0)*v0(2)- x=Pf(1);
1/(tf-t0)*vf(2); y=Pf(2);
a13=-2/(tf-t0)^3*(Pf(1)-P0(1))+1/(tf- end
t0)^2*(vf(1)+v0(1));
a23=-2/(tf-t0)^3*(Pf(2)-P0(2))+1/(tf-
t0)^2*(vf(2)+v0(2));
9/11/2024 46
Example
function [x,y] = x=a10+a11*tt+a12*tt^2+a13*tt^3;
TrajectoryPlanning(t,P0,v0,t0,Pf,vf,tf) y=a20+a21*tt+a22*tt^2+a23*tt^3;
a10=P0(1); end
a20=P0(2);
a11=v0(1);
a21=v0(2);
a12=3/(tf-t0)^2*(Pf(1)-P0(1))-2/(tf-t0)*v0(1)-
1/(tf-t0)*vf(1);
a22=3/(tf-t0)^2*(Pf(2)-P0(2))-2/(tf-t0)*v0(2)-
1/(tf-t0)*vf(2);
a13=-2/(tf-t0)^3*(Pf(1)-P0(1))+1/(tf-
t0)^2*(vf(1)+v0(1));
a23=-2/(tf-t0)^3*(Pf(2)-P0(2))+1/(tf-
t0)^2*(vf(2)+v0(2));
9/11/2024 47
Example
48
Example
5 times
A B A 5 times B
2 Seconds 2 Seconds
9/11/2024 49
Example
function [x,y] = TrajectoryPlanning(t,P0,v0,Pf,vf,tf)
a10=P0(1);
a20=P0(2);
a11=v0(1);
a21=v0(2);
a12=3/tf^2*(Pf(1)-P0(1))-2/tf*v0(1)-1/tf*vf(1);
a22=3/tf^2*(Pf(2)-P0(2))-2/tf*v0(2)-1/tf*vf(2);
a13=-2/tf^3*(Pf(1)-P0(1))+1/tf^2*(vf(1)+v0(1));
a23=-2/tf^3*(Pf(2)-P0(2))+1/tf^2*(vf(2)+v0(2));
x=a10+a11*t+a12*t^2+a13*t^3;
y=a20+a21*t+a22*t^2+a23*t^3;
end
9/11/2024 50
Point to Point Trajectories
q0
• Assumptions: tb t f − tb t f tb t f − tb tf
• We assume: 𝑞ሶ 0 = 𝑞ሶ 𝑓 = 0 (null initial and final velocities)
• (Symmetric trajectory: q(tf /2) = qf /2)
2. We specify:
• Final time: tf
• Initial and final point: q0, qf
• Maximum velocity: 𝑞ሶ 𝑚𝑎𝑥 , or tb, or maximum acceleration 𝑞ሷ 𝑚𝑎𝑥
Point to Point Trajectories
1 qmax
q (t ) = q0 − tb qmax + qmax t , tb t t f − tb
2
1 qmax tb t f − tb
q f − (t − t f ) 2
, t f − tb t t f tf
2 tb
Trajectory:
10 + 6.67t 2 , 0 t 1.5
q (t ) = −5 + 20t ,1.5 t 2.5
60 − 6.67(t − 4) 2 , 2.5 t 4
Point to Point Trajectories
Final time:
60 − 10
tf = 2 = 3.8735 s
13.33
Trajectory:
10 + 6.67t 2 , 0 t 1.94
q (t ) =
60 − 6.67(t − 3.87) ,1.94 t 3.87
2
Outline
1. Trajectory Generation
2. Trajectories in the Joint Space
2.1. Point to point trajectories
2.2 Trajectories using waypoints
3. Trajectories in the Operational Space
Trajectories using waypoints
1. Move from an initial position qi to a final qf “passing by” intermediate points (waypoints)
qf
qi
Methods
1. High order polynomials
If we have N points, we can use a polynomial of degree N - 1
Problems?
• Oscillating trajectory (more oscillations as we increase the degree)
• We cannot set initial and final velocities
2. Low-order polynomials in every segment
Example:
• Cubic polynomials (positions+velocities)
• Quintic polynomials (positions+velocities+accelerations)
Possibilities:
• Each segment on its own
• Interdependent segments (splines)
Trajectories using waypoints
k (tk ) = qk
For velocity
k (tk +1 ) = qk +1 4 conditions to continuity
k (tk ) = qk
compute the k-th k (tk +1 ) = k +1 (tk +1 )
cubic polynomial
k (tk +1 ) = qk +1
Trajectories using waypoints
Cubic “Splines”
1. Spline: smooth curve (in this case, 𝒞 2 [continuity up to the 2nd derivative]) that joins N points
2. How?
• N-1 cubic polynomials concatenated to pass through N points
• Continuity in velocity and acceleration every N-2 internal points
qN −1
qN
qk +1 N −1
qk
k
q2
q1 1
t1 t2 tk tk +1 t N −1 tN
Cubic “Splines”
1. How many coefficients need to be determined?
• 4 (N-1) coefficients (4 per polynomial)
2. How many imposed constraints?
• 2(N-2): continuity in velocity and acceleration of internal points
k (tk ) = k +1 (tk ) k (tk ) = k +1 (tk )
• 2(N-1): waypoints for every polynomial
k (tk ) = qk k (tk +1 ) = qk +1
3. How many free parameters?
• 2: we can specify initial and final velocity (𝑞ሶ 1 , 𝑞ሶ 𝑁 )
1 (t1 ) = q1 N −1 (t N ) = qN
4. With these constraints we can determine every cubic polynomial
Trajectories using waypoints
Cubic “Splines”
1. Properties of splines
• It is the curve with minimum possible curvature (for 𝒞 2 functions)
• A spline is uniquely determined when we specify: q1, …, qN, t1, … tN, 𝑞ሶ 1 , 𝑞ሶ 𝑁
• They do not allow us to specify the initial or final acceleration
Cubic “Splines”
Example
Find a spline that passes through the points q1 = 0, q2 = 2π, q3 = π/2, q4 = π, at times t1 = 0, t2 = 2, t3 =
3, t4 = 5, considering null initial and final velocities.
To obtain a null acceleration, use fictitious points in a) ta = 0.5, tb = 4.5, y b) ta = 1.5, tb = 3.5
Trajectories using waypoints
Parabolic Blending
1. Parts:
Linear interpolation in the “intermediate” part
Smooth “intersections” using parabolas
parab
parab
parab
Trajectories using waypoints
Parabolic Blending
Example
Generate a trajectory with parabolic blending that passes through the points q1 = 0, q2 = 2π, q3 = π/2,
q4 = π, at times t1 = 0, t2 = 2, t3 = 3, t4 = 5, with null initial and final velocities. Consider two cases for
the durations of the parabolas (blending time): 0.2 s y 0.6 s
1. Trajectory Generation
1. They are used to follow a path that is geometrically specified (line, circle, etc.)
2. In general:
• We can apply the same interpolation methods used in the joint space
• Each position (x, y, z) and minimal representation of orientation (φr, φp, φy) is independently
considered
3. Problems with orientation:
• When interpolating, the result cannot be intuitively visualized
• We prefer to deal with position and orientation separately
4. Number of waypoints is typically low
• Usually simple paths: lines, circular arcs, etc.
5. They always need inverse kinematics
Trajectories in the Operational Space
1. Some Problems
Initial and final point are Initial and final points reachable in Singularities cause high
reachable. Intermediate point different configurations velocities
is not reachable
Trajectories in the Operational Space
where
tb t f − tb t f v Lamax + vmax
2
tb = max tf =
amax amax vmax
Trajectories in the Operational Space
Orientation Trajectory
1. How to interpolate orientation?
{A} {B}
2. Alternative 1:
• Using a minimal representation for orientation (Euler angles)
Example: linear path in space
Orientation Trajectory
1. Alternative 2:
• Using the axis/angle representation
Procedure:
• Determine the rotation that starts at {A} and reaches {B}: R = ( 0 RA ) ( 0 RB )
T
76
References
• B. Siciliano, L. Sciavicco, L. Villani, y G. Oriolo. Robotics: modelling, planning and control. Springer
Science & Business Media, 2010 (Chapter 4)
• M.W. Spong, S. Hutchinson, y M. Vidyasagar. Robot Modeling and Control. John Wiley & Sons,
2006 (Chapter 5)
Thank you for your listening
78