Main Content

waypointTrajectory

Waypoint trajectory generator

Description

The waypointTrajectory System object™ generates trajectories using specified waypoints. When you create the System object, you can optionally specify the time of arrival, velocity, and orientation at each waypoint.

To generate a trajectory from waypoints:

  1. Create the waypointTrajectory object and set its properties.

  2. Call the object as if it were a function.

To learn more about how System objects work, see What Are System Objects?.

Creation

Description

trajectory = waypointTrajectory returns a System object, trajectory, that generates a trajectory based on default stationary waypoints.

trajectory = waypointTrajectory(Waypoints,TimeOfArrival) specifies the Waypoints that the generated trajectory passes through and the TimeOfArrival at each waypoint.

trajectory = waypointTrajectory(Waypoints,TimeOfArrival,Name,Value) sets each creation argument or property Name to the specified Value. Unspecified properties and creation arguments have default or inferred values.

Example: trajectory = waypointTrajectory([10,10,0;20,20,0;20,20,10],[0,0.5,10]) creates a waypoint trajectory System object, trajectory, that starts at waypoint [10,10,0], and then passes through [20,20,0] after 0.5 seconds and [20,20,10] after 10 seconds.

Creation Arguments

Creation arguments are properties which are set during creation of the System object and cannot be modified later. If you do not explicitly set a creation argument value, the property value is inferred.

If you specify any creation argument, then you must specify both the Waypoints and TimeOfArrival creation arguments. You can specify Waypoints and TimeOfArrival as value-only arguments or name-value pairs.

Properties

expand all

Unless otherwise indicated, properties are nontunable, which means you cannot change their values after calling the object. Objects lock when you call them, and the release function unlocks them.

If a property is tunable, you can change its value at any time.

For more information on changing property values, see System Design in MATLAB Using System Objects.

Sample rate of trajectory in Hz, specified as a positive scalar.

Tunable: Yes

Data Types: double

Number of samples per output frame, specified as a positive scalar integer.

Tunable: Yes

Data Types: double

Positions in the navigation coordinate system in meters, specified as an N-by-3 matrix. The columns of the matrix correspond to the first, second, and third axes, respectively. The rows of the matrix, N, correspond to individual waypoints.

Dependencies

To set this property, you must also set valid values for the TimeOfArrival property.

Data Types: double

Time corresponding to arrival at each waypoint in seconds, specified as an N-element column vector. The first element of TimeOfArrival must be 0. The number of samples, N, must be the same as the number of samples (rows) defined by Waypoints.

Dependencies

To set this property, you must also set valid values for the Waypoints property.

Data Types: double

Velocity in the navigation coordinate system at each way point in meters per second, specified as an N-by-3 matrix. The columns of the matrix correspond to the first, second, and third axes, respectively. The number of samples, N, must be the same as the number of samples (rows) defined by Waypoints.

If the velocity is specified as a non-zero value, the object automatically calculates the course of the trajectory. If the velocity is specified as zero, the object infers the course of the trajectory from adjacent waypoints.

Dependencies

To set this property, you must also set valid values for the Waypoints and TimeOfArrival properties.

Data Types: double

Horizontal direction of travel, specified as an N-element real vector in degrees. The number of samples, N, must be the same as the number of samples (rows) defined by Waypoints. If neither Velocities nor Course is specified, course is inferred from the waypoints.

Dependencies

To set this property, the Velocities property must not be specified in object creation.

Data Types: double

Groundspeed at each waypoint, specified as an N-element real vector in m/s. If the property is not specified, it is inferred from the waypoints. The number of samples, N, must be the same as the number of samples (rows) defined by Waypoints.

Dependencies

To set this property, the Velocities property must not be specified at object creation.

Data Types: double

Climbrate at each waypoint, specified as an N-element real vector in degrees. The number of samples, N, must be the same as the number of samples (rows) defined by Waypoints. If neither Velocities nor Course is specified, climbrate is inferred from the waypoints.

Dependencies

To set this property, the Velocities property must not be specified at object creation.

Data Types: double

Orientation at each waypoint, specified as an N-element quaternion column vector or 3-by-3-by-N array of real numbers. The number of quaternions or rotation matrices, N, must be the same as the number of samples (rows) defined by Waypoints.

If Orientation is specified by quaternions, the underlying class must be double.

Dependencies

To set this property, you must also set valid values for the Waypoints and TimeOfArrival properties.

Data Types: quaternion | double

Align pitch angle with the direction of motion, specified as true or false. When specified as true, the pitch angle automatically aligns with the direction of motion. If specified as false, the pitch angle is set to zero (level orientation).

Dependencies

To set this property, the Orientation property must not be specified at object creation.

Align roll angle to counteract the centripetal force, specified as true or false. When specified as true, the roll angle automatically counteract the centripetal force. If specified as false, the roll angle is set to zero (flat orientation).

Dependencies

To set this property, the Orientation property must not be specified at object creation.

Reference frame of the trajectory, specified as 'NED' (North-East-Down) or 'ENU' (East-North-Up).

Usage

Description

[position,orientation,velocity,acceleration,angularVelocity] = trajectory() outputs a frame of trajectory data based on specified creation arguments and properties.

Output Arguments

expand all

Position in the local navigation coordinate system in meters, returned as an M-by-3 matrix.

M is specified by the SamplesPerFrame property.

Data Types: double

Orientation in the local navigation coordinate system, returned as an M-by-1 quaternion column vector or a 3-by-3-by-M real array.

Each quaternion or 3-by-3 rotation matrix is a frame rotation from the local navigation coordinate system to the current body coordinate system.

M is specified by the SamplesPerFrame property.

Data Types: double

Velocity in the local navigation coordinate system in meters per second, returned as an M-by-3 matrix.

M is specified by the SamplesPerFrame property.

Data Types: double

Acceleration in the local navigation coordinate system in meters per second squared, returned as an M-by-3 matrix.

M is specified by the SamplesPerFrame property.

Data Types: double

Angular velocity in the local navigation coordinate system in radians per second, returned as an M-by-3 matrix.

M is specified by the SamplesPerFrame property.

Data Types: double

Object Functions

To use an object function, specify the System object as the first input argument. For example, to release system resources of a System object named obj, use this syntax:

release(obj)

expand all

cloneCreate duplicate System object
stepRun System object algorithm
releaseRelease resources and allow changes to System object property values and input characteristics
resetReset internal states of System object
isDoneEnd-of-data status

Extended Capabilities

Introduced in R2018b