Introduction
During the last decade, there has been an increase in the implementation of new technologies for unmanned aerial vehicles (UAVs) in multiple fields, e.g., logistics, surveillance and monitoring, public security, among others (Macrina et al., 2020). Many cases can be highlighted, such as the design and construction of the S4 Éhecatl UAV by Hydra Technologies in Mexico, intended for the surveillance and monitoring of hazardous terrain, or the use of a UAV by the Geophysical Institute of Peru in a volcano monitoring project, which flew over the Ubinas volcano in Moquegua over 6000 m above sea level (Saito, 2019).
A quadcopter is a type of UAV that lifts and propels itself with four motors, which control its stability and mobility by varying their rotational speeds (Ahmad et al., 2020).
The most commonly used controller in quadcopters is the classic PID (proportional-integral-derivative) control system, given its ease of implementation and parameter adjustment (Cedro and Wieczorkowski, 2019). Nevertheless, quadcopters pose a significant challenge in terms of control due to their complex nature, as their dynamic model is nonlinear, multivariable, strongly coupled, and underactuated, a result of the six degrees of freedom being controlled by only four actuators (Zhang et al., 2014). Therefore, it would be convenient to implement nonlinear control algorithms to ensure flight stability and robustness against uncertainties such as external airflows or model errors (Santoso et al., 2018).
An appropriate quadcopter controller has to adapt to changes in dynamics and handle uncertainty; it is necessary to identify an accurate dynamic model, as its performance depends on it. To obtain this model, two methods can be used. The first involves modeling the system from a physical analysis using Newton's laws and Euler angles. The second method is called system identification, and it involves analyzing input and output data from experimental flights (Pairan and Shamsudin, 2017).
The identification method based on experimental data can be parametric or non-parametric; in the former, a reduced number of parameters are fitted to a predefined mathematical model, whereas, in the latter, more flexible techniques such as neural networks are used to fit the data without imposing a prior mathematical structure (Atteia et al., 2021). Neural network-based identification methods allow obtaining an appropriate dynamic model for quadcopters since they can adapt to the complexity of the system, adjust to any variation, and obtain more precise results in real-time control (Rosales et al., 2019).
System identification can be achieved through linear approaches such as AutoRegressive eXogenous models (ARX), Autoregressive Moving Average models with eXogenous variables (ARMAX), and Output Error models (OE). Belge et al. (2020) found the OE method to be the linear model with the highest estimation accuracy for a fixed-wing UAV under different noise variations. In a comparative analysis between a linear and a nonlinear Model Predictive Controller (MPC) for trajectory tracking in a Micro Air Vehicle (MAV), the latter showed better performance regarding disturbance rejection capabilities, step response, tracking performance, and computational effort (Kamel et al., 2017).
Recent studies have devised methods to effectively quantify uncertainties in identifying nonlinear systems, with a focus on cascade or block-oriented approaches such as Volterra series and Wiener and Hammerstein models (Xavier et al., 2021). Similarly, there are black-box models, which have been primarily used in the analysis of electrical and control systems. These models do not incorporate prior knowledge, but instead rely on a structure flexible enough to capture all relevant physics in the measured data. Typical approaches include the Nonlinear AutoRegressive eXogenous model (NARX), the Nonlinear AutoRegressive Moving Average model with eXogenous inputs (NARMAX), artificial neural networks, fuzzy networks, statistical learning theory, and kernel methods (Noel and Kerschen, 2017).
In Altan et al. (2018), the trajectory tracking of a hexacopter was studied with a NARX neural network controller aimed at the transportation of physical cargo packages. Moreover, this approach was compared against a PID controller using performance indicators such as the Mean Squared Error (MSE) and the Root Mean Squared Error (RMSE), with the NARX controller yielding much more robust and stable results.
In addition, the implementation of a tensor network B-splines algorithm with the NARX model for nonlinear system identification demonstrated high efficiency and accuracy through numerical experiments in Single Input and Single Output nonlinear systems (SISO), surpassing the RMSE of other nonlinear methods during both prediction and simulation processes (Karagoz and Batselier, 2020).
In a detailed performance comparison between a PID and an advanced controller utilizing NARX neural networks, various indicators such as the MSE and RMSE were utilized (Karakaya and Goren, 2022). The findings revealed a similar performance for both controllers in yaw tests. However, the advanced controller yielded superior results in altitude, roll, and pitch tests, exhibiting an enhanced performance.
In this vein, Ozbek et al. (2015) identified the issue of modeling uncertainties in UAVs during a survey of quadrotor aerial robot control, and, in their quadcopter modeling review, Pairan et al. (2020) concluded that neural network-based identification is a more suitable option due to its high accuracy, cost, and resource availability. They proposed future research using Radial Basis Functions (RBF) for activation.
The most recent proposals in this field include the works by Ullah et al. (2020, 2021, 2022), who presented two sliding mode control designs for UAVs. These proposals were evaluated using mathematical models and simulations, with promising results. However, the progress of these works could be accelerated through more accurate models with the help of system identification.
Consequently, the design of a NARX neural network identification algorithm could be considered in order to obtain a robust model of the nonlinear systems featured by quadcopters. This would ensure proper functioning while avoiding total equipment losses associated with flight control failures.
Nonetheless, the way to ensure system identification is to consider data representing the system's non-linear behavior. Thus, input/output quadcopter data that genuinely exhibit a nonlinear behavior must be verified for use in the training and validation of quadcopter system identification models.
In light of the above, the objective of this research was to identify the non-parametric model that captures the dynamic behavior of a F450 quadcopter, with the purpose of representing the inherent nonlinearities of the system using NARX neural networks. The model was trained with experimental data acquired from the quadcopter's sensors, and a nonlinear data validation was conducted to ensure suitable data for system identification.
System identification methods
ARX
The ARX model, a linear input/output model, is commonly used due to its computationally efficient parameter estimation (Galrinho et al., 2017). This is accomplished directly through the use of a least squares algorithm, which handles linear relationships between parameters and prediction errors (Tu et al., 2020). However, if the actual noise in the process differs from the assumed conditions, the parameters may deviate from their optimal values, and consistency issues may occur (Nelles, 2020).
As described by Equation (1), the ARX model establishes a relationship between the future value of the dependent output signal y(k), the preceding values of the output signal, and an independent or exogenous input signal u(k). In this context, na and nb represent the model orders, whereas e(k) corresponds to the error of the system, indicating the discrepancy between the predicted and actual output values (Billings, 2013).
NARX
The NARX model represents a nonlinear generalization of the ARX model that substitutes the linear relationship described in Equation (1) with an unknown nonlinear function F(·), as outlined in Equation (2), where nu and ny represent the input and output memory orders, respectively (Nelles, 2020).
N-NARX
The neural network NARX representation is referred to as N-NARX. It is a dynamic neural network with a closed-loop architecture that consists of an input layer, a hidden layer, and an output layer. In addition, it incorporates lagged inputs and outputs through explicit integration or a recurrent procedure, as depicted in Figure 1.
Materials and methods
This work was conducted while following the methodology depicted in Figure 2, which involved a systematic review of the available scientific literature to obtain relevant and up-to-date information.
After conducting the literature review, the focus shifted towards implementing the workspace, specifically a test bench, and building a prototype F450 quadcopter. With this test bench, experimental data on the roll and pitch angle of the quadcopter were acquired. The input and output data obtained from the quadcopter were pre-processed to reduce noise. Afterwards, a neural network model was selected, its parameters were defined, and it was trained using the conditioned data. Finally, the trained model was validated using performance indicators such as the MSE and the RMSE, as well as through cross-correlation with data that were not used during training.
Implementation
A quadcopter was developed using a commercial F450 frame. The prototype was equipped with four brushless motors, four Electronic Speed Controllers (ESCs), four propellers, and a Lithium Polymer (LiPo) battery. These components were connected to an Arduino UNO hardware development board, along with an MPU9250 IMU sensor, in order to enable precise control of the system's orientation (Figure 3).
The data acquisition process involved the use of specialized equipment, i.e., a test bench specifically designed to collect data on the quadcopter's dynamic behavior. Figure 4 shows the CAD assembly of the test bench with a single degree of freedom (or one axis), which was used to analyze two of the three attitude angles of the F450 quadcopter: roll and pitch.
Data acquisition
The data acquisition architecture relied on the test bench, which combined the use of an Arduino board and a computer running the MatLab software. Furthermore, to ensure ease of resetting in case of failure, the Arduino board was located outside the quadcopter.
Figure 5 presents the equipment used for data acquisition alongside a block diagram illustrating the control system of the quadcopter's initial programming, which includes a PID control algorithm with deliberately unsynchronized gains, causing the quadcopter to exhibit an oscillatory motion. The goal of this was to gather crucial insights into the quadcopter's dynamic performance. This motion was critical in capturing the necessary data for subsequent identification processes. Additionally, an algorithm called Motor Mixer was implemented to distribute the output of the PID controller into four Pulse-Width Modulation (PWM) signals that served as inputs for the quadcopter's four Electric Propulsion Units (EPUs).
Subsequently, four experiments were conducted for each angle, with each lasting 40 seconds and featuring a sampling time of 10 ms, in order to gather a comprehensive range of data on the quadcopter's dynamic behavior.
The input and output data obtained from Experiment 1 with the roll angle are presented in Figures 6 and 7, respectively.
Data pre-processing
Dataset selection:
The selection of the dataset considered the type of model to be used for the identification process, i.e., a neural network. To train the model, it was important for the data to contain the maximum possible information on the system's dynamics. To ensure this, the dominant frequency from the dynamic system's output data was taken into account alongside its maximum amplitude range.
From the datasets collected during the four experiments conducted for each angle, only two were selected: one for the identification process and the other for cross-validation. Dataset selection for the training process was based on the experiment whose output data had a higher dominant frequency and maximum amplitude range. For the cross-validation process, however, the experiment with lower dominant frequency and a higher maximum amplitude range in its output data would be selected.
The output data for the roll angle data from Experiment 1 are presented in Figure 8, showing a maximum amplitude range of -51.42 to 48.77°.
The output pitch angle data from Experiment 1 are shown in Figure 9, indicating a maximum amplitude range of -50.22 to 44.19°.
The Fourier transform was applied to calculate the frequency spectrum of the signal and analyze its dominant frequency. The entire frequency domain of the data was limited to the interval from 0 Hz up to twice the dominant frequency.
The frequency spectrum of the roll angle for Experiment 1 is depicted in Figure 10, indicating a dominant frequency of 0.61523 Hz. The frequency spectrum of the pitch angle from Experiment 1 is presented in Figure 11, revealing a dominant frequency of 0.6665 Hz.
Therefore, based on the criterion of higher dominant frequency, the output data from the first experiments involving the roll and pitch angles were selected as the training dataset for the corresponding neural network model. Similarly, following the criterion of lower dominant frequency and lower amplitude, the data from Experiment 3 were selected for the cross-validation of both angles.
Nonlinear data validation:
In order to validate the nonlinear relationship between input and output data (ensuring that the nonlinear behavior of the system would be obtained), two evaluation criteria were considered:
The quotient between the RMS value of each wave of the output's oscillatory signal with respect to the RMS value of each wave of the oscillatory signal of the pitch or roll torque.
A higher-order correlation function of the system's output signal, as long as the input signal satisfied the nonlinear conditions established by (Billings, 2013). This is described in Equation 3.
where φy'y2 is the cross-correlation between the average level output and its power squared, and τ denotes the torque.
Data conditioning:
Data conditioning was performed for both the input and output of the system. In the case of the input, an internal numerical rounding took place in the Arduino micro-controller during the execution of the Motor Mixer algorithm. On the other hand, the output data exhibited measurement variations as a consequence of the quadcopter's vibrations and the presence of white noise in the signal. These inherent factors contributed to the fluctuations and noise observed in the recorded data.
Figure 12 shows a preliminary demonstration, prior to interpolation, of the one-second sampled stepped input data from the first roll angle experiments.
Afterwards, the acquired stepped input data underwent a smoothing procedure using linear interpolation. This process aimed to obtain a refined dataset that would be more suitable for the subsequent identification.
The interpolated input data from the first set of experiments, with a sample interval of one second, is illustrated in Figure 13 for the roll angle and in Figure 14 for the pitch angle.
It is important to note that this interpolation technique was consistently applied to all the input data gathered throughout the experiments.
The output signals correspond to the roll and pitch tilt angles, which are considered to be the attitude angles of an aircraft with respect to the horizontal plane. Their processing is based on the implementation of the Kalman filter, a robust estimation algorithm that effectively removes inconsistencies and variations in the measurements, thereby ensuring more precise, reliable, and consistent results.
Figure 15 shows a demonstration, prior to filtering, of a one-second sample interval of the output data for the first experiment with the roll angle.
The one-second sample interval of the output data from the first experiments with the roll and pitch angles, as filtered using the Kalman filter, is shown in Figures 16 and 17.
Training the neural network model
Based on Al-Mahasneh et al. (2017), a neural model was chosen for the quadcopter identification process. Comparisons between different neural network approaches were made to determine their usefulness and versatility in this task.
The N-NARX model was selected based on El Dakrory and Tawfik (2016). This model consistently demonstrated its promising performance over other methods, surpassing the capabilities of its linear counterpart, the ARX model.
The system architecture (i.e., the number of layers and neurons) followed the mathematical model obtained by Oktay and Kose (2019), with RBF activation functions stemming from prior work by Pairan and Shamsudin (2017). This was used as a starting point for the training and weight adjustment process. The backpropagation training method and the Levenberg-Marquardt algorithm were also employed to minimize the MSE.
Table 1 presents an overview of the features considered while designing the architecture for the selected neural network. This includes the network type, the number of layers, and the neuron activation function used.
In the N-NARX model, one lag was considered for the input and three for the output. This decision was based on the literature review, as illustrated in Figure 18 (Pairan and Shamsudin, 2017). As previously mentioned, an RBF was considered.
After identifying the parameters of the neural network model, the processed roll and pitch angle datasets were trained. Firstly, the roll angle information from Experiment 1 was used, consisting of 3901 input and output data. The N-NARX model's training stopped at 19.48 seconds, achieving a minimized MSE of 4.59.
Meanwhile, for the pitch angle dataset from Experiment 1, also consisting of 3901 input and output data, the training stopped at 2.16 seconds, with a minimized MSE of 1.44.
Results and discussion
Results
Based on the previously mentioned indicators, this study compared the temporal response of the non-parametric quadcopter system's actual attitude angles (from Experiment 1) and those predicted by the N-NARX model.
Two validation steps were implemented:
Graphical and quantitative validation, showing how closely the neural model's results approximated the real system data, with quantitative metrics such as the MSE, the RMSE, and the fit percentage.
Cross-validation, using experimental data not employed in training the N-NARX model. This procedure is detailed below.
For the roll angle (Figure 19), the following values were obtained: an MSE of 4.59, an RMSE of 2.14, an RMSE percentage of 2.14%, and a fit percentage of 90.87%.
Source: Authors
Figure 19. Approximation of the N-NARX model using data from Experiment 1 – Roll angle
As for the pitch angle, the comparison is shown in Figure 20, with the following results: a MSE of 1.44, a RMSE of 1.20, a RMSE percentage of 1.28%, and a fit percentage of 93.80%.
Source: Authors
Figure 20. Approximation of the N-NARX model using data from Experiment 1 – Pitch angle
Afterwards, the selected neural model underwent validation on a separate dataset, specifically that of Experiment 3 (i.e., cross-validation).
For the roll angle (Figure 21), the following values were obtained: a MSE of 5, a RMSE of 2.23, a RMSE percentage of 2.25%, and a fit percentage of 89.44%.
Source: Authors
Figure 21. Approximation of the N-NARX model using data from Experiment 3 – Roll angle
For the pitch angle, as depicted in Figure 22, the performance evaluation yielded the following results: a MSE of 2.70, a RMSE of 1.64, a RMSE percentage of 2.20%, and a fit percentage of 89.29%.
Source: Authors
Figure 22. Approximation of the N-NARX model using data from Experiment 3 – Pitch angle
Table 2 presents a quantitative comparison between the performance indicators obtained from Experiment 1, which were used in the training dataset, and those from Experiment 3, i.e., the dataset for cross-validation. This comparison enables an assessment of the model's performance across different datasets.
It is worth mentioning that the results obtained from Experiment 1 evinced a higher level of accuracy and a lower error in predicting both angle values when compared to the actual data, as the model was trained on the former. However, it is important to note that the N-NARX model showed a remarkable prediction performance even when evaluated on the unseen data from Experiment 3.
A statistical analysis was conducted to assess the behavior of the trained model's predictions and the actual values obtained from Experiment 3 for the roll angle (Figure 23) and the pitch angle (Figure 24).
The results confirm that the simple correlation consistently falls within the established confidence bands, at a 95% level for different time lags. This indicates a strong and consistent association between the predicted and actual values, supporting the model's ability to capture the patterns and behaviors of the analyzed nonlinear system.
Discussion
The proposed artificial neural network method showed a high capability to predict attitude angles in a complex nonlinear system model such as a quadcopter. This observation aligns with the results of Muresan et al. (2013) and Zhang et al. (2014), who reported the model's high performance and accuracy in predicting both roll and pitch angles with a trained nonlinear model, outperforming the capacities of linear counterparts.
In light of the above, a comparison was conducted (Table 3) to assess the RMSE percentages of our method and the 4-neuron Minimal Resource Allocating Network (MRAN) linear model proposed by Pairan and Shamsudin (2017), whose work provided the essential basis for parameter selection during the training of the designed neural network. Note that the trained N-NARX model exhibits a lower RMSE percentage than the MRAN model in both roll and pitch angles.
Similarly, Table 4 presents a comparison of the fit percentage between our method and the 4-input, 1-output Multiple Input and Multiple Output (MIMO) ARX linear model presented by Salameh et al. (2015). Note that the trained N-NARX model significantly outperforms the MIMO ARX model regarding the fit percentage for both roll and pitch angles.
The results shown in Tables 3 and 4, which compare the designed model with those proposed by other authors, clearly demonstrate the system's nonlinear behavior. Moreover, these findings highlight our model's robustness and its exceptional accuracy in delivering precise predictions, further validating its effectiveness and reliability in real-world applications.
Conclusions
Quadcopter drones are extremely complex and highly nonlinear systems, underscoring the importance of employing advanced algorithms for their identification. Thereupon, in this study, the roll and pitch angles of an F450 prototype were captured using a neural network model. To facilitate experimentation, a test bench was employed, enabling data collection from four tests conducted for each angle. Simultaneously, a real-time signal monitoring system was set up by connecting the Arduino to a computer, enabling the tracking of inputs consisting of four PWM signals sent to the quadcopter's EPUs, while the MPU9250 IMU sensor determined the device's orientation and produced the corresponding output signals.
These experiments revealed inherent variations, and data quality was assessed through amplitude and frequency spectrum analyses, leading to the selection of Experiments 1 and 3 as databases for each angle. For enhanced modeling, the input data were pre-processed using linear interpolation, while the output data underwent Kalman filtering, resulting in smoother signals and improved dynamic capture. Next, the NARX neural network, with a hidden layer comprising five neurons and utilizing RBF activation, was employed. The model was then trained using the dataset derived from Experiment 1, using the Levenberg-Marquardt algorithm. This yielded optimal outcomes.
The neural network model effectively captured the quadcopter's nonlinear dynamics during both the training and validation processes, resulting in an 89.44% fit with an RMSE of 2.25% for the roll angle, and an 89.29% fit with an RMSE of 2.20% for the pitch angle. Furthermore, the designed neural network model outperformed the proposals of other authors, clearly showcasing its ability to accurately represent the nonlinear behavior of the system.
Future work and scenarios
Considering the work by Ucgun et al. (2022), future research could also build on both the NARX model and the Vertical Take-Off and Landing (VTOL) UAV testbed by evaluating free-flight drones. This would allow validating neural network-based control algorithms and their integration with the robust sliding mode controller developed for the testbed. The goal would be to enhance drone stability and performance, comparing the combined approach against traditional control methods and demonstrating improved robustness and tracking in real-world scenarios. This synergy between the NARX model and the testbed could lead to more reliable UAV control systems.
Building on previous research using a NARX neural network model to identify nonlinear quadcopter dynamics, future work could be extended to free-flying drones, capturing a fully dynamic behavior that includes yaw motion. By moving from controlled environments to free flight, a neural network-based system could identify and stabilize the drone in real time, adapting to conditions like wind disturbances or payload changes. Combining the NARX model with traditional methods like PID or model predictive control could help to create a hybrid system, enhancing performance in complex scenarios. Real-time experiments would validate the approach for more robust flight control in unpredictable environments.
In addition, according to Mechali et al. (2021), the NARX neural model for UAVs can be extended by integrating it with control strategies such as Continuous Non-singular Terminal Sliding Mode Control (CNTSMC) and Disturbance Observer-Based Control (DOBC). In future research, the use of NARX models to accurately predict and identify the nonlinear dynamics of a free-flying UAV could be explored. Then, the CNTSMC scheme could be applied for robust attitude and position control. By combining the predictive capabilities of the NARX model with CNTSMC's robustness, disturbance rejection (DOBC) and Fixed-time eXtended State Observer (FXESO), a highly accurate and resilient control system for UAVs could be developed which performs well even under uncertainties, nonlinearities, and external disturbances. This approach would allow enhancing trajectory tracking and system stability in real-time scenarios, validating the combined method through both simulations and real-world tests.














