メインコンテンツ

Multiloop Control Design for VTOL UAV in Fixed Wing Configuration

This example shows how to tune the fixed wing controller of a tilt-rotor VTOL UAV

Getting Started

To open the example livescript and directory which contains the Simulink® project file, first run openExample('uav/TuneControlDesignForUAVInFixedWingFlightExample') in the command window.

You must open the VTOLRefApp.prj project file to access the Simulink model, supporting files, and project shortcuts that this example uses.

% Open the Simulink project
prj = openProject("VTOLApp/VTOLRefApp.prj");

Set up the VTOL UAV plant by clicking the Set up Plant button in the project shortcuts, or run the setupPlant helper function.

setupPlant;
Initialized VTOL model.
Enabled hover configuration.
Enabled hover guidance mission.

To configure the VTOL UAV to fixed wing configuration, click the Set Fixed Wing Configuration shortcut or run the setupFixedWingConfiguration helper function.

setupFixedWingConfiguration;
Enabled fixed-wing configuration.

Verify Baseline Fixed Wing Controller Gains with Guidance Mission

The VTOL UAV reference application allows you to use a fixed wing guidance mission to verify the fixed wing controller gains, which ensures that the VTOL UAV is able to follow a more aggressive setpoints during operations in urban environment. During the guidance mission, the Guidance Testbench subsystem calculates the fixed wing controller setpoints based on the mission and the current state of the UAV.

Set up a fixed wing guidance mission by clicking Guidance Mode under the Fixed Wing section of Project Shortcuts, or by running the setupFixedWingGuidanceMission helper function.

setupFixedWingGuidanceMission;
Enabled fixed-wing guidance mission.

Disable the visualization subsystem to speed up the simulation.

Visualization = 0;

Run the VTOLTiltrotor model and store the output in out.

open_system(mdl);
out = sim(mdl);

To plot the simulation output that you have stored in out, use the exampleHelperPlotFixedWingControlTrackingResults helper function.

Observe the commanded altitude and airspeed with the output altitude and airspeed for the entire duration of the mission. The plots show that there is a significant steady state error in both measurements, and the UAV takes a long time to reduce its altitude.

The third plot shows the navigation metrics of the UAV as it follows the commanded course. The plots are the aircraft path and the mission waypoints in the XY plane (left), and the comparisons of the pitch and roll angle output with the commanded values (right). The untuned controller is unable to track the reference angles, leading to the aircraft not able to efficiently navigate through the waypoints. The pitch controller performance also causes oscillatory behavior as shown in the altitude tracking plot.

exampleHelperPlotFixedWingControlTrackingResults(out,FixedWingMission)

Figure contains 2 axes objects. Axes object 1 with title Command vs Output, ylabel Airspeed contains 2 objects of type line. These objects represent Command, Output. Axes object 2 with xlabel Time (seconds), ylabel Altitude contains 2 objects of type line. These objects represent Command, Output.

Figure contains 3 axes objects. Axes object 1 with title Navigation, xlabel North (m), ylabel West (m) contains 2 objects of type line. These objects represent Waypoints, Aircraft Path. Axes object 2 with title Time Series Plot:Pitch Tracking, xlabel Time (seconds), ylabel Pitch Tracking contains 2 objects of type stair. These objects represent Command, Output. Axes object 3 with title Time Series Plot:Roll Tracking, xlabel Time (seconds), ylabel Roll Tracking contains 2 objects of type stair. These objects represent Command, Output.

Automatic Tuning of Attitude Controller Gains

In this step, you adjust the controller gains based on design goals specified for multiple feedback loops of the VTOLTiltrotor model by using systune (Simulink Control Design), a fixed-structure tuning method in Simulink Control Design™ software.

The Fixed Wing Controller subsystem in the model contains an inner loop Attitude Controller subsystem that tracks the roll and pitch angles. The outer loops of Airspeed-Altitude Controller and Lateral Guidance Logic subsystems compute the pitch and roll angular set points for the inner loop controller.

In this example, you use programmatic tuning for PID controllers in the attitude, altitude, and airspeed loops shown in the highlighted subsystems in the following diagram.

Simulink mode of Fixed Wing Controller subsystem with attitude, altitude, and airspeed loops subsystems highted.

The desired response for the different loops is based on analysis of the settling time for the airspeed, altitude and roll controllers in the Transition from Low- to High-Fidelity UAV Models in Three Stages example. To obtain a faster response for the inner loops, you tune the pitch and roll control loop to a higher bandwidth.

Create Interface for Control Tuning

To tune the aircraft controllers, you must specify the angle setpoints, measured outputs, and the loop gain locations for pitch and roll loops as the linear analysis points.

To specify the analysis points and blocks to tune for pitch and roll loops, run the exampleHelperSetupFixedWingControlTuning_Attitude script.

exampleHelperSetupFixedWingControlTuning_Attitude;

Create an slTuner (Simulink Control Design) object, the interface for tuning of Simulink models, using the controller blocks to tune and the analysis points as input. During tuning, the interface linearizes the model around an initial condition at which the aircraft is cruising in steady state with a fixed velocity.

options=slTunerOptions('AreParamsTunable',false);
attitudeTuner=slTuner(mdl,tunedBlocks,analysisPoints,options);
attitudeTuner.Ts=0.005;
attitudeTuner.OperatingPoints=5;

Create Tuning Goals for Pitch and Roll Controllers

Use loop-shaping design to create a desired open-loop response of an integrator. Set bandwidth to 20 rad/s for roll and 15 rad/s for pitch control loops. This helps track the reference inputs with zero steady state error, while attenuating inputs with frequencies that exceed the bandwidth.

wcRoll = 20;
wcPitch = 15;

Create the loop-shaping goals for the roll and pitch loops using TuningGoal.LoopShape (Control System Toolbox).

rollLoopShape = TuningGoal.LoopShape({rollOpenLoopLocation}, wcRoll);
rollLoopShape.Name = 'Roll Loop Shape';
pitchLoopShape = TuningGoal.LoopShape({pitchOpenLoopLocation}, wcPitch);
pitchLoopShape.Name = 'Pitch Loop Shape';

Visualize the loop shaping goal. The plot shows the singular values of the desired target loop shape. The green region shows the constraints on the inverse sensitivity function as minimum low-frequency loop gain, and the red region marks the complementary sensitivity as maximum high-frequency loop gain.

viewGoal(rollLoopShape);

MATLAB figure

Create the tuning goals to match the step response to a desired first order response with a time constant of 0.1 seconds for pitch and 0.2 seconds for roll (see TuningGoal.StepTracking (Control System Toolbox)). These time constants map to the settling times mentioned in the Transition from Low- to High-Fidelity UAV Models in Three Stages example.

% Define time constant
tauRoll = 0.2;
tauPitch = 0.1;

To compute the linearized closed-loop response, compute the open loop response of the outer loops that compute the set points for pitch and roll.

% Roll Loop
rollStepTracking = TuningGoal.StepTracking({rollAngleInput},{rollAngleOutput}, tauRoll, 10);
rollStepTracking.Openings = [{rollAngleInput}; {pitchAngleInput}];
rollStepTracking.Name = 'Roll Step Tracking';

% Pitch Loop
pitchStepTracking = TuningGoal.StepTracking({pitchAngleInput},{pitchAngleOutput}, tauPitch, 10);
pitchStepTracking.Openings = [{rollAngleInput}; {pitchAngleInput}];
pitchStepTracking.Name = 'Pitch Step Tracking';

Visualize desired step response of the closed-loop system.

viewGoal(rollStepTracking);

MATLAB figure

Tune Controller Gains and Analyze Results

Use systune to tune the gains based on the defined soft goals.The systune function performs a multi-objective optimization to meet step tracking and frequency response requirements. Tuning for step tracking and loop shape tuning goals enables the controller to achieve a good tracking performance with a desired bandwidth that rejects of high frequency disturbance and noise.

% Options
options = systuneOptions();
options.Display = 'final';

% Tune
attitudeTuner_Tuned= systune(attitudeTuner,[rollLoopShape; rollStepTracking; pitchLoopShape; pitchStepTracking],options);
Final: Soft = 4.26, Hard = -Inf, Iterations = 29

The best achieved soft constraint value of slightly greater than 1 indicates that the solution nearly satisfies all requirements. A closer inspection of the tuning goal plots shows that the multi-objective optimization returns a solution that matches the open loop shape and is slightly higher than desired bandwidth, as well as the closed-loop step response. This is considered acceptable for the inner loop performance as it nearly meets all the requirements of minimum and maximum loop gains and the overall objective is close to 1.

Visualize the loop shape and step response after the controller is tuned.

exampleHelperViewTuningGoal([rollLoopShape,rollStepTracking,pitchLoopShape,pitchStepTracking],attitudeTuner_Tuned);

MATLAB figure

MATLAB figure

MATLAB figure

MATLAB figure

Update Parameters

Update the VTOL UAV parameters with the tuned values. In this example, the exampleHelperWriteBlockValue_Attitude function updates the variable values in the MATLAB® workspace that the controller blocks uses. This function updates the FWControlParams struct in the workspace with the new control gains.

FWControlParams=exampleHelperWriteBlockValue_Attitude(attitudeTuner_Tuned,FWControlParams);

Automatic Tuning of Airspeed-Altitude Controller Gains

In this section, you tune the airspeed and altitude controllers using systune and slTuner, similar to tuning the attitude loops in the preceding section.

Define Interface for Tuning

Specify analysis points and blocks to tune for altitude and airspeed loops.

exampleHelperSetupFixedWingControlTuning_AltitudeAirspeed;

Create the slTuner object.

options = slTunerOptions('AreParamsTunable',false);
altitudeAirspeedTuner = slTuner(mdl,tunedBlocks,analysisPoints,options);
altitudeAirspeedTuner.Ts = 0.005;
altitudeAirspeedTuner.OperatingPoints = 5;

Create Tuning Goals for Altitude and Airspeed Controllers

Create the desired loop shapes of an integrator with bandwidth of 1 rad/s for altitude control loop and 10 rad/s for airspeed control.

% Altitude Loop
Wc = 1;
altitudeLoopShape = TuningGoal.LoopShape({altitudeOpenLoopLocation},Wc);
altitudeLoopShape.Name = 'Altitude Loop Shape';
% Airspeed Loop
Wc = 10;
airspeedLoopShape = TuningGoal.LoopShape({airspeedOpenLoopLocation},Wc);
airspeedLoopShape.Name = 'Airspeed Loop Shape';

Create step tracking goals using first order response with time constants of 1 seconds for altitude and 0.1 seconds for airspeed.

% Altitude Loop
Tau = 1;
altitudeStepTracking = TuningGoal.StepTracking({altitudeInput},{altitudeOutput},Tau);
altitudeStepTracking.Name = 'Altitude Step Tracking';
% Airspeed Loop
Tau=0.1;
airspeedStepTracking = TuningGoal.StepTracking({airspeedInput},{airspeedOutput},Tau);
airspeedStepTracking.Name = 'Airspeed Step Tracking';

Tune Controller Gains and Analyze Results

Use systune to tune the gains based on the defined soft goals.

% Options
options = systuneOptions();
options.Display = 'final';

% Tune
[altitudeAirspeedTuner_Tuned] = systune(altitudeAirspeedTuner,[altitudeLoopShape; altitudeStepTracking; airspeedLoopShape; airspeedStepTracking],options);
Final: Soft = 1.74, Hard = -Inf, Iterations = 41

Compare the controller loop shape and step response after tuning to the tuning goals. The plots show that the tuned controllers are able to provide the required bandwidth and step tracking time response.

exampleHelperViewTuningGoal([altitudeLoopShape; altitudeStepTracking; airspeedLoopShape; airspeedStepTracking],altitudeAirspeedTuner_Tuned);

MATLAB figure

MATLAB figure

MATLAB figure

MATLAB figure

Update Parameters

Update the parameters with the tuned value by using the exampleHelperWriteBlockValue_AltitudeAirspeed. This function updates the variable values in the MATLAB workspace used by the controller blocks in the model.

FWControlParams=exampleHelperWriteBlockValue_AltitudeAirspeed(altitudeAirspeedTuner_Tuned,FWControlParams);

Verify Tuned Fixed Wing Controller Gains with Guidance Mission

Disable the tuning mode and enable the test mode to set up the fixed wing guidance mission.

TestMode = 1;
TuningMode = 0;
setupFixedWingGuidanceMission;
Enabled fixed-wing guidance mission.

Disable the visualization subsystem to speed up the simulation.

Visualization = 0;

Run the Simulink model and store the output in out by running the sim function.

out = sim(mdl);

Use the exampleHelperPlotFixedWingControlTrackingResults function to plot the simulation results. The altitude and airspeed plots show that the outputs converge in a shorter time without any steady state error and oscillations. The comparison of pitch and roll angles shows an improved tracking with a faster response. This shows that the UAV navigates the waypoints more efficiently.

exampleHelperPlotFixedWingControlTrackingResults(out,FixedWingMission);

Figure contains 2 axes objects. Axes object 1 with title Command vs Output, ylabel Airspeed contains 2 objects of type line. These objects represent Command, Output. Axes object 2 with xlabel Time (seconds), ylabel Altitude contains 2 objects of type line. These objects represent Command, Output.

Figure contains 3 axes objects. Axes object 1 with title Navigation, xlabel North (m), ylabel West (m) contains 2 objects of type line. These objects represent Waypoints, Aircraft Path. Axes object 2 with title Time Series Plot:Pitch Tracking, xlabel Time (seconds), ylabel Pitch Tracking contains 2 objects of type stair. These objects represent Command, Output. Axes object 3 with title Time Series Plot:Roll Tracking, xlabel Time (seconds), ylabel Roll Tracking contains 2 objects of type stair. These objects represent Command, Output.

Similar to the Tune Hover Control Design for VTOL UAV in Steady Wind Condition example, you can refine the gains that you have obtained for fixed-wing flight in steady wind condition by completing the following steps:

  1. Enable the steady wind in the simulation by setting Wind = 1.

  2. Obtain a steady-state operating point by setting the OperatingPoints parameter of slTuner to 10.

  3. Linearize the system under wind disturbance.

Before resuming to other examples in this example series, you must close the VTOLRefApp.prj Simulink project by running this command in the Command Window:

close(prj)

References

[1] N., Pavan. "Design of Tiltrotor VTOL and Development of Simulink Environment for Flight Simulations." Master's thesis, Indian Institute of Technology Madras, 2020.

[2] Mathur, Akshay, and Ella M. Atkins. "Design, Modeling and Hybrid Control of a QuadPlane." In AIAA Scitech 2021 Forum. VIRTUAL EVENT: American Institute of Aeronautics and Astronautics, 2021. https://doi.org/10.2514/6.2021-0374.

[3] Ducard, Guillaume, and Minh-Duc Hua. "Modeling of an Unmanned Hybrid Aerial Vehicle." In 2014 IEEE Conference on Control Applications (CCA), 1011–16. Juan Les Antibes, France: IEEE, 2014. https://doi.org/10.1109/CCA.2014.6981467.

See Also

Topics