Tune Hover Control Design for VTOL UAV in Steady Wind Condition
This example shows how to tune your control system design for a VTOL UAV in hover configuration in steady wind condition.
In the Tune Control Design for VTOL UAV in Hover Configuration example, you have tuned the VTOL UAV for flight in hover configuration. However, you need to update the controller gains for flights with steady wind conditions so that the VTOL UAV can track the desired path and reject the wind disturbances.
Getting Started
To open the example livescript and directory which contains the Simulink project file, first run openExample('uav/TuneHoverControlDesignForVTOLUAVInSteadyWindConditionExample')
in the command window.
You must open the VTOLRefApp.prj
project file to access the Simulink model, supporting files, and project shorcuts that this example uses.
% Open the Simulink project after running openExample('uav/TuneHoverControlDesignForVTOLUAVInSteadyWindConditionExample') prj = openProject("VTOLApp/VTOLRefApp.prj");
Use the highlighted project shortcuts for setting up the hover configuration. To see these shortcuts, you must open and view the Project Shotcuts tab.
To set up the VTOL UAV plant model and base controller, click the Getting Started button in the project shortcuts or run the setupPlant
helper function.
setupPlant;
Initialized VTOL model. Enabled hover configuration. Enabled hover guidance mission.
Set up Hover Configuration
This figure shows a VTOL aircraft in hover mode.
In the hover configuration, the UAV pitch is stabilized to 0 degrees to minimize interference of wing aerodynamic effects. The yaw is controlled through differential tilt of the front rotors. To achieve lateral motion in the hover configuration, the VTOL UAV rolls similar to a multicopter.
To configure the VTOL UAV to hover configuration, click the Set Hover Configuration shortcut or run the setupHoverConfiguration
helper function.
setupHoverConfiguration;
Enabled hover configuration.
Simulate UAV Hover in Wind with Baseline Controller Gains
The hover controller must be robust and be able to track trajectories precisely so that the VTOL UAV can navigate in steady wind.
To set up a hover mission consisting of takeoff, waypoint navigation, and landing, click Guidance Mode shortcut or run the setupHoverGuidanceMission
helper function.
setupHoverGuidanceMission;
Enabled hover guidance mission.
Load the gains that you obtained in Tune Control Design for VTOL UAV in Hover Configuration example for the baseline controller gains.
load tunedHoverGainsNoWind.mat;
To enable steady wind in the simulation, set the Wind
variable to 1. By default, the wind is set at 8 m/s from the east.
Wind = 1;
Run the VTOLTiltrotor.slx
Simulink model and store the output in outBaseline
by running the sim
function as follows. To visualize the trajectory, open the UAV Animation block inside the Visualization
subsystem.
outBaseline = sim(mdl);
Simulation Result with Baseline Controller Gains
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
.
To plot the simulation output that you have stored in outBaseline
, use the exampleHelperPlotHoverControlTrackingResults
helper function. This allows you to visualize the control tracking error from the hover mission and determine the control design performance by comparing the command versus feedback position and errors.
exampleHelperPlotHoverControlTrackingResults(outBaseline);
Note that compared to the simulation result with no wind, the VTOL UAV has a reduced performance while tracking a complex trajectory in hover with steady wind.
To improve the controller performance in steady wind condition, tune and test the controller in hover configuration with steady wind in the next step.
Update Controller Gains using Autotuning
You must enable the manual test bench mode and set the aircraft to manual control mode before starting the tuning process. Click Manual Mode under the Hover section in the project or use the setupHoverManual
helper function
setupHoverManual;
Enabled hover manual testbench mode.
To automatically tune the VTOL UAV controller, you must linearize the aircraft around a trim configuration. Reset the multicopter commands to allow linearization at hover.
set_param([mdl '/Manual Control Dashboard/Slider3'],'Value','0'); set_param([mdl '/Manual Control Dashboard/Slider2'],'Value','0'); set_param([mdl '/Manual Control Dashboard/Slider1'],'Value','10');
In order to tune each controller loop, perform the following steps:
Obtain the linearization input and output points
Linearize the system using
linearize
Obtain tuned controller using
pidtune
Ensure the tuned filter coefficient is nonzero
Write the tuned gains to the workspace
Run the exampleHelperAutomatedHoverControlTuningWind
script to linearize and trim each controller in hover successively, from inner to outer loop, to achieve a phase margin of 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.
exampleHelperAutomatedHoverControlTuningWind;
Simulate UAV Hover in Wind with Updated Controller Gains
With the new gains, verify the improvement in controller performance by running the mission again. To set up the hover mission, click Guidance Mode shortcut or run the setupHoverGuidanceMission
helper function
setupHoverGuidanceMission;
Enabled hover guidance mission.
Run the Simulink model and store the output in outTuned
by running the sim
function as follows. To visualize the trajectory, open the UAV Animation block inside the Visualization
subsystem.
outTuned = sim(mdl);
Simulation Result with Updated Controller Gains
To plot the simulation output that you have stored in outTuned
, use the exampleHelperPlotHoverControlTrackingResults
helper function. The plot shows the tracking performance comparison.
exampleHelperPlotHoverControlTrackingResults(outTuned);
Use the exampleHelperPlotHoverControlTrackingComparison
to plot and compare the baseline performance to the tuned performance. Observe the improved hovering performance of the VTOL UAV against steady wind from the east, as indicated by the reduced overshoot in the y-position error.
exampleHelperPlotHoverControlTrackingComparison(outBaseline,outTuned);
Summary
In this example, you tuned the control design of a VTOL UAV in hover configuration with a steady wind disturbance.
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.