compute

SCurveTrajectory.compute(time: Time) AngularPosition

It computes the angular position at the given time instant, according to the S curve trajectory from the start_position to the stop_position.

Parameters

timeTime

Specific instant of time in which to calculate the angular position in accordance with the S curve.

Returns

AngularPosition

Angular position according to S curve trajectory at the given time.

Raises

TypeError

If time is not an instance of Time.

Notes

The input parameter time \(t\) is compared to the S curve trajectory parameters, to establish the motion regime at that time instant. Five cases are be possibile:

  1. \(t \lt t_0\): The time \(t\) instant preceeds the start_time \(t_0\). The motion regime is uniform velocity at start_velocity \(\dot{\theta}_0\). The angular position \(\theta\) is computed as:

    \[\theta = \dot{\theta}_0 t_l + \theta_0\]

    where \(t_l = t - t_0\).

  2. \(t_0 \le t \lt t_0 + t_A\): The time \(t\) instant is greater than the start_time \(t_0\), but lower than the duration \(t_0 + t_A\). The motion regime is uniform acceleration at maximum_acceleration \(\ddot{\theta}_{A,max}\). The angular position \(\theta\) is computed as:

    \[\theta = \frac{1}{2} \ddot{\theta}_{A,max} t^2_l + \dot{\theta}_0 t_l + \theta_0\]

    where \(t_l = t - t_0\).

  3. \(t_0 + t_A \le t \lt t_0 + t_A + t_U\) The time \(t\) instant is greater than the duration \(t_0 + t_A\), but lower than the duration \(t_0 + t_A + t_U\). The motion regime is uniform velocity at maximum_velocity \(\dot{\theta}_{max}\). The angular position \(\theta\) is computed as:

    \[\theta = \dot{\theta}_{max} t_l + \theta_0 + \theta_A\]

    where \(t_l = t - t_0 - t_A\).

  4. \(t_0 + t_A + t_U \le t \lt t_1\) The time \(t\) instant is greater than the duration \(t_0 + t_A + t_U\), but lower than the duration \(t_1\). The motion regime is uniform deceleration at maximum_deceleration \(\ddot{\theta}_{D,max}\). The angular position \(\theta\) is computed as:

    \[\theta = - \frac{1}{2} \ddot{\theta}_{D,max} t^2_l + \dot{\theta}_{max} t_l + \theta_0 + \theta_A + \theta_U\]

    where \(t_l = t - t_0 - t_A - t_U\).

  5. \(t \ge t_1\) The time \(t\) instant is greater than the duration \(t_1\). The motion regime is uniform velocity at stop_velocity \(\dot{\theta}_1\). The angular position \(\theta\) is computed as:

    \[\theta = \dot{\theta}_1 t_l + \theta_1\]

    where \(t_l = t - t_0 - t_A - t_U - t_D\).

In some cases, the difference between stop_position \(\theta_1\) and start_position \(\theta_0\) is small compared to the acceleration and deceleration distances \(\theta_A\) and \(\theta_D\). In that case, there is no room for uniform velocity regime at maximum_velocity \(\dot{\theta}_{max}\), so the step 3 is skipped and the maximum_velocity is not reached.

The acceleration duration \(t_A\) is computed as:

\[t_A = \frac{\dot{\theta}_{max} - \dot{\theta}_0}{\ddot{\theta}_{A,max}}\]

The uniform duration \(t_U\) is computed as:

\[t_U = \frac{\theta_U}{\dot{\theta}_{max}}\]

The deceleration duration \(t_D\) is computed as:

\[t_D = \frac{\dot{\theta}_{max} - \dot{\theta}_1}{\ddot{\theta}_{D,max}}\]

The acceleration distance \(\theta_A\) is computed as:

\[\theta_A = \frac{1}{2} \frac{\dot{\theta}_{max}^2 - \dot{\theta}_0^2}{\ddot{\theta}_{A,max}}\]

The uniform distance \(\theta_U\) is computed as:

\[\theta_U = | \theta_1 - \theta_0 | - \theta_A - \theta_D\]

The deceleration distance \(\theta_D\) is computed as:

\[\theta_D = \frac{1}{2} \frac{\dot{\theta}_{max}^2 - \dot{\theta}_1^2}{\ddot{\theta}_{D,max}}\]

The stop time is computed as:

\[t_1 = t_0 + t_A + t_U + t_D\]

Here the list of the parameters used in the above equations:

  • \(\theta\) is the angular position,

  • \(\dot{\theta}_{max}\) is the maximum_velocity,

  • \(\ddot{\theta}_{A,max}\) is the maximum_acceleration,

  • \(\ddot{\theta}_{D,max}\) is the maximum_deceleration,

  • \(\theta_0\) is the start_position,

  • \(\theta_1\) is the stop_position,

  • \(\dot{\theta}_0\) is the start_velocity,

  • \(\dot{\theta}_1\) stop_velocity,

  • \(t_0\) is the start_time.