Simulating Unmanned Aerial Vehicles (UAV) with MATLAB and Simulink
Simulate Unmanned Aerial Vehicles (UAVs) in MATLAB and Simulink with UAV Toolbox (transitioned from the UAV Library for Robotics System Toolbox™). You can simulate fixed-wing or multirotor UAVs using a guidance model that approximates a closed-loop autopilot controller with a kinematic model.
You can also implement a waypoint-following controller and tune its parameters using the low-fidelity model. Furthermore, you can use the same parameters to control the UAV with a high-fidelity model built with Aerospace Blockset™. This workflow is useful to simulate small off-the-shelf drones for various applications such as inspection, monitoring, surveillance, etc.
The UAV Library for the Robotics System Toolbox contains the following reference examples:
- Tuning Waypoint Follower for Fixed-Wing UAV
- Approximate High-Fidelity UAV model with UAV Guidance Model block
Published: 2 Nov 2018
Unmanned aerial vehicles can fly autonomously for various applications such as inspection, monitoring, and surveillance across industries such as agriculture, mining, construction, and more. They can also be used for aerial photography or even to deliver your pizza.
One of the common workflows in all these applications is to have the UAV follow a set of waypoints using the guidance control algorithm. In this video we will learn about these workflows with Simulink.
Flying a UAV without modeling and simulation can cause failures leading to safety and cost issues. A common simulation workflow for UAVs involves 3 steps:
- Having a kinematic model of a UAV,
- Controlling and tuning the model using a waypoint-following algorithm,
- Visualizing the flight behavior and analyzing the flight data.
In the 2018b release, Robotics System Toolbox provides functions and blocks to model and simulate UAV algorithms in MATLAB and Simulink. Let’s talk about Simulink blocks and examples for UAVs, where you can use UAV Guidance Model block, Waypoint Follower block, and UAV Animation block to implement this workflow on either a multi-rotor or a fixed-wing UAV.
UAV simulation starts with tuning the control parameters with a low-fidelity simulation model, in which external disturbances like wind and turbulence are not considered. The UAV Guidance Model block is suitable for low-fidelity, but fast, simulation.
This inbuilt example consists of a fixed-wing path following model, where this part is the guidance model configuration. The UAV Guidance Model block includes the fixed-wing UAV aerodynamics and an autopilot. This lets you approximate the kinematic behavior of a closed-loop system.
And this part is the waypoint-follower configuration, where the waypoint Follower block computes a desired heading for the UAV. It does so by giving a set of waypoints, current pose, and look-ahead distance as inputs.
The heading control block is a proportional controller that regulates the UAV’s heading angle. You can use the sliders to tune the look-ahead distance and heading control values.
To visualize the flight behavior, we use the UAV Animation block. We can see that a small look-ahead distance and a fast heading control results in a very curvy path. Whereas, a large look-ahead distance and a slow heading control gives the desirable path.
Once the flight behavior satisfies the design specifications in the low-fidelity model, we can test the same control parameters with a higher-fidelity aerodynamic model based on Aerospace Blockset.
Aerospace Blockset lets you represent the behavior of a UAV in a more realistic flight environment by including validated environment models for the atmosphere, gravity, wind, and more. This second inbuilt example consists of a plant model and a mid-level autopilot, in which you can:
- Switch between high- and low-fidelity model,
- Approximate high-fidelity model with low-fidelity guidance model and provide an input step signal to compare the responses for roll angle, air speed, and height,
- And finally, test the waypoint navigation model with both the low- and high-fidelity models and compare the flight behavior results.
We can see that the output responses for the low- and high-fidelity models are similar. Thus, we can tune the control parameters for different scenarios with the low-fidelity model and then tune the high-fidelity model accordingly for implementation in the real environment.
You can try these examples by installing UAV library with Robotics System Toolbox. And for more details, check out the links for the Robotics System Toolbox product page and the reference examples for UAV algorithms.