Motion Planning
Motion Planning
Motion planning
With the motion planning we want to assign the way the robot evolves from an initial posture to a final
one.
Motion planning is one of the essential problems in robotics. Most of the success on the market of a robot
depends on the quality of motion planning.
We need to introduce some terminology concerning concepts which are often confused:
Path: it is a geometric concept and stands for a line in a certain space (the space of Cartesian
positions, the space of the orientations, the joint space,..) to be followed by the object whose
motion has to be planned
Timing law: it is the time dependence with which we want the robot to travel along the
assigned path
The final result of a motion planning problem is thus a trajectory that will then serve as an input
to the real-time position/velocity controllers.
TrajGen
Inverse Axis
target Kinematics controller
state
INSTRUCTION
STACK
state update
Instruction stack: list of instructions to be executed, specified using the proprietary programming
language
Trajectory generation: converts an instruction into a trajectory to be executed
Inverse kinematics: maps the trajectory from the Cartesian space to the joint space (if needed)
Axis controllers & drives: closes the control loop ensuring tracking performance
TrajGen
Inverse Axis
target Kinematics controller
state
INSTRUCTION
STACK
state update
Instruction stack: list of instructions to be executed, specified using the proprietary programming
language
Trajectory generation: converts an instruction into a trajectory to be executed
Inverse kinematics: maps the trajectory from the Cartesian space to the joint space (if needed)
Axis controllers & drives: closes the control loop ensuring tracking performance
Using the teach-pendant, the operator moves the manipulator along the desired
path. Position transducers memorize the positions the robot has to reach, which
will be then jointed by a software for trajectory generation, possibly using some of
the intermediate points as via points. COMAU SpA
The robot will be then able to autonomously repeat the motion.
The robot programmer can also write the robot program directly using a robotic programming
language.
With a robotic programming language the operator can program the motion of the robot as
well as complex operations where the robot, inside a work-cell, interacts with other machines
and devices. With respect to a general purpose programming language, the language provides
specific robot oriented functionalities.
In the following, we will discuss some elements of the PDL2 programming language by COMAU
Robotics.
Besides data types typical of any programming language (integer, real, boolean, string, array), some
types specific to robotic applications are defined in PDL2. Among them:
POSITION: three components of Cartesian position, three orientation components (Euler angles)
and a configuration string (which indicates whether it is a shoulder/elbow/wrist
upper/lower configuration)
In PDL2 for each manipulator a world reference frame is defined. The operator might redefine
the base frame ($BASE) relative to the world frame. This is useful when the robot has to be
repositioned in the work area, since it avoids re-computation of all the positions of objects in
the cell.
With the instruction MOVE, motion commands of the arms are given. The format
of the instruction is as follows:
MOVE <ARM[n]> <trajectory> dest_clause <opt_clauses> <sync_clause>
There are several destination clauses for the instruction MOVE. Main ones are:
MOVE TO
It moves the arm towards the specified destination, which might be a variable of
type POSITION or JOINTPOS. For example:
MOVE LINEAR TO POS(x,y,z,e1,e2,e3,config)
MOVE TO home
The optional VIA clause can be used with the MOVE TO destination clause to specify
a position through which the arm passes between the initial position and the
destination. The VIA clause is used most commonly to define an arc for circular
moves. For example:
MOVE TO initial
MOVE CIRCULAR TO destination VIA arc
MOVE NEAR
With this clause it is possible to specify a destination which is located along the approach vector
of the tool, within a certain distance (expressed in mm) from a certain position.
Example:
MOVE NEAR destination BY 250.0
MOVE AWAY
A destination can be specified along the approach vector of the
tool, at a specified distance from the current position.
Example:
MOVE AWAY 250.0
MOVE RELATIVE
A destination relative to the current position of the
frame can be specified. Example:
MOVE RELATIVE VEC(100,0,100) IN frame
MOVE ABOUT
It defines the destination that the tool has to reach
after a rotation around the specified vector, with
respect to the current position. Example:
MOVE ABOUT VEC(0,100,0) BY 90 IN frame
MOVE BY
Allows the programmer to specify a destination as a list of REAL expressions, with
each item corresponding to an incremental move for the joint of an arm. Example:
MOVE BY {alpha, beta, gamma, delta, omega}
MOVE FOR
Allows the programmer to specify a
partial move along the trajectory
towards a theoretical destination.
The orientation of the tool changes
in proportion to the distance.
Example:
Using the optional clause WITH it is possible to assign values to some predefined
temporary variables. In particular we can operate over the following variables:
$PROG_SPD_OVR
It is a percentage by which we can modify the default speed value used by the
controller for joint space motions.
$PROG_ACC_OVR, $PROG_DEC_OVR
They are percentages by which we can modify the default values of acceleration
and deceleration used by the controller for joint space motions.
$LIN_SPD
It is the value of linear speed for a Cartesian motion, expressed in m/s:
If we use the instruction MOVEFLY and the motion is followed by another motion, the arm will not
stop at the first destination, but will move from the starting point of the first motion to the end point
of the second motion, without stopping in the common point of the two motions. Example:
MOVE TO a
MOVEFLY TO b ADVANCE
MOVE TO c
If the robot moves in a cluttered environment, the definition of the path might be troublesome
In fact we need a path which is collision free: such path, at the current stage of robotics practice, is
generated manually by the programmer as a sequence of MOVE commands
Usually the path planning problem is addressed in the configuration space (C-space), where
the robot is at each time instant represented as a mobile point
For an articulated robot, the common choice of the configuration space is the space of the
joint variables (joint space)
Obstacles are mapped from the workspace to the configuration space: in case of an
articulated manipulator they take complicated shapes
C-space Workspace
Assume that the initial and final posture of the robot in the Workspace are mapped into corresponding
configurations in C-space, respectively a start configuration 𝐪𝐪S and a goal configuration 𝐪𝐪G .
Planning a collision-free motion for the robot means to generate a path from 𝐪𝐪S to 𝐪𝐪G if they belong to
the same connected component of Cfree, and to report a failure otherwise.
The exact planning algorithms that are based on the a priori knowledge of the complete C-space are
exponential in the dimensionality of the C-space and thus hardly applicable in practice
Probabilistic planners are instead a class of methods of remarkable efficiency, especially for high-
dimension configuration spaces
They belong to the general family of sampling-based methods, where the basic idea is to randomly
select a finite-set of collision-free configurations that adequately represent how Cfree is connected, and
using these configurations to build a roadmap
At each iteration a sample configuration is chosen and it is checked whether it entails a collision
between the robot and the obstacles: if yes, the configuration is discarded, otherwise it is added to the
current roadmap
Two versions of such randomized sampling-based approach are:
PRM (Probabilistic Roadmap)
RRT (Rapidly-exploring Random Tree)
a random sample 𝐪𝐪rand of the C-space is selected using a uniform probability distribution
and tested for collision
if 𝐪𝐪rand does not cause collisions it is added to a roadmap which is progressively being
formed and connected (if possible) through free local paths to sufficiently “near”
configurations already in the roadmap
the generation of a free local path between 𝐪𝐪rand and a near configuration 𝐪𝐪near is made by
a procedure called local planner
the iterations terminate when either a maximum number of iterations has been reached or
the number of connected components in the roadmap becomes smaller than a given
threshold
then we try to verify whether the path panning problem can be satisfied by connecting 𝐪𝐪S
and 𝐪𝐪G to the same connected component of the PRM by free local paths
Advantages of PRM:
it is remarkably fast in finding solutions to motion planning problems
unlike other methods, there is no need to generate the obstacles in C-space
Disadvantages of PRM:
it is only probabilistically complete: the probability to find a solution to the planning
problem, if it exists, tends to 1 as the execution time tends to infinity
the RRT expansion technique, though simple, results in a very efficient exploration of the C-
space, since the procedure for generating new candidate configurations is intrinsically biased
towards regions in Cfree that have not been visited yet
as in the PRM method, there is no need to generate the obstacles in C-space
like the PRM method, it is only probabilistically complete
Example of path
generated with a
RRT algorithm
in the artificial potential method, the motion of the point that represents the robot in C-
space is influenced by a potential field 𝑈𝑈
this field is obtained as the superposition of an attractive potential to the goal and a
repulsive potential from the obstacles.
at each configuration 𝐪𝐪 the artificial force generated by the potential is defined as the
negative gradient −∇𝑈𝑈 𝐪𝐪 of the potential local minima!
TrajGen
Inverse Axis
target Kinematics controller
state
INSTRUCTION
STACK
state update
Instruction stack: list of instructions to be executed, specified using the proprietary programming
language
Trajectory generation: converts an instruction into a trajectory to be executed
Inverse kinematics: maps the trajectory from the Cartesian space to the joint space (if needed)
Axis controllers & drives: closes the control loop ensuring tracking performance
As we have seen, in general the user, when assigning a motion command, specifies a restricted number
of parameters as inputs:
Space of definition: joint space or Cartesian space
For the path: endpoints, possible intermediate points, path geometry (segment, circular arc, etc..)
For the timing law: overall travelling time, maximum velocity and/or acceleration (or percentages
thereof)
Based on this information the trajectory planner generates a dense sequence of intermediate points in the
relevant space (joint space or Cartesian space) at a fixed rate (e.g. 10 ms).
In case of Cartesian space trajectories these points are additionally converted into points in joint space
through kinematic inversion.
These values can the be interpolated in order to match the rate of the motion controller (e.g 1ms or 500µs):
this is also called micro-interpolation
When we plan the trajectory in joint space we want to generate a function 𝐪𝐪 𝑡𝑡 which interpolates the
values assigned for the joint variables at the initial and final points.
It is sufficient to work component-wise (i.e. we consider a single joint variable 𝑞𝑞𝑖𝑖 𝑡𝑡 ): in the following we
will then consider planning of a scalar variable.
Two situations are of interest:
Point-to-point motion:
we just specify the endpoints
Interpolation of points:
we also specify some intermediate points
When planning in joint space, the definition of the path as a geometric entity is not an
issue, since we are not interested in a coordinated motion of the joints (apart from
having all the joints complete their motion at the same instant).
?
the travel time.
ti tf
t
𝑞𝑞 𝑡𝑡 = 𝑎𝑎0 + 𝑎𝑎1 𝑡𝑡 + 𝑎𝑎2 𝑡𝑡 2 + ⋯ + 𝑎𝑎𝑛𝑛 𝑡𝑡 𝑛𝑛
The higher the degree 𝑛𝑛 of the polynomial, the larger the number of boundary
conditions that can be satisfied and the smoother the trajectory will be.
30
𝑞𝑞𝑖𝑖 = 10°, 𝑞𝑞𝑓𝑓 = 30°, 30
20
deg/s
deg
20
10
𝑞𝑞̇ 𝑖𝑖 = 𝑞𝑞̇ 𝑓𝑓 = 0°/𝑠𝑠 10
0
0 -10
-0.2 0 0.2 0.4 0.6 0.8 1 -0.2 0 0.2 0.4 0.6 0.8 1
t(s)
Acceleration
150
100
50
deg/s2
0
-50
-100
-150
-0.2 0 0.2 0.4 0.6 0.8 1
t(s)
In order to assign conditions also on the accelerations, we need to consider polynomials of degree 5:
2 3 4 5
𝑞𝑞 𝑡𝑡 = 𝑎𝑎0 + 𝑎𝑎1 𝑡𝑡 − 𝑡𝑡𝑖𝑖 + 𝑎𝑎2 𝑡𝑡 − 𝑡𝑡𝑖𝑖 + 𝑎𝑎3 𝑡𝑡 − 𝑡𝑡𝑖𝑖 + 𝑎𝑎4 𝑡𝑡 − 𝑡𝑡𝑖𝑖 + 𝑎𝑎5 𝑡𝑡 − 𝑡𝑡𝑖𝑖
Position Velocity
40 40
20
deg/s
deg
20
𝑞𝑞𝑖𝑖 = 10°, 𝑞𝑞𝑓𝑓 = 30°, 10
10
0
𝑞𝑞̇ 𝑖𝑖 = 𝑞𝑞̇ 𝑓𝑓 = 0, 0 -10
-0.2 0 0.2 0.4 0.6 0.8 1 -0.2 0 0.2 0.4 0.6 0.8 1
t(s)
100
50
deg/s2
0
-50
-100
-150
-0.2 0 0.2 0.4 0.6 0.8 1
t(s)
The harmonic trajectory generalizes the equation of a harmonic motion, where the
acceleration is proportional to the position, with opposite sign. A harmonic trajectory has
continuous derivatives of all orders in all the internal points of the trajectory.
30
30
𝑞𝑞𝑖𝑖 = 10°, 𝑞𝑞𝑓𝑓 = 30° 20
deg/s
deg
20
10
10
0
0 -10
-0.2 0 0.2 0.4 0.6 0.8 1 -0.2 0 0.2 0.4 0.6 0.8 1
t(s)
Acceleration
150
100
50
deg/s2
0
-50
-100
-150
-0.2 0 0.2 0.4 0.6 0.8 1
t(s)
The harmonic trajectory has discontinuities in the acceleration in the initial and final instants, and then
undefined (or infinite) values of jerk. An alternative is the cycloidal trajectory, which is continuous in the
acceleration, too.
Position Velocity
𝑡𝑡𝑖𝑖 = 0, 𝑡𝑡𝑓𝑓 = 1 𝑠𝑠, 40 40
30
30
𝑞𝑞𝑖𝑖 = 10°, 𝑞𝑞𝑓𝑓 = 30° 20
deg/s
deg
20
10
10
0
0 -10
-0.2 0 0.2 0.4 0.6 0.8 1 -0.2 0 0.2 0.4 0.6 0.8 1
t(s)
Acceleration
150
100
50
deg/s2
0
-50
-100
-150
-0.2 0 0.2 0.4 0.6 0.8 1
t(s)
A quite common industrial practice to generate the trajectory consists in planning a linear position
profile adjusted at the beginning and at the end of the trajectory with parabolic bends. The resulting
velocity profile has the typical trapezoidal shape.
.
q
.
qv
The trajectory is then composed of three parts:
ti ti+Ta tf−Ta tf t
1. Constant accel., linear velocity, parabolic position; 1 2 3
2. Zero acceleration, constant velocity, linear position;
3. Constant deceleration, linear velocity, parabolic position.
Often the duration 𝑇𝑇𝑎𝑎 of the acceleration phase (phase 1) is set equal to the duration of
the deceleration phase (phase 3): this way a trajectory is obtained, which is symmetric
with respect to the central time instant. Of course it has to be 𝑇𝑇𝑎𝑎 ≤ 𝑡𝑡𝑓𝑓 − 𝑡𝑡𝑖𝑖 ⁄2 .
Acceleration: 𝑡𝑡 ∈ 𝑡𝑡𝑖𝑖 , 𝑡𝑡𝑖𝑖 + 𝑇𝑇𝑎𝑎 Constant velocity: 𝑡𝑡 ∈ 𝑡𝑡𝑖𝑖 + 𝑇𝑇𝑎𝑎 , 𝑡𝑡𝑓𝑓 − 𝑇𝑇𝑎𝑎
𝑞𝑞̇ 𝑣𝑣 𝑞𝑞̈ 𝑡𝑡 = 0
𝑞𝑞̈ 𝑡𝑡 =
𝑇𝑇𝑎𝑎 𝑞𝑞̇ 𝑡𝑡 = 𝑞𝑞̇ 𝑣𝑣
𝑞𝑞̇ 𝑣𝑣 𝑇𝑇𝑎𝑎
𝑞𝑞̇ 𝑡𝑡 = 𝑡𝑡 − 𝑡𝑡𝑖𝑖 𝑞𝑞 𝑡𝑡 = 𝑞𝑞𝑖𝑖 + 𝑞𝑞̇ 𝑣𝑣 𝑡𝑡 − 𝑡𝑡𝑖𝑖 −
𝑇𝑇𝑎𝑎 2
𝑞𝑞̇ 𝑣𝑣 2
𝑞𝑞 𝑡𝑡 = 𝑞𝑞𝑖𝑖 + 𝑡𝑡 − 𝑡𝑡𝑖𝑖
2𝑇𝑇𝑎𝑎
𝑞𝑞̇ 𝑣𝑣
𝑞𝑞̈ 𝑡𝑡 = −
𝑇𝑇𝑎𝑎
𝑞𝑞̇ 𝑣𝑣
𝑞𝑞̇ 𝑡𝑡 = 𝑡𝑡 − 𝑡𝑡
𝑇𝑇𝑎𝑎 𝑓𝑓
𝑞𝑞̇ 𝑣𝑣 2
𝑞𝑞 𝑡𝑡 = 𝑞𝑞𝑓𝑓 − 𝑡𝑡 − 𝑡𝑡
2𝑇𝑇𝑎𝑎 𝑓𝑓
Position Velocity
20
𝑞𝑞𝑖𝑖 = 0°, 𝑞𝑞𝑓𝑓 = 30°, 𝑞𝑞̇ 𝑣𝑣 = 10°/𝑠𝑠
deg/s
deg
5
10
0
0
-1 0 1 2 3 4 5 -1 0 1 2 3 4 5
t(s)
Acceleration
10
5
deg/s2
-5
-10
-1 0 1 2 3 4 5
t(s)
Once a trajectory has been planned, it is often necessary to scale it in order to satisfy the
constraints on the actuation system, which emerge in terms of saturations.
In particular we will consider:
Kinematic scaling of the trajectory is relevant for those trajectory profiles (cubic, harmonic, …) for
which such values are not assigned in the planning itself.
For kinematic scaling we can proceed joint by joint (no coupling effects)
For dynamic scaling we will need to consider the whole coupled model of the robot
It follows:
𝑑𝑑𝑑𝑑 𝑡𝑡 ℎ Maximum values of velocity, acceleration, etc., are obtained in
= 𝜎𝜎 ′ 𝜏𝜏
𝑑𝑑𝑑𝑑 𝑇𝑇 correspondence to the maximum values of functions 𝜎𝜎 𝑖𝑖 𝜏𝜏 :
𝑑𝑑 2 𝑞𝑞 𝑡𝑡 ℎ ′′
= 2 𝜎𝜎 𝜏𝜏 by modifying the travel time 𝑻𝑻 of the trajectory it is possible to satisfy
𝑑𝑑𝑡𝑡 2 𝑇𝑇 the constraints on the kinematic saturations.
⋮
𝑛𝑛
𝑑𝑑 𝑞𝑞 𝑡𝑡 ℎ 𝑛𝑛
= 𝜎𝜎 𝜏𝜏
𝑑𝑑𝑡𝑡 𝑛𝑛 𝑇𝑇 𝑛𝑛
𝜎𝜎 ′ 𝜏𝜏 = 1 − cos 2𝜋𝜋𝜋𝜋
𝜎𝜎 ″ 𝜏𝜏 = 2𝜋𝜋 sin 2𝜋𝜋𝜋𝜋
𝜎𝜎 ‴ 𝜏𝜏 = 4𝜋𝜋 2 cos 2𝜋𝜋𝜋𝜋
We will discuss the dynamic scaling technique making reference directly to the model of the
robotic manipulator (neglecting friction effects):
𝐁𝐁 𝐪𝐪 𝐪𝐪̈ + 𝐂𝐂 𝐪𝐪, 𝐪𝐪̇ 𝐪𝐪̇ + 𝐠𝐠 𝐪𝐪 = τ
Observe that γi depends on the position only (and not on the velocity).
Torques needed to execute the motion are thus:
In order to obtain a different parameterization of the trajectory, consider now a time scaling, for
instance a linear one:
we change the time scale and
𝜃𝜃 = 𝑘𝑘𝑘𝑘 𝜃𝜃 ∈ 0, 𝑘𝑘𝑘𝑘
consider a new time 𝜃𝜃
We obtain:
2
𝜏𝜏𝑖𝑖 𝜃𝜃 = 𝛼𝛼𝑖𝑖 𝜎𝜎� 𝜃𝜃 𝜎𝜎� ″ 𝜃𝜃 + 𝛽𝛽𝑖𝑖 𝜎𝜎� 𝜃𝜃 𝜎𝜎� ′ 𝜃𝜃 + 𝛾𝛾𝑖𝑖 𝜎𝜎� 𝜃𝜃 =
𝜎𝜎̈ 𝑡𝑡 𝜎𝜎̇ 2 𝑡𝑡
= 𝛼𝛼𝑖𝑖 𝜎𝜎 𝑡𝑡 2
+ 𝛽𝛽𝑖𝑖 𝜎𝜎 𝑡𝑡 2
+ 𝛾𝛾𝑖𝑖 𝜎𝜎 𝑡𝑡 =
𝑘𝑘 𝑘𝑘
1
= 2 𝛼𝛼𝑖𝑖 𝜎𝜎 𝑡𝑡 𝜎𝜎̈ 𝑡𝑡 + 𝛽𝛽𝑖𝑖 𝜎𝜎 𝑡𝑡 𝜎𝜎̇ 2 𝑡𝑡 + 𝛾𝛾𝑖𝑖 𝜎𝜎 𝑡𝑡 =
𝑘𝑘
1
= 2 𝜏𝜏𝑖𝑖 𝑡𝑡 − 𝑔𝑔𝑖𝑖 𝜎𝜎 𝑡𝑡 + 𝑔𝑔𝑖𝑖 𝜎𝜎 𝑡𝑡
𝑘𝑘
1
Then: 𝜏𝜏𝑖𝑖 𝜃𝜃 − 𝑔𝑔𝑖𝑖 𝜃𝜃 = 2 𝜏𝜏𝑖𝑖 𝑡𝑡 − 𝑔𝑔𝑖𝑖 𝑡𝑡
𝑘𝑘
1
𝜏𝜏𝑖𝑖 𝜃𝜃 − 𝑔𝑔𝑖𝑖 𝜃𝜃 = 2 𝜏𝜏𝑖𝑖 𝑡𝑡 − 𝑔𝑔𝑖𝑖 𝑡𝑡
𝑘𝑘
With a new parameterization of the trajectory it is not necessary to compute again the dynamics of
the system;
New torques are obtained, apart from the gravitational term (which does not depend on the
parameterization), multiplying the torques obtained with the original trajectory by the factor 1⁄𝑘𝑘 2 ;
The travel time of the new trajectory is 𝑘𝑘𝑇𝑇.
q=q(σ)
0 t T
0 q
σ σmax
0 θ kT
Consider a two d.o.f. manipulator subjected to a trajectory which generates the following torques:
t t 𝜏𝜏1 𝜏𝜏2
𝑘𝑘 2 = max 1, , ≥1
𝑈𝑈1 𝑈𝑈2
−U1 −U2
New torques will be realizable (𝜏𝜏 𝜃𝜃 = 𝜏𝜏 𝑡𝑡 ⁄𝑘𝑘 2 ) and at least one of them will saturate in one
point.
Scaling the trajectory in order to avoid that the torque exceeds the maximum value in a given
interval may excessively slow down the execution: we can resort in this case to a variable scaling
(i.e. applied only in those intervals where there is torque saturation).
So far we have considered conditions only on the initial and final points of the trajectory.
We will now consider the more general situation where intermediate points have to be interpolated at given
instants:
𝑡𝑡1 𝑞𝑞1
𝑡𝑡2 𝑞𝑞2
⋮ ⇒ ⋮
𝑡𝑡𝑛𝑛−1 𝑞𝑞𝑛𝑛−1
𝑡𝑡𝑛𝑛 𝑞𝑞𝑛𝑛
The problem of finding a trajectory that passes through n points can be solved adopting a polynomial function
of degree 𝑛𝑛 − 1:
𝑞𝑞 𝑡𝑡 = 𝑎𝑎0 + 𝑎𝑎1 𝑡𝑡 + 𝑎𝑎2 𝑡𝑡 2 + ⋯ + 𝑎𝑎𝑛𝑛−1 𝑡𝑡 𝑛𝑛−1
Given the values 𝑡𝑡𝑖𝑖 , 𝑞𝑞𝑖𝑖 , 𝑖𝑖 = 1, ⋯ , 𝑛𝑛 vectors 𝐐𝐐, 𝐚𝐚 and matrix 𝐓𝐓 (Vandermonde matrix) are built as:
Position Velocity
50 30
40 20
30
10
deg/s
deg
20
0
10
0 -10
-10 -20
-2 0 2 4 6 8 10 12 -2 0 2 4 6 8 10 12
t(s)
Acceleration
10
0
𝑡𝑡1 = 0 𝑡𝑡2 = 2 𝑡𝑡3 = 4 𝑡𝑡4 = 8 𝑡𝑡5 = 10
-10 𝑞𝑞1 = 10° 𝑞𝑞2 = 20° 𝑞𝑞3 = 0° 𝑞𝑞4 = 30° 𝑞𝑞5 = 40°
deg/s2
-20
-30
-40
-2 0 2 4 6 8 10 12
t(s)
A clear advantage of the polynomial interpolation is that function 𝑞𝑞 𝑡𝑡 has continuous derivatives of all
the orders inside the interval 𝑡𝑡1 𝑡𝑡𝑛𝑛 .
However the method is not efficient from a numerical point of view: as the number n of points increases,
the condition number 𝑞𝑞 (ratio between the maximum and minimum eigenvalue) of the Vandermonde
matrix 𝐓𝐓 increases too, making the inversion problem numerically ill-conditioned.
𝑖𝑖
If, for example, 𝑡𝑡𝑖𝑖 = , 𝑖𝑖 = 1, ⋯ , 𝑛𝑛) :
𝑛𝑛
n 3 4 5 6 10 15 20
k 15.1 98.87 686.43 4924.37 1.519 ⋅ 10 7 4.032 ⋅ 1011 1.139 ⋅ 1016
Other, more efficient, methods exist to compute the coefficient of the polynomial, however the
numerical difficulties stand for high values of 𝑛𝑛.
Regardless the numerical difficulties, the interpolation of n points with only one polynomial of degree
𝑛𝑛 − 1 has other disadvantages:
1. the degree of the polynomial depends on 𝑛𝑛 and, for large values of 𝑛𝑛, the amount of computations
might be remarkable;
2. changing a single point 𝑡𝑡𝑖𝑖 , 𝑞𝑞𝑖𝑖 implies to compute again the entire polynomial;
3. adding a final point 𝑡𝑡𝑛𝑛+1 , 𝑞𝑞𝑛𝑛+1 implies the use of a higher degree polynomial and thus the
computation of all the coefficients;
4. the obtained solution in general presents undesired oscillations
An alternative, instead of using a single polynomial of degree 𝑛𝑛 − 1, is to use 𝑛𝑛 − 1 polynomials of
degree 𝑝𝑝 (typically lower), each of which defined in an interval of the trajectory.
The degree 𝑝𝑝 of the polynomials is usually equal to 3 (pieces of cubic trajectories).
A first, and obvious, way to proceed is to assign positions and velocities in all the points and then to
compute the coefficients of the cubic polynomials between two consecutive points.
Position Velocity
50 20
40
10
30
deg/s
deg
20 0
10
-10
0
-10 -20
-2 0 2 4 6 8 10 12 -2 0 2 4 6 8 10 12
t(s)
Acceleration
40
𝑡𝑡1 = 0 𝑡𝑡2 = 2 𝑡𝑡3 = 4 𝑡𝑡4 = 8 𝑡𝑡5 = 10
20
𝑞𝑞1 = 10° 𝑞𝑞2 = 20° 𝑞𝑞3 = 0° 𝑞𝑞4 = 30° 𝑞𝑞5 = 40°
deg/s2
0 𝑞𝑞̇ 1 = 0°/𝑠𝑠 𝑞𝑞̇ 2 = −10°/𝑠𝑠 𝑞𝑞̇ 3 = 10°/𝑠𝑠 𝑞𝑞̇ 4 = 3°/𝑠𝑠 𝑞𝑞̇ 5 = 0°/𝑠𝑠
-20
-40
-2 0 2 4 6 8 10 12
t(s)
If only the intermediate positions are specified, and not the intermediate velocities, these can be
assigned with rules like:
𝑞𝑞̇ 1 = 0
0 sign 𝑅𝑅𝑘𝑘 ≠ sign 𝑅𝑅𝑘𝑘+1
𝑞𝑞̇ 𝑘𝑘 = �𝑅𝑅𝑘𝑘 + 𝑅𝑅𝑘𝑘+1
sign 𝑅𝑅𝑘𝑘 = sign 𝑅𝑅𝑘𝑘+1
2
𝑞𝑞̇ 𝑛𝑛 = 0
where:
𝑞𝑞𝑘𝑘 − 𝑞𝑞𝑘𝑘−1
𝑅𝑅𝑘𝑘 =
𝑡𝑡𝑘𝑘 − 𝑡𝑡𝑘𝑘−1
Position Velocity
50 20
40
10
30
deg/s
deg
20 0
10
-10
0
-10 -20
-2 0 2 4 6 8 10 12 -2 0 2 4 6 8 10 12
t(s)
Acceleration
30
20 𝑡𝑡1 = 0 𝑡𝑡2 = 2 𝑡𝑡3 = 4 𝑡𝑡4 = 8 𝑡𝑡5 = 10
10 𝑞𝑞1 = 10° 𝑞𝑞2 = 20° 𝑞𝑞3 = 0° 𝑞𝑞4 = 30° 𝑞𝑞5 = 40°
deg/s2
0
-10
-20
-30
-2 0 2 4 6 8 10 12
t(s)
The interpolation with cubic polynomials generates a trajectory which presents a discontinuity in the
acceleration in the intermediate points.
In order to avoid this problem, while keeping cubic interpolation, we must avoid to assign specific values of
velocity in the intermediate points, assigning just the continuity of velocities and accelerations (and of
course positions) in these points.
The trajectory which is obtained this way is called spline (smooth path line).
The spline is the minimum curvature interpolating function, given some conditions on continuity of
derivatives.
each of which has 4 coefficients, the total number of coefficients to be computed is 4 𝑛𝑛 − 1 . The
conditions to be imposed are:
2 𝑛𝑛 − 1 conditions of passage through the points (each cubic has to interpolate the points at its
boundaries)
𝑛𝑛 − 2 conditions on continuity of velocities in the intermediate points
𝑛𝑛 − 2 conditions on continuity of accelerations in the intermediate points
We thus have: 4 𝑛𝑛 − 1 − 2 𝑛𝑛 − 1 − 2 𝑛𝑛 − 2 = 2
residual degrees of freedom.
A (not unique) way to use these 2 degrees of freedom consists in assigning suitable initial and final
conditions on the velocity.
Assume initially that the velocities 𝑣𝑣𝑘𝑘 , 𝑘𝑘 = 2, … , 𝑛𝑛 − 1 in the intermediate points are known. In
this way, for each cubic polynomial we have four boundary conditions on position and velocity,
which give rise to the system:
𝑎𝑎𝑘𝑘𝑘 = 𝑞𝑞𝑘𝑘
Solving the system yields: 𝑎𝑎𝑘𝑘𝑘 = 𝑣𝑣𝑘𝑘
1 3 𝑞𝑞𝑘𝑘+1 − 𝑞𝑞𝑘𝑘
𝑎𝑎𝑘𝑘𝑘 = − 2𝑣𝑣𝑘𝑘 − 𝑣𝑣𝑘𝑘+1
𝑇𝑇𝑘𝑘 𝑇𝑇𝑘𝑘
1 2 𝑞𝑞𝑘𝑘 − 𝑞𝑞𝑘𝑘+1
𝑎𝑎𝑘𝑘3 = 2 + 𝑣𝑣𝑘𝑘 + 𝑣𝑣𝑘𝑘+1
𝑇𝑇𝑘𝑘 𝑇𝑇𝑘𝑘
By substituting the expressions for the coefficients 𝑎𝑎𝑘𝑘2 , 𝑎𝑎𝑘𝑘3 , 𝑎𝑎𝑘𝑘+1,2 and multiplying by 𝑇𝑇𝑘𝑘 𝑇𝑇𝑘𝑘+1 ⁄2 we
obtain:
3
𝑇𝑇𝑘𝑘+1 𝑣𝑣𝑘𝑘 + 2 𝑇𝑇𝑘𝑘+1 + 𝑇𝑇𝑘𝑘 𝑣𝑣𝑘𝑘+1 + 𝑇𝑇𝑘𝑘 𝑣𝑣𝑘𝑘+2 = 𝑇𝑇𝑘𝑘2 𝑞𝑞𝑘𝑘+2 − 𝑞𝑞𝑘𝑘+1 + 𝑇𝑇𝑘𝑘+1
2
𝑞𝑞𝑘𝑘+1 − 𝑞𝑞𝑘𝑘
𝑇𝑇𝑘𝑘 𝑇𝑇𝑘𝑘+1
3
𝑇𝑇𝑘𝑘+1 𝑣𝑣𝑘𝑘 + 2 𝑇𝑇𝑘𝑘+1 + 𝑇𝑇𝑘𝑘 𝑣𝑣𝑘𝑘+1 + 𝑇𝑇𝑘𝑘 𝑣𝑣𝑘𝑘+2 = 𝑇𝑇𝑘𝑘2 𝑞𝑞𝑘𝑘+2 − 𝑞𝑞𝑘𝑘+1 + 𝑇𝑇𝑘𝑘+1
2
𝑞𝑞𝑘𝑘+1 − 𝑞𝑞𝑘𝑘
𝑇𝑇𝑘𝑘 𝑇𝑇𝑘𝑘+1
In matrix form:
𝑇𝑇2 2 𝑇𝑇1 + 𝑇𝑇2 𝑇𝑇1 𝑣𝑣1 𝑐𝑐1
0 𝑇𝑇3 2 𝑇𝑇2 + 𝑇𝑇3 𝑇𝑇2 𝑣𝑣2 𝑐𝑐2
⋮ ⋮ = ⋮
𝑇𝑇𝑛𝑛−2 2 𝑇𝑇𝑛𝑛−3 + 𝑇𝑇𝑛𝑛−2 𝑇𝑇𝑛𝑛−3 0 𝑣𝑣𝑛𝑛−1 𝑐𝑐𝑛𝑛−3
𝑇𝑇𝑛𝑛−1 2 𝑇𝑇𝑛𝑛−2 + 𝑇𝑇𝑛𝑛−1 𝑇𝑇𝑛𝑛−2 𝑣𝑣𝑛𝑛 𝑐𝑐𝑛𝑛−2
where constants 𝑐𝑐𝑘𝑘 depend only on the intermediate positions and on the lengths of the intervals, all
known quantities.
Since the velocities 𝑣𝑣1 and 𝑣𝑣𝑛𝑛 are known (they are specified as initial data), by eliminating the related
columns we have:
Matrix 𝐀𝐀 is a dominant diagonal matrix and is always invertible provided that 𝑇𝑇𝑘𝑘 > 0;
Matrix 𝐀𝐀 has a tridiagonal structure: for these matrices there exist efficient numerical
techniques (Gauss-Jordan method) for its inversion;
Once the inverse of 𝐀𝐀 is known we might compute velocities 𝑣𝑣2 , ⋯ , 𝑣𝑣𝑛𝑛−1 as:
𝐯𝐯 = 𝐀𝐀−1 𝐜𝐜
It is also possible to determine the spline with an alternative (yet completely equivalent) algorithm
which computes the accelerations instead of the velocities in the intermediate points.
Position Velocity
50 20
40
10
30
deg/s
deg
20 0
10
-10
0
-10 -20
-2 0 2 4 6 8 10 12 -2 0 2 4 6 8 10 12
t(s)
Acceleration
20
-10
-20
-2 0 2 4 6 8 10 12
t(s)
min𝑇𝑇 = � 𝑇𝑇𝑘𝑘
𝑇𝑇𝑘𝑘
𝑘𝑘=1
𝑞𝑞̇ 𝜏𝜏, 𝑇𝑇𝑘𝑘 < 𝑣𝑣max 𝜏𝜏 ∈ 0, 𝑇𝑇
such that
𝑞𝑞̈ 𝜏𝜏, 𝑇𝑇𝑘𝑘 < 𝑎𝑎max 𝜏𝜏 ∈ 0, 𝑇𝑇
It is then a non linear optimum problem with a linear cost function, which can be solved with operations
research techniques.
An alternative, quite simple, way to handle the interpolation problem is to link the points with
linear functions (segments). In order to avoid discontinuities in the velocity, the linear segments
can be connected through parabolic bends
Trajectory planning in the joint space yields unpredictable motions of the end-
effector. When we want the motion to evolve along a predefined path in the
operational space, it is necessary to plan the trajectory directly in this space.
We will first address the trajectory planning for the position, and
then we will concentrate on the orientation.
In this case it is not possible to define the frame (𝐭𝐭, 𝐧𝐧, 𝐛𝐛) uniquely.
A linear path is completely characterized once two points in Cartesian space are given.
During the over-fly, i.e. the passage near a via point, the path remains always in the plane specified by the
two lines intersecting in the via point. This means that the problem of planning the over-fly is planar.
𝜌𝜌 cos 𝑠𝑠⁄𝜌𝜌
𝐩𝐩′ 𝑠𝑠 = 𝜌𝜌 sin 𝑠𝑠⁄𝜌𝜌
0
Defining:
𝐜𝐜 the vector that identifies the centre of the circumference in the base frame
𝐑𝐑 the rotation matrix from base frame to frame 𝑥𝑥 ′ 𝑦𝑦 ′ 𝑧𝑧 ′
the general parametric representation of a circumference in space is:
𝐩𝐩 𝑠𝑠 = 𝐜𝐜 + 𝐑𝐑𝐩𝐩′ 𝑠𝑠
The circular path can also be defined assigning three points in space belonging to the same plane:
For the orientation planning we might interpolate (e.g. linearly) the components of the unit
vectors 𝐧𝐧 𝑡𝑡 , 𝐬𝐬 𝑡𝑡 and 𝐚𝐚 𝑡𝑡 .
This procedure is however not advisable as the orthonormality of unit vectors cannot be
guaranteed at all times.
An alternative way is to interpolate three Euler angles, using the following relations:
𝑠𝑠
φ 𝑠𝑠 = φ𝑖𝑖 + φ𝑓𝑓 − φ𝑖𝑖 We can use any timing law s(t) on the natural parameter.
φ𝑓𝑓 − φ𝑖𝑖
𝑠𝑠̇ The angular velocity ω, which is linearly related to 𝜑𝜑,̇ has a
φ̇ = φ𝑓𝑓 − φ𝑖𝑖 continuous variation of the amplitude.
φ𝑓𝑓 − φ𝑖𝑖
𝑠𝑠̈ Poor predictability and understanding of the
φ̈ = φ𝑓𝑓 − φ𝑖𝑖
φ𝑓𝑓 − φ𝑖𝑖 intermediate orientation!
Define with 𝐑𝐑𝑖𝑖 𝑡𝑡 the matrix that describes the transition from 𝐑𝐑 𝑖𝑖 to 𝐑𝐑𝑓𝑓 .
Then:
𝐑𝐑𝑓𝑓
with:
𝜗𝜗
𝜂𝜂 = cos
2 𝜂𝜂 2 + 𝜀𝜀𝑥𝑥2 + 𝜀𝜀𝑦𝑦2 + 𝜀𝜀𝑧𝑧2 = 1
𝜗𝜗 1
𝜺𝜺 = sin 𝐫𝐫 𝜂𝜂 = 𝑟𝑟 + 𝑟𝑟22 + 𝑟𝑟33 + 1
2 2 11
where 𝜗𝜗 and 𝐫𝐫 have the same sgn 𝑟𝑟32 − 𝑟𝑟23 𝑟𝑟11 − 𝑟𝑟22 − 𝑟𝑟33 + 1
meaning as with the axis/angle 1
𝜺𝜺 = sgn 𝑟𝑟13 − 𝑟𝑟31 𝑟𝑟22 − 𝑟𝑟33 − 𝑟𝑟11 + 1
representation, but the 2
representation singularity has sgn 𝑟𝑟21 − 𝑟𝑟12 𝑟𝑟33 − 𝑟𝑟11 − 𝑟𝑟22 + 1
been removed:
TrajGen
Inverse Axis
target Kinematics controller
state
INSTRUCTION
STACK
state update
Instruction stack: list of instructions to be executed, specified using the proprietary programming
language
Trajectory generation: converts an instruction into a trajectory to be executed
Inverse kinematics: maps the trajectory from the Cartesian space to the joint space (if needed)
Axis controllers & drives: closes the control loop ensuring tracking performance
Inverse kinematics has already been discussed with reference to the study of the
kinematics of the (possibly redundant) manipulator.
Options are:
.
q0
Closed form analytic solution
(whenever possible) .
rd In−J#(q)J(q)
Numerical solution through
(pseudo) inverse of the .
Jacobian rd + + + J#(q) + + q q
K
−
r
f(q)
TrajGen
Inverse Axis
target Kinematics controller
state
INSTRUCTION
STACK
state update
Instruction stack: list of instructions to be executed, specified using the proprietary programming
language
Trajectory generation: converts an instruction into a trajectory to be executed
Inverse kinematics: maps the trajectory from the Cartesian space to the joint space (if needed)
Axis controllers & drives: closes the control loop ensuring tracking performance (see next set of
slides)