# Optimised Tuning of a PID-Based Flight Controller for a Medium-Scale Rotorcraft
## 4 Simulation Results and Discussion
### Controller Implementation Results
#### 4.2.1 Hover  
The four controllers are then tuned to minimise the objective function in Equation (25). For each optimisation algorithm, ten trials were executed. The convergence graphs of each of the four optimisation techniques are shown in Figure 6.  
The best gains returned the following values of the objective function and the running times as given in Table 6. The ACO-PID completed the optimisation the fastest and had the lowest average ISE score. The gains found for the four PID controllers' optimisation methods are given in Table 7. \begin{table}
\begin{tabular}{c c c c c} \hline \hline
**PID Gains** & **PSO** & **GA** & **ACO** & **CS** \\ \hline Best fitness & 1.499 \(\times\) 10\({}^{-7}\) & 2.563 \(\times\) 10\({}^{-7}\) & 1.340 \(\times\) 10\({}^{-7}\) & 1.566 \(\times\) 10\({}^{-7}\) \\ Running time (min) & 94.70 & 91.21 & 77.59 & 119.68 \\ \hline Mean & 1.521 \(\times\) 10\({}^{-7}\) & 2.608 \(\times\) 10\({}^{-7}\) & 1.434 \(\times\) 10\({}^{-7}\) & 1.763 \(\times\) 10\({}^{-7}\) \\ Standard deviation & 0.020 & 0.065 & 0.119 & 0.240 \\ \hline \hline \end{tabular}
\end{table} 
Table 6: The fitness, the running times of the four PID controllers’ gains optimisation algorithms and the mean and standard deviation of the ten experiments conducted. Figure 5: The nonlinear rotorcraft model response to selected trim control input. The performance of these controllers is evaluated for tracking elevation around the trim height, i.e., \(z_{d}=-10\pm 1\) metres and unit steps wind gust for \(y\) at \(t=7\) s. Figures 7 and 8 show a visual comparison of the controllers. The ACO-PID is superior to others, although the others are also within the performance specifications. \begin{table}
\begin{tabular}{r r r r r r r} \hline \hline
**PID Gains** & **Roll** & **Pitch** & **Yaw** & **Altitude** & **Long** & **Lat** \\ \hline \(PSOK_{p}\) & \(-12.564\) & \(36.446\) & \(-20.986\) & \(-37.172\) & \(10.998\) & \(49.8666\) \\ \(K_{i}\) & \(0\) & \(0\) & \(36.985\) & \(2.460\) & \(-45.444\) & \(19.936\) \\ \(K_{d}\) & \(-12.546\) & \(16.296\) & \(48.725\) & \(7.108\) & \(41.892\) & \(-47.418\) \\ \hline \(GA\)\(K_{p}\) & \(21.0000\) & \(-10.0000\) & \(-14.0000\) & \(-17.7500\) & \(19.7552\) & \(36.0000\) \\ \(K_{i}\) & \(0\) & \(0\) & \(18.0000\) & \(-10.0000\) & \(11.0000\) & \(33.2500\) \\ \(K_{d}\) & \(0\) & \(0\) & \(31.0000\) & \(0.9319\) & \(-19.0000\) & \(-8.0000\) \\ \hline \(ACO\)\(K_{p}\) & \(20.0000\) & \(-9.7567\) & \(-19.9999\) & \(-19.9970\) & \(0.9746\) & \(19.9999\) \\ \(K_{i}\) & \(0\) & \(0\) & \(8.6687\) & \(-1.7510\) & \(10.9126\) & \(19.9970\) \\ \(K_{d}\) & \(0\) & \(0\) & \(19.9860\) & \(0.8009\) & \(-17.1235\) & \(-6.5332\) \\ \hline \(CSK_{p}\) & \(20.0000\) & \(-8.8618\) & \(-19.6234\) & \(-20.0000\) & \(17.6503\) & \(20.0000\) \\ \(K_{i}\) & \(0\) & \(0\) & \(20.0000\) & \(-14.9142\) & \(19.5898\) & \(20.0000\) \\ \(K_{d}\) & \(-4.3698\) & \(-11.9869\) & \(20.0000\) & \(1.0630\) & \(-18.6291\) & \(-8.6031\) \\ \hline \hline \end{tabular}
\end{table} 
Table 7: The four PID controllers’ gains found using optimisation for hover conditions. Figure 6: The change in fitness over the number of iterations (generations). PID controllers tend to have better regulation than tracking due to the limited region of effectiveness. Next is the tracking of sudden changes in longitudinal displacement. The controllers are able to track a small forward speed up to 2 m/s (Figures 9 and 10). However, the ACO-PID seems to perform better. It also has less overshoot, which is very desirable if the rotorcraft is performing in confined spaces. The PSO-PID is the worst-performing, with a velocity overshoot of 68%. Figure 11 shows the inputs into the rotorcraft commanded by each controller. An attempt to move the rotorcraft from trim with a velocity higher than 2 m/s results in instability. Figure 8: The controlled nonlinear rotorcraft orientation response to selected desired input. Figure 7: The controlled nonlinear rotorcraft position response to selected desired inputs.