UAV Control Based on Dual LQR and Fuzzy-PID Controller

This paper presents the design of a longitudinal controller for an autonomous unmanned aerial vehicle (UAV). This paper proposed the dual loop (inner-outer loop) control based on the intelligent algorithm. The inner feedback loop controller is a Linear Quadratic Regulator (LQR) to provide robust (adaptive) stability. In contrast, the outer loop controller is based on Fuzzy-PID (Proportional, Integral, and Derivative) algorithm to provide reference signal tracking. The proposed dual controller is to control the position (altitude) and velocity (airspeed) of an aircraft. An adaptive Unscented Kalman Filter (AUKF) is employed to track the reference signal and is decreased the Gaussian noise. The mathematical model of aircraft has been (Cessna 172) presented. The stability and robustness of the system have been verified in a simulation experiment.


Introduction
Unmanned aerial vehicles (UAVs) have been a popular research subject over the last years. These vehicles have been used in civilian applications and military missions, including search, rescue, and atmospheric research [1, 2]. Studies have been carried out on small UAVs because of the low costs of the system and their effectiveness in special missions. Autonomous UAV like helicopters are one of the most popular robotic platforms because they are easy to control for vertical take-off and landing as well as for stationary flight [3,4]. The choices are many possible methodologies that can be used UAV control. Sliding mode control is an efficient, robust control method that widely used in the control of many complex systems [5]. However, chattering is a big drawback of sliding mode control [6]. The most popular controller in the past is a proportional-integral-derivative controller (PID). Analytical methods are used to tune the conventional structure of the PID controller [7]. An approach to control, stabilization, and disturbance rejection of the attitude subsystem of a quadrotor. A self-tuned PID is used to design the controller of the autopilot based on the longitudinal motion (altitude, and speed), and lateral motion (heading angle) of Aerosonde UAV [8]. The authors in [9,10] presented a method to guide and control a system-based vision system. They introduced a Fuzzy logic controller is designed to be compared with the self-tuned PID controller also they used AUKF to estimate the state of the system and reduce the effect the noise on it. In [11], a stable gain scheduling PID controller is developed based on the grid point concept for nonlinear systems. The autopilot controller has a high accuracy of the tracking path, and the robustness with respect to environmental disturbances and especially winds. The small UAVs are sensitive to wind disturbance, since its magnitude may be comparable to the UAVs speed [12]. The author [13] presents self-tuning PID controller method based on neural network is proposed. This method single layer neural network to get the PID gains. The Fuzzy PID controller is developed to improve the performance of the longitudinal motion (pitch control) of the aircraft [14]. This paper focuses on how to combine both advantages of fuzzy control and PID control so that the dynamic performance, far away from the design point, can be improved [15]. The longitudinal model of the unmanned aerial vehicle (UAV) is established and control using Fuzzy PID [16]. The control strategies include the velocity loop (inner loop) and the height loop (outer loop). The authors [17] present a comparison between different controllers used with a dynamic model of a quadcopter platform. These controllers are an ITAE tuned PID, a classic LQR controller, and a PID tuned with an LQR loop. The conventional LQR method present in [18] has effectively solved the problems that fixed-wing UAV is disturbed by air current easily and has poor flight stability. The longitudinal control for the flying wing UAV based on LQR can make the flying wing UAV achieves satisfactory longitudinal flying qualities [19]. The authors presented a studying the control of the vertical moving for UAV under PID, LQR, fuzzy control, and self-tuning fuzzy PID. They have investigated the controller's effectiveness on the state of vertical motion UAV [20]. A PLQR controller is presented to investigate the longitudinal motion control of UAV. This controller is explained and compared with PID and LQR controllers [21]. The robust control is presented in [22]. A CMMAC (Classical Multiple Model Adaptive Control) has implemented for tracking the performance of quadrotor helicopter against the linearization model error and uncertainties. A robust controller on an aerial manipulator is presented [23]. This controller can track the error in the external disturbance and also, the stability is proved. The main objective of this paper is to introduce a more robust controller schema and a more distinctive gain tuning procedure. The controller must provide a reference signal for altitude and airspeed. A dual fuzzy PID and LQR controllers are proposed in this work to analyze the effectiveness of the control designs. The corresponding evaluation of the system performance is presented.

Mathematical Model of A UAV
The equation of motion for a UAV can be divided into longitudinal and lateral movement.
The platform of Cessna 172 can show in Fig. 1. The only motion control considered in this paper is longitudinal. This model can be obtained based on the linearization of the equations in steady level flight. The longitudinal dynamics are the response of the aircraft along the pitch axis, as expressed in the following Eqn. 1 [24,25]: in the longitudinal motion, the mas is M, A is the system transition matrix, the control matrix is B, the input vector u T is [d e τ], and d e is the elevator and τ is the throttle control input, u, w are the forward and vertical velocities, q, θ ,h are the pitch rate and pitch angles and the altitude.

Control System Design
The airspeed and altitude controllers of the aircraft are significantly affected by the thrust force and the control surfaces. The thrust force generated by the throttle control and the control surfaces is adjusted by the longitudinal control angle (elevator).
The controllability and observability of the system eq. (1) are studied based on the theory of controllability and observability as following.
Let us define the controllability matrix as [26].
The matrix Cntr has full rank, so the system is controllable. On the other hand, the observability matrix is The matrix O bse has full rank, so the system is observable.

LQR Controller
LQR is an optimal control approach which is based on closed-loop control with the linear state feedback or output feedback [27]. The state feedback controller, LQR has shown in Fig.2

Fig. 2. Block diagram of LQR controller.
In LQR, a cost function for optimal control performance is: The vector u in eq. (4) is important to know that it minimizes the quadratic cost function, which leads to optimal feedback control law represented in eq. 5. The cost function has a unique minimum that can be obtained by solving the Algebraic Riccati Equation.
The parameters Q and R are employed as design parameters to judge the state variables and the control signals. Choosing a large value of R led to stabilizing the system with less (weighted) energy, but this is an expensive control strategy. On the other hand, a small value for R means you don't want a good performance. This is similarly for Q. So, there is a trade-off between the two assumptions [27].
The steady-state optimal gain is determined by using the Riccati equation as below B J J J.E 89 . B J C 0 …(6) Where Q is the state-cost matrix, and R is the performance index matrix. The selection weight matrices Q and R are very important in the LQR method, which should be symmetric and nonnegative matrices. The weight matrices affect the control performance. These matrices are determined by the experience of engineers who are familiar with the controlled system [28].

Fuzzy Logic Controller (FLC)
Fuzzy logic tools are a mathematical tool to handle's ambiguity and uncertainty existing in complex problems, and it was introduced in 1965 by Lofti Zadeh. It provides a technique to deal with the imprecision and details of the information. [29,30]. It consists of three basic segments (Fuzzification, Fuzzy Inference Process, and Defuzzification), as shown in Fig. 3.
In general, the fuzzy-PID control strategies can improve dynamic performance from the design point. It is based on the conventional PID controller as the foundation. The advantage of Fuzzy logic to self-tune the PID parameters are used to derive adaptive Fuzzy-PID.
In the Fuzzy PID, there are two inputs and three outputs. The inputs of the Fuzzy PID are the error, e(t), and the error gradient, ∆e=de(t)/dt while the outputs are PID coefficients, Kp, Ki, and Kd. Then; Fuzzy inference gives a nonlinear mapping from the inputs to the PID coefficients, as shown in the block diagram in Fig. 3

State Estimation for UAV using AUKF
The AUKF is built to estimate the longitudinal dynamic state for UAV. The state vector and control vector are: Then, the state space of the UAV process and measurement models is: Where A is a transition dynamic matrix, B is control matrix, H is the measurement matrix, M K is a white Gaussian for the process and P K is mean white Gaussian for measurement.
QRM K M S B T C K , QRP K P S B T E K , QRM K P S B T 0 …(10) where Q k is the process noise and R k is the measurement noise. The algorithm of UKF [9] is shown in Table 1. The adaptive Unscented Kalman Filter (AUKF) algorithm can be shown in [9] and the summary is list in Table 2.

Simulation and Results
The  It is noticed that these functions are designed around the Zero value to guarantee the control sensitivity at a small deviation. According to the different values of e and ∆e taken from the experiences; these summarized the behavior of system response for UAV [33], it can be concluded as follows in Table 3:

Step input to the Fuzzy -PID with LQR controller
In Fig 6, Fuzzy-PID with LQR controller was designed to make sure to stabilize the aircraft within a certain threshold. A unit step command is required to follow the reference value. In longitudinal control, the altitude and airspeed are controlled by using the combination of elevator and throttle, In Fig.7 shown that the Fuzzy-PID controller was given a step of 200 ft/s as a reference for the airspeed input. The controller should be able to track that reference airspeed while another Fuzzy-PID controller was regulating the attitude, as shown in Fig.8.

Verification
Change step inputs in both throttle control and elevator input were studied separately, to make sure the controller works correctly. a) Throttle control increased while the elevator fixed, Fig. 9 shown that the airspeed was increased from 200 ft/s to 300 ft/s at 6s while the altitude was increasing slowly to 360 ft as we expected as shown Fig.10. b) The throttle control is fixed while the elevator increased. Fig.11 show that the airspeed was not affected, while the altitude increased with elevation, as shown in Fig.12.

The Comparing Between the Controllers
The performance control and the output response of two controller schemes with respect to the airspeed are shown in Fig.13. Also, the airspeed and altitude of the step input signal are shown in Fig.13, 14 and 15. It noticed that the proposed Fuzzy-PID with the LQR controller has the best performance and has achieved a better response than the Fuzzy PID controller. Compared to the proposal controller with Fuzzy PID, the settling, peak time, rising time, and overshoot have been improved, as shown in Figs. 14, 15. Therefore, the performance of the UAV can be enhanced by employing the Fuzzy-PID with LQR controller.

The Disturbance Effects
To investigate the Fuzzy -PID with the LQR controller performance of the system, the disturbance effects are applied to the pitch angle as shown in Fig 16. It is seen that the controller's response is to work properly when we considered the disturbance effects. The performance control of airspeed The performance control of altitude Fuzzy-PID Fuzzy-PID+LQR

The Noise Effects
The noises are considered for roll angle controller in the system and the noises parameters are taken as Q k =0.4, R k =0.6. Since the noise effects on the roll angle, the controller may cause inaccurate functioning of the roll angle controller. So, the response of the performance of the controller with and without AUKF under noises is verified and shown in fig. (17). It is noticed that the roll angle controller with AUKF Reduces the noise effects when compared to the controller without noise under the same conditions. Moreover, it shows more reliable performance than the roll angle controller without AUKF. The difference of the roll angle between the controller based on AUKF with noise and with noise is shown in Fig. (18). It is noticed the error in the controller of the roll angle based on AUKF is between -0.05 to 0.05 while the error in the controller of the roll angle with noise is between -0.1 to 0.1.

Conclusion
A nonlinear control algorithm was designed and experiment for the Cessna 172 aircraft in longitudinal motion using dual fuzzy-PID and LQR controller. The performance of this controller is compared with the Fuzzy-PID controller.
The longitudinal controller is described as the following; the elevator is the first input that responsible for stabilized the altitude, while the throttle (second input) is employed to stabilize the airspeed of the UAV.
It is noticed that the airspeed still stabilization when the throttle control increase, as shown in Fig. 9. While small steady-state error occurs for altitude stabilization, as shown in Fig. 10. The reason for this error is the approximation used for finding the altitude. This error, however, is rather small and can be neglected. Another interesting observation is also the steady-state error for altitude shown in Fig. 12 when the elevator increases for the same reason.
Regarding the performance control in Fig. 14 and Fig.15, it should be mentioned that the performance for the second controller (i.e. Fuzzy-PID with LQR) is better than the first controller, the reason is we employ LQR as the inner loop to achieve the stability of the system before the out loop controller works and the states could be easily held with reference values. In the results, the Fuzzy-PID with LQR shows a good response to track the reference value of the roll angle when a sudden change occurs.
The Adaptive Unscented Kalman Filtering (AUKF) is used in the controller to estimate the roll angle. The result shows that the proposed method is decreased the influence of noise.
The future work is to design an autopilot system that will be able to control and navigate both longitudinal and lateral motion. This system design is a sensor fusion of multi-sensor using our algorithm called an Adaptive Unscented Kalman Filter (AUKF) [9].