Main Content

UAV Animation

Animate UAV flight path using translations and rotations

  • UAV Animation block

Libraries:
UAV Toolbox / Utilities

Description

The UAV Animation block animates one or multiple unmanned aerial vehicle (UAV) flight paths based on an input array of translations and rotations. The output figure displays a visual mesh for either a fixed-wing or multirotor UAV at the given position and orientation. To bring up the figure after simulation, click Show animation in the block mask.

Examples

Ports

Input

expand all

xyz-positions of the UAVs, specified as an m-by-3 matrix, where m is the total number of UAVs that you want to animate. Each row of the matrix specifies the xyz-position of a UAV in the coordinate frame that you specify in the Inertial frame z-axis direction property.

Example: [1 1 1]

Rotations of UAV body frames relative to the inertial frame, specified as an m-by-3 or m-by-4 matrix.

  • If you specify the Rotation format parameter as Euler ZYX, specify this input as an m-by-3 matrix, where m is the total number of UAVs that you want to animate. Each row of the matrix represents the rotation angles about the z-, y-, and x-axes of the inertial frame for a UAV, in radians.

  • If you specify this Rotation format parameter as Quaternion, specify the input as an m-by-4 matrix, where m is the total number of UAVs that you want to animate. Each row of the matrix represents the quaternion vector of a UAV.

UAV mesh type, specified as an m-element vector of integers, where m is the total number of UAVs that you want to animate. Each element specifies the mesh type of a UAV, where 1 is a quadcopter mesh and 2 is a fixed-wing mesh.

Dependencies

To enable this port, select the Enable dynamic UAV mesh configuration parameter.

UAV mesh configuration, specified as an m-element column vector or an m-by-4 or m-by-5 matrix. m is the total number of UAVs that you want to animate, and each row corresponds to the mesh configuration of a UAV. The size of this input depends on the parameters that you want to configure for the UAVs:

  • m-element column vector — Each element specifies the mesh size of a UAV, and must be a positive value. Each UAV has the default color of [1 0 0] and alpha of 1.

  • m-by-4 matrix — Each row specifies the mesh size and color of a UAV, where the first element is the size and the other three specify the color as an RGB triplet.

  • m-by-5 matrix — Each row specifies the mesh size, color, and transparency of a UAV, where the first element is the size, the next three specify the color, and the last element specifies the alpha value of the UAV mesh as a value in the range [0, 1]. A value of 0 is completely transparent, and a value of 1 is completely opaque.

Example: [10 1 0 0 0.5; 20 0 1 0 0.5] sets the first UAV mesh size to 10 and color to red, and the second UAV mesh size to 20 and color to green. Both UAV meshes have a transparency of 0.5.

Dependencies

To enable this port, select the Enable dynamic UAV mesh configuration parameter.

Marker configuration, specified as a n-row matrix. n is the total number of markers that you want to draw, and each row corresponds to the configuration of a marker. The size of the input depends on the parameters that you want to configure for the markers:

  • n-by-3 matrix — Each row specifies the xyz-position of a marker. Each row has the default size, color, type, and filled status.

  • n-by-4 matrix— Each row specifies the xyz- position and size of a marker, where the first 3 elements specify the position, and the last element specifies the size.

  • n-by-7 matrix — The first three elements specifies the xyz- position, next element specifies the size, and the other three specifies the color of a marker as a RGB triplet.

  • n-by-8 matrix — The first three elements specifies the xyz- position, next element specifies the size, the next three element specifies the color, and the last element specifies the type of a marker as follows:

    • 1 — Round marker

    • 2 — Square marker

    • 3 — Triangle marker

  • n-by-9 matrix — The first three elements specifies the xyz- position, next element specifies the size, the next three element specifies the color, the next element specifies the marker type, and the last element specifies the filled status for a marker as a positive integer, with 1 being filled, and 0 being not filled.

Dependencies

To enable this port, select the Draw marker parameter.

Parameters

expand all

The number of UAV to display, specified as a positive integer.

Select this parameter to enable the UAV Type and UAV Mesh Configuration input ports, which enable you to configure different meshes for each UAV in your simulation.

Specify the mesh to display for the simulated UAVs as either FixedWing or Multirotor. Use this parameter to set a uniform mesh type for all UAV.

Dependencies

To enable this parameter, clear the Enable dynamic UAV mesh configuration parameter.

Use this parameter to set a uniform mesh size for all simulated UAVs. Specify the value as a positive numeric scalar.

Dependencies

To enable this parameter, clear the Enable dynamic UAV mesh configuration parameter.

Specify the color for the UAV meshes as an RGB triplet. Use this parameter to set a uniform mesh color for all the UAVs in your simulation.

Dependencies

To enable this parameter, clear the Enable dynamic UAV mesh configuration parameter.

Use this parameter to set a uniform a transparency for the meshes and trajectories of all the UAVs in your simulation.

Dependencies

To enable this parameter, clear the Enable dynamic UAV mesh configuration parameter.

Specify the positive direction of the z-axis of the inertial frame as either Up or Down. In the plot, the positive z-axis always points up. The parameter defines the rotation between the inertial frame and plot frame. Set this parameter to Down if the inertial frame follows the north-east-down (NED) configuration.

Specify the rotation input format as one of these options:

  • Euler ZYX — The rotation input must be an m-by-3 matrix of Euler zyx-angles in radians, where m is the total number of UAV that you want to animate.

  • Quaternion— The rotation input must be an m-by-4 matrix of quaternion vectors, in which each row is a quaternion. m is the total number of UAVs that you want to animate.

Select this parameter to enable the Marker input port, which enables you to draw markers in your simulation.

Specify the interval between outputs as a scalar, in seconds. In the simulation, the sample time follows simulation time and not actual wall-clock time.

The default value indicates that the block sample time is inherited.

For more information about the inherited sample time type, see Specify Sample Time (Simulink).

Tips

  • Increase the sample time to improve simulation performance. Higher sample times increase simulation speed because the block updates less frequently.

Extended Capabilities

Version History

Introduced in R2018b

expand all