search for


Design of Fuzzy-PID Controller for Quadcopter Trajectory-Tracking
International Journal of Fuzzy Logic and Intelligent Systems 2018;18(3):204-213
Published online September 25, 2018
© 2018 Korean Institute of Intelligent Systems.

Mohammed Rabah, Ali Rohan, Yun-Jong Han, and Sung-Ho Kim

1School of Electronics and Information Engineering, Kunsan National University, Gunsan, Korea, 2Associate Research Engineer, Nongboochon company, Korea, 3Department of Control and Robotics Engineering, Kunsan National University, Gunsan, Korea
Correspondence to: Sung Ho Kim (
Received August 21, 2018; Revised September 2, 2018; Accepted September 2, 2018.
This is an Open Access article distributed under the terms of the Creative Commons Attribution Non-Commercial License ( which permits unrestricted non-commercial use, distribution, and reproduction in any medium, provided the original work is properly cited.

Trajectory-tracking is an attractive application for quadcopters and a very challenging, complicated field of research due to the complex dynamics of a quadcopter. Various control algorithms have been developed to stabilize the quadcopter over a certain trajectory since it is hard for a quadcopter to follow a certain trajectory. In this paper, a fuzzy-PID controller is designed to stabilize the quadcopter over a certain trajectory using the speed information as an input. The proposed controller is compared to a PD controller and a fuzzy logic controller (FLC) to distinguish which has a better performance using MATLAB/Simulink. The simulation results demonstrate that under different trajectories the fuzzy-PID controller shows a better response than the other two controllers.

Keywords : Fuzzy logic controller, Fuzzy-PID, Quadcopter, MATLAB/Simulink, Trajectory-tracking
1. Introduction

Quadcopter is a type of unmanned aerial vehicles (UAVs), which is lifted and propelled by four rotors. Compared to the other types of UAVs, a quadcopter is low-cost, simpler, and smaller. Furthermore, it has high maneuverability as it can hover, take off, cruise, and land on narrow areas. Because of this, there has been an increasing interest in quadcopter applications such as surveillance, mapping, search and rescue, object detection and landing to drone station [15].

Trajectory-tracking is a very important task for quadcopters as it is proven to be effective in many different example scenarios, such as forest fires and damage surveying after floods and storms where time is a critical factor for decision-making and measures implementation.

Generally, quadcopters are dynamically unstable, under-actuated, and nonlinear systems. This is principally the reason why it is very challenging to design a controller to stabilize a quadcopter over a certain trajectory. To deal with these difficulties, many control algorithms for trajectory-tracking have been developed to stabilize a quadcopter. A proportional-integral (PI) and proportional-integral-derivative (PID) controller were used to develop a tracking control algorithm of a quadcopter [6, 7]. A linear quadratic regulator (LQR) control method has been proposed in [8]. To overcome the under-actuated problem of a quadcopter, a back-stepping controller and a sliding mode controller were proposed in [911].

Even though the prior researches work well, their results show slower response and higher overshot. Therefore, in this paper, a fuzzy-PID controller is designed to overcome the previously mentioned problems. MATLAB/Simulink is used to compare the output of the proposed controller to a typical PD controller and an fuzzy logic controller (FLC). Simulations are carried out under different trajectories. The comparison shows that the proposed controller has a higher response and no overshoot compared to the other two controllers.

In the next section, the dynamic model of a quadcopter system is explained. In Section 3, the controllers used in this system are explained. In Section 4, simulation studies are carried out for all the three controllers followed by the simulation results. Furthermore, a comparison between these controllers is discussed, followed by the conclusion.

2. Dynamic Model of Quadcopter

As shown in Figure 1, a quadcopter consists of six degrees of freedom (DOF) body actuated by four propellers. The four rotors provide upward thrusts as well as the direction of the quadcopter. Each motor is located at one end of the quadcopter arm. The motors located diagonally opposite to each other rotate in the same direction while the adjacent motors rotate in the opposite direction. The mathematical model of a quadcopter is developed based on Newton-Euler equations. A quadcopter is assumed to be rigid, symmetric and the gyroscopic effects of the propellers are negligible [12, 13]. Eqs. (1)(6) show the mathematical equation of the quadcopter, while Table 1 shows the parameters described in these equations.


A quadcopter system has four inputs (U1, U2, U3, U4) and six outputs (x, y, z, ϕ, θ, ψ), where U1 is the force acting on the quadcopter body, U2 is the force causing the roll motion, U3 is the force causing the pitch motion and U4 is the force causing the yaw torque. Eq. (7) provides mathematical expression of the input forces of the quadcopter where T the thrust coefficient is and Q is the torque coefficient.


Eqs. (8)(10) describe the transformation from body frame of quadcopter to earth frame using the rotation matrix R, where c and s represent cos and sin, Rx is the rotation around x-axis, Ry is the rotation around y-axis and Rz is the rotation around z-axis.

3. Controllers Description

The block diagram of quadcopter system is shown in Figure 2. The path command block sends the required trajectory to the position control block by accepting a time series input from the user. The position control block isresponsible for controlling the position of the quadcopter by sending the attitude data required to fly the quadcopter over a desired trajectory. This data is used inside the attitude controller to manage the required angle for quadcopter to follow the trajectory. This data (Ui) is used as an input to quadcopter dynamics block, which has been explained in the previous section. Figure 3 shows the block diagram of the three controllers that is used to control the position of the quadcopter.

3.1 PD Controller

PID controller is a control loop feedback mechanism commonly used in industrial control systems because of its simple design [14].

In this paper, the integrator part of PID controller is avoided since it is more preferable to use a PD controller in position control algorithms. A PD controller continuously calculates an error value as the difference between the desired reference and the output of the system, then applies a correction based on proportional and derivative terms according to Eq. (11).


where Kp and Kd are the proportional and derivative gains, e (t) is the error value and y (t) is the output of the system. Figure 4 shows the PD controller block diagram.

3.2 Fuzzy Logic Controller

FLC is a logic operation method based on many-valued logic rather than the usual “true or false” (1 or 0) Boolean logic on which the modern computer is based. FLC has some advantages compared to other classical controllers such as simplicity of control, low cost, and the possibility to design without knowing the exact mathematical model of the process. FLC has two inputs, error (e) and its derivative (δe). As shown in Figure 5, the FLC has three main stages: fuzzification, rule base, and defuzzification. Fuzzification describes the input and output of the FLC to specify set of rules to control our system. The collection of rules is called a rule base. The rules are in “If Then” format and formally the If side is called the conditions and the Then side is called the conclusion. The computer is able to execute the rules and compute a control signal depending on the measured inputs error (e) and its derivative (δe). Defuzzification is when all the actions that have been activated are combined and converted into a single non-fuzzy output signal which is the control signal of the system [15, 16].

3.3 Fuzzy-PID Controller

The designed fuzzy-PID controller is a hybrid controller, utilizing two sets of PI gains in order to achieve a nonlinear response. Fuzzy-PID takes two inputs, error (e) and its derivative (δe), and gives two outputs, Kpf and Kif, which are determined by a set of fuzzy rules. Figure 6 shows the basic structure of fuzzy-PID controller. The output of the fuzzy-PID controller (Kpf and Kif) are used to adapt the Kp and Ki gains of the PID controller as shown in Eq. (12), where e (t) is the error value and y (t) is the output of the system.

4. Simulation Studies

MATLAB/Simulink is used to test the proposed trajectory-tracking system by comparing the performance of the three controllers: PD controller, FLC, and fuzzy-PID controller. The used quadcopter simulation system is available on MATLAB file exchange and it’s free to use. Figure 7 shows the simulation system of the quadcopter and Table 2 shows the values of the parameters used in the quadcopter simulation system. In this system, the position control block is responsible for taking the trajectory data (x, y, z, t) from the user, and gives out the required angle responsible for controlling the quadcopter over a desired trajectory. Figure 8 shows the position control block. As shown in Figure 8, the error rotation block keeps on calculating the position error between the current position in the desired trajectory and the current position of the quadcopter, and gives out the desired velocity. The Theta/Phi Command Control block takes the difference between the desired velocity and the actual velocity of the quadcopter as an input to the controllers, and gives out the required Theta/Phi (Roll/Pitch) angle required for tracking based on the outputs of the three controllers. Figure 9 shows the controllers used in Theta/Phi Command Control block to control the trajectory-tracking of the quadcopter. In Figure 9, the switch block is used to switch between the three controllers. An attitude limit switch is used to limit the output angle between −12° and 12°. The PD controller implementation is shown in Figure 9. The gains used in the PD controllers are Kp = 0.32 and Kd = 0.1.

4.1 Fuzzy Logic Controller

FLC is used to generate gains instead of PID to avoid high fluctuations in the start. In FLC, five linguistic variables are used for each input, which means there are 25 possible rules with all combinations of the inputs. The set of linguistic values for two inputs and one output with 25 rules are negative big (NB), negative small (NS), zero (ZE), positive small (PS),and positive big (PB). A Mamdani type with triangular membership functions is used for the two inputs and one output as shown in Figure 10. The FLC uses MIN for t-norm operation, Max for s-norm operation, MAX for aggregation, MIN for implication, and Centroid for defuzzification. FLC rule base of the trajectory-tracking control algorithm is shown in Table 3. FLC takes two inputs (e and δe) and one output (angle). Membership functions of the inputs and output variable are shown in Figure 11. The FLC implementation is shown in Figure 9.

4.2 Fuzzy-PID Controller

The fuzzy-PID controller uses the same parameters of FLC. It has two inputs (e and δe) and two outputs (Kp and Ki). The fuzzy-PID parameters is shown in Figure 12.

Figure 13 shows the membership of the inputs and outputs.

Figure 14 shows the implementation of the proposed controller. The rule base for Kp and Ki are shown in Tables 4 and 5.

5. Simulation Results

In order to verify the validity and efficiency of the control algorithm proposed in this paper, a comparison between the three controllers has been carried out under three different trajectories. In Figure 15(a) and (b), fuzzy-PID shows the best response in x and y-direction while PD controller and FLC have overshot.

Figure 15(c) shows the output of the three controllers in the XY plane. The fuzzy-PID has the best response among the three controllers. FLC has overshot while PD controller has bigger overshot and oscillation. In Figure 16(a) and (b), fuzzy-PID and FLC have close results. However, there is a small oscillation in the FLC. PD controller has poor stability and it takes more time to settle. Figure 16(c) shows a comparison of the three controllers in the XY plane. According to Figure 16(c), fuzzy-PID has a slightly better response than FLC. In Figure 17(a), fuzzy-PID shows faster response than the other two controllers. PD controller shows a slower response to the other two controllers, while FLC shows poor stability. Figure 17(b) shows close results for both fuzzy-PID controller and FLC while PD controller has a slower response. Figure 17(c) shows that the fuzzy-PID controller has a faster response than the other two controllers. Table 6 shows the sum of square errors (SSE) in the three trajectories to determine the best performance among the three controllers where:


where n is the number of data, i = 1, . . . , n and e is the error.

According to the comparison results and SSE results, the PD controller shows the poorest response. Although PD controller is easy to use and implement, entailing a fast way to control the system, it will nonetheless fail to control the quadcopter in case of disturbances like wind or sharp turns because of the usage of fixed gains. In order to get the best performance from a PD controller, gains need to be changed continuously. Although both fuzzy-PID controller and FLC controller have close results because both controllers use error and its derivative as input to minimize the error between the reference and the actual output as much as possible, fuzzy-PID tends to work more as an auto-tuning method by continuously changing the PI gains according to the controller input. Thus, a fuzzy-PID combines the pros of both a PID controller and an FLC.

6. Conclusion

In this paper, a trajectory-tracking control system for quadcopter has been designed based on fuzzy-PID controller. In order to test the performance of the designed controller, three different trajectories were used to compare the output of the designed controller with a PD controller and an FLC using MATLAB/Simulink. According to the comparison results, the designed controller and the FLC has close results. By calculating the SSE of each controller, the designed controller shows that it has the best performance among the three controllers and can be used in the practical test.

Conflict of Interest

No potential conflict of interest relevant to this article was reported.


This work was supported by Korea Institute of Planning and Evaluation for Technology in Food, Agriculture, Forestry(IPET) through Advanced Production Technology Development Program, funded by Ministry of Agriculture, Food and Rural Affairs(MAFRA)(318007-3).

Conflict of Interest

No potential conflict of interest relevant to this article was reported.

Fig. 1.

Quadcopter structure.

Fig. 2.

Block diagram of the quadcopter system.

Fig. 3.

Block diagram of the trajectory-tracking controller of the quadcopter.

Fig. 4.

PD controller block diagram.

Fig. 5.

FLC block diagram.

Fig. 6.

Fuzzy-PID basic structure.

Fig. 7.

Quadcopter simulation system.

Fig. 8.

Position control block.

Fig. 9.

Trajectory-tracking control system.

Fig. 10.

FLC parameters.

Fig. 11.

(a) FLC input membership functions. (b) FLC output membership function.

Fig. 12.

Fuzzy-PID parameters.

Fig. 13.

(a) Fuzzy-PID input membership functions. (b) Fuzzy-PID output membership function.

Fig. 14.

Fuzzy-PID controller implementation.

Fig. 15.

Simulation results of the three controllers in a rectangular trajectory in (a)X position, (b) Y position, (c) XY plane.

Fig. 16.

Simulation results of the three controllers in a triangular trajectory in (a)X position, (b) Y position, (c) XY plane.

Fig. 17.

Simulation results of the three controllers in a circular trajectory in (a)X position, (b) Y position, (c) XY plane.


Table 1

Parameters description

θradPitch angle
ψradYaw angle
ϕradRoll angle
Jxx, Jyy, Jzzkg.m2Moments of inertia of the quadcopter
Jmkg.m2Moment of inertia of the rotors
wrrad/sAngular velocity of the rotor
UiNInput forces
gm/s2Acceleration due to gravity
mkgMass of quadcopter
rmLength from the motors to the center of mass

Table 2

Parameters in the quadcopter simulation system


Table 3

FLC rule base of the trajectory-tracking system


Table 4

Rule base for Kp


Table 5

Rule base for Ki


Table 6

The SSE results of each controller

ControllerSSE of Figure 15SSE of Figure 16SSE of Figure 17

  1. Bhaskaranand, M, and Gibson, JD . Low-complexity video encoding for UAV reconnaissance and surveillance., Proceedings of IEEE Military Communications Conference (MILCOM), 2011, Baltimore, MD, Array, pp.1633-1638.
  2. Doherty, P, and Rudol, P (2007). A UAV search and rescue scenario with human body detection and geolocalization. Australasian Joint Conference on Artificial Intelligence. Heidelberg: Springer, pp. 1-13
  3. Tomic, T, Schmid, K, Lutz, P, Domel, A, Kassecker, M, Mair, E, Grixa, IL, Ruess, F, Suppa, M, and Burschka, D (2012). Toward a fully autonomous UAV: research platform for indoor and outdoor urban search and rescue. IEEE Robotics & Automation Magazine. 19, 46-56.
  4. Talha, M, Asghar, F, Rohan, A, Rabah, M, and Kim, SH (2018). Fuzzy logic-based robust and autonomous safe landing for UAV quadcopter. Arabian Journal for Science and Engineering, 1-13.
  5. Liu, J, Wu, C, Wang, Z, and Wu, L (2017). Reliable filter design for sensor networks using type-2 fuzzy framework. IEEE Transactions on Industrial Informatics. 13, 1742-1752.
  6. Erginer, B, and Altug, E . Modeling and PD control of a quadrotor VTOL vehicle., Proceedings of the IEEE Intelligent Vehicles Symposium, 2007, Istanbul, Turkey, Array, pp.894-899.
  7. Bolandi, H, Rezaei, M, Mohsenipour, R, Nemati, H, and Smailzadeh, SM (2013). Attitude control of a quadrotor with optimized PID controller. Intelligent Control and Automation. 4, 335-342.
  8. Bouabdallah, S, Noth, A, and Siegwart, R . PID vs LQ control techniques applied to an indoor micro quadrotor., Proceedings of the IEEE/RSJ International Conference on Intelligent Robots and Systems (IROS), 2004, Sendai, Japan, Array, pp.2451-2456.
  9. Basri, MAM, Husain, AR, and Danapalasingam, KA (2015). Stabilization and trajectory tracking control for underactuated quadrotor helicopter subject to wind-gust disturbance. Sadhana. 40, 1531-1553.
  10. Lee, D, Kim, HJ, and Sastry, S (2009). Feedback linearization vs. adaptive sliding mode control for a quadrotor helicopter. International Journal of Control, Automation and Systems. 7, 419-428.
  11. Besnard, L, Shtessel, YB, and Landrum, B (2012). Quadrotor vehicle control via sliding mode controller driven by sliding mode disturbance observer. Journal of the Franklin Institute. 349, 658-684.
  12. Bouabdallah, S 2007. Design and control of quadrotors with application to autonomous flying. PhD dissertation. Lausanne Polytechnic University. Lausanne, Switzerland.
  13. Samir, A, Hammad, A, Hafez, A, and Mansour, H (2017). ?Quadcopter trajectory tracking control using state-feedback control with integral action. International Journal of Computer Applications. 168, 1-7.
  14. Rabah, M, Rohan, A, and Kim, SH (2018). Comparison of position control of a gyroscopic inverted pendulum using PID, fuzzy logic and fuzzy PID controllers. International Journal of Fuzzy Logic and Intelligent Systems. 18, 103-110.
  15. Rohan, A, Asghar, F, and Kim, SH (2018). Design of fuzzy logic tuned PID controller for electric vehicle based on IPMSM using flux-weakening. Journal of Electrical Engineering and Technology. 13, 451-459.

Mohammed Rabah received his B.S. degree in Electronics and Telecommunication Engineering in 2015 from the AL-SAFWA High Institute of Engineering, Cairo, Egypt. He completed his M.S. in Electrical, Electronics and Control Engineering in 2017 from Kunsan National University in Korea, where he is currently pursuing his Ph.D. in Electrical, Electronics and Control Engineering. His research Interests include UAV’s, fuzzy logic systems and machine learning.


Ali Rohan received his B.S. degree in Electrical Engineering in 2012 from The University of Faisalabad, Pakistan. He is currently pursuing his M.S. & Ph.D. in Electrical, Electronics and Control Engineering from Kunsan National University in Korea. His Research Interests include renewable energy system, power electronics, fuzzy logic, neural network, EV system, and flywheel energy storage system.


Yun-Jong Han received his B.S. degree in Control Measurement Engineering from Kunsan National University in Korea. He completed his M.S.&Ph.D. In Electrical, Information, and Control Engineering from Kunsan National University in 2003 & 2007, respectively. Currently, he is an Associate Research Engineer in Nongboochon Company in Korea. His research interests include intelligent control system, and fault diagnosis system.


Sung-Ho Kim received his B.S. degree in Electrical Engineering from Korea University in 1984. He completed his M.S. & Ph.D. in electrical engineering from Korea University in 1986 & 1991, respectively. In 1996, he completed hispostdoc from Japan Hiroshima University. Currently, he is a professor at Kunsan National University. His research interests include fuzzy logic, sensor networks, neural networks, intelligent control system, renewable energy system, fault diagnosis system.