Tuning the Proportional–Integral–Derivative Control Parameters of Unmanned Aerial Vehicles Using Artificial Neural Networks for Point-to-Point Trajectory Approach

Nowadays, trajectory control is a significant issue for unmanned micro aerial vehicles (MAVs) due to large disturbances such as wind and storms. Trajectory control is typically implemented using a proportional–integral–derivative (PID) controller. In order to achieve high accuracy in trajectory tracking, it is essential to set the PID gain parameters to optimum values. For this reason, separate gain values are set for roll, pitch and yaw movements before autonomous flight in quadrotor systems. Traditionally, this adjustment is performed manually or automatically in autotune mode. Given the constraints of narrow orchard corridors, the use of manual or autotune mode is neither practical nor effective, as the quadrotor system has to fly in narrow apple orchard corridors covered with hail nets. These reasons require the development of an innovative solution specific to quadrotor vehicles designed for constrained areas such as apple orchards. This paper recognizes the need for effective trajectory control in quadrotors and proposes a novel neural network-based approach to tuning the optimal PID control parameters. This new approach not only improves trajectory control efficiency but also addresses the unique challenges posed by environments with constrained locational characteristics. Flight simulations using the proposed neural network models have demonstrated successful trajectory tracking performance and highlighted the superiority of the feed-forward back propagation network (FFBPN), especially in latitude tracking within 7.52745 × 10−5 RMSE trajectory error. Simulation results support the high performance of the proposed approach for the development of automatic flight capabilities in challenging environments.


Introduction
In recent years, autonomous unmanned aerial vehicles (UAVs) have been given significant attention due to their enormous potential applications in civil and military fields.UAVs appear as micro-aerial robots that support a sustainable environment, offer a contactless delivery option, or can be used for hobby purposes [1][2][3][4][5].In addition, aerial robots can be used autonomously in many applications with cameras and equipment mounted on them, such as increasing agriculture productivity, determining product maturity, detecting diseases and agricultural spraying [6].Autonomous aerial robots should use a robust controller to perform assigned tasks with higher accuracy on specified trajectories.Many different methods are applied to control autonomous aerial robots.Masse et al. used the linear quadratic regulator (LQR) method and structured an H∞ synthesis method for aerial Sensors 2024, 24, 2752 2 of 18 robot control.The results show that the H∞ method performs better than the LQR method in windy conditions.However, it presented an overview based on mathematical models and the section on actual working conditions is not mentioned [7].Perozzi et al. utilized sliding mode control for trajectory tracking of a quadrotor.Results of numerical experiments confirmed the sliding mode control's success in stabilizing the quadrotor under varying wind.Their study aimed to develop a control structure based on predicted wind; however, the variable conditions in the real environment were not taken into account [8].Celen and Oniz used fuzzy logic and neural network controllers for trajectory tracking for a quadcopter.The results show that artificial neural networks (ANNs) provide stability and robustness to the drone system [9].In addition to the mentioned control methods, control models such as model predictive control, backstepping control and model reference adaptive control are also used [10,11].Another popular method used for drone control is the proportional-integral-derivative (PID) controller [12].Tuning the gain parameters of the PID controller is important, although the most commonly used method for tuning these parameters is trial and error.This method is time consuming as Lee and Peng pointed out in their study.Therefore, different methods are needed for tuning parameters [13].
The importance of PID control lies in its simplicity, efficiency, and above all, how easy it is to implement.There are many PID control studies in the literature developed for trajectory control in UAVs [14].In these studies, many of the solutions given in terms of PID control are created temporarily, meaning that priority is given to solving the task rather than providing an analysis that will reveal the limitations and advantages of the control strategy.Independent of these studies, the number of ANN-based approaches that have increased their effectiveness has been increasing rapidly, especially in recent years.
Wang et al. used RBF (radial basis function) neural network to tune the autonomous flight PID controller parameters of UAVs in adapting to different environments [15].Gao et al. used NN-PID to control the attitude and position of a quadrotor.Simulation results show that their NN-PID algorithm is more robust than the PID algorithm [16].In many studies, quadrotors exhibit complex nonlinear dynamics resulting from complex interactions between multiple rotors and their effects on both translational and rotational motion.PID controllers designed by classical methods for linear systems have difficulty in accurately modeling and handling the nonlinear behavior of quadrotors.Therefore, superior methods such as artificial intelligence are needed for tuning PID parameters.
In this study, an ANN-based PID control parameter adjustment method is proposed for the autonomous flying robot system developed to determine the yield in an apple orchard where autotune mode is not possible [17].This system is controlled with three different PID control structures for roll, pitch and yaw movements.Thus, the adaptation of the quadrotor to linear PID parameters is facilitated by using nonlinear behavioral parameters in ANN training.For this purpose, the flying robot system, which has a script coded in Python, performed flight simulations with 200 different randomly determined PID parameter combinations in the Mission Planner simulation environment to which it is connected via SITL, and a data set with position data as input and PID parameters as output is created.Simulations performed on the trajectory used as a reference while creating the data set show that changing the PID parameters of the yaw control does not cause a significant change in the trajectory error.Therefore, a neural network predictor model for yaw control is not developed in this study.The data set obtained for roll and pitch controllers is used for models developed with three different ANN algorithms.As a result, test flights are carried out in the Mission Planner simulation environment of the quadrotor system with the PID gain parameters estimated by three different ANN models, and the performance and error values of the estimated PID parameters were observed.Simulation results are presented comparatively in tables and graphics.

Methodology
Using the conventional approach of autotune mode to establish control parameters for the quadrotor robotic system is deemed unsuitable, particularly in an apple orchard's narrow and sparsely covered corridors, as illustrated in Figure 1.Autotune mode is frequently used in studies to determine PID control parameters.Mini aerial vehicles using this mode automatically determine the optimum K p , K i and K d gain parameters in large and open areas, with movements similar to the dance of bees in the air.However, it is not possible to apply the method in the apple orchard where the study will be carried out to determine the yield since the apple orchards have narrow corridors and the upper parts are covered with thin cover.For this reason, in this study, the K p , K d and K i gain parameters are determined with artificial intelligence methods in the determined trajectories and the system performance is evaluated.In the study, the determination of K p , K d and K i gain parameters is carried out in a simulation environment, and the trajectory tracking performance of the quadrotor system is examined with the obtained gain parameters.

Methodology
Using the conventional approach of autotune mode to establish control parameters for the quadrotor robotic system is deemed unsuitable, particularly in an apple orchard's narrow and sparsely covered corridors, as illustrated in Figure 1.Autotune mode is frequently used in studies to determine PID control parameters.Mini aerial vehicles using this mode automatically determine the optimum Kp, Ki and Kd gain parameters in large and open areas, with movements similar to the dance of bees in the air.However, it is not possible to apply the method in the apple orchard where the study will be carried out to determine the yield since the apple orchards have narrow corridors and the upper parts are covered with thin cover.For this reason, in this study, the Kp, Kd and Ki gain parameters are determined with artificial intelligence methods in the determined trajectories and the system performance is evaluated.In the study, the determination of Kp, Kd and Ki gain parameters is carried out in a simulation environment, and the trajectory tracking performance of the quadrotor system is examined with the obtained gain parameters.This section describes the developed system with a broad explanation.Firstly, software specifications are outlined in detail.The modified standard PID controller is described with tuned gain parameters.The general methodology of this article is given in Figure 2. The study, seen in Figure 2, consists of four basic stages.This section describes the developed system with a broad explanation.Firstly, software specifications are outlined in detail.The modified standard PID controller is described with tuned gain parameters.The general methodology of this article is given in Figure 2. The study, seen in Figure 2, consists of four basic stages.

Methodology
Using the conventional approach of autotune mode to establish control parameters for the quadrotor robotic system is deemed unsuitable, particularly in an apple orchard's narrow and sparsely covered corridors, as illustrated in Figure 1.Autotune mode is frequently used in studies to determine PID control parameters.Mini aerial vehicles using this mode automatically determine the optimum Kp, Ki and Kd gain parameters in large and open areas, with movements similar to the dance of bees in the air.However, it is not possible to apply the method in the apple orchard where the study will be carried out to determine the yield since the apple orchards have narrow corridors and the upper parts are covered with thin cover.For this reason, in this study, the Kp, Kd and Ki gain parameters are determined with artificial intelligence methods in the determined trajectories and the system performance is evaluated.In the study, the determination of Kp, Kd and Ki gain parameters is carried out in a simulation environment, and the trajectory tracking performance of the quadrotor system is examined with the obtained gain parameters.This section describes the developed system with a broad explanation.Firstly, software specifications are outlined in detail.The modified standard PID controller is described with tuned gain parameters.The general methodology of this article is given in Figure 2. The study, seen in Figure 2, consists of four basic stages.The high accuracy of the simulation software is demonstrated by comparing simulated and experimental trajectories for three different UAVs [18].In this study, Mission Planner is used as the flight planning and simulation program.Furthermore, the quadrotor dynamics [19] required for flight are provided by embedded libraries in the Mission Planner open source software [20].
In addition to referenced studies, flight trajectory is created for simulation to compare trajectory tracking performances with different K p , K i and K d parameters.For the quadrotor to track this trajectory, which is similar to the corridors in the apple orchard, a mission program is coded in Python using the Dronekit library.Software in the Loop (SITL) is used to simulate systems operating in real time [21].Using this program, each simulation flight performed with different parameters is tracked on the map as shown in Figure 3, and location data is recorded.These data are then processed and a data set is created for training the neural network model.be achieved with PID control parameters determined through the flight planning program.The high accuracy of the simulation software is demonstrated by comparing simulated and experimental trajectories for three different UAVs [18].In this study, Mission Planner is used as the flight planning and simulation program.Furthermore, the quadrotor dynamics [19] required for flight are provided by embedded libraries in the Mission Planner open source software [20].
In addition to referenced studies, flight trajectory is created for simulation to compare trajectory tracking performances with different Kp, Ki and Kd parameters.For the quadrotor to track this trajectory, which is similar to the corridors in the apple orchard, a mission program is coded in Python using the Dronekit library.Software in the Loop (SITL) is used to simulate systems operating in real time [21].Using this program, each simulation flight performed with different parameters is tracked on the map as shown in Figure 3, and location data is recorded.These data are then processed and a data set is created for training the neural network model.

Standard PID Controller System
PID controllers have been used for a wide variety of systems.Today, PID control is also used in many drone studies [22].The continuous time PID controller is defined by Equation ( 1) [23].To drive a plant output y(t), towards a reference signal r(t), the control input u(t), is calculated by a closed loop PID controller, which uses the error in the output, that is, e(t) = r(t) − y(t) [24].In Equation (1), Kp is the proportional gain, Ki is the integral gain and Kd is the derivative gain.
Appropriate coefficient values must be adjusted for the PID controller parameter to operate correctly.Although the Ziegler Nichols method [25] is the most widely used method for tuning these parameters in many systems, it is not easy to apply in such unique systems.Due to the high degree of non-linearity in these systems, it is difficult to modify the PID controller's gain parameters when there are external disturbances or the system parameters are changing.As a result, the PID controller's performance is reduced [26].
MAVs perform their flights according to specific modes.This study uses Auto and Guided modes for the quadrotor to perform the task fully autonomously.Auto mode is used when the flight program is uploaded to the controller, and Guided mode is used when it is managed externally through the program written with Dronekit.In both modes, position errors must be minimized by continuous monitoring of a controller so the quadrotor system can follow the determined trajectory.This system is controlled by three different PID control structures for roll, pitch and yaw movements.The PID control model of UAVs is shown schematically in Figure 4 for UAV movements.

Standard PID Controller System
PID controllers have been used for a wide variety of systems.Today, PID control is also used in many drone studies [22].The continuous time PID controller is defined by Equation (1) [23].To drive a plant output y(t), towards a reference signal r(t), the control input u(t), is calculated by a closed loop PID controller, which uses the error in the output, that is, e(t) = r(t) − y(t) [24].In Equation (1), K p is the proportional gain, K i is the integral gain and K d is the derivative gain.
Appropriate coefficient values must be adjusted for the PID controller parameter to operate correctly.Although the Ziegler Nichols method [25] is the most widely used method for tuning these parameters in many systems, it is not easy to apply in such unique systems.Due to the high degree of non-linearity in these systems, it is difficult to modify the PID controller's gain parameters when there are external disturbances or the system parameters are changing.As a result, the PID controller's performance is reduced [26].
MAVs perform their flights according to specific modes.This study uses Auto and Guided modes for the quadrotor to perform the task fully autonomously.Auto mode is used when the flight program is uploaded to the controller, and Guided mode is used when it is managed externally through the program written with Dronekit.In both modes, position errors must be minimized by continuous monitoring of a controller so the quadrotor system can follow the determined trajectory.This system is controlled by three different PID control structures for roll, pitch and yaw movements.The PID control model of UAVs is shown schematically in Figure 4 for UAV movements.Kp, Ki and Kd parameters must be tuned for each control model before the flight.This tuning can be performed by the trial-and-error method based on experience or adjusted autonomously in autotune mode, a mode developed for this type of MAV.If there is a suitable and sufficient area for flight, automatically tuning the PID controller gain parameters gives a more effective result.In this mode, the UAV moves autonomously in a widearea trajectory, similar to the dance of bees, according to a determined algorithm.During this movement, Kp, Ki and Kd parameters are tuned in the most optimal way.However, it is not possible to use the autotune mode because the micro-UAV designed in this study will perform its movement in a narrow and covered environment among trees.For this reason, an artificial neural network (ANN) model has been developed to determine the Kp, Ki and Kd parameters.
In the simulation environment, a trajectory was determined by reference to the row size of the tree array where the experimental study will be carried out.This trajectory is autonomously followed with datasets consisting of 100 different Kp, Ki and Kd parameters determined separately for the roll and pitch control models.During the sample preparation, it is experienced that 100 samples in the dataset are sufficient to extract the characteristics between the position-PID parameters.Changing the PID parameters of the yaw control does not cause a significant change in the trajectory error.Therefore, there is no need for an optimization for the yaw control model in the simulation flights, and the default values are used in all flights.The default values for the gain parameters are 0.2 for Kp, 0.02 for Ki and 0.002 for Kd.
In this method, 200 flight simulations are performed according to the parameter changes in two different control models.The Kp, Ki and Kd parameters adjusted in each simulation are used as output values for the samples in the training of the ANN model.These values are determined randomly through the program and the Kp, Ki and Kd parameters of one of the roll and pitch control models were changed while the others were kept constant.In this way, it is aimed to determine the optimum Kp, Ki and Kd control parameters for each movement type.

Proposed Artificial Neural Network (ANN)
For tuning PID parameters, several offline methods are available.In this section, the critical ideas of ANN, supervised learning and system identification methodologies are introduced and analyzed in relation to the theoretical development and applications of optimal PID controllers [27].ANNs can offer flexible solutions to non-linear problems with their structure similar to the human brain.
ANNs where data flow only in the forward direction are feed-forward networks.ANNs with connections that allow data to flow both forward and backward are called feedback neural networks.One of the network structures used in this study is the feedforward back propagation network (FFBPN).The FFBPN is a method of supervised learning.Radial basis neural network (RBNN) and cascade forward back propagation network (CFBPN), other network structures used in the study, are also supervised learning methods.K p , K i and K d parameters must be tuned for each control model before the flight.This tuning can be performed by the trial-and-error method based on experience or adjusted autonomously in autotune mode, a mode developed for this type of MAV.If there is a suitable and sufficient area for flight, automatically tuning the PID controller gain parameters gives a more effective result.In this mode, the UAV moves autonomously in a wide-area trajectory, similar to the dance of bees, according to a determined algorithm.During this movement, K p , K i and K d parameters are tuned in the most optimal way.However, it is not possible to use the autotune mode because the micro-UAV designed in this study will perform its movement in a narrow and covered environment among trees.For this reason, an artificial neural network (ANN) model has been developed to determine the K p , K i and K d parameters.
In the simulation environment, a trajectory was determined by reference to the row size of the tree array where the experimental study will be carried out.This trajectory is autonomously followed with datasets consisting of 100 different K p , K i and K d parameters determined separately for the roll and pitch control models.During the sample preparation, it is experienced that 100 samples in the dataset are sufficient to extract the characteristics between the position-PID parameters.Changing the PID parameters of the yaw control does not cause a significant change in the trajectory error.Therefore, there is no need for an optimization for the yaw control model in the simulation flights, and the default values are used in all flights.The default values for the gain parameters are 0.2 for K p , 0.02 for K i and 0.002 for K d .
In this method, 200 flight simulations are performed according to the parameter changes in two different control models.The K p , K i and K d parameters adjusted in each simulation are used as output values for the samples in the training of the ANN model.These values are determined randomly through the program and the K p , K i and K d parameters of one of the roll and pitch control models were changed while the others were kept constant.In this way, it is aimed to determine the optimum K p , K i and K d control parameters for each movement type.

Proposed Artificial Neural Network (ANN)
For tuning PID parameters, several offline methods are available.In this section, the critical ideas of ANN, supervised learning and system identification methodologies are introduced and analyzed in relation to the theoretical development and applications of optimal PID controllers [27].ANNs can offer flexible solutions to non-linear problems with their structure similar to the human brain.
ANNs where data flow only in the forward direction are feed-forward networks.ANNs with connections that allow data to flow both forward and backward are called feedback neural networks.One of the network structures used in this study is the feedforward back propagation network (FFBPN).The FFBPN is a method of supervised learning.Radial basis neural network (RBNN) and cascade forward back propagation network (CFBPN), other network structures used in the study, are also supervised learning methods.
The schematic representation of the ANN model trained to estimate the K p , K i and Kd parameters for the FFBPN model is given in Figure 5.
The schematic representation of the ANN model trained to estimate the Kp, Ki and Kd parameters for the FFBPN model is given in Figure 5.The weights between input and hidden layers are updated as Equation ( 2) in FFBPN, where η is the learning rate and α is the momentum term.E2(t) is the propagation error between hidden and input layers.E1(t) is the error between experimental and neural network output signals [28,29].
The weights between the hidden and output layers are updated as Equation (3).
The CFBPN model is similar to a FFBPN model in using the backpropagation algorithm for weight updating.However, a fundamental characteristic of this network is that every layer of neurons is associated with all preceding layers of neurons.As other feedforward networks, CFBPN has one or more interconnected hidden layers and activation functions.Each neuron has a bias of its own and each connection has a specific weight [30,31].The schematic representation of the CFBPN model is given in Figure 6.The weights between input and hidden layers are updated as Equation ( 2) in FFBPN, where η is the learning rate and α is the momentum term.E 2 (t) is the propagation error between hidden and input layers.E 1 (t) is the error between experimental and neural network output signals [28,29].
The weights between the hidden and output layers are updated as Equation (3).
The CFBPN model is similar to a FFBPN model in using the backpropagation algorithm for weight updating.However, a fundamental characteristic of this network is that every layer of neurons is associated with all preceding layers of neurons.As other feed-forward networks, CFBPN has one or more interconnected hidden layers and activation functions.Each neuron has a bias of its own and each connection has a specific weight [30,31].The schematic representation of the CFBPN model is given in Figure 6.
Each combination in the CFBPN learning sample (p q , d q ) is calculated as follows [32]: p q inputs are propagated forward through the layers of the m-layer neural network by Equation ( 4): where p q is input, a is cell output, b is bias and w is weight.Back propagate the sensitivities through the layers by Equation ( 5): Modify the biases and weights by Equations ( 6) and (7), respectively: These steps continue until the stopping criterion is reached.The nonparametric estimation of multidimensional functions using sparse amounts of training data is a common application for RBNN.Fast and thorough training of RBNNs makes them effective [33,34].RBNNs have many benefits, including strong global approximation ability, no local minimum difficulties and fast learning speed [35].FFBPNs can have one or multiple hidden layers, while RBNNs have only one.The input layer, which is the first layer of the RBNN, just serves to transfer information and does not process the input data in any way.The second layer is a hidden layer.The third layer is the output layer, which will linearly transform the input data and then the output [36].The schematic representation of the RBNN model is given in Figure 7.
where pq is input, a is cell output, b is bias and w is weight.Back propagate the sensitivities through the layers by Equation ( 5): Modify the biases and weights by Equations ( 6) and ( 7), respectively: These steps continue until the stopping criterion is reached.The nonparametric estimation of multidimensional functions using sparse amounts of training data is a common application for RBNN.Fast and thorough training of RBNNs makes them effective [33,34].RBNNs have many benefits, including strong global approximation ability, no local minimum difficulties and fast learning speed [35].FFBPNs can have one or multiple hidden layers, while RBNNs have only one.The input layer, which is the first layer of the RBNN, just serves to transfer information and does not process the input data in any way.The second layer is a hidden layer.The third layer is the output layer, which will linearly transform the input data and then the output [36].The schematic representation of the RBNN model is given in Figure 7.The objective function in RBNN can be defined by Equation ( 8), where hi is the height value of sample i [37].The objective function in RBNN can be defined by Equation (8), where h i is the height value of sample i [37].
The f (x) given in Equation ( 8) can be defined as in Equation (9).
where n is the number of neurons in the hidden layer, ω i ∈ W is the weight of neuron i in the linear output neuron, c i denotes the center vector of the neuron i, ϕ (.) denotes the nonlinear function that is a multiquadratic function in Equation (10).
where r denotes the distance between unknown and known data, and ξ is a smoothing factor between 0 and 1.As a result, the formula used to calculate the weights in the network structure is given in Equation (11).
The latitude and longitude values (12 pieces) of the corner points determined from the position data recorded at 2 s intervals during the flight are used as input in the training of the ANN model.The output of the ANN model is the parameters K p , K i and K d .The performance of the ANN models for the roll and pitch control models are examined in detail in the Results section.

Estimation of PID Parameters
In the study, three different artificial neural network models, namely feed-forward back propagation neural network, cascade-forward back propagation neural network and radial basis neural network, are designed to determine the PID control parameters of the flying robot system.The designed models are trained with the trajectory points-PID gain values data set obtained in the Mission Planner simulation environment.Z-score normalization is applied to the entire data set for the training process.PID parameters for the reference trajectory are estimated with the trained artificial neural network models.The data set allocated for 100 rolling and 100 pitching values is divided into three groups as 70% train, 15% test and 15% validation for FFBPN and CFBPNN.This separation is performed randomly among the data.Then, flight tests are carried out in the same simulation environment with the obtained parameters and flight performances are compared in terms of latitude, longitude and altitude.
FFBPN and CFBPN artificial neural network models are designed as twelve inputs, three outputs and two hidden layers with eight neurons each.In the training process of both models, three training algorithms, the Levenberg-Marquart (trainlm), scaled conjugate gradient (trainscg) and BFGS quasi-newton (trainbfg), and three activation functions (logsig, radbas and tansig) are used.The training algorithm and activation function that gave the lowest training error are determined by the grid search method to be used in performance tests.Training parameters of artificial neural network models are given in Table 1.MSE values of FFBPN models and estimated PID parameters for the rolling and pitching controllers are given in Table 2. Figure 8 shows the performance plots of FFBPN neural network models with the best training MSE values for rolling and pitching control, respectively.MSE values of CFBPN models and estimated PID parameters for the rolling and pitching controllers are given in Table 3. Figure 9 shows the performance plots of CFBPN neural network models with the best training MSE values for rolling and pitching control.
Finally, the RBNN model is designed and training procedures are carried out to determine the control parameters of both control approaches.Although this artificial neural network model also has twelve inputs and three outputs, it has 100 neurons in its single hidden layer.The spread value of the model is selected as 0.1.Training MSE values and control gain values estimated with the trained network are given in Table 4. Additionally, the training performance graphs of RBNN network trained for rolling and pitching control are shown in Figure 10.MSE values of CFBPN models and estimated PID parameters for the rolling and pitching controllers are given in Table 3. Figure 9 shows the performance plots of CFBPN neural network models with the best training MSE values for rolling and pitching control.Finally, the RBNN model is designed and training procedures are carried out to determine the control parameters of both control approaches.Although this artificial neural network model also has twelve inputs and three outputs, it has 100 neurons in its single hidden layer.The spread value of the model is selected as 0.1.Training MSE values and control gain values estimated with the trained network are given in Table 4. Additionally, the training performance graphs of RBNN network trained for rolling and pitching control are shown in Figure 10.Finally, the RBNN model is designed and training procedures are carried out to determine the control parameters of both control approaches.Although this artificial neural network model also has twelve inputs and three outputs, it has 100 neurons in its single hidden layer.The spread value of the model is selected as 0.1.Training MSE values and control gain values estimated with the trained network are given in Table 4. Additionally, the training performance graphs of RBNN network trained for rolling and pitching control are shown in Figure 10.

Flight Performance Tests
A reference flight trajectory is designed in the Mission Planner program to analyze the performance of PID control gain parameters obtained with artificial neural network models in roll and pitch control.Flights are carried out with each PID value and the tracking performance of the reference latitude, longitude and altitude values are analyzed with four error metrics.The mathematical expressions of the error metrics RMSE (root mean square error), MSE (mean square error), MAE (mean absolute error) and MAPE (mean absolute percentage error) used for this purpose are given in Equations ( 12)- (15).RMSE (root mean square error) is the square root of the mean of the squares of the differences between the actual and reference values, giving greater weight to larger errors.MSE (mean squared error) is the average of the squares of the differences between the actual and reference values, providing an average value according to the error squares.MAE weights all errors equally by averaging the absolute values of the error amounts, thus

Flight Performance Tests
A reference flight trajectory is designed in the Mission Planner program to analyze the performance of PID control gain parameters obtained with artificial neural network models in roll and pitch control.Flights are carried out with each PID value and the tracking performance of the reference latitude, longitude and altitude values are analyzed with four error metrics.The mathematical expressions of the error metrics RMSE (root mean square error), MSE (mean square error), MAE (mean absolute error) and MAPE (mean absolute percentage error) used for this purpose are given in Equations ( 12)- (15).RMSE (root mean square error) is the square root of the mean of the squares of the differences between the actual and reference values, giving greater weight to larger errors.MSE (mean squared error) is the average of the squares of the differences between the actual and reference values, providing an average value according to the error squares.MAE weights all errors equally by averaging the absolute values of the error amounts, thus reducing the weight of larger errors.MAPE evaluates the relative accuracy of actual values relative to the reference by providing a percentage measure of errors, making it easier to compare data at different scales.
In the equations, n is the number of samples, y i is the ith actual output value, and r i is the ith reference value.The reference trajectory points determined for the performance test are given in Table 5 and the reference trajectory is given in Figure 11.Additionally, rolling and pitching PID controller gain values are given in Table 6 for all artificial neural network models.The actual and reference trajectories of the flight realized with PID parameters estimated with FFBPN are given in Figure 12, CFBPN in Figure 13, RBNN in Figure 14.In addition, error metrics for latitude, longitude and altitude values, which are position information for each flight, are given in Table 7.The actual and reference trajectories of the flight realized with PID parameters estimated with FFBPN are given in Figure 12, CFBPN in Figure 13, RBNN in Figure 14.In addition, error metrics for latitude, longitude and altitude values, which are position information for each flight, are given in Table 7.The reference and actual latitude, longitude and altitude values for the flights performed with all control parameters obtained with the three ANN models are shown in Figure 15, and the RMSE error graphs of these coordinate values are shown in Figure 16.The reference and actual latitude, longitude and altitude values for the flights performed with all control parameters obtained with the three ANN models are shown in Figure 15, and the RMSE error graphs of these coordinate values are shown in Figure 16.
When the error metrics and graphs are examined, the results are quite close in flights where PID parameters obtained with FFBPN and CFBPN models are used.However, the performance of the parameters obtained with RBNN appears to be unsuccessful, especially in terms of latitude and altitude values.Especially, fluctuations in the flying robot system's altitude values cannot be ignored.Although the training error of the RBNN model is lower than the other two models, the fact that it is not successful in the test results reveals the possibility of overfitting.Therefore, it is understood that it cannot produce a robust response to external situations.This shows that the RBNN model is unsuitable for this specific task compared to the other two.
When FFBPN and CFBPN are compared with each other, it is seen that FFBPN parameters provide more successful tracking.Again, although the train errors of these models are quite close to each other, the test results reveal that the train performance should be evaluated in terms of its own hyperparameters within each network model.When the flight performance of the parameters estimated by the two models is examined, the models do not reveal very different results in terms of latitude and longitude values.In contrast, in the flight study conducted with CFBPN, it is observed that there is an increase in altitude on long straight roads and a decrease in corner points.This shows that the FFBPN model is more successful than others in predicting altitude changes.
Additionally, feed-forward networks include only forward connections between layers, whereas cascade-forward networks also have direct connections of the inputs and outputs of each layer to subsequent layers.While this enables cascade-forward networks to model more complex relationships by capturing longer-range dependencies in the data set, it may cause undesirable lengths of training time and the risk of overfitting in non-complex data sets.Therefore, it is necessary to consider each artificial neural network model by assessing the nature and properties of the data set.

Figure 2 .
Figure 2. Flow chart description of the proposed methodology.

2. 1 .
Software Specifications Ardupilot software (Copter-4.4.0) is embedded in the controller to run flight commands and manage the flight.Through this software, precise control of the quadrotor can

Figure 2 .
Figure 2. Flow chart description of the proposed methodology.

2. 1 .
Software Specifications Ardupilot software (Copter-4.4.0) is embedded in the controller to run flight commands and manage the flight.Through this software, precise control of the quadrotor can

Figure 2 .
Figure 2. Flow chart description of the proposed methodology.

2. 1 .
Software Specifications Ardupilot software (Copter-4.4.0) is embedded in the controller to run flight commands and manage the flight.Through this software, precise control of the quadrotor can be achieved with PID control parameters determined through the flight planning program.

Figure 3 .
Figure 3.View of one of the simulation flights on the map.

Figure 3 .
Figure 3.View of one of the simulation flights on the map.

Figure 5 .
Figure 5.The schematic representation of the FFBPN model with signal flow direction.

Figure 5 .
Figure 5.The schematic representation of the FFBPN model with signal flow direction.

Figure 7 .
Figure 7.The schematic representation of the RBNN model.

Figure 8 .
Figure 8. Training performance graphs of FFBPN models giving the best training results used to estimate PID parameters of the controllers for (a) rolling and (b) pitching.

Figure 8 .Figure 9 .
Figure 8. Training performance graphs of FFBPN models giving the best training results used to estimate PID parameters of the controllers for (a) rolling and (b) pitching.

Figure 9 .
Figure 9. Training performance graphs of CFBPN models giving the best training results used to estimate PID parameters of the controllers for (a) roll control and (b) pitch control.

Figure 9 .
Figure 9. Training performance graphs of CFBPN models giving the best training results used to estimate PID parameters of the controllers for (a) roll control and (b) pitch control.

Figure 10 .
Figure 10.Training performance graphs of RBNN model used to estimate PID parameters of the controllers for (a) rolling and (b) pitching.

Figure 10 .
Figure 10.Training performance graphs of RBNN model used to estimate PID parameters of the controllers for (a) rolling and (b) pitching.

Figure 11 .
Figure 11.Reference trajectory and corner points (P1: Start point, P2 -P5: Trajectory points and P6: End point) to be used for performance testing.

Figure 11 .
Figure 11.Reference trajectory and corner points (P 1 : Start point, P 2 -P 5 : Trajectory points and P 6 : End point) to be used for performance testing.

Figure 11 .
Figure 11.Reference trajectory and corner points (P1: Start point, P2 -P5: Trajectory points and P6: End point) to be used for performance testing.

Figure 12 .
Figure 12.The actual and reference trajectory variations of the flight performed with PID parameters estimated with FFBPN.

Figure 12 .
Figure 12.The actual and reference trajectory variations of the flight performed with PID parameters estimated with FFBPN.Sensors 2024, 24, x FOR PEER REVIEW 14 of 19

Figure 13 .
Figure 13.The actual and reference trajectory variations of the flight performed with PID parameters estimated with CFBPN.

Figure 13 .
Figure 13.The actual and reference trajectory variations of the flight performed with PID parameters estimated with CFBPN.

Figure 13 .
Figure 13.The actual and reference trajectory variations of the flight performed with PID parameters estimated with CFBPN.

Figure 14 .
Figure 14.The actual and reference trajectory variations of the flight performed with PID parameters estimated with RBNN.

Figure 14 .
Figure 14.The actual and reference trajectory variations of the flight performed with PID parameters estimated with RBNN.

Table 2 .
MSE values of FFBPN models and estimated PID parameters for the rolling and pitching controllers.

Table 3 .
MSE values of CFBPN models and estimated PID parameters for the rolling and pitching controllers.

Table 4 .
MSE values of RBNN model and estimated PID parameters for the roll and pitch controllers.

Table 3 .
MSE values of CFBPN models and estimated PID parameters for the rolling and pitching

Table 4 .
MSE values of RBNN model and estimated PID parameters for the roll and pitch controllers.

Table 4 .
MSE values of RBNN model and estimated PID parameters for the roll and pitch controllers.

Table 5 .
Latitude, longitude and altitude values of the reference trajectory points to be used for performance testing.

Table 5 .
Latitude, longitude and altitude values of the reference trajectory points to be used for performance testing.

Table 6 .
Roll and pitch PID controller gain values for all artificial neural network models.

Table 6 .
Roll and pitch PID controller gain values for all artificial neural network models.

Table 6 .
Roll and pitch PID controller gain values for all artificial neural network models.

Table 7 .
Error metrics for latitude, longitude and altitude values.