Optimized neural network based sliding mode control for quadrotors with disturbances

In this paper, optimized radial basis function neural networks (RBFNNs) are employed to construct a sliding mode control (SMC) strategy for quadrotors with unknown disturbances. At first, the dynamics model of the controlled quadrotor is built, where some unknown external disturbances are considered explicitly. Then SMC is carried out for the position and the attitude control of the quadrotor. However, there are unknown disturbances in the obtained controllers, so RBFNNs are employed to approximate the unknown parts of the controllers. Furtherly, Particle Swarm optimization algorithm (PSO) based on minimizing the absolute approximation errors is used to improve the performance of the controllers. Besides, the convergence of the state tracking errors of the quadrotor is proved. In order to exposit the superiority of the proposed control strategy, some comparisons are made between the RBFNN based SMC with and without PSO. The results show that the strategy with PSO achieves quicker and smoother trajectory tracking, which verifies the effectiveness of the proposed control strategy.


Introduction
Quadrotors have been widely used in military, photography, navigation and other application fields due to their properties of economy, portability and flexibility. Comparing with helicopter or airplane, quadrotors are with simpler structure, so they are more available for engineering [1]. left half plane, so the stability of the system was guaranteed. Backstepping design was combined with neural network in [22] to realize the control of a quadrotor with unknown input saturation. In [23] a learning-based scheme with neural networks was used to obtain the optimal control law for a quadrotor with time-varying and coupling uncertainties, the stability of the closed-loop system was proved by theory. The authors of [24] proposed RBFNNs based proportional derivative-sliding mode control (RPD-SMC) for the outer loop for position tracking, and employed the robust integral of the signum of error (RISE) to guarantee attitude convergence.
Optimization algorithms have been gradually employed to improve the performance of neural networks. Particle swarm optimization (PSO) algorithm base RBF network was designed in [25] to get better PID parameters. The authors of [26] used genetic algorithms to optimize RBFNNs for more accuracy modeling. In [27], genetic algorithm was also used for optimizing the hyperparameters of a two hidden layer neural network, by which the training and running time of the neural network was reduced. However, using the optimized neural networks in SMC to realize robust control of quadrotors has been rarely considered so far.
This paper aims to improve robust tracking performance of a quadrotor with unknown disturbances. SMC is employed to design the position and attitude control laws in the inner and outer loops, RBFNNs are introduced to approximate the unknown parts of the control laws. The weights of the RBFNNs are updated by designed adaptive laws. Besides, the center and the width values of the RBFNNs are optimized by PSO. The proposed strategy can guarantee the stability and robustness of the controlled quadrotor.
The rest of this paper is organized as follows: the dynamics model of a quadrotor is built in section 2. In Section 3, the position and attitude controllers are designed for the quadrotor based on RBFNN-SMC. PSO is conducted in section 4 to optimize the center and the width values of the RBFNNs. Simulation results are introduced in Section 5. Finally, Section 6 concludes the paper.

Dynamic modeling of a quadrotor
The physical structure of a quadrotor is presented in Figure 1. As the figure shows, there are two coordinate systems to describe the motion of the quadrotor [28], one is the body coordinate system, and the other is the inertial coordinate system. The transformation of the two coordinate systems can be realized by a rotation matrix. It depends on the three attitude angles of the quadrotor, that are the roll angle  , the pitch angle  , and the yaw angle  . All the attitude angles are bounded, the roll angle and the pitch angle belong to ( ) -/2, /2  , and the yaw angle is constrained by ( ) Based on the attitude angles, the rotation matrix E B R which transforms the position of the quadrotor in body coordinate system to inertial coordinate system can be expressed as (2.1).
. Let x, y, z be the position variables of the center of gravity of the quadrotor along the three axes of the inertial coordinate system. Define [ , , ] T w x y z = , then from Newton's Second Law of Motion, one can gets that where m is the mass of the quadrotor, g is the gravitational acceleration, u1 is the lifting force generated by the rotation of the propellers, and f is the air friction during the flying of the quadrotor. Owing to external disturbances existed, (2.2) should be rewritten as where dp is the unknown external disturbance. Suppose that the quadrotor is a symmetric rigid body, and let p, q, r be the angular velocity of the quadrotor's rotation about the three axes of the where ki (i = 1, …, 6) are the air resistance coefficients, l represents the distance of each propeller to the center of the quadrotor, 234 ,, u u u represent the input torques of roll, pitch and yaw respectively, where b and k are thrust and drag coefficients, respectively.

Flight control design
This section introduces the design of sliding mode control with radial basis function neural networks. The control structure is shown in Figure 2.

Position control
At first, rewrite the state equation of the quadrotor's position as follows.
From the above definition, one can see that all the control inputs ux, uy, uz are corresponding to the lifting force u1 because the quadrotor is an underactuated system. In the design showing below, the control input uz will be employed to derive the needed force u1, and ux, uy are auxiliary inputs to obtain the desired roll and pitch angles.
As SMC is employed for the control design, three sliding surfaces are defined here as (3.2) -(3.4).  ( where Qi is obtained from a RBFNN, and i  represents the approximation error which is bounded, i = 1,2,3. The structure of a 3 layers RBFNN is shown in Figure 3.
The three layers of the RBFNN are input layer, hidden layer and output layer [29]. The mappings from the input layer to the hidden layer are nonlinear, while the ones from the hidden layer to the output layer are linear. The inputs of the RBFNN are the desired variable D and its derivatives D and D , and the error between actual variable and the desired one e , as well as its derivative e .
Generally, Gaussian functions are selected to form the nonlinear mappings of a RBFNN, then the output of the i th node of the hidden layer can be expressed as  The proof of the controllers' stability, and the adaptive laws of the weights ˆi W , i = 1, …, 5, will be presented later. Based on the above controllers, the lifting force u1 and the desired roll and pitch angles are obtained as

Attitude control
The purpose of attitude control is to guarantee the attitude angles converge to the desired ones.  with j = 2, 3, 4, i = 4, 5, 6. In order to realize the control design, the weights of each RBFNN need to be updated. Therefore, the following adaptive law is designed.
Taking the adaptive law (3.27) into (3.29), one can get that According to Assumption 1, || ii   , so 0 V  can be guaranteed, which implies that si → 0, i = 1, … ,6. By the definition of the sliding surfaces, and the characteristics of SMC, the convergence of ex, ey, ez, eϕ, eθ and eψ can be guaranteed, which means that all states of the quadrotor system converge to their desired signals, and the trajectory of the quadrotor tracks the given reference.

Optimization of the sliding mode controller
Based on the above control design, the stability of the quadrotor system can be guaranteed.
However, the influence of the center i  and the width i  of the Gaussian function i  , i =1, … ,5, cannot be ignored. In this section, particle swarm optimization algorithm (PSO) will be used to adjust these parameters offline for better control performance.
PSO originates from the imitating of bird predation and has the advantages of simple implementation and fast convergence. Each bird or particle will carry the training parameters, and move according to the situations of itself and the whole group.
An evaluation function is needed for PSO, which is used to evaluate the position of the current particle. Here we choose the sum of absolute errors as the evaluation function, which is shown in Then, define the number of iterations G and the size N of the particle swarm. Each particle in the PSO contains the following information: the current position X, which represents the parameters of RBFNN that are needed to be optimized; the moving velocity V, which represents the updating rate of a particle position; as well as the particle dimension H, which is determined by the total number of the optimized parameters.
We also define the optimal value of the group as gb, and the optimal value of an individual particle as pb. At first, we initialize each pb by the value of the evaluation function at the initial position of the corresponding particle, and assign the smallest pb to gb, then update pb and gb by the following rules: for each particle, if the value of the evaluation function (4.1) is smaller than the value in last iteration, we will assign pb with the value at the current position, otherwise pb will be unchanged. And gb selects the smallest pb among all the particles.
During each iteration, the position value of each particle is brought into the RBFNN to approximate the training samples, then the evaluation function can be calculated, by which pb and gb can be updated according to the rules mentioned above.
The updating values of the velocity and the position of a particle are calculated as where i=1, … , N, C1 , C2 are the learning factors which are generally set to be 2, and R1 , R2 are random numbers belong to [0,1]. In order to improve the global optimization ability of the PSO, an inertia factor ρ and a scale factor λ are employed for the velocity and position updating of a particle.
Remark: In order to maintain the integrity of the employed RBFNN, the weights of each RBFNN are also placed in X for optimizing, but only the center value o and the width value σ are taken as the optimization result, since the weight W is estimated by the adaptive law (3.27). The parameters of our PSO are listed in Table 1. And the process of PSO is shown in Figure 4. Scale factor 0.7 Figure 4. The process of PSO algorithm.

Simulation result
Some simulation experiments are conducted to verify the effectiveness of the proposed control strategy, and the results of the experiments are demonstrated in this section. The parameters of the quadrotor model are given in Table 2. And the parameters of the designed sliding mode controllers are listed in Table 3. The disturbances for the simulation experiments are considered as follows, whose curves are plotted in The trajectories of the controlled quadrotor with the two methods, together with the desired one are shown in Figure 7. The initial values of the position and attitude of the quadrotor are given in Table 4.     In order to show more details of the flight trajectories, the position and angle variables of the quadrotor are shown in Figures 8-9. It can be seen that both of the control methods can drive the quadrotor to track the desired trajectory, but SMC-RBFNN-PSO can achieve quicker convergence of all the states. This fact indicates that the center and the width values of the neural networks are effectively optimized by the PSO. The desired roll angle and pitch angle are calculated by (3.18)- (3.19), which are related to the auxiliary inputs , xy uu, so the angles  and  with the two methods are different, which can be seen in Figure 9.     Figure 10 shows the tracking errors of the three position variables with the two methods. By SMC-RBFNN, the maximum absolute errors of x, y and z are 0.5775m, 0.09m and 0.8676m, respectively. And the errors converge to zero at 6.88s, 7.24s and 6.85s, respectively. It can be seen from Figure 10 that there are unexpected fluctuations in the position tracking of the quadrotor with SMC-RBFNN. However, by SMC-RBFNN-PSO, the quadrotor can track the desired trajectory more quickly and smoothly without fluctuation.

Conclusions
A RBFNN based SMC strategy with PSO is proposed in this paper for the tracking control of quadrotors. Based on the SMC, the position and the attitude controllers can be designed at first. However, these controllers cannot be exerted directly because of the unknown disturbances. Therefore, the RBFNNs are employed to approximate some items of the control laws. The weights of the RBFNNs are updated by adaptive mechanism. Besides, the center and the width values of the RBFNNs are optimized by PSO, with which better trajectory tracking performance can be achieved for the quadrotor. Simulation results demonstrate the stability of the system and the convergence of the states to their desired signals. Also, the comparison results show obvious superiority of the proposed SMC-RBFNN-PSO to SMC-RBFNN.