Adaptive Neuro-Fuzzy Inference System Based on Sliding Mode Control for Quadcopter Trajectory Tracking with the Presence of External Disturbance
Abstract:
Objective of this study is to develop a novel, effective, and robust Sliding Mode Control (SMC) method for quadcopters (also called quadrotors) based on Adaptive Neuro-Fuzzy Inference System (ANFIS) for the purposes of enhancing trajectory tracking performance and realizing safe and reliable flight. In the paper, the ANFIS was combined with SMC technology to propose a scheme of adaptive robust controller, which is composed of three sub-controllers, x position controller, y position controller, and z position (altitude) controller. The proposed method can realize position tracking control of quadcopters in the presence of external disturbances. With the help of ANFIS, an adjustable gain rather than a fixed gain was established for the SMC controller, the optimal output could be attained based on a set of rules, and the position control gain was updated by ANFIS, enabling the SMC to adapt to environmental changes. Through modelling, simulation and comparison, experimental data verified that the proposed ANFIS-SMC controller outperformed conventional SMC controller in terms of convergence speed, robustness, accuracy, and stability with a maximum mean error of 0.125 meters in trajectory tracking. Research findings of this paper could contribute to the development of robust and responsive control strategies for Unmanned aerial vehicles (UAVs) trajectory tracking by providing valuable insights into the design of more effective and efficient control systems for UAVs, particularly in the context of dynamic environmental conditions.
1. Introduction
Unmanned aerial vehicles (UAVs) have received extensive attention from the engineering community due to their promising potential in military and civilian applications, such as disaster rescue [1], [2], intelligent surveillance [3], [4], smart agriculture [5], [6], [7], [8], aerial photography [9], [10], mapping [11], industry inspection [12], [13] logistics [14], [15], [16], forest fire-fighting [16], and crop disease monitoring [17], [18], [19], etc. Numerous types of UAVs have been fabricated and developed as research platforms, among which the quadcopters (also called quadrotors) are the most popular type because of their considerable merits including autonomous flight, easy construction, simple maintenance, low cost, onboard vision, vertical take-off and landing [20], hovering ability, and manoeuvrability. The use of quadcopters is expected to grow rapidly in the future owing to their potentiality to transform many industries, increase efficiency, reduce costs, and improve safety. Moreover, the evolution of cutting-edge technologies such as artificial intelligence, machine learning, and computer vision has enhanced the capabilities of quadcopters, for example, once equipped with sensors and cameras [7], [9], [12], quadcopters can autonomously collect and analyze data, identify objects and anomalies, and conduct missions without human intervention. As a result, no doubt quadcopters are indispensable in many industries in the future, to fully exert their many advantages, it’s a necessary work to design and develop advanced control systems for quadcopters, however, such work is quite challenging since the highly nonlinear systems [21], underactuated [22] and strongly coupled dynamics make it very difficult to design tracking control for quadcopters in the presence of various uncertainties such environmental disturbances and unknown loads.
2. Literature Review
World field scholars have designed various controllers for UAVs, classical methods including Proportional Integral Derivative (PID), Linear Quadratic Regulator (LQR), Backstepping controller, and Sliding Mode Control (SMC) have been widely used in quadcopters, but each type has its pros and cons, for instance, PID controller can stabilize the position of quadcopters and successfully eliminate errors in steady state [23], but in cases with disturbance, its lengthy adjustment time, big overshoot, and large steady-state error are non-negligible disadvantages [24]. Compared with PID, LQR owns a better robustness in controlling UAV’s position and orientation coordinates but its response is slower [25]. Backstepping controller has excellent tracking performance, rapid adjustment, good adaptability in handling underactuation problem with rigid negative feedback form [26], but its performance is inferior to SMC as it has difficulties in estimating variations in uncertainties and external disturbances [27]. SMC has become the most popular controller for UAVs thanks to its fast convergence, high adaptability, and robust to external disturbances and parameter uncertainties, but still, its system stability can be undermined by chattering issues caused by high-frequency switching [28].
In order to enhance the performance of SMC, researchers have integrated many techniques, for example, Razmi and Afshinfar [29] introduced Neural Network (NN) adaptive scheme into SMC and proposed a NN-based SMC controller for position and attitude tracking control of quadcopters in the presence of parameter uncertainties and external disturbances, which gave a good performance in terms of settling time, maximum overshoot, and steady state error. Zhao and Jin [30] proposed a SMC algorithm based on Radial Basis Function Neural Network (RBFNN) to eliminate the effects of model uncertainties and exogenous disturbances on the path tracking controller of agricultural quadcopter with variable payload, and verified the efficacy and more accurate path tracking performance of the proposed controller by comparing it experimentally with other classic SMC methods. Darwito and Wahyuadnyana [31] combined SMC with Back Propagation Neural Network (BPNN) for trajectory tracking of quadcopters and simulated its effect, their results proved that the proposed scheme could control the quadcopter in absence and presence of time-varying external disturbances. Zare et al. [32] integrated SMC with fuzzy logic based on Lyapunov function and optimized it using an intelligent fuzzy-genetic algorithm and applied it to quadcopter slung load position and attitude control, the proposed method exhibited good stability, robustness, and tracking performance in case of transient and steady states with external disturbances, and effectively reduced the chattering phenomenon. Xu and Lu [33] integrated fuzzy control and SMC for accurate trajectory tracking of quadcopters under time-varying model uncertainties and external disturbances and proved the uniform stability of the proposed system. Abro et al. [34] proposed a model-free based single-dimension fuzzy Sliding Mode Control (MFSDF-SMC) scheme for controlling attitude and position of underactuated quadcopters, and compared it with conventional SMC methods via simulation, results demonstrated that the proposed scheme exhibited robust trajectory tracking performance. In terms of merging fuzzy control and neural networks, a technique known as ANFIS (Adaptive Neuro-Fuzzy Inference System) can be used to solve this problem, which has been used in trajectory tracking of UAVs both as a single control method [35], [36] and in combination with PID [37], and is capable of minimizing tracking error, exhibiting greater stability in various flight conditions, and ensuring rapid convergence. Zeghlache et al. [38] developed a hybrid technique for the control of coaxial octorotor UAV in the presence of actuator faults that combines fuzzy logic, neural networks, and SMC, and verified that the proposed scheme could significantly reduce the chattering effect and attain good tracking results.
After carefully reviewing existing studies, it’s found that previous scholars have done plenty works combining conventional or latest methods, particularly SMC, with other techniques to attain better trajectory tracking results of UAVs by eliminating chatter and developing adaptive SMC controllers with less errors, faster convergence speed, higher adaptability, and stronger robustness to external disturbances and parameter uncertainties, however, none of these works has attempted to combine SMC with ANFIS to solve the issue of quadcopter trajectory tracking. To fill in this research blank, this paper aims to introduce ANFIS, an adaptive control method that can automatically adjust control parameters, to optimize the SMC of quadcopters, and investigate the effectiveness of the proposed ANFIS-SMC scheme in quadcopter trajectory tracking in the presence of external disturbances. In the third chapter, this paper established a mathematical model for quadcopter; in the fourth chapter, the proposed ANFIS-SMC scheme of quadcopter was introduced in detail; in the fifth chapter, simulation experiment was performed and the results were given. Conclusions were drawn in the last part.
Main innovations and contributions of this paper are:
(1) This paper innovatively proposed to combine ANFIS with SMC for the quadcopter position control problem in the presence of external disturbances and developed an novel controller which was divided into three sub-controllers: x position controller, y position controller, and z position (altitude) controller. The sliding surface coefficients in each of these controllers were adaptively tuned by the ANFIS method.
(2) An adaptive tuning sliding surface was considered for reducing the duration of the reaching phase, ensuring less sensitivity to parameter variations and disturbances.
(3) The proposed ANFIS-SMC scheme of quadcopter controller was compared with the SMC method proposed in [31] and its effectiveness and superiority were verified via simulation results.
3. Modelling
Consider a quadcopter system with four propellers, as illustrated in Figure 1, driven by motors positioned in two orthogonal directions. The system is designed with the body frame denoted by $B=\left(x_b, y_b, z_b\right)$ and the earth frame denoted by $E=\left(x_e, y_e, z_e\right)$.

A rotation matrix is defined to transform from the body frame to the earth frame as follows [39]:
Where, $\operatorname{c} x=\cos x$ and s $x=\sin x(x=\phi, \theta, \psi)$; $ϕ$,$θ$, and $ψ$ are roll angle, pitch angle, and yaw angle, respectively. Applying Newton-Euler equations, the dynamical equations governing the motion of the 6-DoF (Degree of Freedom) and underactuated quadcopter are stated as follows [39]:
Parameters $a_i$,$b_i$,and $c_i (i=1,2,3)$ are described as follows:
$a_1=\frac{I_y-I_z}{I_x}, a_2=\frac{I_z-I_x}{I_y}, a_3=\frac{I_z-I_x}{I_y}, b_1=\frac{J_r}{I_x}, b_2=\frac{J_r}{I_Y}, c_1=\frac{l}{I_x}, c_2=\frac{l}{I_Y} , c_3=\frac{l}{I_z}$
where, $g$ denotes the acceleration of gravity, $m$ is the mass of the quadcopter, $J_r$ is the inertia of the rotor; $I_x$,$I_y$, and $I_z$ represent the inertia of the quadcopter in directions $x$, $y$, and $z$ respectively; l represents the distance between the rotor and the center of the quadcopter; the global position of the quadrotor is denoted as $x$, $y$, $z$; disturbances are denoted as $D_x$, $D_y$, $D_z$, $D_ϕ$, $D_θ$, $D_ψ$. $U_1$ represents the overall drag of rotors; $U_2$, $U_3$, and $U_4$ are the moments for pitch, roll and yaw, respectively; $U_x$ and $U_y$ respectively represent the input virtual control for quadcopter position in $x$ and $y$ directions, which can be written as [39]:
The input control ($U_1$, $U_2$, $U_3$, $U_4$ ) can be expressed as follows [39]:
where, $\Omega_d= \left(-\Omega_1+\Omega_2-\Omega_3+\Omega_4\right) ; \Omega_i(i=1,2,3,4)$ is the speed of each rotor; $b$ and $d$ are the thrust and drag factors, respectively.
4. Control Design
This chapter gave the design of adaptive SMC for quadcopter trajectory tracking. The ANFIS was applied to update the gain of position control, allowing SMC to adjust according to environmental changes. The control scheme is illustrated in Figure 2.

The control strategy adopted in this paper was a SMC method based on the backstepping approach [31], [39]. Let the $x_d, y_d, z_d$, and $ϕ_d$, $θ_d$, $ψ_d$ respectively represent the desired position of quadcopter in $x$, $y$, $z$ directions and the desired attitude of quadcopter in $ϕ$, $θ$, $ψ$, directions; then the tracking error $e_i$,$i$ $ (i=x,y,z,ϕ,θ,ψ)$, can be defined as:
The sliding surface can be chosen as:
The first derivative of sliding surface is:
The Lyapunov function was chosen:
The first derivative of Lyapunov function is:
To ensure the stability of the system $\dot{V}_i<0$, the sliding mode condition applied is as follows:
According to Eqns. (2) to (10), the control law can be derived as follows:
where, $K_{1_i }$,$K_{2_i }$, and $λ_i$ are the gains of SMC controller. In this paper, only $K_{1_i }$ was tuned by ANFIS. The error and change rate of error were derived using the vectorial distance between the state trajectory and the manifold, as shown in Eqns. (12) and (13), which are denoted by $L_{sn}$ and $L_o$ [34]:
Furthermore, the visual illustration can be seen in Figure 3.

Designing a fuzzy logic controller can be challenging, particularly for complex systems. Given a set of input/output training data, ANFIS is a simple method for obtaining a properly tuned fuzzy logic controller [37]. The combined advantages of Fuzzy Inference System (FIS) and neural networks (NN) contribute to the effectiveness of the ANFIS approach. The proposed neuro-fuzzy network is a five-layer architecture with fuzzy Sugeno-type system components [36] presented in Figure 4:
Layer 1 (fuzzification): Adaptive nodes present in this layer. The outputs, which are the fuzzy degrees of membership of the inputs, are determined as follows:
where, $μ_{A_i }$ and $μ_{B_j }$ represent the membership degrees acquired from this layer.
Layer 2 (weighting of fuzzy rules): This layer contains fixed nodes. The membership values determined in the fuzzification layer are used to figure out the firing strength $w_k$ in this layer, and the outputs are computed as follows:
Layer 3 (normalization): All nodes in this layer are fixed nodes. Each node is normalized by computing the ratio of the $k-th$ rule's firing strength (true values) to the total firing strength of all rules. The output $O_k^3$ at this stage is as follows:
Layer 4 (defuzzification): Each node of this layer calculates the weighted consequent values of rules as indicated in Eq. (17).
where, $w_k$ represents the output of the third layer, and {$p_k$, $q_k$, $r_k$} are consequents.
Layer 5 (summation): The output of this layer is determined by summing the outputs of all incoming signals from the defuzzification layer to produce the overall ANFIS output, as shown in Eq. (18):







The proposed ANFIS structure has two inputs, $L_o$ as input 1 and $L_{sn}$ as input 2, and one output, $k_1$. Each input was classified as either small (S), medium (M), or big (B). The position training data sets were obtained by simulating the quadcopter with a backstepping-based SMC controller to obtain the paired input-output data. The ANFIS-SMC controller was trained and designed using a neuro-fuzzy designer in MATLAB. The type of membership function was chosen based on trial and error with the minimum RMSE during training and testing. The best membership function type for input x and y positions was gaussian (gaussmf), while the best type for input z position was trapezium (trapmf). Figure 5, Figure 6, and Figure 7 show the input membership functions acquired after training for X, Y, and Z positions, respectively. Figure 8 illustrates the rule surface for each position.

The rule surface plots for ANFIS shown in Figure 8 are 3D representations showing the decision boundaries created by fuzzy rules. The rules were generated through a combination of fuzzy reasoning and neural network learning. The x and y axes in plots represent the two input features of the classification task, which are input 1 as $L_o$ for the x axis and input 2 as $L_{sn}$ for the y axis, while the z-axis represents the predicted class label, which is $K_1$. Each point in the plots corresponds to a specific combination of input values, and the color of the point indicates the predicted class label.
5. Simulation and Result
In this section, the dynamics of a quadrotor were simulated to evaluate the performance of the proposed controller in trajectory tracking. The ANFIS-SMC scheme was compared with conventional SMC controller. Simulations were executed in two case scenarios. There was no external disturbance in the first scenario, while in the second scenario, there were external disturbances. All simulation results were computed in MATLAB and Simulink software (version R2022b). The values of the quadcopter model and controller parameters are summarized in Tables 1 and 2, respectively. The initial state of position was chosen as $P_0=\left[\begin{array}{lll}0 & 0 & 0\end{array}\right]^T$. The desired trajectory is shown in Table 3.
Parameter | Value | Unit |
$m$ | $65 E-2$ | $K_g$ |
$d$ | $313 E-2$ | $m$ |
$b$ | $75 E-8$ | $N_s^2$ |
$g$ | $981 E-2$ | $\mathrm{m} / \mathrm{s}^2$ |
$l$ | $23 E-2$ | $m$ |
$I_x$ | $75 E-4$ | $K_g \cdot m^2$ |
$I_y$ | $75 E-4$ | $N_s / \mathrm{rad}$ |
$I_z$ | $13 E-3$ | $N_s / m$ |
$J_r$ | $6 E-5$ | $K_g \cdot m^2$ |
Parameter | Value |
$\lambda_x, \lambda_y, \lambda_z$ | 3 |
$k_{1_x}, k_{1 y}, k_{1_z}$ | 5 |
$k_{2 x}, k_{2 y}, k_{2 z}$ | 1E-7 |
t (s) | $x_d$ | $y_d$ | $z_d$ | $\psi_d$ |
0-2000 | 0 | 0 | $\frac{t}{100}$ | 0 |
2000-3000 | $\left(\frac{t}{100}-20\right) * \cos \left(\frac{\pi}{45}\right)$ | $\left(\frac{t}{100}-20\right) * \cos \left(\frac{\pi}{45}\right)$ | 20 | 0 |
3000-4500 | $10+\cos \frac{t}{100}$ | $11+\sin \frac{t}{100}$ | $0-\left(\frac{\tau}{100}-30\right)$ | 0 |
4500-5000 | $10+\cos 45$
| $11+\sin 45$ | $0-\left(\frac{\tau}{100}-30\right)$ | 0 |
In this scenario, the quadcopter was simulated under ideal conditions and no external disturbance. Subgraph (a) of Figure 9 demonstrates the tracking performance of SMC and ANFIS-SMC in 3D trajectory. Subgraphs (a), (b) and (c) of Figure 9 show the trajectory tracking performance of SMC and ANFIS-SMC in directions of x, y, and z axes, respectively.


Figure 10 shows the errors occurred when tracking the position of quadcopter. In light of Figure 9 and Figure 10, it seems that both controllers exhibited a satisfactory level of control. ANFIS-SMC can achieve convergence more quickly and lower overshoot than SMC. However, it is known to generate extremely light chatter along the trajectory. ANFIS-SMC converged more quickly owing to its parameter adaptation. The adaptation law modifies the system's control parameters based on the system's current state and the desired performance. This adaptive strategy enables the control system to adapt to varying circumstances and unpredictability, thereby accelerating the convergence. Nevertheless, this adaptation may also result in extremely light chatter along the trajectory. Chattering is a phenomenon that occurs in SMC when the control signal rapidly switches between different values, resulting in oscillations with a high frequency. Due to the continuous adaptation of control parameters, ANFIS-SMC can reduce chattering but cannot eliminate it entirely. The extremely light chatter occurring in ANFIS-SMC is insignificant and has no impact on the system's stability. SMC, on the other hand, uses constant control parameters throughout the control process, thus resulting in longer convergence times. Once convergence is achieved, there is no chatter along the trajectory. This credit is given to the fixed and stable nature of control parameters, which has eliminated the possibility of chattering. As a result of its adaptation law, ANFIS-SMC can reach convergence faster, but it may generate extremely light chatter along the trajectory. This chatter can be caused by the constant modification of control parameters. On the other hand, conventional SMC may take longer to achieve convergence, but once it does, there is no chatter along the trajectory because the control parameters are fixed and stable.
In this scenario, the system was simulated while external disturbances are present in the environment. Alterations in the velocity of wind are one example of this phenomenon that may occur in real world. The following equation is an expression of the high-level disturbance that has been selected for this situation [21]:
Considering Figure 11 and Figure 12, the performance of the proposed ANFIS-SMC controller in the presence of external disturbance was superior compared to that of the SMC controller. Under ideal conditions, as depicted in Figure 9 and Figure 10, both ANFIS-SMC and SMC showed similar robustness and satisfactory trajectory tracking performance. Nonetheless, under the turbulent conditions depicted in Figure 11 and Figure 12, the ANFIS–SMC approach was more robust than SMC. External disturbances, such as gusts of wind, can cause changes in system dynamics and present uncertainty, thereby introducing turbulent conditions. These disturbances can reduce the robustness of the control system, particularly for control techniques with fixed parameters, such as SMC. The adaptation law of ANFIS-SMC can adjust the control parameters in response to these changes, allowing the control system to maintain robust and compensate for disturbances. SMC, on the other hand, employs fixed control parameters that may not be optimal under these conditions, thus resulting in a less robust control performance.


Three commonly used performance indicators were employed to give a quantitative comparison between the proposed ANFIS-SMC controller and the SMC controller, namely the root mean square error (RMSE), the mean square error (MSE), and the mean absolute error (MAE). A concise summary of the results obtained for each of the indicators is given in Table 4.
CASE 1 | CASE 2 | ||||
SMC | ANFIS-SMC | SMC | ANFIS-SMC | ||
MAE | X | 0.020 | 0.050 | 0.494 | 0.046 |
Y | 0.020 | 0.058 | 0.363 | 0.064 | |
Z | 0.020 | 0.041 | 0.339 | 0.044 | |
MSE | X | 0.020 | 0.010 | 0.353 | 0.009 |
Y | 0.020 | 0.014 | 0.202 | 0.016 | |
Z | 0.020 | 0.004 | 0.152 | 0.005 | |
RMSE | X | 0.140 | 0.102 | 0.594 | 0.094 |
Y | 0.140 | 0.119 | 0.449 | 0.125 | |
Z | 0.140 | 0.065 | 0.390 | 0.069 |
Mean errors of each controller are shown in Table 4. The lower mean errors indicated an improvement in the performance of the controller. The data of Case 1 in the table suggest that the MSE and RMSE of the ANFIS-SMC controller were smaller than those of the SMC controller; while the MAE values of ANFIS-SMC controller were higher. This occurred because the errors produced by ANFIS-SMC were more dispersed at each point, despite producing smaller values, whereas the errors produced by SMC controller tended to be at one point, forming a peak with a higher value. Consequently, the ANFIS-SMC controller's mean errors were higher when calculated using the MAE method. However, in Case 2, the mean errors of the ANFIS-SMC controller were lower than those of the SMC controller, according to all methods. Therefore, this has demonstrated that the ANFIS-SMC controller can reduce errors of trajectory tracking and improve accuracy.
6. Conclusions
In this paper, a SMC-based ANFIS was proposed to enhance the trajectory tracking performance of quadcopters. The proposed ANFIS used an adjustable gain instead of a fixed gain for SMC, allowing for greater output in accordance with a set of rules. The position control gain was tuned by a neuro-fuzzy adaptive inference system, enabling the SMC to adjust adaptively according to variations in the environment. Then, to verify the effectiveness of the proposed controller, the study compared the performance of the proposed ANFIS-SMC controller with the conventional SMC controller under both ideal and non-ideal conditions. The results of analysis showed that the ANFIS-SMC controller had a faster convergence speed and lower overshoot than the SMC controller, indicating that the ANFIS-SMC controller can quickly adapt to changes in the system and converge to the desired trajectory with high accuracy and stability. The study also demonstrated the effectiveness of the ANFIS-SMC controller by evaluating its performance under different conditions. The proposed ANFIS-SMC controller was found to be more robust and exhibited better trajectory tracking performance than the SMC controller under turbulent conditions, where external disturbances can affect the system's dynamics. The ANFIS-SMC approach could adjust control parameters in response to changes, allowing the control system to maintain robust and compensate for disturbances. In contrast, the fixed control parameters of the SMC approach may not be optimal under these conditions, resulting in less robust control performance. In summary, research findings of this paper indicate that the ANFIS-SMC controller outperformed the SMC controller in terms of fast convergence, strong robustness, high accuracy, and stability. The controller's adaptive mechanism allows it to quickly respond to changes in the system's dynamics and maintain high accuracy and stability. These findings could contribute to the development of robust and responsive control strategies for UAV trajectory tracking by providing valuable insights into the design of effective control systems.
The data used to support the research findings are available from the corresponding author upon request.
Authors would like to express their appreciation to the team and parties involved with the Instrumentation, Control, and Optimization Laboratory at Sepuluh Nopember Institute of Technology (ITS) for providing the necessary hardware and software for this study.
The authors declare no conflict of interest.
