Main Content

Tune Control Design for VTOL UAV in Hover Configuration

This example shows how to tune your control system design for a VTOL aircraft in hover configuration.

VTOL aircraft must be tuned for each of the four configurations that it flies in, starting by the hover configuration. In the hover configuration, the aircraft tilts the front two rotors in order to achieve forward and backward motion. This figure shows a VTOL aircraft in hover mode.

To achieve lateral motion in the hover configuration, the aircraft rolls similar to a multicopter. While in the hover configuration, the pitch is stabilized to 0 degrees to minimize interference of wing aerodynamic effects. The yaw is controlled through differential tilt of the front rotors.

Getting Started

Open the VTOLRefApp project file.

prj = openProject("VTOLApp/VTOLRefApp.prj");

This example uses MATLAB Project shortcuts. Use the highlighted project shortcuts for setting up the hover configuration. You can use the other project shortcuts for tuning the fixed-wing, transition configurations, and setting up the city mission. To see these shortcuts, you must open and view the Project editor tab.

Click the Getting Started button in project shortcuts to setup the aircraft plant model and base controller.

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

Set up Hover Configuration

First clicking Set Hover Configuration in the project to set the aircraft to be in hover configuration or run the setupHoverConfiguration helper function directly.

setupHoverConfiguration;
Enabled hover configuration.

Tune Control Design with Manual Control

To use manual control to tune the hover configuration, click Manual Mode under the Hover section in the project or use the setupHoverManual helper function directly.

setupHoverManual;
Enabled hover manual testbench mode.

Open and run the model

open_system(mdl);

Navigate to the ManualControl block in the Guidance Test Bench block in VTOLTiltrotor/Guidance Test Bench/ControlType/Manual Control. Adjust the sliders and observe the flight response of the UAV in hover configuration. You can optionally switch off the fixed wing aerodynamics to observe controller performance without aerodynamic effects.

A set of predefined gains provided in exampleHelperInitializeVTOLGains.m are already loaded in at setup. You can manually tune these gains for a more aggressive or robust control tracking.

Observe that the UAV reasonably executes any changes in manual setpoint. However, the UAV can enter highly non-linear regimes in flight path and using manual control as the only measure is insufficient. In the next step, leverage a test-bench to validate the UAV's ability to track complex trajectories.

Set up Guidance-Test Bench for Hover

The hover controller must be robust and be able to track trajectories precisely so that the VTOL vehicle can navigate in dense urban scenarios. Instead of specifying setpoints manually, leverage guidance algorithms in UAV toolbox as a guidance-testbench to validate VTOL aircraft flying complex missions. Click Guidance Mode to set up the VTOL to execute a hover mission consisting of takeoff, waypoint navigation, and landing.

setupHoverGuidanceMission;
Enabled hover guidance mission.

Run the model and open the UAV Animation block inside the Visualization subsystem to visualize the trajectory. The UAV takes off and flies in a zig-zag pattern before landing.

outBaseline = sim(mdl)
### Searching for referenced models in model 'VTOLTiltrotor'.
### Found 1 model references to update.
### Starting serial model reference simulation build.
### Successfully updated the model reference simulation target for: PropellerDynamics

Build Summary

Model reference simulation targets built:

Model              Action                        Rebuild Reason                                        
=======================================================================================================
PropellerDynamics  Code generated and compiled.  Target (PropellerDynamics_msf.mexw64) did not exist.  

1 of 1 models built (0 models already up to date)
Build duration: 0h 0m 51.655s

Figure UAV Animation contains an axes object. The axes object with xlabel North, ylabel West contains 5 objects of type patch, line.

outBaseline = 
  Simulink.SimulationOutput:

       FixedWingCmdFdbk: [1x1 struct] 
        PositionCmdFdbk: [1x1 struct] 
     TransitionFeedback: [1x1 struct] 
                logsout: [1x1 Simulink.SimulationData.Dataset] 
                   tout: [26550x1 double] 

     SimulationMetadata: [1x1 Simulink.SimulationMetadata] 
           ErrorMessage: [0x0 char] 

Analyze Tracking and Control Performance.

Visualize the control tracking error from the hover mission to determine the control design performance. Plot the command versus feedback position and errors using the exampleHelperPlotHoverControlTrackingResults helper function. The VTOL UAV is expected to reasonably follow the setpoints within some margin. However, lookahead distance of guidance logic also affects position error, which should be of the order of R_LOOKAHEAD, a control parameter set to 5.

%Plot results.
exampleHelperPlotHoverControlTrackingResults(outBaseline);

Figure contains 3 axes objects. Axes object 1 with title Command vs Feedback, ylabel X Position contains 2 objects of type line. These objects represent Command, Feedback. Axes object 2 with ylabel Y Position contains 2 objects of type line. Axes object 3 with xlabel Time (sec), ylabel Z Position contains 2 objects of type line.

Figure contains 3 axes objects. Axes object 1 with title Command-Feedback Error, ylabel X Position Error contains an object of type line. Axes object 2 with ylabel Y Position Error contains an object of type line. Axes object 3 with xlabel Time (sec), ylabel Z Position Error contains an object of type line.

Figure contains an axes object. The axes object with xlabel North, ylabel West contains 2 objects of type line. These objects represent Command, Feedback.

Note that while manual tracking was smooth, the VTOL UAV has a reduced performance while tracking a complex trajectory in hover. You can automate the process of control tuning to allow faster design iterations responding to changes in aircraft design. In the next step, tune and test the controller in hover configuration.

Automate Tuning of Tiltrotor in Hover Configuration

To improve the control performance, utilize control design analysis. To automatically tune the aircraft design, you must linearize the aircraft around a trim configuration. The accompanying model is set up for the VTOL UAV to hover at a fixed location.

hovertuning.png

First, reset the multicopter commands to initial condition to allow linearization at hover configuration. The TestMode is set to 0 (Manual) and AutotuningMission to true to allow tuning the controller in manual control.

% Reset multicopter commands to 0 for linearization.
set_param([mdl '/Guidance Test Bench/ControlType/Manual Control/Slider1'],'Value','0');
set_param([mdl '/Guidance Test Bench/ControlType/Manual Control/Slider2'],'Value','0');
set_param([mdl '/Guidance Test Bench/ControlType/Manual Control/Slider3'],'Value','0');
% TestMode to 0 - Manual Mode
TestMode = 0;
% AutotuningMission true - Tune Controller 
AutotuningMission = true;
% Disable Sensors
SensorType = 0;

Linearize VTOL Plant Model and Tune Control Design

To tune the controllers, you must set the phase margin. In control theory, and in pidtune, the default value used is 60 degrees. This value is chosen to balance robustness and response time as a lower value of phase margin will lead to more oscillations with a faster response, and a higher value will lead to fewer oscillations with a slower response.

Run the exampleHelperAutomatedHoverControlTuning script below to linearize and trim each controller in hover successively, from inner to outer loop, to achieve a phase margin of 60 degrees. In order to tune each loop, perform the following steps:

  1. Obtain the linearization io points

  2. Linearize the system using linearize

  3. Obtain tuned controller using pidtune

  4. Ensure the tuned filter coefficient is nonzero

  5. Write the tuned gains to the workspace

For reference, the roll rate loop tuning contains detailed comments outlining the steps for tuning the controller in exampleHelperAutomatedHoverControlTuning. Note that the process of tuning the parameters can take some time. You can instead load the tuned parameters from the tunedHoverGains_BW50 MAT file.

exampleHelperAutomatedHoverControlTuning;
load tunedHoverGains_BW50;

Verify Tracking and Control Performance

With the new gains, verify the improvement in controller performance by running the mission again. While there is little improvement in how well the controllers track the references, the overall mission is completed in a much shorter time as shown in the next section.

Click the Guidance Mode project shortcut to set up the hover guidance mission.

setupHoverGuidanceMission;
Enabled hover guidance mission.
outTuned = sim(mdl);
### Searching for referenced models in model 'VTOLTiltrotor'.
### Found 1 model references to update.
### Starting serial model reference simulation build.
### Model reference simulation target for PropellerDynamics is up to date.

Build Summary

0 of 1 models built (1 models already up to date)
Build duration: 0h 0m 3.4313s

Figure UAV Animation contains an axes object. The axes object with xlabel North, ylabel West contains 5 objects of type patch, line.

%Plot results.
exampleHelperPlotHoverControlTrackingResults(outTuned);

Figure contains 3 axes objects. Axes object 1 with title Command vs Feedback, ylabel X Position contains 2 objects of type line. These objects represent Command, Feedback. Axes object 2 with ylabel Y Position contains 2 objects of type line. Axes object 3 with xlabel Time (sec), ylabel Z Position contains 2 objects of type line.

Figure contains 3 axes objects. Axes object 1 with title Command-Feedback Error, ylabel X Position Error contains an object of type line. Axes object 2 with ylabel Y Position Error contains an object of type line. Axes object 3 with xlabel Time (sec), ylabel Z Position Error contains an object of type line.

Figure contains an axes object. The axes object with xlabel North, ylabel West contains 2 objects of type line. These objects represent Command, Feedback.

Comparision of Mission Time Between Tuned and Untuned Gains

Plot and compare the baseline performance to the tuned performance. Note that the UAV performs mission about 30 seconds faster based on optimized gains while maintaining stability.

exampleHelperPlotHoverControlTrackingComparison(outBaseline,outTuned)

Figure contains 3 axes objects. Axes object 1 with title Command vs Feedback, ylabel X Position contains 2 objects of type line. These objects represent Baseline, Autotuned. Axes object 2 with ylabel Y Position contains 2 objects of type line. Axes object 3 with xlabel Time (sec), ylabel Z Position contains 2 objects of type line.

Figure contains 3 axes objects. Axes object 1 with title Command-Feedback Error, ylabel X Position Error contains 2 objects of type line. Axes object 2 with ylabel Y Position Error contains 2 objects of type line. Axes object 3 with xlabel Time (sec), ylabel Z Position Error contains 2 objects of type line.

Figure contains an axes object. The axes object with xlabel North, ylabel West contains 2 objects of type line. These objects represent Baseline, Autotuned.

Summary

In this example, you tuned the control design of a VTOL aircraft in hover. Next, design the control system of the fixed wing mode of the VTOL aircraft.

References

[1] N., Pavan. (2020). Design of Tiltrotor VTOL and Development of Simulink Environment for Flight Simulations.

[2] Mathur, Akshay & Atkins, Ella. (2021). Design, Modeling and Hybrid Control of a QuadPlane.

[3] Ducard, Guillaume Jacques Joseph and Minh-Duc Hua (2014). Modeling of an unmanned hybrid aerial vehicle.

See Also