Main Content

Minimum Snap Polynomial Trajectory

Generate minimum snap polynomial trajectories through multiple waypoints

Since R2022a

  • Minimum Snap Polynomial Trajectory Block

Libraries:
UAV Toolbox / Algorithms
Robotics System Toolbox / Utilities

Description

The Minimum Snap Polynomial Trajectory block generates minimum snap polynomial trajectories that pass through the waypoints at the times specified in time points. The block outputs positions, velocities, accelerations, jerks, snap, and time of arrival for achieving this trajectory based on the Time input.

The block also accepts boundary conditions for waypoints. The block also outputs the coefficients for the polynomials and status of the trajectory generation.

The initial and final values of positions, velocities, accelerations, jerks, and snap of the trajectory are held constant outside the time period defined in TimePoints input.

Examples

Ports

Input

expand all

Time point along the trajectory, specified as a scalar or vector.

  • When the time is specified as a scalar, this value is synced with simulation time and is used to specify the time point for sampling the trajectory. The block outputs a vector of the trajectory variables at that instance in time.

  • If the time is specified as a vector, the block outputs a matrix with each column corresponding to each element of the vector.

Data Types: single | double

Positions of waypoints of the trajectory at given time points, specified as an n-by-p matrix. n is the dimension of the trajectory and p is the number of waypoints.

Data Types: single | double

Time points for the waypoints of the trajectory, specified as a p-element row vector. p is the number of waypoints.

Data Types: single | double

Velocity boundary conditions for waypoints, specified as an n-by-p matrix. Each row sets the velocity boundary for the corresponding dimension of the trajectory n at each of p waypoints.

By default, the block uses a value of 0 at the boundary waypoints and NaN at the intermediate waypoints.

Dependencies

To enable this input port, select Show boundary conditions input ports.

Data Types: single | double

Acceleration boundary conditions for waypoints, specified as an n-by-p matrix. Each row sets the acceleration boundary for the corresponding dimension of the trajectory n at each of p waypoints.

By default, the block uses a value of 0 at the boundary waypoints and NaN at the intermediate waypoints.

Dependencies

To enable this input port, select Show boundary conditions input ports.

Data Types: single | double

Jerk boundary conditions for waypoints, specified as an n-by-p matrix. Each row sets the jerk boundary for the corresponding dimension of the trajectory n at each of p waypoints.

By default, the block uses a value of 0 at the boundary waypoints and NaN at the intermediate waypoints.

Dependencies

To enable this input port, select Show boundary conditions input ports.

Data Types: single | double

Snap boundary conditions for waypoints, specified as an n-by-p matrix. Each row sets the snap boundary for the corresponding dimension of the trajectory n at each of p waypoints.

By default, the block uses a value of 0 at the boundary waypoints and NaN at the intermediate waypoints.

Dependencies

To enable this input port, select Show boundary conditions input ports.

Data Types: single | double

Output

expand all

Positions of the trajectory, returned as an n-element vector or n-by-m matrix.

  • If you specify a scalar for the Time input with an n-dimensional trajectory, the output is a vector with n-elements.

  • If you specify a vector of m-elements for the Time input, the output is an n-by-m matrix.

Data Types: single | double

Velocities of the trajectory, returned as an n-element vector or n-by-m matrix.

  • If you specify a scalar for the Time input with an n-dimensional trajectory, the output is a vector with n-elements.

  • If you specify a vector of m-elements for the Time input, the output is an n-by-m matrix.

Data Types: single | double

Accelerations of the trajectory, returned as an n-element vector or n-by-m matrix.

  • If you specify a scalar for the Time input with an n-dimensional trajectory, the output is a vector with n-elements.

  • If you specify a vector of m-elements for the Time input, the output is an n-by-m matrix.

Data Types: single | double

Jerks of the trajectory, returned as an n-element vector or n-by-m matrix.

  • If you specify a scalar for the Time input with an n-dimensional trajectory, the output is a vector with n-elements.

  • If you specify a vector of m-elements for the Time input, the output is an n-by-m matrix.

Data Types: single | double

Snaps of the trajectory, returned as an n-element vector or n-by-m matrix.

  • If you specify a scalar for the Time input with an n-dimensional trajectory, the output is a vector with n-elements.

  • If you specify a vector of m-elements for the Time input, the output is an n-by-m matrix.

Data Types: single | double

Time of arrival at each waypoint, returned as a p-element vector. p is the number of waypoints.

Data Types: single | double

Polynomial coefficients, returned as an n(p1)-by-10 matrix. n is the dimension of the trajectory and p is the number of waypoints. Each set of n rows defines the coefficients for the polynomial that described each variable trajectory.

Dependencies

To enable this output port, select Show polynomial coefficients output port.

Data Types: single | double

Status of trajectory generation, returned as a three-element vector of the form [SingularityStatus MaxIterStatus MaxTimeStatus].

SingularityStatus returned as 0 or 1 indicates the occurrence of singularity. If singularity occurs reduce the Maximum segment time to Minimum segment time ratio.

MaxIterStatus returned as 0 or 1 indicates if the number of iterations for the solver has exceeded Maximum iterations.

MaxTimeStatus returned as 0 or 1 indicates if the time limit for the solver has exceeded Maximum time.

Dependencies

To enable this output port, select Show status output port.

Data Types: uint8

Parameters

expand all

Select this parameter to input the velocity, acceleration, jerk, and snap boundary conditions, at the VelBC, AccelBC, JerkBC, and SnapBC ports, respectively.

Tunable: No

Select this parameter to output polynomial coefficients at the PolynomialCoefs port.

Tunable: No

Select this parameter to output status at the Status port.

Tunable: No

Enable to specify time allocation for the trajectory using the Time weight, Minimum segment time, Maximum segment time, Maximum iterations, and Maximum time parameters.

Tunable: No

Weight for time allocation, specified as a positive scalar.

Tunable: No

Dependencies

To enable this parameter, select Time allocation.

Minimum time segment length, specified as a positive scalar or (p1)-element positive row vector. p is the number of waypoints.

Tunable: No

Dependencies

To enable this parameter, select Time allocation.

Maximum time segment length, specified as a positive scalar or (p1)-element positive row vector. p is the number of waypoints.

Tunable: No

Dependencies

To enable this parameter, select Time allocation.

Maximum iterations for solver, specified as a positive integer scalar.

Tunable: No

Dependencies

To enable this parameter, select Time allocation.

Maximum time for solver, specified as a positive scalar.

Tunable: No

Dependencies

To enable this parameter, select Time allocation.

Select the type of simulation to run from these options:

  • Interpreted execution — Simulate model using the MATLAB® interpreter. This option shortens startup time but has a slower simulation speed than Code generation. In this mode, you can debug the source code of the block.

  • Code generation — Simulate model using generated C code. The first time you run a simulation, Simulink® generates C code for the block. The C code is reused for subsequent simulations, as long as the model does not change. This option requires additional startup time but the speed of the subsequent simulations is comparable to Interpreted execution.

Tunable: No

Tips

For better performance, consider these options:

References

[1] Bry, Adam, Charles Richter, Abraham Bachrach, and Nicholas Roy. “Aggressive Flight of Fixed-Wing and Quadrotor Aircraft in Dense Indoor Environments.” The International Journal of Robotics Research, 34, no. 7 (June 2015): 969–1002.

[2] Richter, Charles, Adam Bry, and Nicholas Roy. “Polynomial Trajectory Planning for Aggressive Quadrotor Flight in Dense Indoor Environments." Paper presented at the International Symposium of Robotics Research (ISRR 2013), 2013.

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.

Version History

Introduced in R2022a