Electronics 10 02218 v2
Electronics 10 02218 v2
Article
Design, Simulation, Analysis and Optimization of PID and
Fuzzy Based Control Systems for a Quadcopter
Isaac S. Leal 1 , Chamil Abeykoon 2, * and Yasith S. Perera 3
1 Department of Electronics Design, Mid Sweden University, Holmgatan 10, 851 70 Sundsvall, Sweden;
[email protected]
2 Aerospace Research Institute and Northwest Composites Centre, Department of Materials, Faculty of Science
and Engineering, The University of Manchester, Oxford Road, Manchester M13 9PL, UK
3 Department of Textile and Apparel Engineering, University of Moratuwa, Moratuwa 10400, Sri Lanka;
[email protected]
* Correspondence: [email protected]
Abstract: Unmanned aerial vehicles or drones are becoming one of the key machines/tools of
the modern world, particularly in military applications. Numerous research works are underway
to explore the possibility of using these machines in other applications such as parcel delivery,
construction work, hurricane hunting, 3D mapping, protecting wildlife, agricultural activities, search
and rescue, etc. Since these machines are unmanned vehicles, their functionality is completely
dependent upon the performance of their control system. This paper presents a comprehensive
approach for dynamic modeling, control system design, simulation and optimization of a quadcopter.
The main objective is to study the behavior of different controllers when the model is working under
linear and/or non-linear conditions, and therefore, to define the possible limitations of the controllers.
Five different control systems are proposed to improve the control performance, mainly the stability
of the system. Additionally, a path simulator was also developed with the intention of describing the
Citation: Leal, I.S.; Abeykoon, C.;
Perera, Y.S. Design, Simulation,
vehicle’s movements and hence to detect faults intuitively. The proposed PID and Fuzzy-PD control
Analysis and Optimization of PID systems showed promising responses to the tests carried out. The results indicated the limits of the
and Fuzzy Based Control Systems for PID controller over non-linear conditions and the effectiveness of the controllers was enhanced by
a Quadcopter. Electronics 2021, 10, the implementation of a genetic algorithm to autotune the controllers in order to adapt to changing
2218. https://doi.org/10.3390/ conditions.
electronics10182218
Keywords: quadcopter; unnamed aerial vehicle; dynamic model; PID controller; fuzzy logic; genetic
Academic Editor: Nurul I. Sarkar algorithm; intelligent control
need for achieving a stable system with a high degree of precision and accuracy to allow
the implementation of different technologies such as artificial vision, and so forth.
A quadcopter is a machine that can fly without a pilot but in order to realize this, an
implementation of a reliable control system is necessary. Basically, a control system should
control the velocity of the rotors, enabling the vehicle to fly stably and safely. Usually,
linear control techniques should enable these types of vehicles to fly stably. However, a
quadcopter possesses a very complex dynamic model and is very susceptible to wind or
other unforeseeable climatological adversities. For this reason, a quadcopter requires a non-
linear control system which can be improved by implementing an algorithm that can help
the controller in making decisions to adapt to the possible adverse conditions. Intelligent
control techniques are gradually becoming more effective in helping conventional control
techniques to tackle these issues with an elevated level of abstraction.
The growing popularity of quadcopters stimulates a wide variety of projects to be
devoted to this theme [1–8]. Several previous works related to quadcopters on the develop-
ment of dynamic models and the designing of linear control as well as non-linear control
are reviewed in detail in the following section.
the “plus” (+) configuration. This model was also based on the Newton–Euler formulation
and it was implemented in Simulink where the test results were very close to those of the
real vehicle.
Sá et al. [12] aimed to design a platform on which the testing and evaluation of new
control systems for quadcopters would be possible and they also reported the stages for
designing and manufacturing a quadcopter from scratch. The proposed dynamic model
was based on the Newton–Euler formulation and the frame configuration was of the “plus”
(+) type. Although the quadcopter design was completed, the controllers were not designed
in this work. The quadcopter was equipped with all the required components (i.e., sensors,
communication systems, a power system, etc.) and its functionality was tested by adding
different loads. However, the quadcopter designed in this work could carry only small
loads (i.e., up to 800 g).
Fernando et al. [13] reported a dynamic model of a quadcopter to create a platform to
facilitate the implementation of future automatic navigation systems. Similar to the work
by Amir and Abbass [9], several assumptions were made to develop the mathematical
model, the main assumptions being that the center of mass of the quadcopter coincides
with the origin of the fixed frame and that the frame axes coincide with the principal
axes of inertia. Furthermore, the “plus” (+) configuration was used for the frame. The
development of the model was based on the Newton–Euler method. The authors also
developed a control system which was based on four cascaded Proportional-Integral (PI)
controllers, and they argued that this type of a configuration would be effective in limiting
the effects of disturbances. Finally, the authors highlighted that the vehicle exhibited better
stability and maneuverability during indoor flights than during outdoor flights. Perhaps
the use of a genetic algorithm (GA) or a controller based on fuzzy logic could have helped
the system to cope with the conditions existing in outdoor flights.
Barve and Patel [14] reported the development of a mathematical model, its simulation
and a novel study called the “Altitude-Range-Analysis” for a quadcopter. The mathematical
model was developed by using the Newton–Euler formulation and transformation matrices,
and the configuration of the frame was of the “plus” (+) type. The main contribution of this
work lies in the study of the feasible altitude ranges, which shows the altitude limitations
of the quadcopter. The authors have considered several parameters for carrying out this
analysis, such as the payload weight, rotor thrust, reference altitude positions, and so forth.
Moreover, the authors modified their mathematical model to account for the air density
variations, as well. The MATLAB simulator was used in this work, and it was mentioned
that an altitude control system should tackle the changes in the air density during the flight.
This is because, within the Earth’s atmosphere, the air pressure/density is inversely related
to the altitude. Hence, at a higher altitude, the air pressure is lower, which makes the air
thinner, and therefore, the flight conditions are not constant [15]. This was confirmed by
the simulation results, which indicated a lower altitude limit at a low reference altitude
than the altitude limit at a high reference altitude [14].
Alkamachi and Erçelebi [16] reported a mathematical model and the design of an
intelligent control system for a quadcopter. The mathematical model chosen was of the
“H” type (i.e., corresponding to the shape of its chassis) and its development was based on
the Newton–Euler method. The Newton formulation was used to model the translation
dynamics and the Euler formulation for the rotational dynamics. The type “H” is not a
very common type of chassis in modern quadcopter design, but it is interesting to note that
its double symmetry feature makes it completely suitable to fly with four engines.
performed in all the tests carried out. Moreover, the importance of intelligent control
systems as a support for the conventional techniques was appreciated by this work as well.
Thu and Gavrilov [21] introduced a novel method of control for a quadcopter based
on an L1 adaptive feedback control system. The key feature of the L1 adaptive control is
the decoupling of adaptation from robustness [22]. The separation between the adaptation
and the robustness is achieved by explicitly constructing the robustness specification in the
formulation of the problem, understanding that the uncertainties in any feedback loop can
be compensated only within the bandwidth of the control channel. Moreover, the authors
explained that this modification of the formulation of the problem leads to the insertion
of a limited bandwidth filter into the feedback path to maintain the control signal within
the desired frequency range [21]. The control parameters were systematically determined
based on the desired performance and robustness metrics. On the one hand, the rapid
adaptation makes it possible to compensate for the undesirable effects of rapidly changing
uncertainties and significant changes in system dynamics. Rapid adaptation is also critical
for achieving predictable transient performance of the inputs and outputs of the system,
without imposing persistence of excitation or resorting to high gain feedback. On the other
hand, the limited bandwidth filter keeps the limited robustness margins far from zero
in the presence of fast adaptation. In this sense, the bandwidth and the structure of the
filter define the compensation between the performance and robustness of the closed-loop
adaptation system. The simulation results indicated that the L1 adaptive controller showed
excellent performance in trajectory tracking.
Njinwoua and Wouwer [23] suggested a cascade control strategy for the attitude
control of a quadcopter, to handle the disturbances created by asymmetric actuators in the
UAV. The proposed control system involved a PD controller in the inner loop to achieve
stabilization, while a PI controller was used in the outer loop to handle disturbances.
The simulation results showed that the proposed control system was capable of quickly
adjusting to the disturbances, and an overshoot of about 10% and a settling time of 5 s were
observed for 5% asymmetry on the drag and lift factors of the actuators.
Cedro and Wieczorkowski [24] employed the Wolfram Mathematica modelling soft-
ware to optimize PID controller gains of a quadcopter. It was found that unconstrained
optimization procedures were not suitable as they resulted in negative gains. Constrained
procedures delivered satisfactory gain values, but they required the constraints to be very
precisely defined. The best results were reported by the “RandomSearch” constrained
optimization method with a penalty coefficient value of 1. The penalty coefficient was used
to reduce the input signal level to prevent overshoots and oscillations, but its value should
be selected using a trial-and-error approach.
Paredes et al. [25] presented (in the form of a tutorial) the design, simulation, imple-
mentation and testing of quadcopter controllers, which were designed based on a linearized
quadcopter model. The aim was to assess the performance of these controllers when im-
plemented on computationally limited embedded systems. The authors developed and
compared quadcopter controllers based on PD, PID, LQR, LQR with integrators (LQR-I)
and explicit model predictive control algorithms. The controllers were tested using inclined,
circular flight sequences and position tracking error, velocity tracking error and also the
control effort of these controllers was assessed. Based on the results, the authors claimed
that the PID controller exhibited the best tracking performance, while the LQR-I controller
provided the best compromise between the tracking performance, maintaining consistent
simulation and experimental performance. The LQR controller was the fastest in terms
of the average computation time. Furthermore, the authors inferred that the controllers
were capable of meeting the time constraints imposed by the computationally limited
embedded systems. This study is quite useful for future researchers not only to be used
as a step-by-step guide in designing quadcopter controllers, but also in choosing a more
suitable control strategy for computationally constrained applications.
Electronics 2021, 10, 2218 6 of 33
were achieved through the implementation of a fuzzy controller which was responsible for
offering the most suitable gains to respond to the demands of the control system. The auto
tuning fuzzy controller was achieved based on an extended Kalman filter algorithm, which
is an optimal algorithm for managing computational resources that allows the addition of
external parameters (such as odometry or scan). This consists of two stages: prediction and
correction. An algorithm called Dijkstra was also applied in order to plan the shorter paths
to avoid the obstacles in the way. The results were satisfactory in obtaining an autotuned
intelligent PID controller, which can adapt to changing situations.
Fatan et al. [32] reported an altitude control system for a quadcopter. The system
was based on an adaptive neural PID which was initially tuned with an evolutionary
algorithm and then a GA was implemented to tune the gains. The authors emphasized that
the main advantage of this method was the ability to adapt to new variations that arise
during execution. Moreover, they mentioned that the learning rate presented a challenge,
as the learning speed decreased the mobility of the coefficients, which in turn reduced the
adaptive capacity of the controller. In this study, this issue was considered when designing
the GA, which was a part of the controller.
Benavidez et al. [33] developed two fuzzy logic control systems for a Parrot AR Drone
2.0, with the aim of achieving landing and altitude control. The altitude fuzzy controller
worked directly with a sonar input and had five rules to control the vehicle relative to the
“z” axis. Nineteen rules were defined for the landing controller to establish a logical linear
behavior relative to the three axes of rotation. The simulation results showed satisfactory
control performance in moderately adverse environmental conditions.
Larrazabal and Peñas [34] proposed a control mechanism for the rudder of a ship. Ac-
cording to the authors, such a system shows a strong non-linearity and usually operates in
an unstable environment. They implemented two control systems: a fuzzy logic controller,
which was responsible for solving the problem of non-linearity, and a PID controller with
self-tuning gains adjusted by GAs which make the system adaptable and computationally
efficient (i.e., a low computational cost). This work demonstrated that the combination of
traditional and intelligent techniques is suitable to manage complex problems.
Garcia-Aunon et al. [35] presented a route tracking algorithm for a UAV. The proposed
algorithm has the ability of adapting its parameters using a fuzzy logic based approach. In
fact, the models generated with tuned parameters performed better than the models with
constant parameters as the tuned models were able to adapt to the variations of speed and
trajectories quite well. On the other hand, the authors proposed different laws of tuning by
studying the equations of movement which were based on the theoretical model and the
appropriate simulations. Although comparable results were achieved with the kinematic
law and the diffuse law, it was stated that the diffuse law was faster and easier to develop.
Moreover, this work highlights the importance of parameter tuning (rather than using
constant values) as this enables achieving better performance even if the system becomes a
little more complex.
Domingos et al. [36] proposed a solution to the problem of tuning fuzzy controllers.
The authors stated that a quadcopter is a non-linear and complex system, and these
vehicles face non-stationary environments where the perturbations occur randomly. It
makes the design and adjustment of fuzzy controllers a task that requires a significant effort.
Therefore, the authors justified the inefficiency of classic fuzzy controllers and the need for
the implementation of autonomous fuzzy controllers. The design of the system was carried
out using a self-evolving parameter-free fuzzy rule-based controller (SPARC), which is
a real-time adaptive controller. The advantage of this controller lies in its configuration.
According to the authors, this controller does not need rules or other parameters so only
the supply of the input and output ranges is sufficient. Furthermore, this controller needed
to be trained to reduce the values of error and overshoot, thus obtaining data clouds to
be used as control signals would help to follow the entry references. The performance
of the controllers was evaluated through the application of the mean square error (MSE)
technique in each of the plants. The authors showed that the MSE returned the square of
Electronics 2021, 10, 2218 8 of 33
the difference between the output of the plant and the reference signal at each instant, and
then, the result was divided by the total simulation time. Therefore, it was shown that
a lower result corresponded to better performance. In the table of results shown by the
authors, it was appreciated that the results obtained are slimier for the SPARC controller.
The simulation results showed a clear advantage from the point of view of design and
efficiency of the autonomous fuzzy controllers (SPARC) over the classic fuzzy controllers.
Yazid et al. [37] proposed a self-tuning controller for trajectory tracking control of a
quadcopter. They presented a first-order Takagi-Sugeno-Kang fuzzy logic controller (FLC)
tuned using an evolutionary algorithm. The authors compared the performance of the FLC
optimized with three major evolutionary algorithms: GA, particle swarm optimization and
artificial bee colony (ABC) algorithm. The performance of the FLC was evaluated under
three different flight conditions: constant step, varying step and sinusoidal functions. The
results indicated that the ABC-FLC outperformed the other two in terms of faster settling
time in the absence of overshoots. The GA-FLC had faster rise time and consequently
larger overshoots, which is undesirable. The proposed method was effective in optimizing
the fuzzy parameters to obtain good performance and robustness, without having to go
through the tedious manual tuning process.
Pham et al. [38] introduced a control strategy for tracking the trajectory of a quadcopter,
the mass of which changes with time. Continuous reduction of the mass as well as a sudden
change in the mass during the flight were considered in the study. The authors proposed a
cascaded structure, with two linear parameter varying H∞ controllers in the inner loop to
control the attitude and a combination of backstepping and PD controllers in the outer loop
for altitude and longitudinal control. The simulation results showed that the quadcopter
was able to track the trajectory under both types of mass variation, even when external
disturbances were present.
Ali et al. [39] designed a feedback linearization based non-linear controller for a
quadcopter, cascaded with sliding mode and backstepping based control, which can
deal with uncertain external disturbances. The authors argued that most of the existing
controllers reported in the literature do not account for the Coriolis effect and that the
models are simplified using small signal approximations, which make the controllers
less robust even against small disturbances. As a solution to this, the authors derived
a non-linear model for the quadcopter, with fewer assumptions compared to existing
models in the literature. Based on the simulation results, the authors demonstrated that the
proposed controller showed slightly better tracking performance than a conventional PID
controller for small step signals, while for larger step signals, it clearly outperformed the
PID controller. Furthermore, it was found that larger step signals caused the PID controller
to become unstable, while the proposed controller showed excellent performance. A similar
behavior was observed for sinusoidal inputs, as well. Moreover, it was clear that both
the advanced control strategies used for dealing with uncertainties (i.e., sliding mode and
backstepping based control) had better transient performance than the PID controller, while
the sliding mode control surpassed the backstepping based control in terms of steady state
performance.
Guerrero-Sánchez et al. [40] developed and compared two control strategies (i.e., a PD
control law with non-linear coupled term and a non-linear control law), with a simple struc-
ture and low computational complexity, to stabilize a quadcopter designed to transport a
payload attached by a cable. In order to stabilize the attitude dynamics, a state-dependent
differential Riccati equation control was also developed. For the numerical experiments,
the authors considered a commercial Parrot AR Drone attached with a hanging payload.
Based on the numerical simulations, the authors validated the suitability of the proposed
controllers for a quadcopter carrying a payload. Moreover, the simulation results indi-
cated that the non-linear control law was superior in terms of payload oscillation angle
suppression, lower settling time and lower maximum swing.
It can be seen that in the previous studies, dynamic models were formulated by taking
two reference systems into account (i.e., fixed and mobile). Rotational 3D matrices were
Electronics 2021, 10, 2218 9 of 33
applied to represent the orientation of the mobile system with respect to the fixed earth
system. With these matrices, it is possible to represent the mobile system vectors using the
vectors defined in the fixed system. The first step in constructing a dynamic model is the
formulation of a kinematic model. This means that it is necessary to establish the reference
systems and then find the position vectors, velocity and acceleration. It is obvious that
the most common frame configuration used in the past studies is the “plus” (+) configu-
ration. The quadcopter’s frame configuration (i.e., +, H, or ×) determines the capacity
of performing complicated maneuvers. Each configuration presents a different motor
organization having one or two motors in propulsion of the vehicle to make the vehicle
more powerful and capable, but it also compromises the control system. In the present
study, the “×” configuration was implemented. The aim was to obtain a configuration
that allows a greater pushing force to the vehicle. This is possible as the “×” configuration
allows the use of two motors for longitudinal and lateral movements.
Based on the review of the existing literature, it is possible to see a great diversity in
the control systems used for quadcopters such as traditional PIDs, LQR controllers and
controllers based on fuzzy logic. The non-linear controllers have generally outperformed
linear controllers due to their ability to conform to varying conditions. Autotuning of
controller parameters is necessary to ensure the reliable performance of the controller
under varying conditions. Evolutionary algorithms have widely been used in this context.
This work aims to design an advanced control system for a quadcopter which can
handle the possible non-linear behaviors in the worst possible conditions. The dynamic
model for the controller is developed using the “×” configuration due to the benefits
discussed above, as opposed to the “+” configuration commonly used in the past research
works. The study investigates the limitations and potentials of traditional PID and fuzzy
based controllers and investigates the potential of enhancing their performance by auto-
tuning their parameters using a GA. Therefore, five different control systems that include a
traditional PID controller, two Fuzzy-PD controllers and two controllers autotuned using
a GA are designed based on the developed dynamic model, and their performance is
compared.
The rest of the paper is structured as follows. In Section 2, a detailed description of
the dynamic modelling, the design of the controllers, the implementation of the GA and
controller tuning is presented. Section 3 illustrates the details of the 3D simulator devel-
opment. The simulation results are discussed in Section 4. Finally, the conclusions drawn
from the results of this study are presented with future recommendations in Section 5.
qe = (ε e , ηe ) = ( x, y, z, φ, σ, ψ) ∈ R6 (1)
qb = (ε b , ηb ) = (u, v, w, p, q, r ) ∈ R6 (2)
where ε e = x, y, z: Position vector in system 1;
ηe = φ, σ, ψ: Angular position vector in system 1;
ε b = u, v, w: Position vector in system 2;
ηb = p, q, r: Angular position vector in system 2.
Electronics 2021, 10, 2218 10 of 33
Initially, both systems of reference stay together, but when the quadcopter starts its
movement, the second system is displaced from the first system. This change in coordinates
involves a set of changes in the components (i.e., relevant parameters) of the second system.
This means that if the quadcopter is able to move (depending on the type of movement), it
is necessary to modify the components u, v and w for the linear displacement and p, q and r
for the angular displacement. When the coordinates on the second system are modified,
a new set of coordinates can be obtained, describing the position of the second system
with respect to the first system. Figure 1 represents a linear displacement of w and angular
displacements of u and v vectors as a result of the changes in p and q values. This motion
causes the second system fixed on the quadcopter’s body to move to U’, V’ and W’. Hence,
it is possible to determine the position of the vehicle with respect to the system which is
fixed to the earth (i.e., system 1).
In both systems of reference, all the variables affecting the kinematics of the vehicle
(i.e., velocity and acceleration) should be described, and the 3D rotation matrices were
used for this purpose. These rotation matrices describe the counter clockwise rotations of
the system around the x, y and z axes. The 3D matrix has been used with an interest of
knowing the variation of the coordinates and not the variation of the vectors. In general, a
solid can rotate in 3D space which can be described by three Euler angles: PhI (ϕ), Theta
(θ) and Psi (φ). Each of these angles describes the rotation with respect to a coordinate
axis: Phi—spinning with respect to “x”, Theta and Psi—rotations around “y” and “z”,
respectively. A composition of rotations, considering that the product of the matrices
is not commutative, is required for the representation of the orientation as described in
Equation (3).
cφcθ sφcφ + cψsθsφ sψsφ + cψscφ
R = sφcθ cψcθ + sψsθsφ −cψsφ + sψsθcφ (3)
−sθ cθsφ cθcφ
where s and c symbolize the sine and cosine of the angle, respectively.
With rotation matrices, it is possible to project the speeds and linear accelerations from
the secondary system to the primary system and vice versa if necessary. The use of angular
velocities projection matrix given in Equation (4) is necessary for projecting the magnitudes
of the angles [41].
1 sinφ × tanθ cosφ × tanθ
S= 0 cosφ −sinφ (4)
0 sinφ/cosθ cosφ/cosθ
Physical theories describe the way to predict the behavior of a moving rigid solid and
these can be used to model the behavior of a quadcopter, as well. Generally, the movement
of a rigid body can be complex, but the problem can be simplified by isolating different
movements. A quadcopter is a machine that can follow very convoluted trajectories where
it can turn around itself while making linear displacements and angular movements. It is
possible to compare such a motion with a solid which follows a parabolic trajectory. New-
ton’s second law describes the movement of the center of mass of a rigid body translation.
If the center of mass is fixed, preventing its translation, it is possible to appreciate that
the solid is only rotating. Then, the motion of a solid can be analyzed as the composition
of the translational movement of its center of mass with respect to a system of reference
and the rotation about an axis that passes through the center of mass. The Newton–Euler
Electronics 2021, 10, 2218 11 of 33
formulation describes the dynamics of this process and has been commonly used in this
type of dynamic models [11,12,19,20].
To formulate a mathematical model of a quadcopter, it is essential to account for all the
aspects related to the forces and torques acting on the vehicle. The model can be developed
in two parts as dynamics of linear and angular movements. The main aim is to find the
dynamic model tied to the primary system of reference, because it is the platform to control
the quadcopter. However, initially, it is required to start from the mobile model as it is the
system that experiences all the forces and torques.
∑ Fe = m × a (7)
where Fe is the total force on the primary system (earth), m is the total mass and a is the
acceleration due to the forces acting on the primary system.
L T × (sinφsinψ + cosφcosψsinθ )
∑ Fe = − LT × (cosψsinφ − cosφsinψsinθ ) (8)
L T × (cosφcosθ ) − g × m
Then, the expressions (9)–(11) were obtained to describe the accelerations in the
primary reference system:
.. L T × (sinφsinψ + cosφcosψsinθ )
x= (9)
m
.. − L T × (cosψsφ − cosφsinψsinθ )
y= (10)
m
Electronics 2021, 10, 2218 12 of 33
.. L T × (cosψcosθ − g × m)
z= (11)
m
.. .. ..
where x, y, z are the linear accelerations on the primary system.
∆L21,43 × l
τφ
τσ = ∆L42,13 × l (13)
τψ ∆D14,23 × l
where ∆L and ∆D are the increase in the lift and drag forces due to the torque increment of
the two pairs of motors, respectively, and l is the arm length.
If the motor speeds are exactly the same, the sum of these velocities would be zero and
then it can be said that the quadcopter is stable. Conversely, if the speeds of the motors are
not the same, a torque due to the gyroscopic effect occurs [41], and this torque is described
by Equation (14):
.. 0
Gyb = ITP × η b × −q p 0 (14)
Then, the angular accelerations in the secondary reference system were obtained and
are given by Equations (15)–(17):
. . . . .
.. Iyy × q × r − Izz × q × r − ITP × q × Ω2 + τφ
p= (15)
Ixx
. . . . .
.. ITP × p × Ω2 + τσ − Ixx × p × r + Izz × p × r
q= (16)
Iyy
. . . .
.. τψ + Ixx × p × q − Iyy × p × q
r= (17)
Izz
.. .. ..
where p, q and r are the angular accelerations on the secondary system, ITP is the total
inertia of the propellers and Ω is the rotor’s angular velocity.
By making the projection using the S matrix, the angular accelerations in the primary
system can be obtained:
.. ..
ηe = S × ηb (18)
.. ..
where η e and η b are the angular acceleration vectors on the primary and secondary systems,
respectively, and S is the angular acceleration matrix.
The expressions describing the angular accelerations in the primary reference system
are given by Equations (19)–(21):
. . .
.. ITP ×q×Ω2 τ ( Iyy − Izz )×q×r
φ= Ixx + Ixxφ + Ixx
. . .
sinφ×tanθ ×(− ITP × p×Ω2 +τθ +( Izz − Ixx )× p×r )
(19)
+ Iyy
Electronics 2021, 10, 2218 13 of 33
. . .
.. cosφ × − ITP × p × Ω2 + τθ + Izz − Iyy × p × r sinφ × τψ
θ= + (20)
Iyy Izz
. . .
sinφ × − ITP × p × Ω2 + τθ + Izz − Iyy × p × r
.. cosφ × τψ
ψ= − (21)
Iyy × cosφ Izz × cosφ
.. .. ..
where φ, θ and ψ are the angular accelerations on the primary system.
Once the mathematical model of the quadcopter was obtained, it was necessary to
determine the specifications (i.e., the basic mass and size data) and parameters (i.e., the
moment of inertia and other coefficients contained in the equations of the model). As
per the previous studies reported in the literature, a quadcopter can be designed with
different configurations: “+”, “H” or “×”. The “+” configuration presents a greater ease
of calculating the moment of inertia of the engines which are located on the coordinate
axes, but the movements are generated by a single motor. However, in this study, the
“×” configuration was chosen to leverage the power of thrust to be offered by a couple of
motors. It was assumed that this would allow the aerobatic maneuvers to be performed
more easily. For calculating the moment of inertia, the components of the vehicle (i.e.,
motors, blades, etc.) were assumed as cylinders. Due to the “×” configuration (as shown
in Figure 2a), no component coincides with the main axis; thus, in comparison with the
“+” configuration, the calculations are relatively more complex.
Figure 2. Inertial model of the quadcopter: (a) full model, (b) arms.
Of the components, the chassis presented difficulties in calculating the inertia. With
the “+” configuration, it is possible to assume that the frame is composed of two cross
cylinders that coincide with the main axis, whereas with the “×” configuration, none of
these cylinders are coincided. Hence, to obtain the moment of inertia of the chassis, it
was assumed that the arms are composed of multiple concatenated cylinders as shown
in Figure 2. This was the simplest solution, because of its resemblance to the calculations
used to find the inertia of the engines.
L T × (sinφsinψ + cosφcosψsinθ )
x (s) = (22)
m × s2
− L T × (cosψsinφ − cosφsinψsinθ )
y(s) = (23)
m × s2
L T × (cosψcosθ − g × m)
z(s) = (24)
m × s2
Electronics 2021, 10, 2218 14 of 33
. . .
cosφ × − ITP × p × Ω2 + τθ + Izz − Iyy × p × r sinφ × τψ
θ (s) = 2
+ (26)
Iyy × s Izz × s2
sinφ × − ITP × p × Ω2 + τθ + Izz − Iyy × p × r
cosφ × τψ
ψ(s) = 2
− (27)
Iyy × cosφ × s Izz × cosφ × s2
For the design of the control system, the non-linear dynamic system was reduced to
a linear system by assuming that the quadcopter works with very small angles [42] (i.e.,
approximating the sine values to zero and the cosine values to one). Furthermore, since the
angles are assumed to be very small, the angular speeds experienced by the quadcopter’s
body would also be approximated to be equal to zero. With these assumptions, a simplified
model of the quadcopter was obtained and given by the Equations (28)–(33).
x (s) = 0 (28)
y(s) = 0 (29)
1 LT
z(s) = 2 × −g (30)
s m
τφ
φ(s) = 2 (31)
s × Ixx
τ
θ (s) = 2 θ (32)
s × Iyy
τψ
ψ(s) = − (33)
s2 × Izz
To verify the performance, both the non-linear and the simplified models were sim-
ulated with unit step inputs. The results showed very similar behaviors between both
models, and this confirms the accuracy of the simplified linear model. Based on the ob-
tained model, two types of controllers were designed: a PID controller and two Fuzzy-PD
controllers (i.e., Mandami and Sugeno). One of the major aims of this study is to verify
whether a PID controller is sufficient to perform the basic maneuvers of a quadcopter, and
to determine when the implementation of a non-linear controller is required. Subsequently,
a GA is employed to improve the controllers’ capabilities and performance.
The tuning was carried out through the MATLAB optimization tool (see Figure 4).
The optimization tool adjusts the inputs to achieve the desired output signal based on the
pre-defined conditions. The simulation was carried out until it found the best possible
combination of parameters that could match the output signal to the desired signal.
Figure 4. Tuning of the PID controller using the MATLAB optimization tool.
The PID controller responded accurately when the model was subjected to the trajec-
tories with little variations. However, under stringent conditions such as sudden turns
or sudden changes in altitude, these controllers began to lose the reference due to the
non-linearities present in the model. Because of this limitation, the quadcopter was not
able to make extreme turns or to perform acrobatic maneuvers. Each time a simulation was
carried out, the model deviated from its linearity conditions, and hence, the PID controller
required re-tuning of its gains. Therefore, the implementation of a supportive algorithm
that provides the model with the necessary information on the changes in key parameters
(or to update the gains of the controller) should be useful in achieving the desired stability.
have a linguistic meaning such as “negative”, “positive” or “zero”. After defining the
rule-base and the membership functions, the controller’s operation includes three stages:
fuzzification, inference and defuzzification. Fuzzification introduces input data, and they
are processed to calculate the degree of membership that they will have on the controller.
At the inference stage, the degree of membership in the input data is considered, and a
decision is taken in the output space. Overall, the decisions are based on the scope of
knowledge defined by the expert.
In this work, the fuzzy controller design was performed with the MATLAB Fuzzy
Toolbox, which provides a simple and intuitive interface. Mamdani-type [43] and Sugeno-
type [44] inference mechanisms were used to design these controllers. The design was
carried out by analyzing the input and output signals of the previously designed PID
controller discussed in Section 2.2.1. The behavior of the proportional, derivative and
integral components of the PID controller was separately observed and the results were
recorded for each time instant. The main idea was to understand the operation of the PID
controller to set the initial platform of the fuzzy control.
Initially, the objective was to design a Fuzzy-PID controller, but due to certain difficul-
ties, it was decided to design a Fuzzy-PD controller. The Fuzzy-PID required an extensive
rule base (due to the number of inputs, the error, its derivative and integral), which would
mean a higher computational cost. Finally, it was concluded that the problem with the
Fuzzy-PID was due to the integral gain, and hence, it was decided to suppress this input.
As a result, it was possible to simplify the rule base and in turn reduce the computational
cost. If the Fuzzy-PD controller could work well with proportional and derivative gains,
then the integral part could be added at a later stage to improve the performance. In this
way, the Fuzzy-PD + I controller would be able to provide all the advantages of a parallel
PID controller (the advantage offered by the integral part is given by its ability to consider
past information). Once the Fuzzy-PD controller was designed, the integral action was
added and it was observed that the error continued to be integrated indefinitely (i.e., the
response had the “windup” effect). Once the problem was analyzed, two solutions were
proposed: implementing an “anti-windup” or working only with the Fuzzy-PD controller.
Finally, it was decided to eliminate the integral gain, and a Fuzzy-PD system as shown in
Figure 5 was used.
After selecting the controller arrangement, the two Fuzzy-PD controllers (i.e., Mam-
dani and Sugeno) were designed.
The next step was to create a table of possible combinations of inputs and their
potential outputs (i.e., the rule base). Moreover, this table must fulfil the control law of a
PD controller as well which is given by a continuous-time transfer function presented in
Equation (34):
U ( s ) = K p + Kd × s (34)
This means that when K p = −Kd × s, the control signal should be U (s) = 0. With this
logic, the identification of the outputs was made as illustrated in Figure 7a. Then, the rule
base for the Fuzzy-PD was implemented using MATLAB. Nine rules were defined in total,
and the corresponding control surface is shown in Figure 7b.
Figure 7. (a) Fuzzy outputs identification, (b) Mamdani Fuzzy–PD control surface.
Figure 9 shows the control surface obtained for the Fuzzy-PD controller with the
Sugeno type fuzzy system. Moreover, Figure 9 shows that the surface is non-linear and
offers a gradual evolution without abrupt changes. Achieving a smooth surface was the
initial requirement considered.
Figure 9. (a) Sugeno Fuzzy–PD rule base, (b) Sugeno Fuzzy–PD control surface.
Similar to the PID controller, the tuning of the gains for both controllers was performed
through experimentation using the MATLAB optimization tool. The experimental tuning
was realized by introducing a unit step input and executing the required actions. The gain
allocated to the output of the Fuzzy-PD controller (Kf ) is a scale factor which was the same
gain used for the previously designed PID controller, as well. The tuning of the fuzzy
controllers is an arduous task that consumes lots of time. However, the time here was
substantially reduced thanks to the optimization tool in MATLAB.
Simulations were performed with both the Mamdani type and Sugeno type Fuzzy-PD
controllers and excellent results were achieved compared to the PID controller. Moreover,
it was observed that the Sugeno type Fuzzy-PD controller showed the worst performance
in terms of tracking complicated trajectories (i.e., acrobatic maneuvers), as will be shown in
Section 4. By re-tuning, it was possible to improve its performance, and it was concluded
that the Sugeno Fuzzy-PD controller requires an adaptive adjustment of the gains to offer
the most optimal response. On the other hand, the Mamdani Fuzzy-PD controller showed
excellent performance in the majority of the tests (see Section 4).
Electronics 2021, 10, 2218 19 of 33
GA Code Explanation
The elaboration of the GA is carried out following the methodology presented in a
previous work [45]. First, the objective function is defined, which is the function of error.
The error is a function of the reference signal, the plant and the expression of the controller,
which in turn is a function of the gains. Then, the input parameters of the controller must
be able to minimize the error.
Another important aspect is representation. It is necessary to encode the decision
variables in a binary string. In the case of having three gains, sixteen bits must be used
to represent a single variable (Kp , Ki or Kd ). The assignment of the binary string to a real
number is performed by the following expression presented in Equation (35):
up_rang − low_rang
Var = dec_val × (35)
2bit_length
− 1 + low_rang
Thus, the total length of a chromosome is 48 bits: 16 for Kp , 16 for Ki and 16 for Kd .
The next step is to create an initial population. It is stipulated that in each generation,
the size of the population is 20. The initial population is generated randomly, thus obtaining
an initial population of 960 (i.e., 20 × 48 bits).
Once the initial population is generated, the first step is the evaluation, that is to
calculate the fitness value of each member. This step has three sub-steps:
1. Conversion of the genotype of a chromosome to its phenotype by converting the
binary chains into the corresponding real values.
2. Evaluation of the objective function by obtaining its value.
3. Conversion of the value of the objective function into an adjustment value where the
fitness of each chromosome is equated to the objective function (i.e., evaluated for
each chromosome) minus the maximum value obtained for the objective function. In
this way, the chromosomes of a better fit are determined. In this work, these were the
chromosomes with the lowest value.
Once the evaluation is complete, a new population is created based on the current
generation. In this part, the reproduction, selection and crossing and mutation operators
are used.
1. Reproduction: It can live and have offspring in the second population to the chromo-
somes that showed the best fit (i.e., the minimum value).
Electronics 2021, 10, 2218 20 of 33
2. Selection and Crossing: The crossing is based on the calculation of the cumulative
probability. This is carried out to decide which chromosomes will be selected for the
crossover. This has three steps: calculating the total fit, calculating the probability of
each chromosome and finally calculating the cumulative probability. The crossing
method used was the Xover point, where a cut-off point is randomly selected and the
parents in the right-hand side are exchanged to generate an offspring.
3. Mutation: The mutation is performed after the crossing by altering one or more genes
with a probability equal to the mutation rate. In this case, the probability of mutation
is 0.01. A population is generated as a function of the initial value (i.e., 20) and the
number of bits (i.e., 48) and the last bit is changed from 1 to 0, and vice versa. The
elite chromosomes of the above population are not subject to mutation, so after the
mutation, they are restored. After an iteration of the GA, a new population is created.
The procedure is repeated until there is no improvement in the best member of each
generation after 20 iterations.
After the GA was implemented, the operational limits of the parameters were found,
and the system was simulated showing promising results. The autotuned PID control
system was able to pass the most demanding tests, and its level of performance is discussed
in detail in Section 4.
associated to the input signals, but the controller showed a high sensitivity to the output,
and some variation was reflected in the output, showing jumps and punctual losses of the
reference. After analyzing the problem, it was decided that part of the faults could be due
to the integral component, which had the “windup” effect. Initially, it was suggested to
implement an “anti-windup”, but finally, it was decided to design a Fuzzy-PD controller, as
it would allow the elimination of the cited parameter (which was also presenting problems),
resulting in a less complex system. The adjustment of the autotuned GA-Sugeno Fuzzy-PD
ranks was less complex. Initially, it was proposed not to adjust the membership functions
and only to configure the parameter ranges. The ranges for a unit step signal were set
and the system responded accurately, but it could not respond to the maximum inputs
(i.e., 360 degrees). This would prevent the quadcopter from making extreme turns and
is therefore not acceptable. The adjustment was then made using the same parameters
multiplied by other parameters until the system started responding to the 360-degree step
input. Once this was achieved, the system began to accurately respond to all sorts of entries.
It should be noted that the ranges of the parameters are very sensitive and even a minimal
modification could make the system stop working accurately. However, we have found
the optimal ranges that make the system a robust system.
3. 3D Simulator Development
A 3D simulator was developed to observe the behavior of the quadcopter in an intu-
itive way which would enable further analysis of the proposed controllers’ performance
and to explore the possible errors. Initially, the controllers were developed and the simu-
lation results were used to fine-tune the controllers to achieve satisfactory performance.
After achieving satisfactory results, the simulator was designed using MATLAB.
A dynamic model offers the possibility of obtaining movements performed in x, y and
z planes. Therefore, it is possible to place the quadcopter in 3D space and to draw and
examine the paths described by the vehicle. Here, defining of a point describing the path
was possible, but it was impossible to see the rotation of the vehicle on its own axis while it
was moving. The fundamental idea was then to consider the data that gave the dynamic
model (i.e., linear and angular displacements) and provide these to the program written in
MATLAB for plotting the points that draw the quadcopter’s movement in real time. The
main path described by the quadcopter was taken as the crucial point and this means that
this point would be the main coordinate to follow and plot the vehicle’s movement. This
point coincided with the physical center of the model and it allowed the plotting of the
vectors corresponding to the four arms that were traced with respect to the central point.
However, the arms had an additional difficulty as they moved around the central point
according to the maneuvers assigned. Hence, the coordinates of the arms would be four
free points in the space and are related to each other like two cross vectors. Therefore, the
only option was to use the Euler angles to know their orientation. To obtain the coordinates
of the points that would indicate the orientation of the vehicle, arrays of homogeneous
transformations were defined, and these provide the rotations and translations of the new
points of orientation with respect to the central point.
Upon the completion of the design of the simulator, the corresponding characteristics
were considered as necessary (i.e., displaying the path/s, the visualization of the speed
of the engine in revolutions per minute (rpm)). To obtain the speed of the rotors, it was
necessary to design a new circuit, and the sole purpose of this circuit was to separate the
control signals to obtain the speeds of each engine. First, it was necessary to know that
the inputs to the controllers are the speed changes between the pairs of rotors and then
the controllers offer the corrected signals in their outputs. Then, the controllers’ signals
are introduced into the plants of the dynamic model in order to apply corrective actions.
With this, it was possible to obtain each motor’s speed in rpm. Table 1 shows the relevant
information on the allocation of speed rates (only for a couple of engines in each plant),
which were considered in the design of the circuit for the separation of signals.
Electronics 2021, 10, 2218 23 of 33
Figure 13. Fuzzy–PD response (the same for Mandami and Sugeno types) to a step of 10◦ with a
disturbance of 5◦ .
It can be concluded that the PID controller could perform with the non-linear model,
only with small angles and when no more than two inputs were introduced to the model.
This is because when the system is working with simple paths, the dynamic model is not
susceptible to many variations (i.e., the system becomes a little more static or constant
over time and this condition was not unfavorable for the PID controller). On the other
Electronics 2021, 10, 2218 24 of 33
hand, it can be observed that the Fuzzy-PD controller proved to reach the reference with
slightly less settling time than that of the PID controller. Such a difference in the settling
time may be due to the adjustment of the gains. Tests with the non-linear model showed
that the Fuzzy-PD controller is well adapted to all kinds of reference signals, but it showed
difficulties when following acrobatic trajectories. Therefore, both the controllers required
the implementation of a GA to improve their capabilities.
Figures 14–18 illustrate the simulation results of the five control systems designed, PID,
Mandami Fuzzy-PD, Sugeno Fuzzy-PD, autotuned GA-PID and autotuned GA-Sugeno
Fuzzy-PD, performing on a very complex track. From these figures, it is possible to
appreciate the benefits of the implementation of a GA with both controllers. The details
relevant to these figures are given in Table 2.
Figure 14. PID simulation results. (a) Altitude plant, (b) roll plant, (c) pitch plant, (d) yaw plant.
Electronics 2021, 10, 2218 25 of 33
Figure 15. Mamdani Fuzzy–PD simulation results. (a) Altitude plant, (b) roll plant, (c) pitch plant,
(d) yaw plant.
Figure 16. Sugeno Fuzzy–PD simulation results. (a) Altitude plant, (b) roll plant, (c) pitch plant,
(d) yaw plant.
Electronics 2021, 10, 2218 26 of 33
Figure 17. Autotuned GA–PID simulation results. (a) Altitude plant, (b) roll plant, (c) pitch plant,
(d) yaw plant.
Figure 18. Autotuned GA–Sugeno Fuzzy–PD. (a) Altitude plant, (b) roll plant, (c) pitch plant, (d) yaw
plant.
Electronics 2021, 10, 2218 27 of 33
Figure 14 indicates the results of the four PID controllers. A satisfactory performance
can be observed when the plants are subjected to conditions of minor variations. However,
as the complexity of the trajectories increases, the controllers begin to fail by losing the
references and then follow undesired trajectories. As shown in Figure 14b,c, the roll and
pitch actions are conflicting, and this is because they are sharing variables and for this
reason both can feel the modifications that exist between them. As a result, the stabilization
of the roll and pitch plants (see Figure 14b,c) are achieved approximately at t = 9 s and t = 6 s,
respectively. By means of experimentation, it has been verified that the PID controllers
manage to stabilize the system in all cases, but these demand the variation of the gains in
each simulation.
Figure 15 shows the simulation results achieved from the Mamdani Fuzzy-PD con-
trollers. At first glance, a noticeable improvement can be observed when following the path
in comparison with the PID controllers. This is due to the ability of the fuzzy controllers
to work under non-linear conditions. These controllers show promising results without
needing a GA. What is striking is the response to the disturbance at the altitude plant. As
is shown in Figure 15a, it seems that the controller does not show any response when a
disturbance occurs, and it is able to follow the reference with a high degree of accuracy. It
should be stated that a good design of a fuzzy controller is more than enough to cover the
control demands that the model of a quadcopter requires.
Figure 16 shows the results obtained for the Sugeno Fuzzy-PD controller. It is observed
that the performance of this controller is better than that of the PID controller and manages
to follow the reference well. However, it shows problems when dealing with acrobatic
trajectories in the roll and pitch plants at t = 2 s (see Figure 16b,c). Hence, it was decided to
reduce the speed of response of the controller, but after some tests, it could be seen that it
did not respond to abrupt changes in an efficient manner. For this reason, this configuration
gave large overshoots when sudden changes in the trajectory occurred. Therefore, as with
the PID controller, the gains have been re-tuned, and the results have found to be better,
and hence it was concluded that these controllers also required automatic tuning of the
gains.
Figure 17 shows the results of the autotuned GA-PID controller. It can be observed
that the algorithm works efficiently by providing the appropriate parameters to the PID
controller. The controller was subjected to highly demanding trajectories and the results
have been excellent in all tests. In the pitch graph shown in Figure 17c, there is still a small
error at t = 2 s which was effectively corrected. Moreover, the controller of each plant was
able to respond successfully to the disturbances.
Figure 18 shows the results of the autotuned GA-Sugeno Fuzzy-PD controller. The
first point that stands out is the pitch plant error, as shown in Figure 18c at t = 2 s. In this
controller the error is bigger than that shown in Figure 17c (autotuned GA-PID). This is
because the controller’s response is faster than the autotuned GA-PID and for this reason,
there is an overshoot. The response curve of the GA-Sugeno Fuzzy-PD makes it faster than
the GA-PID for large changes in the quadcopter’s trajectory, but the PID is faster for small
variations. This is clear from the details presented in Table 3 as the GA-PID is faster in most
cases with the applied unit inputs (i.e., step, ramp and parabolic). On the other hand, it can
be noticed that the GA-Sugeno Fuzzy-PD presents no overshoot. This could be due to the
fact that the precision of the controller increases with the path changes with low demands.
Electronics 2021, 10, 2218 28 of 33
Then, the precision of this controller would be compromised in the face of large changes in
the plant where a higher response speed would be required, giving rise to the overshoot,
as can be observed in Figure 18c at t = 2 s. The autotuned GA-Sugeno Fuzzy-PD controller
was subjected to several tests with different input values, and all have been successful. It
can be concluded that, owing to the implemented GA, the system is now able to adapt to
the most adverse conditions, such as spins on the axis, loops or other acrobatic trajectories.
The quadcopter’s behavior with the proposed control system (as illustrated by the
3D simulator) is presented in Figures 19 and 20. The speed of each motor is indicated in
rpm. The screw trajectory shown in Figure 19 shows the quadcopter’s response when an
Electronics 2021, 10, 2218 29 of 33
undefined turn is introduced into the yaw axis. It is possible to appreciate that the vehicle
realizes a displacement of elevation while turning on its own axis. This is because initially,
the quadcopter is in the rest position (i.e., in the ground at zero meters elevation) and
when
the the simulation
simulation starts,
starts, the the motors
motors increaseincrease their
their speed speed
until the until thetakes
vehicle vehicle
off, takes
in thisoff, in
case,
up
thistocase,
a 1mupheight
to a 1m in height
the “Z”inaxis. Thisaxis.
the “Z” fact This
can befactappreciated by observing
can be appreciated the central
by observing the
trajectory described
central trajectory with redwith
described circles
redwhere
circlesthe circles
where theare initially
circles separated
are initially as the vehicle
separated as the
is moving up. When it reaches its steady state, the vehicle stops and the
vehicle is moving up. When it reaches its steady state, the vehicle stops and the red circles red circles are
accumulated in the same position. Thanks to this, it is possible to observe
are accumulated in the same position. Thanks to this, it is possible to observe the rotation the rotation of
the vehicle
of the on on
vehicle its its
own ownaxis, which
axis, which describes
describesa screw
a screwmaneuver.
maneuver.
1.4 3821.7001
m2
3249.78
1.2
3821.7001 m1
1 m3
3249.78
0.8 m4
Z
0.6
0.4
0.2
0 0.4
-0.4 0.2
-0.2 0
0
0.2 -0.2
0.4 -0.4 Y
X
Figure 19.
Figure 19. The quadcopter’s operation along a spiral path.
Figure 20 illustrates the simulation of the quadcopter by making a movement along
the “X”Figure
axis.20 illustrates
Figure the simulation
20a shows of the quadcopter
the three-dimensional image by making trajectory
of another a movement along
executed
the “X” axis. Figure 20a shows the three-dimensional image of another trajectory
by the vehicle, from its takeoff at the origin (X = 0, Y = 0, Z = 0) until the beginning of the executed
by the vehicle,
movement from
in the its takeoff
negative at theoforigin
direction the “X” (X axis
= 0, (i.e.,
Y = 0,the
Z =backward
0) until the beginning of the
movement).
movement in the negative direction of the “X” axis (i.e., the backward
Figure 20b shows a top view where the rpm of each motor is observed in more detail. movement).
It canFigure
be seen 20b shows
that a top view where
the displacement of thethevehicle
rpm ofiseach
made motor
by theis observed
thrust of in more detail.
engines 1 and
3 (i.e., 5141.91 rpm), while engines 2 and 4 are responsible for keeping the vehicle1 at
It can be seen that the displacement of the vehicle is made by the thrust of engines and
a
3 (i.e., 5141.91 rpm), while
constant height (i.e., 3712.47 rpm). engines 2 and 4 are responsible for keeping the vehicle at a
constant
Afterheight
several(i.e., 3712.47 rpm).
simulations with the simulator, it was verified that the responses of
the dynamic model are compatible with the characteristics that were attributed to the
quadcopter during its design stage. It means that a stationary state is obtained at about
3500 rpm and the thrust is realized using two motors (i.e., “×” configuration), while the
twists and turns originate correctly.
It is evident from the results that the PID controllers were able to provide satisfactory
performance when following simple paths, but failed when performing complex acrobatic
maneuvers. Fuzzy-PD controllers outperformed the PID controllers in this regard, but still,
the Sugeno Fuzzy-PD controller exhibited problems when dealing with acrobatic trajecto-
ries. The autotuned GA-PID and autotuned GA-Sugeno Fuzzy-PD controllers introduced
in this study show that the implementation of a GA could enhance the performance of
the traditional PID and Sugeno Fuzzy-PD controllers, which allowed the quadcopter to
accurately follow complex acrobatic trajectories. Furthermore, it is clear that the Mamdani
Fuzzy-PD controller was able to show excellent performance even without implementing a
GA for tuning its parameters.
The proposed approach of implementing a GA for tuning the controller parameters
has the benefit of improving the performance of traditional controllers, enabling the
quadcopter to follow complex trajectories. For applications where the quadcopter has
to follow simple trajectories only, a traditional PID controller can be equipped with a
GA to improve its performance rather than using a more complex fuzzy controller. For
quadcopter applications with more complex trajectories Fuzzy-PD controllers are more
appropriate and their performance can further be enhanced by the implementation of a
GA. However, this has several shortcomings, such as the time and effort needed to develop
Electronics 2021, 10, 2218 30 of 33
3
5141.9139
m1
3712.4675 5141.9139
2 m2 m3
3712.4675
m4
Z
0
0.5 0.5
0 0
-0.5
-0.5
Y -1 X
(a) A 3D view of the quadcopter performing a backward movement.
0.4
3712.4675 5141.9139
m2 m1
0.2
0
Y
3712.4675 5141.9139
-0.2
m4 m3
-0.4
-0.6
-1 -0.5 0 0.5
X
(b) Top view of the quadcopter performing a backward movement.
Figure20.
Figure 20.The
Thequadcopter
quadcopterexecuting
executingaabackward
backwardmovement.
movement.
5. Conclusions
After several andsimulations
Recommendationswith the simulator, it was verified that the responses of the
dynamic model are types
Five controller compatible with the characteristics
were designed for a quadcopter thatand
weretheir
attributed to the quad-
performance was
copter during
evaluated its designastage.
in simulation: PID, aItMamdani
means that a stationary
Fuzzy-PD, a Sugenostate Fuzzy-PD,
is obtainedan at autotuned
about 3500
GA-PID
rpm andand thean autotuned
thrust GA-Sugeno
is realized using two Fuzzy-PD. A paths
motors (i.e., “×” simulator was also
configuration), designed
while to
the twists
visualize
and turns the quadcopter’s
originate behavior at different paths.
correctly.
Through
It is evident the from
simulations carried
the results out,PID
that the it has been verified
controllers that to
were able theprovide
stabilization of a
satisfactory
quadcopter poses a challenge from the point of view of control
performance when following simple paths, but failed when performing complex acrobatic engineering. Despite the
effort to obtain the optimal parameters of the controllers,
maneuvers. Fuzzy-PD controllers outperformed the PID controllers in this regard, butonly the Mamdani Fuzzy-PD
controller was able
still, the Sugeno to face the
Fuzzy-PD most adverse
controller exhibited conditions.
problemsThis when controller showed
dealing with the best
acrobatic tra-
results with
jectories. most
The of the difficult
autotuned GA-PID trajectories,
and autotunedand it GA-Sugeno
did not require the implementation
Fuzzy-PD of a
controllers intro-
GA to improve
duced in this studyits performance.
show that the implementation of a GA could enhance the performance
The time taken
of the traditional PID to and
tuneSugeno
the PIDFuzzy-PD
and Fuzzy-PD controllers
controllers, whichwas substantially
allowed reducedto
the quadcopter
by the use of the MATLAB optimization tool. Moreover, it should
accurately follow complex acrobatic trajectories. Furthermore, it is clear that the Mamdani be noted that the scale
factor of the plant (placed in the output of the controllers)
Fuzzy-PD controller was able to show excellent performance even without implementing played a fundamental role in
determining the speed
a GA for tuning its parameters. of response of the plant. In other words, it was possible to achieve
a highThe degree
proposedof sensitivity.
approach The
of scale factor should
implementing a GAbe forlarge enough
tuning to work with
the controller small
parameters
gains, and in this way, the simulation and the adjustment process
has the benefit of improving the performance of traditional controllers, enabling the quad-become a bit simpler and
more intuitive.
copter to follow complex trajectories. For applications where the quadcopter has to follow
simple trajectories only, a traditional PID controller can be equipped with a GA to im-
prove its performance rather than using a more complex fuzzy controller. For quadcopter
applications with more complex trajectories Fuzzy-PD controllers are more appropriate
Electronics 2021, 10, 2218 31 of 33
With respect to the fuzzy controllers’ design, it is recommended to work within the
limits from 0 to 1. In this way, it is easier to analyze the system boundaries by analyzing
the inputs and thus, to achieve the desired results more quickly. It has been verified that
the performance of the controllers was improved when a GA was implemented. It was
possible to observe this by subjecting the vehicle to the most demanding conditions (i.e.,
difficult trajectories) where the PID and Fuzzy-PD controllers required a re-adjustment of
the gains for such conditions.
Other conclusions related to this work can be drawn as follows:
• For the quadcopter design, the “× ” configuration was chosen for achieving better
propulsion for the execution of acrobatic maneuvers. However, this choice led to
complex calculations of the moments of inertia. On the other hand, the “+” configura-
tion would be simpler in mathematical design and would provide a perfect rotation
around its own axis due to the rotors acting in the same axis, where the vehicles with
“×” configuration may fall slightly downward in this case.
• Even though the PID is a type of linear control system, it can be used with non-linear
systems whenever working with a range of low values (i.e., in this case small angles
and simple paths) and a high degree of accuracy is not required, given the conditions
in indoor flights. However, the Fuzzy-PD controllers showed effectiveness with large
angles and complex paths.
• The development of the PID could be improved by adding an anti-windup module
to avoid the saturation. If so, the PID controller could have offered slightly better
responses to non-linear conditions.
• The simulator proved to be a very useful tool in visualizing the paths and indicated
when the dynamic model was not working properly. Hence, it was possible to investi-
gate the issues in calculations to obtain an accurate dynamic model.
We would like to comment that the project is not closed yet, and that the dynamic
model is currently being reviewed for a better definition with the aim of approaching more
towards the real model.
In the future, novel solutions will be presented by the implementation of new con-
trollers based on neural networks as well as a more intensive analysis of what has been
achieved to date. Finally, we would like to emphasize that the use of a GA has exceeded
expectations and it has proven to be a vital tool in achieving quadcopter stability.
Author Contributions: Conceptualization, I.S.L. and C.A.; methodology, I.S.L.; software, I.S.L.;
validation, I.S.L., C.A. and Y.S.P.; formal analysis, I.S.L. and C.A.; investigation, I.S.L.; resources, I.S.L.
and C.A.; data curation, I.S.L.; writing—original draft preparation, I.S.L., C.A. and Y.S.P.; writing—
review and editing, I.S.L., C.A. and Y.S.P.; visualization, I.S.L.; supervision, C.A. and Y.S.P.; project
administration, I.S.L., C.A. and Y.S.P. All authors have read and agreed to the published version of
the manuscript.
Funding: This research received no external funding.
Conflicts of Interest: The authors declare no conflict of interest.
Abbreviations
References
1. Hoffmann, G.; Huang, H.; Waslander, S.; Tomlin, C. Quadrotor Helicopter Flight Dynamics and Control: Theory and Experiment.
In Proceedings of the AIAA Guidance, Navigation and Control Conference and Exhibit, Hilton Head, South Carolina, 20–23
August 2007. [CrossRef]
2. Huang, H.; Hoffmann, G.M.; Waslander, S.L.; Tomlin, C.J. Aerodynamics and control of autonomous quadrotor helicopters in
aggressive maneuvering. In Proceedings of the 2009 IEEE International Conference on Robotics and Automation, Kobe, Japan,
12–17 May 2009; pp. 3277–3282. [CrossRef]
3. Bolandi, H.; Rezaei, M.; Mohsenipour, R.; Nemati, H.; Smailzadeh, S.M. Attitude Control of a Quadrotor with Optimized PID
Controller. ICA 2013, 04, 335–342. [CrossRef]
4. Sahul, M.P.V.; Chander, V.N.; Kurian, T. A novel method on Disturbance Rejection PID Controller for Quadcopter based on
Optimization algorithm. IFAC Proc. Vol. 2014, 47, 192–199. [CrossRef]
5. Ahmad, F.; Kumar, P.; Bhandari, A.; Patil, P.P. Simulation of the Quadcopter Dynamics with LQR based Control. Mater. Today Proc.
2020, 24, 326–332. [CrossRef]
6. Nguyen, N.T.; Prodan, I.; Stoican, F.; Lefèvre, L. Reliable nonlinear control for quadcopter trajectory tracking through differential
flatness. IFAC-PapersOnLine 2017, 50, 6971–6976. [CrossRef]
7. Al-Mahturi, A.; Santoso, F.; Garratt, M.A.; Anavatti, S.G. Nonlinear Altitude Control of a Quadcopter Drone Using Interval
Type-2 Fuzzy Logic. In Proceedings of the 2018 IEEE Symposium Series on Computational Intelligence (SSCI), Bangalore, India,
18–21 November 2018; pp. 236–241. [CrossRef]
8. Ferdaus, M.M.; Hady, M.A.; Pratama, M.; Kandath, H.; Anavatti, S.G. RedPAC: A Simple Evolving Neuro-Fuzzy-based Intelligent
Control Framework for Quadcopter. In Proceedings of the 2019 IEEE International Conference on Fuzzy Systems (FUZZ-IEEE),
New Orleans, LA, USA, 18–21 June 2019; pp. 1–7. [CrossRef]
9. Amir, M.Y.; Abbass, V. Modeling of Quadrotor Helicopter Dynamics. In Proceedings of the 2008 International Conference on
Smart Manufacturing Application, Goyang-si, Korea, 9–11 April 2008; pp. 100–105. [CrossRef]
10. Pounds, P.; Mahony, R.; Corke, P. Modelling and control of a large quadrotor robot. Control. Eng. Pract. 2010, 18, 691–699.
[CrossRef]
11. Morar, I.-R.; Nascu, I. Model simplification of an unmanned aerial vehicle. In Proceedings of the 2012 IEEE International
Conference on Automation, Quality and Testing, Robotics, Cluj-Napoca, Romania, 24–27 May 2012; pp. 591–596. [CrossRef]
12. Sa, R.C.; Barreto, G.A.; de Araujo, A.L.C.; Varela, A.T. Design and construction of a quadrotor-type unmanned aerial vehicle:
Preliminary results. In Proceedings of the 2012 Workshop on Engineering Applications, Bogota, Colombia, 2–4 May 2012; pp. 1–6.
[CrossRef]
13. Fernando, H.C.T.E.; de Silva, A.T.A.; de Zoysa, M.D.C.; Dilshan, K.A.D.C.; Munasinghe, S.R. Modelling, simulation and
implementation of a quadrotor UAV. In Proceedings of the 2013 IEEE 8th International Conference on Industrial and Information
Systems, Peradeniya, Sri Lanka, 17–20 December 2013; pp. 207–212. [CrossRef]
14. Barve, J.; Patel, K. Modelling, Simulation and Altitude-Range-Analysis of Quad-copter UAV. IFAC Proc. Vol. 2014, 47, 1126–1130.
[CrossRef]
15. Hull, D.G. Fundamentals of Airplane Flight Mechanics; Springer: Berlin/Heidelberg, Germany; London, UK, 2007.
16. Alkamachi, A.; Erçelebi, E. Modelling and Genetic Algorithm Based-PID Control of H-Shaped Racing Quadcopter. Arab. J. Sci.
Eng. 2017, 42, 2777–2786. [CrossRef]
17. Patrascu, M.; Hanchevici, A.B.; Dumitrache, I. Tuning of PID Controllers for Non-Linear MIMO Systems Using Genetic Algorithms.
IFAC Proc. Vol. 2011, 44, 12644–12649. [CrossRef]
18. Lim, H.; Park, J.; Lee, D.; Kim, H.J. Build Your Own Quadrotor: Open-Source Projects on Unmanned Aerial Vehicles. IEEE Robot.
Automat. Mag. 2012, 19, 33–45. [CrossRef]
19. Argentim, L.M.; Rezende, W.C.; Santos, P.E.; Aguiar, R.A. PID, LQR and LQR-PID on a quadcopter platform. In Proceedings of
the 2013 International Conference on Informatics, Electronics and Vision (ICIEV), Dhaka, Bangladesh, 17–18 May 2013; pp. 1–6.
[CrossRef]
20. Boudjit, K.; Larbes, C. Control and stabilization applied to micro quadrotor AR.Drone. In Proceedings of the 3rd International
Conference on Application and Theory of Automation in Command and Control Systems—ATACCS’13, Naples, Italy, 28–30 May
2013; p. 122. [CrossRef]
21. Thu, K.M.; Gavrilov, A.I. Designing and Modeling of Quadcopter Control System Using L1 Adaptive Control. Procedia Comput.
Sci. 2017, 103, 528–535. [CrossRef]
22. Hovakimyan, N.; Cao, C. L1 Adaptive Control Theory: Guaranteed Robustness with Fast Adaptation; Society for Industrial and Applied
Mathematics: Philadelphia, PA, USA, 2010.
Electronics 2021, 10, 2218 33 of 33
23. Njinwoua, B.J.; Wouwer, A.V. Cascade attitude control of a quadcopter in presence of motor asymmetry. FAC-PapersOnLine 2018,
51, 113–118. [CrossRef]
24. Cedro, L.; Wieczorkowski, K. Optimizing PID controller gains to model the performance of a quadcopter. Transp. Res. Procedia
2019, 40, 156–169. [CrossRef]
25. Paredes, J.; Sharma, P.; Ha, B.; Lanchares, M.; Atkins, E.; Gaskell, P.; Kolmanovsky, I. Development, implementation, and
experimental outdoor evaluation of quadcopter controllers for computationally limited embedded systems. Annu. Rev. Control.
2021, S1367578821000420. [CrossRef]
26. Hoffmann, F. Evolutionary algorithms for fuzzy control system design. Proc. IEEE 2001, 89, 1318–1333. [CrossRef]
27. Zulfatman, Z.; Rahmat, M.F. Application of self-tuning fuzzy pid controller on industrial hydraulic actuator using system
identification approach. Int. J. Smart Sens. Intell. Syst. 2009, 2, 246–261. [CrossRef]
28. Santos, M.; López, V.; Morata, F. Intelligent Fuzzy Controller of a Quadrotor. In Proceedings of the 2010 IEEE International
Conference on Intelligent Systems and Knowledge Engineering, Hangzhou, China, 15–16 November 2010; pp. 141–146. [CrossRef]
29. Sydney, N.; Smyth, B.; Paley, D.A. NSydney; Smyth, B.; Paley, D.A. Dynamic control of autonomous quadrotor flight in an
estimated wind field. In Proceedings of the 52nd IEEE Conference on Decision and Control, Firenze, Italy, 10–13 December 2013;
pp. 3609–3616. [CrossRef]
30. Fu, C.; Olivares-Mendez, M.A.; Campoy, P.; Suarez-Fernandez, R. UAS see-and-avoid strategy using a fuzzy logic controller
optimized by Cross-Entropy in Scaling Factors and Membership Functions. In Proceedings of the 2013 International Conference
on Unmanned Aircraft Systems (ICUAS), Atlanta, GA, USA, 28–31 May 2013; pp. 532–541. [CrossRef]
31. Gautam, D.; Ha, C. Control of a Quadrotor Using a Smart Self-Tuning Fuzzy PID Controller. Int. J. Adv. Robot. Syst. 2013, 10, 380.
[CrossRef]
32. Fatan, M.; Sefidgari, B.L.; Barenji, A.V. An adaptive neuro PID for controlling the altitude of quadcopter robot. In Proceedings of
the 2013 18th International Conference on Methods & Models in Automation & Robotics (MMAR), Miedzyzdroje, Poland, 26–29
August 2013; pp. 662–665. [CrossRef]
33. Benavidez, P.; Lambert, J.; Jaimes, A.; Jamshidi, M. Landing of an Ardrone 2.0 quadcopter on a mobile base using fuzzy logic. In
Proceedings of the 2014 World Automation Congress (WAC), Waikoloa, HI, USA, 3–7 August 2014; pp. 803–812. [CrossRef]
34. Larrazabal, J.M.; Peñas, M.S. Intelligent rudder control of an unmanned surface vessel. Expert Syst. Appl. 2016, 55, 106–117.
[CrossRef]
35. Garcia-Aunon, P.; Peñas, M.S.; García, J.M.D. Parameter selection based on fuzzy logic to improve UAV path-following algorithm.
J. Appl. Log. 2017, 24, 62–75. [CrossRef]
36. Domingos, D.; Camargo, G.; Gomide, F. Autonomous Fuzzy Control and Navigation of Quadcopters. IFAC-PapersOnLine 2016,
49, 73–78. [CrossRef]
37. Yazid, E.; Garratt, M.; Santoso, F. Position control of a quadcopter drone using evolutionary algorithms-based self-tuning for
first-order Takagi–Sugeno–Kang fuzzy logic autopilots. Appl. Soft Comput. 2019, 78, 373–392. [CrossRef]
38. Pham, T.H.; Ichalal, D.; Mammar, S. LPV and Nonlinear-based control of an Autonomous Quadcopter under variations of mass
and moment of inertia. IFAC-PapersOnLine 2019, 52, 176–183. [CrossRef]
39. Ali, M.Z.; Ahmed, A.; Afridi, H.K. Control System Analysis and Design of Quadcopter in the Presence of Unmodelled Dynamics
and Disturbances. IFAC-PapersOnLine 2020, 53, 8840–8846. [CrossRef]
40. Guerrero-Sánchez, M.E.; Lozano, R.; Castillo, P.; Hernández-González, O.; García-Beltrán, C.D.; Valencia-Palomo, G. Nonlinear
control strategies for a UAV carrying a load with swing attenuation. Appl. Math. Model. 2021, 91, 709–722. [CrossRef]
41. Bresciani, T. Modelling, Identification and Control of a Quadrotor Helicopter. Master’s Thesis, Lund University, Lund, Sweden,
2008.
42. Meriam, J.L.; Kraige, L.G. Engineering Mechanics: Dynamics, 6th ed.; Wiley: Hoboken, NJ, USA, 2006.
43. Mamdani, E.H.; Assilian, S. An Experiment in Linguistic Synthesis with a Fuzzy Logic Controller. Int. J. Man-Mach. Stud. 1975, 7,
1–13. [CrossRef]
44. Takagi, T.; Sugeno, M. Fuzzy Identification of Systems and Its Applications to Modeling and Control. IEEE Trans. Syst. Man
Cybern. 1985, SMC-15, 116–132. [CrossRef]
45. Sivanandam, S.N.; Deepa, S.N. Introduction to Genetic Algorithms; Springer: Berlin/Heidelberg, Germany; New York, NY, USA,
2007.