Abstract
Introduction
Nowadays, small-scale unmanned air vehicles are popular in many areas such as military, security, commercial usage, or hobby applications; especially, four-rotor air vehicles called quadrocopters have drawn interest because of their small structure, high maneuverability, mobility, and also easy accessibility. This popularity is attractive for researchers.
A good attitude control, position control, and path planning are needed to make a stable and robust quadrocopter for targeted aims. First, a system model must be improved to study on a quadrocopter. Two base approaches, Newton–Euler formalism and Lagrange method, can be used to get a model that has a real characteristic of the system. The system modeled by any approach can be controlled by many methods such as PID, back stepping, sliding mode, and adaptive control. The most common method is the PID controller for a quadrocopter. It is popular due to its simple structure and enough performance. Many controllers have some parameters required to tune for a good or enough performance, and they need experimental studies many times. These experimental studies can take much time, and it is never guaranteed to get optimum parameters. In this case, the optimization algorithms are a good choice. The optimum parameters can be achieved with less experiment and less time. Nature-inspired algorithms are getting much popularity day to day because of their problem-independent structure.1,2
A quadrocopter system design has different types of problems such as flight path planning, attitude, or position control. The differential evolution optimization algorithm is used by researchers for optimal path planning. 3 The artificial potential field4,5 and the simulated annealing 6 methods are some of the other optimization methods that are used for the same aim by researchers. The artificial bee colony (ABC) algorithm and the genetic algorithm (GA) can be used for optimization problems about mobile robots. 7 A quadrocopter can have many controllers for attitude control or trajectory control, and the particle swarm optimization (PSO) is one of the choices for optimization.8–10 The ant colony algorithm11,12 and ABC 13 algorithm are the other alternatives among the popular ones.
All the optimization algorithms mentioned above can be used for many optimization problems, but all these have different performance depending on their characteristic and the applied problem. Their performance can be good or poor and to know this is important. From this point of view, a comparative study is needed for some popular optimization algorithms that are used for controller optimizations of quadrocopters. In this study, a quadrocopter system is modeled, and the controller designed consists of four PID controllers for attitude and hover control. All PID parameters are optimized by ABC, PSO, and GA, and a comparison is made for the optimized system performance, optimization speed, and reliability of the optimization algorithm.
Mathematical model of quadrocopter
The structure of the quadrocopter that has four rotors is given in Figure 1. The propeller pairs (1–3 and 2–4) turn opposite directions. Thrust force, which moves the quadrocopter, can be controlled by changing the speed of the rotors. The quadrocopter moves in the

Structure of a four-rotor air vehicle (quadrocopter).

To define a mathematical model of the quadrocopter, Euler–Lagrange Formalism can be used.14–16 Thrust force generated by the propellers is given using equation (1).
The torque equations that include gyroscopic effects are given in equation (3).
Finally, the system dynamic equations with
System parameters of quadrocopter model.17
Controller design
Thrust and torques can be used to control attitude and hover. Gyroscopic terms can be neglected when angular speeds are too small and angles are too close to the reference values. So a thrust and torque matrix with a reduced complexity can be written as in equation (5).16 It gives us the relationship between the speeds of propellers and torques to control the attitude and Yaw and
In this study, attitude and hover control is made by PID controllers to control the thrust and torques. The general structure of the PID controller is given in equation (7). A step change in set point can be harsh disturbance in control loop when used with the general forms.
18
Derivative mode PID controller can be used to overcome this problem. The structure of the used derivative mode PID controller is given in Figure 3. The sign of the derivative block has been changed to “−” because the derivative contribution always acts in the opposite direction of motion measurement. Four derivative mode PID controllers are used to control thrust and torques. Three of them are used to control the torques of

Structure of derivative mode PID controller.
Optimization
Optimization is one of the most important subjects in control theory. The performances of the same controllers that have different coefficients are different on the same system. So the controller coefficients must be well tuned for a good performance. Today, many optimization algorithms are used for this purpose. Performance comparison of some popular bio-inspired optimization algorithms such as the GA, PSO, and ABC is the main purpose of this study.
GA inspired from the natural selection was developed by Holland and Goldberg. 19 Every individual transfers their genes to new generations. The genes have the knowledge of the characteristic properties of the individuals. Powerful individuals can survive in nature and others die. The survived ones reproduce, and in this way, the new generations have the characteristics of the powerful individuals. GA is successfully applied to many optimization problems.
The PSO algorithm inspired from bird swarm was developed by Kennedy and Eberhart. 20 All birds follow the leader when searching food sources. The leader is the bird which envisaged itself most close to the food source. The leader can be changed during the search of a food source. They communicate with each other to select a new leader.
The ABC algorithm is inspired from the bee colonies which search and collect food. It was first developed by Karaboga and Basturk. 21 Their food search technique is different from that of the birds. There are onlooker, scout, and employed bees in a bee colony. Employed bees carry the food from a known source. Scout bees search food sources randomly, and they inform the onlooker bees about the food source positions and quality by dancing. In this way, onlooker bees can select the best food source and use it. So onlooker and employed bees make local search, and onlooker bees and scout bees make global search. The detailed information about GA, PSO, and ABC algorithms can be found in earlier studies.21–23
An objective function must be determined to use an optimization algorithm. Some objective functions are suggested to optimize a PID controller in literature: integral absolute error (IAE), integral squared error (ISE), and integral time-weighted squared error (ITSE) are some of them.
24
In this study, IAE objective function, given in equation (8), is used to optimize the PID controllers. The optimized system has big overshoot errors and long settling time values because this function has no effect on them. So the function is improved to minimize not only the total error but some other parameters as well. The overshoot error, rising time, and steady-state error values are added to the objective function. Small overshoot errors, short settling time, and small steady-state errors are achieved using the improved version of the objective function given in equation (9).
Simulation
All algorithms used in this study were based on individuals and their food searching characteristic. The number of individuals affects the performance of the algorithm. So the colony sizes are chosen the same. Of course, there are other parameters that effect the performance, but they are specific parameters about the characteristic of the algorithm. So a comparison of them is beside the point. The used colony sizes are 50, and the maximum iteration number is 200. The iteration number is chosen enough more for reaching the best results for each algorithm. Initial angles are zero and reference angles are
Four criteria are used for the comparisons. The first criterion is the least objective function value produced by the algorithms. The second one is performance of the system that uses the coefficients produced by the optimization algorithms. The third criterion is reliability, and the fourth one is speed of the optimization algorithm. An index term is also defined as the ratio of each result to the least one for comparison. In this case, a small index means better performance and “1” means the best performance.
Each of the three algorithms was run 30 times because they have probabilistic operators, and the results produced by the algorithm can change for each repetition. The best results chosen at the end of 30 runs and the results of ZN method are given in Table 2. Two functions are used to compare these results. The first one is IAE, and the other one is root mean squared error (RMSE). In regard to IAE, the best result is produced by ABC. The results of ABC and GA are too close, and the difference is 0.03%. PSO is the third one. The difference between ABC and PSO is 27%. ZN has the worst result, and its IAE index is 5.01 times the index of ABC. GA is the best one with regard to RMSE. The results of ABC and GA are again too close, and the difference is 0.4%. PSO is the third one. ZN has again the worst result. Its RMSE index is 14.94% more than GA. Results of ABC and GA are too close when IAE and RMSE are considered together.
Best optimization results.
ABC: artificial bee colony algorithm; GA: genetic algorithm; IAE: integral absolute error; PSO: particle swarm optimization; RMSE: root mean squared error; ZN: Ziegler-Nichols.
The step response of the system tuned by the ZN method is given in Figure 4. It is a well-known method, and detailed information can be found in the study by Ziegler and Nichols. 25 All outputs have oscillations, big overshoot errors, steady-state errors, and long settling time when compared to the optimized systems. Detailed comparisons are given below.

System outputs of the system tuned by ZN method.
The optimum parameters produced by the optimization algorithms are used to see the controller performance. All optimized systems have small overshoot errors. Phi angle outputs of the system are given in Figure 5. ABC-based PID has the least overshoot. PSO-based PID is the second one, and it has 7% more overshoot than ABC-based PID. GA-based PID is the third one with 15% more overshoot. ZN-based PID is the worst one, and its error is 309.62 times the error of ABC-based one. The Theta angle outputs of the system are given in Figure 6. ABC-based PID has the best performance again. GA-based PID is the second one with 5% more error and PSO-based PID is the third one. The worst one is ZN-based system. The overshoot errors and indexes are given in Table 3. As seen, the ABC-based system has the smallest overshoot errors in controlling the Phi and the Theta angles.

Phi angle outputs of the quadrocopter. ABC: artificial bee colony algorithm; GA: genetic algorithm; PSO: particle swarm optimization.

Theta (The) angle outputs of the quadrocopter. ABC: artificial bee colony algorithm; GA: genetic algorithm; PSO: particle swarm optimization.
Overshoot error comparison table.
ABC: artificial bee colony algorithm; GA: genetic algorithm; PSO: particle swarm optimization; OS: overshoot; ZN: Ziegler-Nichols.
Settling time data and indexes are given in Table 4. PSO-based PID has the shortest settling time for the Phi control. ABC-based PID has 1% more and GA-based PID has 4% more settling times than PSO-based one. ABC-based PID has the shortest settling time for the Theta control, PSO-based PID has almost the same performance with ABC-based one, and GA-based PID is the third one with 2% longer settling time than ABC. ABC- and PSO-based systems have similar settling time, and ZN-based PID has the worst performance. Its settling time is 8.82 times the best time in controlling the Phi angle and 8.23 times the best time in controlling the Theta angles.
Settling time comparison table.
ABC: artificial bee colony algorithm; GA: genetic algorithm; PSO: particle swarm optimization; ST: settling time; ZN: Ziegler-Nichols.
GA-based PID has the least overshoot error for Psi angle control. Psi angle outputs are given in Figure 7. The second one is PSO with 15% more overshoot, and the third one is ABC with 36% more overshoot. PSO-based PID has the best settling time, and GA-based PID has a similar performance with only 1% longer settling time. The third one is ABC-based PID with 33% longer settling time. The results show that GA-based system has the best performance in controlling the Psi angle and ZN-based system has the worst performance. Its overshoot error is 80.89 times the best one, and its settling time is 92% more than the best one.

Psi angle outputs of the quadrocopter. ABC: artificial bee colony algorithm; GA: genetic algorithm; PSO: particle swarm optimization.
The Z position output of the ABC-, PSO-, and GA-based systems for each algorithm is given in Figure 8. GA-based PID has the best performance in controlling the Z position. The second one is PSO-based PID. It has 4% more overshoot and 38% longer settling time than GA-based one. The third one is ABC-based PID. It has 21% more overshoot and 47% more settling time. The system tuned by ZN has the worst performance again.

Z position graphs of the quadrocopter. ABC: artificial bee colony algorithm; GA: genetic algorithm; PSO: particle swarm optimization.
The results show that the system tuned by ZN method has the worst performance. In fact, its performance can be improved tuning the parameters manually, but it has some disadvantages. This process can take much time, and it is not guaranteed finding the optimum parameters. The performance of the ZN-tuned system is also dependent on the experiment of the person who makes the manual tuning process. After all, optimization algorithms do not need any experiment or much time and guarantee to find one of the optimal solutions.
As seen in the Phi, Theta, Psi, and Z graphs, Tables 3 and 4 show that ABC-based PID has a good performance in controlling the Phi and Theta angles; GA-based PID has a good performance in controlling the Psi angle and the Z position. The performance of the PSO-based PID is not the best, but its results are close to the best one in a general view. The data given in Table 2 also support this case but the data given above is not enough to decide which one is best.
Bio-inspired optimization algorithms use stochastic operators. Because of this, the algorithms can produce different results for every run. The results given above are obtained by selecting the best ones after running each algorithm 30 times. So the results of 30 repeats for each algorithm must be considered. All the produced results of the three algorithms for 30 repeats are given in Figure 9. As seen, the highest objective function values are produced by PSO, and the range is between 106.979 and 72.339. GA has a range between 85.936 and 72.444, and ABC has a range between 73.684 and 72.446. The results of GA and PSO are changing very often, but the results of ABC are stable. The minimum and maximum objective function values and the difference between them are given in Table 5. The difference between the minimum and maximum values produced by ABC is only 1.71%. The difference is 18.62% for GA and 47.88% for PSO. All values produced by ABC are close to the best one. So ABC is the better than PSO and GA about the reliability and repeatability.

Solution graphs of ABC, PSO, and GA for 30 repeats. ABC: artificial bee colony algorithm; GA: genetic algorithm; PSO: particle swarm optimization.
Minimum and maximum values of objective function.
ABC: artificial bee colony algorithm; GA: genetic algorithm; PSO: particle swarm optimization.
Another important parameter is speed of the optimization algorithm. An optimization algorithm repeats a standard processes in each iteration when searching the optimum value in the solution space. It reaches the optimum value after a number of iterations. A small number of iteration takes less time, and it means the algorithm is fast. A speed comparison is made for ABC, PSO, and GA depending on the iteration number that reached the optimum result. Iteration number and error graphs of the running found best results, which are given in Figure 10.

Error graphs of ABC, PSO, and GA when searching the optimum solution. ABC: artificial bee colony algorithm; GA: genetic algorithm; PSO: particle swarm optimization.
The fastest one is GA when searching the best result. It reaches the best result in the 173rd iteration. The second one is ABC. It reaches the best result in the 190th iteration. The last one is PSO, and it reaches the best result in the 198th iteration. But this view changes if the results are analyzed with an acceptable tolerance. The best results and the results with an acceptable tolerance are given in Table 6. ABC is the fastest one when the tolerance is 1% which means the result of the objective function is maximum 1% greater than the best result. In this case, PSO is the second one and GA is the last one. This ranking does not change when the tolerance is getting up to 5%.
Iteration number and objective function values for speed comparison.
ABC: artificial bee colony algorithm; GA: genetic algorithm; PSO: particle swarm optimization.
Conclusions
In this study, a quadrocopter model and a controller for attitude and hover control is designed and simulated. All controller parameters are tuned offline by the ZN method, ABC, GA, and PSO algorithms for a performance comparison. Optimization algorithms were run 30 times to test reliability and repeatability.
Best controller performance is seen on ABC- and GA-based PID controllers in regard to IAE and RMSE functions. In addition, ABC-based PID has the lowest maximum overshoot and shortest settling time on Phi and Theta control. Its results are close to PSO-based PID for settling time. GA-based PID has the best performance on Psi and Z position control, and its results are close to PSO-based PID for settling time of Psi control. The ZN method has the worst performance, but its results are important to show why an optimization algorithm is needed.
From the point of reliability and repeatability, ABC shows the best performance. The difference between the minimum and maximum values produced by ABC is only 1.71%. All results are close to the best result. The differences are 18.62% for GA and 47.88% for PSO. Their results are varying around the average for each running with a big changing.
The best performance is shown by GA when the criterion is the speed, but GA-based PID has a bad performance when considered the best result of reliability and repeatability. The second one is ABC and the last one is PSO. However, ABC has the best performance when used with an acceptable tolerance from 1% to 5%. ABC also shows good performance for other criteria.
The results show that ABC has the best performance for controller optimization of quadrocopter, all things considered.
