Trajectory planning for Automatic Machines and Robots (2008)
3.4 Trajectory with Double S Velocity Profile
A trapezoidal (or triangular) velocity motion profile presents a discontinuous acceleration. For this reason, this trajectory may generate efforts and stresses on the mechanical system that may result detrimental or generate undesired vibrational effects (see Chapter 7 for a more detailed discussion on these aspects). Therefore, a smoother motion profile must be defined, for example by adopting a continuous, linear piece-wise, acceleration profile as shown in Fig. 3.13. In this manner, the resulting velocity is composed by linear segments connected by parabolic blends. The shape of the velocity profile is the reason of the name double S for this trajectory, known also as bell trajectory or seven segments trajectory, because it is composed by seven different tracts with constant jerk. Since the jerk is characterized by a step profile, the stress and the vibrational effects generated on the transmission chain and on the load by this motion profile are reduced with respect to trapezoidal velocity trajectories, characterized by an impulsive jerk profile.
Let us assume that
jmin=−jmax,amin=−amax,vmin=−vmax
where jmin and jmax are the minimum and maximum value of the jerk, respectively. With these conditions, it is desired to plan a trajectory that, when possible, reaches the maximum (minimum) values for jerk, acceleration and velocity so that the total duration T is minimized (minimum time trajectory). Only the case q1>q0 is now considered. The case q1<q0 is addressed in the following Sec. 3.4.2. Moreover, for the sake of simplicity, the value t0=0 is assumed. The boundary conditions are:
Generic initial and final values of velocity v0,v1.
Initial and final accelerations a0,a1 set to zero.
Three phases can be distinguished:
Acceleration phase, t∈[0,Ta], where the acceleration has a linear profile from the initial value (zero) to the maximum and then back to zero.
Maximum velocity phase, t∈[Ta,Ta+Tv], with a constant velocity.
Deceleration phase, t∈[Ta+Tv,T], being T=Ta+Tv+Td, with profiles opposite with respect to the acceleration phase.
Given the constraints on the maximum values of jerk, acceleration and velocity, and given the desired displacement h=q1−q0, the trajectory is computed by using (3.30a)-(3.30g). However, it is first necessary to verify whether a trajectory can be actually performed or not. As a matter of fact, there are several cases in which a trajectory cannot be computed with the given constraints. For example, if the desired displacement h is small with respect to the difference between the initial and final velocities v0 and v1, it might be not possible
Fig. 3.13. Typical profiles for position, velocity, acceleration and jerk for the double S trajectory.
to change the velocity (with the given limits on jerk and acceleration), while accomplishing the displacement h.
The limit case is represented by a single acceleration (if v0<v1 ) or deceleration (if v0>v1 ) phase. Therefore, it is first necessary to check if it is possible to perform the trajectory with a double jerk impulse (one positive and one negative) only. For this purpose, let us define
Tj⋆=min{jmax∣v1−v0∣,jmaxamax}(3.17)
If Tj⋆=amax/jmax, the acceleration reaches its maximum value and a segment with zero jerk may exist.
Then, the trajectory is feasible if
If this inequality holds, it is possible to compute the trajectory parameters. In this case, by defining the maximum value of the velocity during the motion as vlim =max(q˙(t)), there are two possibilities:
Case 1: vlim =vmax .
Case 2: vlim <vmax .
In the latter case, that can be verified only after the computation of the trajectory's parameters, the maximum velocity is not reached, and there is only an acceleration and a deceleration phase (no segment with constant velocity).
In both Case 1 and Case 2, it is possible that the maximum acceleration (positive or negative) is not reached. This may happen if the displacement is small, if the maximum allowed acceleration amax is high ("high dynamic" case), or if the initial (final) velocity is close enough to the maximum allowed speed. In these cases, the constant acceleration segment is not present. In particular, it is worth to notice that, because the different values of the initial and final velocities v0,v1, the amounts of time necessary to accelerate (from v0 to vlim ) and to decelerate (from vlim to v1 ) are in general different, and it may happen that the maximum acceleration amax is reached only in one of these phases, while in the other one the maximum acceleration is alim <amax . Let us define:
Tj1 : time-interval in which the jerk is constant (jmax or jmin ) during the acceleration phase;
Tj2 : time-interval in which the jerk is constant (jmax or jmin ) during the deceleration phase;
Ta : acceleration period;
Tv : constant velocity period;
Td : deceleration period;
T : total duration of the trajectory (=Ta+Tv+Td)
Case 1: vlim =vmax .
In this case, it is possible to verify if the maximum acceleration ( amax or amin=−amax) is reached by means of the following conditions:
if (vmax−v0)jmax<amax2⟹amax is not reached; if (vmax−v1)jmax<amax2⟹amin is not reached. (3.19)(3.20)
Then, the time intervals of the acceleration segment can be computed if (3.19) holds as
Tj1=jmaxvmax−v0,Ta=2Tj1(3.21)
otherwise as
Tj1=jmaxamax,Ta=Tj1+amaxvmax−v0(3.22)
The time intervals of the deceleration segment can be computed if (3.20) holds as
Tj2=jmaxvmax−v1,Td=2Tj2(3.23)
otherwise as
Tj2=jmaxamax,Td=Tj2+amaxvmax−v1(3.24)
Finally, it is possible to determine the time duration of the constant velocity segment as
If Tv>0, then the maximum velocity is actually reached and the values obtained by (3.21)-(3.25) can be used to compute the trajectory.
The condition Tv<0 simply means that the maximum velocity vlim is smaller than vmax and, therefore, the following Case 2 must be considered.
Example 3.9 Fig. 3.14 reports the position, velocity, acceleration and jerk for a double S trajectory when the constant velocity phase is present. The boundary conditions are
In this case, the constant velocity segment is not present (Tv=0), and the duration of the acceleration and deceleration segments can be easily computed if the maximum/minimum accelerations are reached in both segments. In this case
Tj1=Tj2=Tj=jmaxamax(3.26a)
and
Fig. 3.14. Double S trajectory profiles (position, velocity, acceleration and jerk) including a constant velocity phase.
Example 3.10 Fig. 3.15 reports the position, velocity, acceleration and jerk for a double S trajectory when the constant velocity phase is not present. The
boundary conditions are
If Ta<2Tj or Td<2Tj, then the maximum (minimum) acceleration is not reached in at least one of the two segments, and therefore it is not possible to use eq. (3.26a), (3.26b), (3.26c). In this case (indeed rather unusual), the determination of parameters is quite difficult, and it may be more convenient to find an approximated solution that, although not optimal, results acceptable from a computational point of view. A possible way to determine this solution is to progressively decrease the value of amax (e.g. by assuming amax=γamax, with 0<γ<1 ) and compute the durations of the segments by means of (3.26a), (3.26b), (3.26c), until the conditions Ta>2Tj and Td>2Tj are both true.
Example 3.11 Fig. 3.16 reports the position, velocity, acceleration and jerk of a double S trajectory when the constant velocity segment is not present. In this case, also the maximum acceleration is not reached and the above recursive algorithm is adopted. The boundary conditions are
q0=0,q1=10,v0=7,v1=0
while the constraints are
vmax=10,amax=10,jmax=30
The time intervals defining the double S trajectory result
The maximum speed is vlim =8.6329, and the limit values of the acceleration during the acceleration and deceleration period are respectively
During this recursive computation, it may happen that Ta or Td becomes negative. In this case, only one of the acceleration or deceleration phase is necessary, depending on the values of the initial and final velocities. If Ta<0
Fig. 3.15. Double S trajectory profiles (position, velocity, acceleration and jerk) without a constant velocity phase.
(note that in this case necessarily v0>v1 ), the acceleration phase is not present. Then, Ta is set to 0 and the duration of the deceleration segment can be computed according to
Example 3.12 Fig. 3.17 reports position, velocity, acceleration and jerk of a double S trajectory composed only by the deceleration phase. The boundary conditions are
q0=0,q1=10,v0=7.5,v1=0
Fig. 3.16. Double S trajectory profiles (position, velocity, acceleration and jerk) without the constant velocity phase and with limit acceleration lower than the maximum value.
with constraints
vmax=10,amax=10,jmax=30
The resulting time intervals are
Ta=0,Tv=0,Td=2.6667,Tj1=0,Tj2=0.0973
The maximum velocity is vlim =7.5, and the limit values of the acceleration during the acceleration and deceleration periods are respectively alima=0
In the dual case, i.e. when Td<0 (this case is possible when v1>v0 ), the deceleration phase is not necessary (Td=0) and the duration of the
Fig. 3.17. Double S trajectory profiles (position, velocity, acceleration and jerk) composed by only a deceleration phase.
After the duration of each segment of the trajectory has been defined, it is possible to compute the values of the maximum/minimum accelerations ( alim a and alim ) and of the maximum velocity ( vlim ) of the trajectory:
alim a=jmaxTj1,alim d=−jmax Tj2vlim =v0+(Ta−Tj1)alim a=v1−(Td−Tj2)alim d
3.4.1 Computation of the trajectory for q1>q0
Once the time lengths and the other parameters have been defined, the double S trajectory is computed by means of the following equations (one for each segment defined in Fig. 3.13). The case t0=0 is assumed, otherwise a translation in time has to be applied, see Sec. 5.1.
In case q1<q0, the parameters of the trajectory can be computed according to the same procedure reported above. It is necessary to consider the initial and final positions/velocities with opposite signs, and, after the computation, to invert the resulting profiles of position, velocity, acceleration, and jerk.
More generally, given any initial and final values for position and velocity (q^0,q^1,v^0,v^1), in order to compute the trajectory it is necessary to transform these values as
q0=σq^0,q1=σq^1,v0=σv^0,v1=σv^1(3.31)
where σ=sign(q^0−q^1). Similarly, also the constraints on maximum and minimum velocity, acceleration and jerk (v^max ,v^min ,a^max ,a^min ,j^max ,j^min ) must be transformed:
Since the synthesis of the double S trajectory is quite articulated, a scheme summarizing the algorithm to determine the trajectory in all possible conditions is shown in Fig. 3.18.
3.4.3 Double S with null initial and final velocities
When the initial and final velocities v0 and v1 are null, the computation of the double S trajectory is much simpler, in particular when the constraints are symmetric (jmin=−jmax ,amin =−amax ,vmin =−vmax ).
Fig. 3.18. Flux diagram for the double S trajectory computation.
As a matter of fact, in this case the acceleration and deceleration segments are symmetric, and then Ta=Td and Tj1=Tj2=Tj. Moreover, it is always possible to find a trajectory joining the initial and the final position, which meets the constraints on velocity, acceleration and jerk.
Let us assume q1>q0 (otherwise consider Sec. 3.4.2). Four situations are possible:
vlim =vmax :
1.a. alim =amax
1.b. alim <amax
vlim <vmax :
2.a. alim =amax
2.b. alim <amax
where vlim and alim are the maximum values of velocity and acceleration actually reached during the trajectory, i.e. vlim =maxt(q˙(t)) and alim =maxt(q¨(t)).
Case 1. vlim =vmax .
In this case, it is necessary to check if the maximum acceleration amax is reached or not, and then compute Tj and Ta(=Td)
a. if vmaxjmax≥amax2⇒TjTa=jmaxamax=Tj+amaxvmax
b. if vmaxjmax<amax2⇒Tj=jmaxvmaxTa=2Tj
Then, the duration of the constant velocity segment can be computed as
Tv=vmaxq1−q0−Ta
If Tv is positive, the maximum velocity is reached, otherwise it is necessary to consider Case 2 (and Tv=0 ).
Case 2. vlim <vmax .
Again, two sub-cases are possible, depending wether the maximum acceleration amax is reached or not. Also in this case the solution can be found in a closed form, as
a. if (q1−q0)≥2jmax2amax3⇒TjTa=jmaxamax=2Tj+(2Tj)2+amaxq1−q0.
b. if (q1−q0)<2jmax 2amax 3⇒Tj=32jmaxq1−q0Ta=2Tj.
Once Tj,Ta (and Td ), Tv are available, the trajectory can be evaluated according to (3.30a)-(3.30g), with
Example 3.13 Fig. 3.19 shows the position, velocity, acceleration and jerk for a double S trajectory with zero initial and final velocities when the constant velocity phase is not present. In this case, also the maximum acceleration is not reached, however the trajectory parameters are computed in closed form. The boundary conditions are
q0=0,q1=10,v0=0,v1=0
while the constraints are
vmax=10,amax=20,jmax=30
The resulting time intervals are
Tj=0.5503,Ta=1.1006,Tv=0
The maximum velocity is vlim=8.6329, and the limit values of the acceleration during the acceleration and deceleration period are respectively
3.4.4 On-line computation of the double S trajectory
A simplified approach for the computation of the double S profile is based on a discrete time formulation of the trajectory. This method is suitable when it is necessary to define complex trajectories, composed by several double S segments, and is appropriate for CNC machines, where the trajectory profiles are computed in discrete time.
Let us define
Fig. 3.19. Double S trajectory profiles with zero initial and final velocities, without a constant velocity phase and with limit acceleration lower than the maximum value.
the values of position, velocity, acceleration and jerk at the k-th time instant, being Ts the sampling period. The structure of the trajectory planner is shown in Fig. 3.20. Given the initial and final values of position, velocity and acceleration and the constraints 2(vmax,vmin,amax,amin,jmax ,jmin ), the jerk profile is computed as detailed below and then it is integrated three[^0]
Fig. 3.20. Block diagram of the trajectory planner for online computation of the double S trajectory.
times to obtain acceleration, velocity and position, respectively. In particular, the trapezoidal integration 3 is adopted, and accordingly the relations between jerk, acceleration, velocity and position are
The basic idea of this trajectory planner is to perform, with acceleration and jerk compliant with the desired constraints, the acceleration phase and then the constant velocity segment until it is necessary to decelerate in order to reach the final position q1 with the desired values of velocity and acceleration v1 and a1. Therefore, the computation of the trajectory is composed by two phases, see Fig. 3.21:
An acceleration profile is computed with the classical trapezoidal acceleration, possibly followed by a constant velocity phase (=vmax ).
During the motion, at each time instant kTs it is checked whether it is possible to decelerate from the current velocity q˙k to the final one v1, with the constraints on q¨k and qk(3), and with the goal to reach exactly q1.
Phase 1: Acceleration and constant velocity phase
In order to perform a double S trajectory from q0 to q1(>q0), the jerk is kept at its maximum value until q¨k<amax. Then, the jerk is set to zero (qk(3)=0), and therefore the acceleration is constant (amax ). Finally, the jerk is set to the minimum value (qk(3)=jmin) in order to have a null acceleration when the maximum velocity is reached. At this point, the maximum velocity is maintained until the deceleration phase starts.
Mathematically, this can be described by
3 The discrete time transfer function of an integrator is GI(z−1)=2Ts1−z−11+z−1.
Fig. 3.21. Online computation of the double S trajectory.
qk(3)=⎩⎨⎧jmax,0,jmin,0, if q˙k−2jminq¨k2<vmax if q˙k−2jminq¨k2<vmax if q˙k−2jminq¨k2≥vmax if q˙k−2jminq¨k2≥vmax and q¨k<amax and q¨k≥amax and q¨k>0 and q¨k≤0(3.35)
The conditions q˙k−2jminq¨k2≥vmax,q¨k≥amax and q¨k≤0 are considered in lieu of q˙k−2jminq¨k2=vmax,q¨k=amax and q¨k=0, since usually small numerical errors affect the computations.
Phase 2: Deceleration phase
At each sampling time 4, one must compute the time intervals Td,Tj2a and Tj2b (refer to Fig. 3.22), necessary to change the acceleration and the velocity from the current values ( q˙k and q¨k ) to the final ones ( v1 and a1 ) according to a trapezoidal deceleration profile, subject to constraints on maximum/minimim acceleration and jerk. From the expressions of velocity and acceleration varia-
equations are not valid.
}
Fig. 3.22. Typical profiles for position, velocity, acceleration and jerk for the double S trajectory, with initial and final velocities and accelerations =0.
tions, in the case that the minimum acceleration amin is reached (accordingly Td≥Tj2a+Tj2b ), one obtains
Note that the periods with maximum and minimum jerk (Tj2b and Tj2a) may be different since the initial and final accelerations of the deceleration phase, q¨k and a1 respectively, are in general not equal (and in particular are not null).
At this point, it is necessary to compute the position displacement produced by the acceleration and velocity profiles obtained from (3.36) or (3.37)
and check if hk<q1−qk. If this condition holds, it is necessary to continue the trajectory computation according to Case 1 (iterating the calculation of the deceleration parameters with the new values of qk,q˙k and q¨k ), otherwise the deceleration phase must start and the jerk is computed as
qk(3)=⎩⎨⎧jmin,0,jmax , if if if (k−kˉ)∈[0,TsTj2a](k−kˉ)∈[TsTj2a,TsTd−Tj2b](k−kˉ)∈[TsTd−Tj2b,TsTd](3.38)
where kˉ is the time instant in which Phase 2 starts.
Example 3.14 Fig. 3.23 reports the position, velocity, acceleration and jerk for a double S trajectory computed online. In this case, it is simple to consider non-null initial and final values of velocity and acceleration, and asymmetric constraints on the maximum values of velocity, acceleration and jerk. In particular, the boundary conditions are
As already mentioned, this algorithm is affected by numerical errors which depend on the sampling period: the larger Ts is, the larger the errors are on
Fig. 3.23. Double S trajectory profiles (position, velocity, acceleration and jerk) computed online.
acceleration, velocity and position. However, if it is necessary for some reasons to have a large value for Ts, it is possible to assume, only for the computation of the trajectory, a sampling period N times smaller, e.g. Ts⋆=NTs, and then under-sample the data points so obtained.
Example 3.15 Fig. 3.24 reports the position, velocity, acceleration and jerk for a double S trajectory computed online, with Ts=0.02s. The same values of boundary and peak conditions of the previous example are considered. The dashed lines have been obtained with Ts=0.02s, while the solid lines have been computed with Ts⋆=Ts/200=0.0001s, and then under-sampling the profiles by considering a point every two hundred samples. Note the errors that affect the dashed curves.
Fig. 3.24. Double S trajectory profiles (position, velocity, acceleration and jerk) computed online, with Ts=0.0001s (solid) and with Ts=0.02s (dashed).
If q1<q0 it is possible to adopt the method described in Sec. 3.4.2.
Example 3.16 Fig. 3.25 reports the position, velocity, acceleration and jerk for a double S trajectory computed online for q1<q0. In particular, the boundary conditions are
Fig. 3.25. Double S trajectory profiles (position, velocity, acceleration and jerk) computed online with q1<q0.
3.4.5 Displacement time of a double S trajectory
The computation of the displacement time of a double S trajectory is rather complex, because of the large number of different possible cases. For this reason, only some specific, but common, situations are considered here.
In particular, assuming h=q1−q0>0, symmetric constraints vmin =−vmax ,amin =−amax ,jmin =−jmax , and that the maximum values of both acceleration and speed ( amax and vmax ) are reached, the total duration of the trajectory can be easily obtained as
If both initial and final speeds are zero, (3.39) becomes
T=vmaxh+amaxvmax+jmaxamax(3.40)
From eq. (3.40), it is straightforward to verify that the time length of the trajectory can be easily modified by properly scaling the values of vmax ,amax , jmax . As a matter of fact, if the new constraints
vmax′=λvmax,amax′=λ2amax,jmax′=λ3jmax
are considered, the duration T′ becomes
T′=λT
and therefore it is possible to compute the value of λ which leads to a desired duration T′=TD :
λ=TDT
The same considerations are valid also if the initial and final velocities are not null, but in this case it is necessary to scale also v0 and v1 (see eq. (3.39)):
v0′=λv0,v1′=λv1
For other considerations about the scaling in time of trajectories, see Chapter 5 .
Example 3.17 In Fig. 3.26 the position, velocity, acceleration and jerk of a double S trajectory with a total duration TD=5s are shown. The boundary conditions and the constraints are the same of Example 3.9, which lead to the time length T=2.71s. In order to modify the duration of the trajectory and to obtain the desired value TD, the constraints and the initial and final velocities are scaled by λ=0.542.
3.4.6 Double S trajectory with assigned duration of the different phases
A general approach for planning a double S trajectory, with a given time length T and with specified durations of the acceleration and of the constant jerk phases, consists in defining the values of vmax,amax, and jmax as a function
Fig. 3.26. Double S trajectory profiles (position, velocity, acceleration and jerk) properly scaled to impose a desired duration (TD=5s).
of the desired T,Ta,Td,Tj. In particular, the symmetric case with vmin=−vmax ,amin =−amax,jmin =−jmax is considered, and the initial and final velocities v0,v1 are both assumed to be zero (therefore Td=Ta ). Moreover, it is supposed that both the maximum speed and the maximum acceleration are reached. Therefore, with reference to equations (3.30a)-(3.30g) which define the trajectory profiles, it results
vlim =vmax,alima=alimd=amax
From the expressions of the total duration, of the time length of acceleration phase and of the constant jerk segment, i.e.
Fig. 3.27. Double S trajectory profiles with zero initial and final velocities, and with desired durations of the single tracts.
By substituting these values in (3.30a)-(3.30g), the trajectory with the given durations is defined.
Example 3.18 A double S trajectory with the boundary conditions
q0=0,q1=10,v0=0,v1=0
is computed with the purpose of obtaining a total duration T=5. The values
α=1/3,β=1/5
are considered, or equivalently
Ta=1.6666,Tj=0.3333
The resulting values of the velocity, acceleration and jerk are
vmax=3.14,amax=2.25,jmax=6.75
They produce the trajectory reported in Fig. 3.28.
Fig. 3.28. Double S trajectory profiles with prescribed duration T , and with the conditions Ta=T/3 and Tj=Ta/5.
Obviously, the equations (3.41) which relate the variables of the double S trajectory ( vmax,amax ,jmax ,h,T,Ta,Tj ) can also be solved with respect to other sets of variables, e.g. ( vmax,amax,Tj), or (vmax,Ta,Tj), and so on, if the other terms are known. For instance, if one desires a trajectory with a total duration T and with a given maximum acceleration and jerk values amax,jmax, it is possible to obtain the remaining coefficients as