Fig. 1. Quadrotor with the applied forces over the rotors.
A simulation of Teppo Luukkonen's paper Modelling and control of quadcopter in MATLAB/Simulink.
Since the quadrotor is considered a rigid body, the dynamic equation that rules the quadrotor can be obtained with the Newton-Euler equations
where
In order to control the quadrotor, a simple linear controller was used, the well-known PID controller, that can be described as
where
The quadrotor begins by default with
where
The goal configuration of the quadrotor can be modified simply by
where
This is a figure with the trajectory of the drone along the time with the previous initial and desired configurations:
Fig. 2. Positions in
Both the initial and desired configurations can be modified in the parameters.m
script.
At the end of each simulation charts with the results will be displayed in order to see the behavior of the quadrotor along the time
Fig. 3. Left: Current and desired roll angle
It may be the case that quadrotor_model/Quadrotor System
.
In order to execute the simulation, the script parameters.m
should be run together with the quadrotor_model.slx
simulink file.
Sometimes, due to the quasi-holonomic constraints of the quadrotor, and that we are using Euler angles, the simulation may fall into warnings and errors while choosing the initial or desired configurations. That's why it's recommended to be careful with the election of the configurations. If this may be the case, the best way to start again is to restart with the default configurations previously mentioned. However, this is up to you.
MIT License
Copyright (c) [2022] [Angelo Espinoza]
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.