Fixed-Wing Plant and Controller Architecture
This page helps you to understand the high level architecture of reference plant and controller models of fixed-wing UAV simulated in HITL. To get started with the example, see PX4 Hardware-in-the-Loop (HITL) Simulation with Fixed-Wing Plant in Simulink.
The diagram below illustrates the workflow of HITL with fixed-wing plant in Simulink®.
Guidance Navigation and Controller Model
State estimates are obtained through uORB topics. States are populated into a non-virtual Simulink Bus and sent to the Path Manager.
Path manager takes the hardcoded waypoints from a workspace variable and computes the high-level commands to the controller. Depending on the flight mode (take-off, loiter, approach, land, waypoint following), certain control loops are enabled or disabled by the Path Manager. The control modes and high-level set-points are sent via non-virtual bus to Fixed Wing Controller subsystem.
Fixed-Wing controller computes these actuator commands - Throttle, Aileron, Elevator, Rudder.
The Send to Actuator scales actuator commands into pulse widths and sends it to specified channels.
Path Manager
Mission
Mission is a MATLAB Struct array that captures flight mode, position, and parameters
such as runway orientation, turning radius, flight speed. This is set in
InitWaypoints.m
file. For more information, see UAV Path
Manager.
Guidance Logic
Mission is fed to the UAV Path Manager block which outputs the active waypoint and previous waypoint. When a waypoint mission item is completed, the block switches to the next waypoint. Mission items have particular characteristics and they all cannot be handled in the same way. For example, during take-off you must not try to maneuver towards waypoints as the plane is low on airspeed and altitude. Guidance logic for each mission item is modelled with a state machine. Guidance Logic chart takes in the mode and waypoint information from UAV Path Manager and outputs high level commands to controller.
Fixed-Wing Controller
A cascaded control structure is formulated for controlling the following:
Airspeed
Altitude & climb rate
Course
Attitude & angular rate
Control loops are modelled as Enabled Subsystems and are enabled or disabled depending on flight phase.
Plant Model
The plant model performs the following functions.
Communication via MAVLink Bridge block
Reading MAVLink packets from Pixhawk® board via serial port.
Relaying MAVLink packets to QGC from Simulink.
Encoding and decoding.
HIL actuator commands are decoded using MAVLink Deserializer block
HIL sensors and heartbeat data is encoded using MAVLink Serializer block.
Plant simulation
Models forces and moments from aerodynamics, propulsion, ground contact, gravity.
Models IMU, GPS, barometer, and airspeed sensors.
References
Px4 Fixed-Wing Landing. Retrieved June 20, 2022, Landing Algorithm.
PX4 Controller Diagrams. Retrieved June 20, 2022, Controller Diagram.
S. Park, J. Deyst, and J. P. How, "A New Nonlinear Guidance Logic for Trajectory Tracking," Proceedings of the AIAA Guidance, Navigation and Control Conference, Aug 2004. AIAA-2004-4900.
M. Lizarraga. Design, Implementation and Flight Verification of a Versatile and Rapidly Reconfigurable UAV GNC Research Platform. PhD Dissertation, UC, Santa Cruz, Santa Cruz, CA, USA, 2009.