Guidance Model
Reduced-order model for UAV
Libraries:
UAV Toolbox /
Algorithms
Description
Examples
Open the reducedOrderUAVModel.slx Simulink® model. The model uses the Guidance Model block to simulate a UAV with a reduced order fixed-wing kinematic models, and a UAV Animation block to visualize the result.
open_system("reducedOrderUAVModel")
Initial Condition of UAV
This model simulates the flight of a UAV with an initial height of 80 meters. The initial condition is specified in the Initial State parameter of the Guidance Model block.

Configuration of UAV
The UAV is configured with a proportional gain of the height controller of 1, and a proportional gain of the flight path angle controller of 1. This configuration is specified in the Configuration parameter of the Guidance Model block.

Control Input
This model uses the Bus Creator block to create the control input bus. The bus name is specified in accordance with the Control Bus Name parameter of the Guidance Model block.

The bus contains these elements:
Height— Sets the UAV to have a height of 90 meters.AirSpeed— Sets the UAV to have an air speed of 10 m/s.RollAngle— Sets the UAV to have a roll angle of -0.3 radians.

Environment Input
This model uses the Bus Creator block to create the environment input bus. The bus name is specified in accordance with the Environment Bus Name parameter of the Guidance Model block.

The bus contains the following elements:
WindNorth— Sets the UAV to have north wind velocity of 0 m/s.WindEast— Sets the UAV to have east wind velocity of 0 m/s.WindDown— Sets the UAV to have down wind velocity of 0 m/s.Gravity— Sets the UAV to have a gravitational acceleration of 9.8 m/s2.

Visualizing State Output
Before visualizing the state output, the model performs these operations on the elements of the bus output by the Guidance Model block.
Multiplies the
<Height>signal by a gain of –1 to match the z-axis direction of the UAV Animation block. The model then combine the height signal with<North>and<East>signals into a matrix. The model connects the matrix to the Translation port of the UAV Animation block.Combines the
<HeadingAngle>,<FlightPathAngle>, and<RollAngle>signals into a matrix. The model connects the matrix to the Rotation port of the UAV Animation block.

Run the Simulink model, and observe the simulation result from the UAV Animation window.

Ports
Input
Control input for UAV, specified as a bus. Specify each element of the bus as a scalar
If you set the Model Type property to
MultirotorGuidance, you must specify a bus with these elements:
Roll— Roll angle of the UAV in radians.Pitch— Pitch angle of the UAV in radians.YawRate— Yaw rate of the UAV in radians per second.Thrust— Vertical thrust of the UAV in Newtons.
If you set the Model Type property to
FixedWingGuidance, you must specify a bus with these elements:
Height— Height of the UAV above the ground in meters.AirSpeed— Airspeed of the UAV in meters per second.RollAngle— Roll angle of the UAV in radians.
Specify the name of the control input bus by using the Control Bus Name property.
Environment inputs, specified as a bus. Specify each element of the bus as a scalar
If you set the Model Type property to
MultirotorGuidance, you must specify a bus with
Gravity element which contains the gravitational acceleration for
the UAV in the z-axis direction of the inertial frame in meters per
second squared.
If you set the Model Type property to
FixedWingGuidance, you must specify a bus with these elements:
WindNorth— Wind velocity in the north direction of the UAV in meters per second.WindEast— Wind velocity in the east direction of the UAV in meters per second.WindDown— Wind velocity in the downward direction of the UAV in meters per second.Gravity— Gravitational acceleration of the UAV in the z-axis direction of the inertial frame in meters per second squared.
Specify the name of the environment input bus by using the Environment Bus Name property.
Data Types: bus
Output
Simulated UAV state, returned as a bus.
If you set the Model Type property to
MultirotorGuidance, the block returns the state output as an
eight-element bus with these elements:
<WorldPosition>— 3-by-1 vector that contains the xyz-position of the UAV in meters. For more details on the coordinate system, see UAV Coordinate Systems.<WorldVelocity>— 3-by-1 vector of that contains the xyz-velocity of the UAV in meters per second.<EulerZYX>— 3-by-1 vector that contains the Euler angles of the UAV in z-,y-,x-axis (yaw-pitch-roll) rotation sequence.<BodyAngularRateRPY>— 3-by-1 vector that contains the angular rates of the UAV with respect to the x-,y-, and z- axes (roll rate, pitch rate, and yaw rate, respectively) in radians per second.<Thrust>— Scalar that contains the thrust of the UAV in newtons.
For more details on the multirotor guidance model equations that results in the multirotor states, see UAV Multirotor Guidance Model Equations.
If you set the Model Type property to
FixedWingGuidance, the block returns the state output as a bus
with eight elements, where each element is a scalar. The bus contains these
elements:
<North>— Position in the north direction of the UAV in meters.<East>— Position in the east direction of the each UAV in meters.<Height>— Height above the ground of the each UAV in meters.<AirSpeed>— Speed relative to the wind of the UAV in meters per second.<HeadingAngle>— Angle between the ground velocity and north direction of the in radians.<FlightPathAngle>— Angle between the ground velocity and north-east plane of the UAV in radians.<RollAngle>— Angle of rotation along the body x-axis of the UAV in radians per second.<RollAngleRate>— Angular velocity of rotation along the body x-axis of the UAV in radians per second.
For more details on the fixed-wing guidance model equations that results in the fixed-wing states, see UAV Fixed-Wing Guidance Model Equations.
Specify the name of the state output bus by using the State Bus Name property.
Data Types: bus
Parameters
UAV guidance model type. Select MultirotorGuidance to simulate a
multirotor UAV or FixedWingGuidance to simulate a fixed wing
UAV.
Specify the input and output numeric data types as double or
single.
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 toInterpreted execution.Interpreted execution— Simulate model using the MATLAB® interpreter. This option shortens startup time but has a slower simulation speed thanCode generation. In this mode, you can debug the source code of the block.
Initial UAV state tab, specified as multiple table entries.
For a multirotor UAV, you must specify these initial states:
World Position — 3-by-1 vector that contains the initial xyz-position of the UAV in meters. The default value is
[0;0;0].World Velocity — 3-by-1 vector that contains the initial xyz-velocity of the UAV in meters per second. The default is
[0;0;0].Euler Angles (ZYX) — 3-by-1 vector that contains the initial Euler angles of the UAV in z-,y-,x-axis (yaw-pitch-roll) rotation sequence. The default value is
[0;0;0].Body Angular Rates — 3-by-1 vector that contains the initial angular rate of the UAV with respect to the x-,y-, and z-axes (roll rate, pitch rate, and yaw rate, respectively) in radians per second. The default value is
[0;0;0].Thrust — scalar that contains the initial thrust of a UAV in newtons. The default value for each UAV is
0.
For a fixed-wing UAV, you must specify these initial states as a scalar:
North Position — Initial position in the north direction of the UAV in meters. The default is
0.East Position — Initial position in the east direction of the UAV in meters. The default value is
0.Height — Initial height above the ground each of the UAV in meters. The default value is
0.Air Speed — Initial speed relative to the wind of the UAV in meters per second. The default value is
0.Heading Angle — Initial angle between the ground velocity and north direction of the UAV in radians. The default value is
0.Flight Path Angle — Initial angle between the ground velocity and north-east plane of the UAV in radians. The default value is
0.Roll Angle — Initial angle of rotation along the body x-axis of the UAV in radians. The default value is
0.Roll Angle Rate — Initial angular velocity of rotation along the body x-axis of the UAV in radians per second. The default value is
0.
Tunable: No
UAV controller configuration tab, specified as multiple table entries.
For multirotor UAV, specify these parameters:
PD Roll — 1-by-2 vector that contains the proportional and derivative gains of the roll angle controller of the UAV. The default value is
[3402.97 116.67].PD Pitch — 1-by-2 vector that contains the proportional and derivative gains of the pitch angle controller of the UAV. The default value is
[3402.97 116.67].P YawRate — Scalar that contains the proportional gain of the yaw rate controller of the UAV. The default value is
1950.P Thrust — Scalar that contains the proportional gain of the thrust controller of the UAV. The default value is
3900.Mass — Scalar that contains the mass of the UAV in Kg. The default is
0.1.
For fixed-wing UAV, specify these parameters:
P Height — Scalar that contains the proportional gain of the height controller of the UAV. The default value is
3.9.P Flight Path Angle — Scalar that contains the proportional gain of the flight path angle controller of the UAV. The default value is
39.PD Roll — 1-by-2 vector that contains the proportional and derivative gains of the pitch angle controller of the UAV. The default value is
[3402.97 116.67].P Air Speed — Scalar that contains the proportional gain of the air speed controller of the UAV. The default value is
1.Min/Max Flight Path Angle — 1-by-2 vector that contains the minimum and maximum flight path angle of the UAV in radians. The default value is
[-pi/2 pi/2]
This tab contains the State Bus Name, Control Bus Name, and Environment Bus Name parameters, which specify the name of the output state bus, the input control bus, and the input environment bus, respectively. Each bus has a default name based on the UAV model and input type.
| Model Type Parameter | Default State Bus Name | Default Control Bus Name | Default Environment Bus Name |
|---|---|---|---|
FixedWingGuidance | FixedWingGuidanceStateBus | FixedWingGuidanceControlBus | FixedWingGuidanceEnvironmentBus |
MultirotorGuidance | MultirotorGuidanceStateBus | MultirotorGuidanceControlBus | MultirotorGuidanceEnvironmentBus |
To use multiple guidance models in the same Simulink model, specify bus names for each Guidance Model block that do not intersect with one another.
More About
The guidance model uses the North-East-Down (NED) coordinate system convention.
The earth frame is assumed to be an inertial frame with an origin that is fixed relative to the earth surface. The frame coordinates are xe (positive in the direction of north), ye (positive in the direction of east), and ze (positive towards the center of the earth). The xeye plane is assumed to be flat.
The UAV body frame is centered on the UAV center of mass. The frame coordinates are xb (positive towards node of UAV) , yb (perpendicular to xb, positive towards right of UAV), and zb (perpendicular to xbyb plane, positive downward).
The orientation of the UAV body frame with respect to the earth frame is specified in ZYX Euler angles. First rotate about the ze-axis by the yaw angle, ψ. Then, rotate about the intermediate y-axis by the pitch angle, ϴ. Then, rotate about the intermediate x-axis by the roll angle, ϕ.
The angular velocity of the UAV is represented by [p,q,r] with respect to the body axes, [xb,yb,zb].
For fixed-wing UAVs, these equations define the guidance model of the UAV:
These equations result in these state variables:
where:
xe, ye, and h are the north position, east position, and height of the UAV in the inertial frame, respectively
χ, γ, and ϕ are the course angle, flight path angle, and roll angle of the UAV, respectively.
Va and Vg are the air and ground speeds of the UAV.
Vwn, Vwe, and Vwd are the wind speeds of the UAV in the north, east, and down directions, respectively.
kP* and kD*are controller proportional and derivative gains of the UAV, respectively.
C is the control input.
The model assumes that the UAV is flying under a coordinated-turn condition, with zero side-slip. The autopilot controls airspeed, altitude, and roll angle.
These equations define the guidance model for multirotor UAVs.
The model governs the acceleration of the UAV center of mass in inertial coordinates as:
where:
xe, ye, and Ze are the north , east, and down positions of the UAV in the inertial frame, respectively.
m and g are the mass and gravitational acceleration of the UAV, respectively
Fthrust is the total force created by the propellers applied to the multirotor along the –zb axis.
Reb is the rotation matrix that rotates the inertial frame to the body frame:
where ψ, ϴ, and ϕare the yaw, pitch, and roll angles, respectively. c and s are abbreviations for cos and sin, respectively.
The model uses two independent proportional-derivative (PD) controllers to control the roll and pitch angles, and two independent proportional (P) controllers to control the yaw rate and thrust.
These equations determine the angular velocity, angular acceleration, and thrust:
where:
ψ, ϴ, and ϕ are the yaw, pitch, and roll angles, respectively
p,q, and r are the angular rotation with respect to xb,yb, and zb, respectively.
kP* and kD*are the proportional and derivative gains of the controller, respectively.
c is the control input
Fthrust is the thrust of the UAV
These equations result in these state variables:
References
[1] Randal W. Beard and Timothy W. McLain. "Chapter 9." Small Unmanned Aircraft Theory and Practice, NJ: Princeton University Press, 2012.
[2] Mellinger, Daniel, and Nathan Michael. "Trajectory Generation and Control for Precise Aggressive Maneuvers with Quadrotors." The International Journal of Robotics Research. 2012, pp. 664-74.
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.
Version History
Introduced in R2018b
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
