See discussions, stats, and author profiles for this publication at: https://www.researchgate.
net/publication/361821001
Modelling and Manual Tuning PID Control of Quadcopter
Chapter in Lecture Notes in Electrical Engineering · July 2022
DOI: 10.1007/978-981-19-3923-5_30
CITATIONS READS
22 5,842
2 authors:
Nur Hayati Binti Sahrir Ariffanan Basri
University of Technology Malaysia University of Technology Malaysia
5 PUBLICATIONS 48 CITATIONS 92 PUBLICATIONS 1,478 CITATIONS
SEE PROFILE SEE PROFILE
All content following this page was uploaded by Nur Hayati Binti Sahrir on 24 January 2023.
The user has requested enhancement of the downloaded file.
Modelling and Manual Tuning PID Control
of Quadcopter
Nur Hayati Sahrir and Mohd Ariffanan Mohd Basri(&)
School of Electrical Engineering, Faculty of Engineering,
Universiti Teknologi Malaysia, UTM, 81310 Johor Bahru, Johor, Malaysia
ariffanan@fke.utm.my
Abstract. As the most common unmanned aerial vehicle either in the industry
or public, quadcopter has gained a significant interest for future technological
developments. There are vast applications of quadcopter such as aerial pho-
tography and videography, involved in search and rescue missions, spying and
more. A quadcopter is under-actuated where there are six types of motion but
only has four rotors to control the motions. In this paper, mathematical mod-
elling of a quadcopter is formulated through the fundamental of Newton-Euler
method. Varying the speed of the four rotors can produce thrust, roll, pitch and
yaw torque which results in specific movements of the quadcopter. The
Proportional-Integral-Derivative (PID) controller is employed in this study due
to its simplicity and easy to design. The PID parameters are tuned using manual
tuning technique. The quadcopter model is built and simulated with PID con-
trollers using MATLAB Simulink. The simulation results demonstrated the
effectiveness of the proposed well-tuned PID controller for altitude and attitude
stabilization of the quadcopter.
Keywords: Modelling PID controller Quadcopter
1 Introduction
There are several types of Unmanned Aerial Vehicle (UAV)s across the world.
A quadcopter or quadcopter, is one type of the multi-rotor drone’s family. For drones,
there are fixed-wing drone, multi-rotor drone, single rotor drone and hybrid drone.
Where a quadcopter falls into the multi-rotor drone’s category, there are also other type
of multi-rotor drones which are tricopter, hexacopter and octocopter which each has
three, six and eight propellers respectively. Quadcopter, on the other hand, has four
propellers and is more common and widely commercialized in the market. A quad-
copter has better stabilization mechanism compared to a tricopter and less complex
with fewer parts and lower costs than hexacopter and octocopter. As the number of
propellers increase, the drone can lift more payload. However, it also causes the drone
to house a heavier battery as there are higher current draw for flight endurance.
As the name suggests, a quadcopter has four motors which each located equidistant
from the center of body frame. Each motor actuates a rotor or propeller and they are
© The Author(s), under exclusive license to Springer Nature Singapore Pte Ltd. 2022
N. A. Wahab and Z. Mohamed (Eds.): Control, Instrumentation
and Mechatronics: Theory and Practice, LNEE 921, pp. 346–357, 2022.
https://doi.org/10.1007/978-981-19-3923-5_30
Modelling and Manual Tuning PID Control of Quadcopter 347
being used for vertical take-off, maneuver the quadcopter in the air, and landing [1].
This small yet popular and useful has come in handy for several applications such as
search and rescue after disasters, replace humans in sites which are harmful for humans
[2], aerial surveillance [3] environmental protection, management of large infrastruc-
tures, carrying certain payloads for deliveries, recreational purposes [1] and aerial
photography or videography [3, 4].
Several methods of controlling a quadcopter have been proposed from several
decades before until recent years. Those are Linear Quadratic Regulator (LQR) Con-
troller [5], Proportional-Integral-Derivative (PID) Controller [4], Fuzzy Logic Con-
troller [6], Feedback Linearization Control, Sliding Mode Control [7] and
Backstepping Control [8]. In this research, a PID controller will be used as it is widely
used in practical applications. For high-performance devices like the quadcopter, PID
controllers can only be utilized for plants with a short time delay [4]. Determination of
the controller gains is the key for designing a PID controller.
This paper aims to design a quadcopter controller and simulate the design using
MATLAB Simulink based on existing works. Since a quadcopter is an under-actuated
model, this research will be going with independent outputs (z, /; h; w) until the end.
The controller to be used is PID controller with manual tuning method.
2 Modelling of the Quadcopter
A quadcopter is an under-actuated UAV where it has only four rotors to control six
degrees-of-freedom (DOF) movement. Figure 1 shows a detailed configuration of a
quadcopter. It can be seen that two opposite rotors (F1 and F3) are rotating clockwise
while the other two (F2 and F4) rotates counterclockwise. This is based on Newton’s
Third Law which states that ‘For every action, there is an equal and opposite direction’.
This is to ensure a balance state of hovering of the quadcopter where the speed of all
rotors is the same but each two has opposite rotating direction, cancelling out the
rotating torque. Due to the torque acting in opposite direction of each propeller, if all
rotors happen to rotate clockwise, the body of the quadcopter will tend to rotate
counterclockwise and out of balance state of hovering. Several assumptions are being
made to ease the quadcopter modelling [9]:
1. The whole structure of quadcopter is assumed rigid and symmetrical with all four
rotors.
2. The quadcopter body frame origin and center of mass coincides.
3. Aerodynamic effects and surrounding wind disturbances are negligible at low
speed.
4. A relatively fast rotor dynamics but rotors are considered rigid, so blade flapping is
neglected.
348 N. H. Sahrir and M. A. Mohd Basri
Fig. 1. The quadcopter configuration
There are two frame axes taking part in this system, the earth frame and the body
frame. The earth frame is fixed regardless the location of the quadcopter while the body
frame always located at the center of quadcopter with respect to the earth frame. The
position of the quadcopter is controlled with respect to the earth frame and the ori-
entation is controlled with respect to the body frame [3]. The forces (F1, F2, F4, F4)
shown in the figure are the lift forces (or thrust forces if the quadcopter moves upward).
Conventionally, East, North, Up (ENU) coordinate system is used where x-axis points
East, y-axis points North and z-axis points upwards.
In the quadcopter, the four rotors which are fixed-located equidistant from the
center of quadcopter, are the keys for maneuvering the quadcopter itself. A total sum of
the thrust force of all rotors is the input, u1. There are translational (x, y, z) and
rotational motion of the quadcopter ð/; h; wÞ. The roll (/) movement happens when the
speed of rotor 2 increase (decreases) while the speed of rotor 4 decreases (increases),
produces an angular rotation along x-axis. The pitch (h) movement occurs when the
speed of rotor 1 increase (decreases) while the rotor 3 decreases (increases), produces
an angular rotation along y-axis. The yaw (w) movement happened when the speed of
rotor 1 and rotor 3 increase (decreases) while the speed of rotor 2 and rotor 4 decreases
(increases), produces rotation along z-axis and causes an imbalance in torque. While
keeping the total thrust at constant, the quadcopter should move around at the same
altitude (z) with changing attitude ð/; h; wÞ.
For roll and pitch orientation, even though the speed of one rotor increases while
the speed of the opposite same direction rotor decreases, it will not affect yaw instead, it
will move to another position depending on the angular rate of roll and pitch. A clearer
visualization of the quadcopter movement based on changing altitude and attitude is
shown in [10].
Modelling and Manual Tuning PID Control of Quadcopter 349
The translational dynamic equation of this quadcopter is obtained from Newton’s
Second Law and Euler’s Rotational Equation of Motion and is defined as below [9]:
€ ¼ uT Rez mgez
mC ð1Þ
where, m is the quadcopter mass, R is the rotation matrix, g is the gravitational
acceleration, ez = (0 0 1)T is the unit vector and uT is the total thrust of all four rotors.
The rotation matrix of the body frame with respect to the earth frame is given by
[11]:
2 3
ChCw S/ShCw SwC/ ShC/Cw þ S/Sw
Reb ¼ 4 SwCh S/ShSw þ C/Cw ShSwC/ S/Cw 5 ð2Þ
Sh S/Ch C/Ch
where, C(angle) represents cosine while S(angle) represents sine. Three Euler angles
namely roll angle (/), pitch angle (h) and yaw angle (w) form the orientation of the
quadcopter.
The rotational dynamic equation of this quadcopter is given by [9]:
32
s/
I x_ ¼ x Ix J r ðx ez ÞXr þ 4 sh 5 ð3Þ
sw
where, it represents all airframe body torque, gyroscopic torque and Coriolis torque. I
is the quadcopter inertia matrix, x_ is the angular acceleration vector, x is the angular
velocity vector, J r is the rotor’s inertia, Xr is the relative speed of all rotors and
s/ ; sh ; sw represent roll, pitch and yaw torque respectively.
Based on Eq. (1) and (3), the produced translational and rotational equation are as
shown below:
€x ¼ m1 ðShC/Cw þ S/SwÞU 1
€y ¼ m1 ðShCwC/ þ S/SwÞU 1
h€z ¼ m ðC/Ch ÞU 1 g
1
i
€ _ _
/ ¼ I xx I yy I zz hw J r hX
1 _ r þ lU 2 ð4Þ
h i
€h ¼ 1 ðI zz I xx Þ/_ w_ þ J r /X
_ r þ lU 3
I yy
h i
€ ¼ 1 I xx I yy h_ /_ þ U 4
w I zz
Note: Xr ¼ ðx1 x2 þ x3 x4 Þ.
The speed of each rotor is obtained from Eq. (5) [1]. As can be seen in Fig. 2, the
speeds produced are used to generate a relative speed, Xr , which is required for
quadcopter dynamics as shown in Eq. (4).
350 N. H. Sahrir and M. A. Mohd Basri
2 3 2 31 2 3
x21 KT KT KT KT U1
6 x2 7 6 0 lK T lK T 7
6 2 7¼6
2 0 7 6 4
U2 7
5 ð5Þ
4 x 5 4 lK 0 lK T 0 5 U3
3 T
x24 Kd K d Kd K d U4
Fig. 2. Simulation to produce relative speed, Xr
3 PID Controller
In this paper, PID controller is used to attenuate the error produced from the difference
of actual state and desired state [13]. This control system is also known as closed-loop
feedback system where it helps to maintain the output as nearly the same as the desired
state. This shows the robustness of the system. Both altitude and attitude controller use
PID controller to give out control inputs U1, U2, U3 and U4. All of these control inputs
are the fundamental in producing the outputs z, /; h; w.
Since this system has four PID controllers, the tuning process will start with altitude
controller first, while disconnecting the other three control inputs. The following
equations shows the PID controller equations to obtain all control inputs U1, U2, U3,
U4 which then used to produce the relative speed, Xr . Control inputs U2, U3 and U4
are produced by utilizing the angular error while U1 utilizes the altitude error [14].
Rt
U 1 ðtÞ ¼ K P ez ðtÞ þ K I 0 ez ðtÞdt þ K D ez ðtÞedtz ðt1Þ
Rt e ðtÞe ðt1Þ
U 2 ðtÞ ¼ K P e/ ðtÞ þ K I 0 e/ ðtÞdt þ K D / dt/
Rt ð6Þ
U 3 ðtÞ ¼ K P eh ðtÞ þ K I 0 eh ðtÞdt þ K D eh ðtÞedth ðt1Þ
Rt e ðtÞe ðt1Þ
U 4 ðtÞ ¼ K P ew ðtÞ þ K I 0 ew ðtÞdt þ K D w dtw
Modelling and Manual Tuning PID Control of Quadcopter 351
The steps for PID gains manual tuning starting with altitude controller are as
described below:
(1) Set the gain of KP, KI, and KD to be zero.
(2) Increase KP until the oscillations are fully sustained or nearly sustained (if fully
sustained is impossible to reach) as shown in Fig. 3. This method is recommended
to use a high simulation stop time (in this case, it is 100 s).
Fig. 3. Increase KP value
(3) Increase KD slightly to make the oscillations reduced to only 1 period as shown in
Fig. 4. Run the simulation at lower simulation stop time (in this case, it is 10 s).
This is to make tuning process easier and clearer.
Fig. 4. Increase KD value
(4) Increase KI until the steady state is just around the setpoint and the single
oscillation to oscillate around the setpoint too (in this case, the setpoint is 1) as can
be seen in Fig. 5.
352 N. H. Sahrir and M. A. Mohd Basri
Fig. 5. Increase KI value
(5) Table 1 is referred for further tuning. Specifically, increasing KP to make the
steady-state error goes zero. Increasing KI to eliminate error and settles to the
setpoint. Increasing KD to reduce the overshoots until a smooth output is achieved
as can be seen in Fig. 6.
Fig. 6. Fine-tuned altitude controller with settling time at 2.282 s and zero ess
Table 1. Effects of increasing a parameter independently
Parameter Rise time Settling %OS ESS Stability
time
KP Decrease Small Increase Decrease Degrade
change
KI Decrease Increase Increase Eliminate Degrade
KD Minor Decrease Decrease No effect in Improve if KD is
change theory small
(6) Repeat steps 1–5 for attitude controllers starting with roll (phi) controller, pitch
(theta) and lastly yaw (psi).
Modelling and Manual Tuning PID Control of Quadcopter 353
The stability of this system is assured when the output can follow the input ref-
erence with zero steady-state error, or at least, the output stays around the given input
reference without going further away from the setpoint by time. This has been partially
proved in Fig. 6 and will be fully proved in the next section. Figure 7 and 8 show the
Simulink blocks for controlling altitude and attitude using PID approach.
Fig. 7. Simulation blocks to produce altitude control input, U1
Fig. 8. Simulation blocks to produce attitude control inputs, U2, U3 and U4
4 Simulation Results
The final top level of quadcopter simulation using MATLAB Simulink is as shown in
Fig. 9 The physical parameters are depicted in Table 2.
354 N. H. Sahrir and M. A. Mohd Basri
Fig. 9. Top-level quadcopter simulation blocks using Simulink
Table 2. Parameters of the quadcopter model [12]
Parameter Value Unit
g 9:81 m s2
m 0:5 kg
l 0:2 m
Jx ¼ Jy 4:85 103 kg m2
Jz 8:81 103 kg m2
Jr 3:36 105 kg m2
KT 2:92 106 kg m
Kd 1:12 107 kg m2
The objectives of tuning the PID controller are to minimize the rise time, maximum
overshoot and the settling time in order to achieve a better stability of the system [15].
By using manual PID tuning method and following all fundamental equations of a
quadcopter with specific parameters, the results are obtained as shown in Table 3
below.
Modelling and Manual Tuning PID Control of Quadcopter 355
Table 3. Results of simulation
Test Attributes & respective PID Rise time, Settling time, Percent
gains Tr (s) Ts (s) overshoot (%OS)
P-D Altitude(z): Kp = 35, Ki = 0, 0.248 1.962 5.851
Kd = 6
Roll (/): Kp = 7, Ki = 0, 0.611 2.621 0.501
Kd = 2
Pitch (h): Kp = 7, Ki = 0, 0.485 2.214 0.490
Kd = 2
Yaw (w): Kp = 7, Ki = 0, 0.612 2.970 0.497
Kd = 2
P-I-D Altitude(z): Kp = 100, 0.187 2.573 15.698
Ki = 190, Kd = 15
Roll (/): Kp = 100, Ki = 39, 0.476 16.642 6.989
Kd = 27
Pitch (h): Kp = 100, Ki = 39, 0.467 14.511 6.989
Kd = 27
Yaw (w): Kp = 100, 0.476 13.009 6.989
Ki = 39, Kd = 27
P-I-D Altitude(z): Kp = 35, 0.279 3.677 3.646
Ki = 28, Kd = 6
Roll (/): Kp = 7, Ki = 10, 0.359 4.772 19.880
Kd = 2
Pitch (h): Kp = 7, Ki = 10, 0.295 4.443 17.059
Kd = 2
Yaw (w): Kp = 7, Ki = 10, 0.361 4.907 18.452
Kd = 2
Fig. 10. Z-position Fig. 11. Roll position
356 N. H. Sahrir and M. A. Mohd Basri
Fig. 12. Pitch position Fig. 13. Yaw position
From the results, it can be seen that by utilizing only P-D controller, the percent
overshoot and settling time improve but altitude controller cannot achieve the desired
step input. By including integral gains into the system, it eliminates errors and settle to
the setpoint with a steady state error and the system accurately follows desired setpoint
[16]. In this project, the final test in Table 3 is the most ideal PID tuning which the
settling time is quite fast with zero steady state error and high stability over time as
proved in Fig. 10, 11, 12 and 13.
5 Conclusions and Future Work
This paper has clearly explained the basic modelling of a quadcopter from the funda-
mental physics and robotics until the final building the simulation blocks. The quadcopter
model is designed to only give out the actual altitude and attitude of the quadcopter which
are the z position, roll, pitch and yaw. This is because those are independent to each other
and controlling them perfectly is one step before continuing to control the x and y
positions. In the future work, a position controller will be designed and included in this
model to produce x and y actual output based on desired position. Furthermore, a tra-
jectory tracking also will be implemented along with improved intelligent PID controller
and stabilization in nonlinear environment to refurbish this model into an autonomous
quadcopter. In order to further improve the trajectory tracking and autonomous feature of
this quadcopter, machine vision will be considerably implemented.
Acknowledgments. The authors would like to thank Ministry of Education (MOE) through
Fundamental Research Grant Scheme, FRGS (R.J130000.7851.5F439) for supporting this
research.
References
1. Iyer, A., Bansal, H.O.: Modelling, simulation, and implementation of PID controller on
quadcopters. In: International Conference on Computer Communication Informatics, ICCCI
(2021). https://doi.org/10.1109/ICCCI50826.2021.9402301
2. Chovancová, A., Fico, T., Chovanec, E., Hubinský, P.: Mathematical modelling and
parameter identification of quadcopter (a survey). Procedia Eng. 96, 172–181 (2014). https://
doi.org/10.1016/j.proeng.2014.12.139
Modelling and Manual Tuning PID Control of Quadcopter 357
3. 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 quadcopter UAV. In: IEEE 8th
International Conference on Industrial and Information Systems, ICIIS 2013, Conference
Proceedings, pp. 207–212 (2013). https://doi.org/10.1109/ICIInfS.2013.6731982
4. Salih, A.L., Moghavvemi, M., Mohamed, H.A.F., Gaeid, K.S.: Modelling and PID controller
design for a quadcopter unmanned air vehicle. In: IEEE International Conference on
Automation, Quality and Testing, Robotics, AQTR 2010 - Proceeding, vol. 1, pp. 74–78
(2010). https://doi.org/10.1109/AQTR.2010.5520914
5. Jafar, H., Zareh, M., Roshanian, J., Nikkhah, A.: An optimal guidance law applied to
quadcopter using LQR method. Trans. Jpn. Soc. Aeronaut. Space Sci. 53(179), 32–39
(2010). https://doi.org/10.2322/tjsass.53.32
6. Santos, M., López, V., Morata, F.: Intelligent fuzzy controller of a quadcopter. In:
Proceedings of the IEEE International Conference on Intelligent Systems and Knowledge
Engineering (ISKE), pp. 141–146 (2010). https://doi.org/10.1109/ISKE.2010.5680812
7. Xu, R., Özgüner, Ü.: Sliding mode control of a quadcopter helicopter. In: Proceedings of the
IEEE Conference on Decision Control, pp. 4957–4962 (2006). https://doi.org/10.1109/cdc.
2006.377588
8. Regula, G., Lantos, B.: Backstepping based control design with state estimation and path
tracking, to an indoor quadcopter helicopter. Period. Polytech. Electr. Eng. 53(3–4), 151–
161 (2009). https://doi.org/10.3311/pp.ee.2009-3-4.07
9. Mohd Basri, M.A., Husain, A.R., Danapalasingam, K.A.: Enhanced backstepping controller
design with application to autonomous quadrotor unmanned aerial vehicle. J. Intell. Rob.
Syst. 79(2), 295–321 (2014). https://doi.org/10.1007/s10846-014-0072-3
10. Basri, M.A.M., Husain, A., Danapalasingam, K.: Stabilization and trajectory tracking control
for underactuated quadrotor helicopter subject to wind-gust disturbance. Sadhana 40(5),
1531–1553 (2015). https://doi.org/10.1007/s12046-015-0384-4
11. Bouabdallah, T.: Design and control of quadcopters with application to autonomous flying
Samir Bouabdallah Thèse No 3727, vol. 3727 (2007). https://infoscience.epfl.ch/record/
95939/files/EPFL_TH3727.pdf
12. Voos, H.: Nonlinear control of a quadcopter micro-UAV using. In: IEEE International
Conference on Mechatronics, no. April, pp. 4–9 (2009)
13. Bao, N., Ran, X., Wu, Z., Xue, Y., Wang, K.: Research on attitude controller of quadcopter
based on cascade PID control algorithm. In: Proceedings of the IEEE 2nd Information
Technology, Networking, Electronic and Automation Control Conference, ITNEC 2017,
vol. 2018-Janua, pp. 1493–1497 (2018). https://doi.org/10.1109/ITNEC.2017.8285044
14. Wang, P., Man, Z., Cao, Z., Zheng, J., Zhao, Y.: Dynamics modelling and linear control of
quadcopter. In: International Conference on Advanced Mechatronic Systems, ICAMechS,
pp. 498–503 (2016). https://doi.org/10.1109/ICAMechS.2016.7813499
15. Kanojiya, R.G.: Tuning of PID controller using Ziegler-Nichols method for speed control of
DC motor. In: International Conference on Advances in Engineering, Science and
Management, pp. 117–122 (2012)
16. Idrissi, M., Salami, M., Annaz, F.: A review of quadrotor unmanned aerial vehicles:
applications, architectural design and control algorithms. J. Intell. Rob. Syst. 104(2), 1–33
(2022). https://doi.org/10.1007/s10846-021-01527-7
View publication stats