INVESTIGATION OF ROUTE TRACKING PERFORMANCE WITH ADAPTIVE PID CONTROLLER IN QUADROTOR

Depending on the intended use, the Unmanned Aerial Vehicle (UAV) must either be able to calculate the route itself to follow or be loyal to the predetermined route. In addition, in some cases, it is of paramount importance to follow the route, reduce the cost and follow the route in the most accurate way, especially under difficult conditions. The aim of this study is to investigate the system modeling of quadrotor to design the position and route following control algorithms of the system which is based on this modeling and to simulate the mentioned algorithms with adaptive proportionalintegral-derivative (PID) controller. Firstly, system modeling and mathematical equations has been developed. Secondly, the simulation environment has been created through the MATLAB program. Route tracking in this simulation environment has been performed on three different geometries, rectangle, lemniscate, spiral route tracking and the rate of the quadrotor on these routes and the amount of error has been determined. The comparison of these geometric shapes revealed the necessity of adaptive PID approaches in cases of sudden maneuvers.


Introduction
Unmanned aerial vehicles (UAVs) in the national intelligence and defense industry, search and rescue activities, the security of places where geographical structure is inaccessible and difficult, and in civilian projects in daily life (monitoring of sports in challenging tracks, detecting illegal flow, etc.) is frequently used. For the last 10 years, UAVs have been preferred in military and civilian applications due to their ability to move autonomously or manually, to leave the beneficial loads on the specified targets and to perform autonomous descent and takeoff [1]. UAVs are produced in different sizes and structures according to the tasks they will perform. Aerodynamic structures play an important role in performing the assigned tasks [2].
UAVs, like many other vehicles, can be produced in various geometries depending on the location and area where the activity will take place. One of the most commonly used and preferred UAVs is the four propeller UAVs called quadrotor. The four-propeller UAVs, in its most basic structure, include a microcontroller, sensor, brushless DC motor, speed controller and power supply [3].
The planning of the trajectories that the UAVs will follow to fulfill the assigned tasks and the completion of the task by the UAV following this trajectory is vital for the UAV activities in strategic regions. In this study, the performance of trailing trajectories with different geometries of quadrotor with adaptive PID controller is examined under external disturbance.
In this paper, system modeling of the UAV are defined in order to get dynamic response as well as route tracking problem. In the third section, PID and adaptive PID properties are explained including advantages of adaptive PID and its use in UAVs. The applications of PID and adaptive PID methods on different geometries are examined in the fourth section. As a result, the performance of the UAV tracing trajectories with different geometries is examined with PID and adaptive PID controllers and the necessity of adaptive PID controllers is demonstrated in case of sudden maneuvers. The nomenclature of variables and abbreviations used in this article are shown in Tab. 1.

System Model of Quadrotor
A quadrotor is defined as a multicopter that can fly through four rotors and provide movement maneuver. Compared to conventional helicopters using a main rotor and tail rotor, quadrotor using four rotors are preferred because they are easy to install and complex to control. In classical helicopters, complex mechanical systems consisting of many moving parts are controlled by commands transmitted to the rotors. On the other hand, quadrotors are generally advantageous in terms of ease of system control. Quadrotor motors are fixed pitch, the use of chassis without simple and moving parts, and forward maneuverability due to high propulsion are the prominent features of the quadrotors. UAVs provide this movement with various torque and thrust forces. Each rotor contains a brushless DC motor. The rotors of the quadrotors are symmetrical and mutually arranged. The rotational directions and speeds of the rotors are changed and the movement of the quadrotors in three-dimensional space (on the , and plane) is provided [4].
The rotation directions of the motors on the quadrotor, which are placed symmetrically about the horizontal and vertical axis, are shown in Fig. 1. Motors 1 and 3 rotate counterclockwise, motors 2 and 4 rotate clockwise. This applies to all multicopters. The aim is to prevent the UAV from moving uncontrolled about its own axes. By moving the propellers in different directions, the torque (rotating force) is balanced and the movement of the UAV is provided depending on the speed and direction of the propellers [5]. When the rotors move at the same speed, the aircraft takes off if gyroscopic effects are neglected. The thrust force generated by each motor must be the same to ensure stable aeration. A slight change in the propulsion of any of the engines (external disturbances such as wind, rain) can lead to an increase in the amount of error in aircraft control. By changing the speed of a single motor, the bearing force can be changed; horizontal and vertical axis movements can be achieved in this way [6]. In Fig. 1, quadrotor; Euler roll, pitch and yaw angles are indicated by body frame { }and the overall coordinate frame { }. Hence the state variables is defined as in [6]; , , , general (north,east,down) position; , , , body (north, right, down) position, , , roll, pitch and yaw angles; , , , roll, pitch and yaw rates of the four propeller, respectively The quadrotor moves in six degrees of freedom, three cycles and three rotations. These movements are achieved by changing the direction of rotation and speed of the motors. The movement of the quadrotor motors according to the direction of rotation is shown in Fig. 2. Thick arrows indicate fast, thin arrows indicate slow rotation. According to this; (a) forward motion, (b) backwards motion, (c) movement left, (d) movement right, (e) increase altitude, (f) decrease altitude, (g) leftwards rotation, (h) rightwards rotation [7]. Control of rolling, pitching and yawing rates, , , , together with position variables is important when evaluating duty time in route tracking.

Modeling of Four-Propeller
The state variables for the speed of the UAV are generated via the coordinate frame { } on the body; however, the state variables specified for the position are on the global coordinate { } frame. Therefore, a transformation matrix must be created to transform the variables on the coordinate frame. The transformation on the general coordinate { } frame and the body coordinate frame { } is given as Brushless motor types are often used to produce the required thrusts and torques in UAVs. Each motor is energized by the electric battery and the electronic speed controller (ESC) receives the desired motor speeds output and sends these commands to each motor. The thrusts and moment equations are used to define as for control inputs of the UAV where 1 : total thrusts, 1 ≤ 1 ≤ 1 , 2 : roll angle input, 2 ≤ 2 ≤ 2 , 3 : pitch angle input, 3 ≤ 3 ≤ 3 , 4 : yaw angle input, 4 ≤ 4 ≤ 4 , : i.th motor angular speed (rad/s), ≤ ≤ = 1 … 4, : drag torque ratio constant, : thrust constant, ℓ ∶ arm length. It is important to limit the control inputs that can be calculated by the control system which are transferred to ESCs and converted to motor speeds.
Equations of motion used in the control of UAV, including (3)-(4) can be defined as [̇̇] = where , and represent the moment of inertia around each axis; refers to the mass of quadrotor; refers to the moment of inertia caused by the rotation of the motor; = 1 + 2 − 3 + 4 and , , refer to rolling, pitching and yawing rates respectively as in [8].

Route Tracking
In order to ensure that the UAVs move unmanned, to move to the desired route as soon as possible and to use minimal energy, it is essential that they follow course and ensure movement on the desired route. In order to follow the route, either the UAV has to advance along the predetermined route, or it has to establish its own route with specific algorithms and methods. There are many studies in the literature regarding the follow-up of the UAV [5][6]9]. Accordingly, the route that the UAV will take first must be determined first. Reference points are determined on desired route. The trajectory optimization is performed over the determined points and the , , position is determined for tracking the trajectory and converted to the , , position via the body coordinate. This creates the rolling, pitching, deflection angles and provides motor control where the height, position, offset and speed values are adjusted and acceleration is provided in the horizontal-vertical plane.
Reference points are determined in all route tracking systems and the UAV's follow-up rate is examined. Accordingly, if , , will determine the reference route in route tracking, , , indicate the route of the UAV. Hence the error can be calculated as where UAV speed and task completion duration are important.

Controller Design for UAV
In this section, PID control and adaptive PID control are outlined and adaptive PID estimation method is mentioned. The most common type of control system is the Proportional-Integral-Derivative (PID) control system [10]. The PID controller is known as a closed loop feedback system. The control system calculates the difference between the actual and desired state and generates an error value. The measured values output from the sensor on the UAV are fed back to calculate this error signal and provide the balance between the desired value and the measured value [11]. The output of the PID control system is a control value that will bring the system closer to the desired state. Adaptive PID control, on the other hand, is a control method for changing system behavior to adapt to new situations. Adaptive PID control is inherently non-linear as it will adapt to new situations.
By using a PID controller, it is possible to move the UAV in the air, glide and move in the desired direction [12]. The PID controller is advantageous in terms of easy adjustment, design and strength of parameter gains; however, in non-linear and definite situations associated with the mathematical model, the quadrotor models limit the movement and performance of the UAV. The UAV controlled by the PID controller has control inputs ( ), where , proportional control gain, , integral control gain, , derivative control gain and , time variable is expressed. In this paper, PID parameters are obtained by taking the system stability into consideration in order to ensure the follow-up of the reference route. The PID parameters are embedded in the motor drive circuits of the UAV.
The adaptive PID control is intended for changes in parameters , , and . The performance in determining the gain parameters directly affects the performance of the PID controller. Therefore, in the study, the gain parameters of the PID controller are determined by the Ziegler-Nichols method. The adaptive PID controller block diagram of the UAV is shown in Fig. 3. It is aimed to determine the orientation and deflection performance and speed of the UAV based on the system model by regulating the controller coefficients. Adaptive PID control generally includes three basic steps that are system modeling, controller design and adaptation of the controller [12][13][14][15]. The system modeling part is created by adapting the mathematical modeling of the UAV into the system. Then, the system is observed and their behavior is examined. A model is obtained from the input and output signal parameters of the observed system. This process is called parameter estimation [11]. Here, the UAV is examined and propeller speeds are controlled by obtaining the required thrust control signals. In the event that the frictionsl forces and gravity effects mentioned in Eqs. (3,4) and (6,7) are neglected, the dynamic model of UAV is obtained as  6) and (7), the resulting reference model is , state variables, , target variables, where 1 , 2 , 1 , and 2 are gain coefficient matrices. Accordingly, position error and attitude error vectors are defined as Adaptation rules to obtain Lyapunov-based stable control signals can be defined as so that the control inputs are obtained. Here, control signal provides 1 , , rolling and pitching desired signals, while u control signal gives 2 , 3 , 4 signals [16]. Also the gain matrices can be defined as where , positively defined matrices that determine the adaptation rate and control signals in Eqs. (17) and (18) include adaptive PID coefficients.

Route Tracking Results
In this section, the route tracking simulation is performed via the MATLAB program of UAV. While performing this simulation, two different control approaches, PID and adaptive PID, are applied and their performance is compared with each other. In this simulation, regulated control systems and route tracking modeling have been developed. UAV flight time is 60 sec where sampling time is 0.01 sec. The motion of the UAV with the PID and adaptive control algorithms on the , and coordinates has been examined on a circle, rectangle, lemniscate ∞and spiral trajectory. The trajectory tracking performances are examined on 3 different scenarios (a), (b), and (c) respectively, as shown in Fig. 4. The reason for examining follow-up performance trajectories is; the aim of the present study is to investigate the follow-up rate of hard turns for scenario 1, reverse turns for scenario 2 and soft turnramp up for scenario 3, and to determine the amount of error. The amount of error indicates the relationship between the specified route and the performance of the UAV to follow the route. If In addition, the total route followed by the UAV is calculated based on location information.  In this study, route tracking performance of four propeller UAV with PID and adaptive PID controller was investigated. PID, , , and , coefficients for X, Y and Z position and roll ( ) -pitch ( ) -yaw ( ) angles and rates of four propeller UAVs are presented in Tab. 2.
The performance of the UAV with adaptive PID control algorithm to follow a rectangular, lemniscate ∞ and spiral trajectory has been investigated on the trajectory shown in Figs. 5-7, respectively. Figs 5-7 also show reference route. In addition, Tab. 3 lists the total path length for PID and adaptive PID controller performance including total route length as well as total distance error as defined in Eq. (22). It has been seen that adaptive PID results much better than PID controller performance. Adaptive PID total error is about 10% less that PID controller not only for hard turns as in scenario 1 (rectangle), but also for reverse turns as in scenario 2 (lemniscate, ∞). In addition to that adaptive PID shows about 50% better total error compare to PID controller for soft turn -ramp up as in scenario 3 (spiral).  Fig. 8 shows the position change , and position tracking including yaw angle as well as squared error change for spiral route tracking of both the PID controller and the Adaptive PID controller. Especially for the hard turn at 8-10 sec, Adaptive PID shows much better performance compare to PID controller. It is very important to note that route tracking application should solve hard turn problem. Fig. 9 shows the variation of , , coefficients for adaptive PID controller as in UAV , , position and deviation movements. The changes are parallel to the parameters given in Tab. 1.

Conclusions
In this study, PID and adaptive PID controller performance for route tracking of four propeller UAVs are studied. Performance of both PID and adaptive PID controllers on trajectories with various geometries has been tested. It has been observed that the error rate of the proposed controller for three different trajectories are lower than the PID controller which is used as a reference. In cases of sudden maneuvers, the necessity of adaptive approaches has been demonstrated. In addition, a stable flight was observed when appropriate PID gain values have been obtained for the system. It has been shown that the adaptive PID controller can be used in route tracking applications with high accuracy. In future studies, the performance of the proposed controller will be tested under different external disturbances as well as target detection and tracking applications.