Planar Smooth Path Guidance Law for a Small Unmanned Aerial Vehicle with Parameter Tuned by Fuzzy Logic

A guidance law has been designed to guide the small unmanned aerial vehicle towards the predefined horizontal smooth path.The guidance law only needs the mathematical expression for the predefined path, the positions, and the velocities of the vehicle in the horizontal inertial frame. The stability of the guidance law has been demonstrated by the Lyapunov stability arguments. In order to improve the path following performance, one of the parameters of the guidance law is tuned by using the fuzzy logic which will still keep its stability. The simulation experiments in the Matlab/Simulink environment to realize the square-, circular-, and the athletics track-style paths following are given to verify the effectiveness of the proposed method. The simulation results show that the path following performance will be improved with smaller overshoot and oscillation amplitude and shorter arrival time with the parameter tuned.


Introduction
In the past decades, the small unmanned aerial vehicles (UAVs) have been widely applied in the military and civilian domains with their ability of automation, such as fire detection, surveillance, aerial photography over the disaster area, and forbidden area monitoring [1].To realize these functions, it is required that the UAVs have the capability of tracking or following the predefined path or trajectory accurately.
During recent years, the approaches to realize the path following or trajectory tracking control of a small unmanned aerial vehicle appear on the linear and nonlinear control methods.The linear techniques include the PID and linear quadratic regulator (LQR), while the nonlinear methods mostly appear on the backstepping technique, the fuzzy logic based control, the sliding mode control, and the model predictive control (MPC).
While applying linear methods, in [2], the outer-loop design for translational motion is based on the PD controller together with the disturbance accommodating control method to estimate the aerodynamic force.Compared to the traditional PID technique, Luo et al. applied the directional fractional order (PI) method to the lateral control of a small fixed-wing unmanned aerial vehicle with its parameters tuned based on the mathematical model [3].However, the PID controller has little robustness to the disturbance, and it is mostly used in the lateral/longitudinal maneuvers by reducing the lateral deviation from a desired flight path.The genetic algorithm has also been used to optimize the control parameters of the trajectory tracking control law which will improve the tracking performance [4].But it needs more calculation which makes it limited to be applied on the low-cost autopilot.In [5], the linear quadratic regulator (LQR) with an adaptive running cost was applied to generate the lateral acceleration command to guide the vehicle towards the path.Lee et al. used the LQR technique to reach the path following by finding the optimal state feedback law where its state is the combination of the lateral attitudes, the cross-track, and heading errors [6].However, the heading and cross-track errors should be saturated to make the system stable due to the limitation of the linear region.
Alternative approaches to realize the path following are based on the nonlinear techniques, which include the intelligent control, the Lyapunov stability based control, and model predictive control.For using the intelligent method, an adaptive neuron-fuzzy inference system based flight controller has been designed to realize the autonomous flight [7].Cancemi et al. applied the fuzzy logic to generate the heading reference which will guide the UAV towards the predefined waypoint trajectory [8].The fuzzy based method was implemented in the hardware-in-the-loop simulation.The fuzzy logic method can reach better track performance compared to the traditional PID controller.
Based on the Lyapunov stability theory, the sliding mode and backstepping techniques are often applied.In [9,10], the sliding mode control technique together with the vector field is used to guide the UAV towards the desired path.A spatial sliding mode controller [10] defined as a stable differential operator with respect to a defined spatial variable is presented to track the predefined path.Liang et al. applied the vector field for the vehicle to reach the planar path following by using the sliding mode control [11].In [12,13], Ren applied the backstepping techniques to obtain the velocity and roll angle control laws to track the predefined path.Brezoescu obtained the direction control of the UAV with the help of the adaptive backstepping method in the presence of the crosswind, which has been tested in simulation [14].For real flight tests, the backstepping technique is usually used as the inner loop to stabilize the dynamics of the UAV [15].Based on the MPC technique, a nonlinear model predictive controller is used to design the high level controller based on the kinematic model of the UAV to follow the line path [16].In [17], an adaptive NMPC that varies the control horizon is used for design as the tracking layer to follow the predefined path by minimizing the mean and maximum errors between the reference path and the UAV.For normal MPC tracking controller, the error can converge fast with respect to its predictive ability, but there exist some static state error and some wave control due to the computational accuracy, limited predictive horizon, and weight matrixes selection.
Motivated by the above discussions, it can be found that the guidance control laws generated by the Lyapunov-stable based methods are usually simple and useful.In our preview works [18], a Lyapunov-stable based nonlinear control law has been designed to guide the UAV towards the predefined line path.In this paper, we have expanded the result to a class of smooth curve-type path in the horizontal plane.The proposed guidance law generated for the smooth path still has one of its parameters tuned by the fuzzy logic, which will make the vehicles fly towards the predefined path more directly and smoothly.
In the outer loop, with the altitude held by a simple PI controller, the concept of vector field which has been applied in fixed-wing UAV to generate the heading rate command was adopted [19].However, the authors only considered the straight line and circular-type path for the fixed-wing UAV.In this study, we have expanded the result to a class of smooth curve-type path in the 2D plane.While applying the vector field to generate the heading rate command, the necessary information including the ground speed, position, and heading angle is measured by a GPS/INS integrated navigation system.Additionally, the asymptotic approximation to the desired path is demonstrated by use of the sliding mode approach and Lyapunov stability arguments.
The organization of this paper is as follows.In the next section, the problem description is presented.In Section 3, a Lyapunov-stable nonlinear controller is designed to generate desired course rate to guide the UAV towards the planar smooth path together with a key parameter of the controller tuned by the fuzzy logic technique.The simulation results in Matlab/Simulink environment to realize the square-, circular-, and the athletics track-style paths are given in Section 4. Finally, some concluding remarks are summarized in Section 5.

Problem Description
Small fixed-wing UAVs equipped with low-level flight controller, which can provide altitude-and airspeed-hold functions, are assumed to be used for the path following.The following kinematics of the UAV in inertial horizontal frame can be used for the controller design: where (, ) is the inertial position of the UAV,   and   are the corresponding components of the wind velocity,   is the airspeed,  is the heading, and  0 is the commanded heading rate.By introducing the ground speed   and the course  shown in Figure 1, the kinematics of the UAV (see (1)) can be expressed as ẋ =   cos () , ẏ =   sin () . ( Following [9,10], with another assumption that the autopilot can provide the course-hold function adopted, by introducing the course rate control χ =  cmd , the system shown as (2) becomes as follows: The relation between the heading rate and course rate is given by [11]  cmd =  ()  0 =   For flying a UAV, it has the fact that the airspeed   is larger than the wind speed .When there is no wind, () = 1, which means that the course of the UAV equals its heading angle.So it can be easily derived that () ∈ (1/2, 1].In the following, we control the UAV's course instead of its heading.The command design is based on model (3).Therefore, the motions of the UAV can be expressed in terms of the ground speed and the course angle.Since the ground speed contains the information of wind velocity, the wind disturbance rejection will be naturally considered by using the inertial measurements [9,18].

Planar Smooth Path Following
3.1.Normal Planar Smooth Path Following Controller.Consider a generic desired smooth path in the horizontal plane which can be described as a continuously differentiable implicit function  :  2 →  with  (, ) = 0. ( In this paper, the desired path shown as ( 5) is a generic curve.Since it is not trivial to express the distance from a generic curve in closed form, the curve function (, ) instead of the Euclidean distance from the curve is used as the distance function [20]; that is, (, ) = (, ).The partial derivatives of (, ) with respect to  and  are The magnitude of corresponding gradient is denoted as ‖‖ = √ 2  +  2  .With the distance function defined above, (, ) is a scalar filed, and it can indicate whether or not the point (, ) lies on the curve (, ) = 0.In order to avoid the vehicle being trapped in the center point of the closed curve (such as the center of a circle), an interesting domain is defined as  int = {(, ) | ,  ∈ , ‖∇‖ ≥ }, where  is a positive constant.When the vehicle's initial position is within  int , the following control law shown as (7) will guide the UAV towards the desired path in finite time.
where  1 is a positive constant. 2 ≥  2 ;  2 is an arbitrary chosen positive value, and the saturation function  sat is defined as Here, the saturation function is used to limit distance, just because if the initial distance from the path is sufficiently high and without the saturation function, the UAV will perform unnecessary endless loops away from the desired path.It should be noted that the term (/)tan −1 (−  /  ) in ( 7) can guarantee that the vehicle will fly along the given path when the distance to the curve is zero.
The following text indicates that the points in the set {( 1 ,  1 ) |  1 = 0,  1 = (2 + 1),  ∈ } are unstable when  1 ,  2 , and   are all positive constants.Without loss of generality, we focus on the point x 0 = [0, ]  and define the domain  1 as Then, on the domain  1 , the function (x, ) can be expressed as ] .
It can be found that (x, ) is continuously differentiable on  1 .The following Jacobian matrix can be derived as [21] By solving the eigenvalues of matrix , it gets that one of them equals ‖∇‖  ( 2   + √ 2  2  2  + 4 1 )/2, which is positive.Hence, the point x 0 = [0,]  is unstable [21].Similarly, the equilibrium points in the set {( 1 ,  1 ) |  1 = 0,  1 = (2 + 1),  ∈ } are all unstable.(11) with Different Parameters  2 .In order to analyze the dynamic performance of the nonlinear system (11), the line style and the circle style paths are chosen as the case study.For the line style path, the function (, ) is chosen as (, ) =  +  +  with ‖∇‖ = √  2 +  2 = 1, while for the circle style path following, the function (, ) is chosen as (, ) = √ ( −  0 ) 2 + ( −  0 ) 2 − , where ( 0 ,  0 ) and  represent the center and the radius of the circle, respectively.It can be found that with the circle style path function (, ) chosen as above, the magnitude of corresponding gradient ‖∇‖ = 1.Thus Figure 2 which presents the phase plot of system (11) with ‖∇‖ = 1 can display the dynamics of the line-or the circle-style path following.

The Phase Plot of System
Figure 2(a) shows the dynamics of the nonlinear system (11) under different initial values.It displays the fact that if the vehicle is far away from the desired path, the vehicle will firstly adjust the course to an approximate invariant value and then flies towards the path until the absolute value of the distance (, ) is smaller than   .Finally, some oscillations appear while the vehicle is approaching the desired path.
During the proof process of Theorem 1, the positive parameter  2 is variable if it is larger than a given positive constant, while the parameter  1 is chosen as a positive constant to get (15) which is used to be one of the conditions to guarantee the stability.Thus, the following study only considers how the variable parameter  2 will influence the performance of the proposed guidance law. Figure 2(b) shows the different trajectories of system (11) with the control parameters couple as (0.0006, 0.0006), (0.0006, 0.0008), (0.0006, 0.001), and (0.0006, 0.0012) but under the same initial conditions, respectively.The system is convergent for the given parameters couple.However, the convergence speeds are quite different due to the different control parameters.With larger parameter  2 , the trajectories in the plane of phases tend to equilibrium more directly.Nevertheless, while implementing the control law on a real vehicle, if the vehicle flies near the predefined path, the control law is similar to the traditional PD controller.The larger parameter  2 will lead to high-frequency oscillations and weaken the disturbance rejection.The following subsection shows how to adjust the parameter  2 to improve the path following performance.

Path Following Controller with Gain Tuned by Fuzzy Logic (FL_PFC).
As stated in the last subsection, the control gain  2 should be adjusted to improve the path following performance.In [8], the authors have applied the fuzzy logic to generate the guidance law.Due to its simple structure and comprehensible concept, we adopted the advantages of the fuzzy logic and applied it to tune the control gain  2 .Figure 3 presents the general structure of the proposed controller.The control parameter  2 is adjusted around a given nominal value  20 dynamically by the fuzzy logic unit as where Δ 2 is the output of the fuzzy logic unit for adjusting the parameter  2 .As ( 13) and ( 15) show, while taking the procedure of ( 19), the adjusting parameter  2 should be larger than a given positive constant; then system (11) has the asymptotically stable equilibrium points {( 1 ,  1 ) |  1 = 0,  1 = 2,  ∈ }.
Figure 4 shows the triangular, Z-shaped, and S-shaped membership functions used for the fuzzification of the inputs and output, that is, the distance (, ), the derivative of the distance ḋ (, ), and the adjusting parameter Δ 2 .Here, NB, NM, NS, Z, PS, PM, and PB stand for negative big, negative medium, negative small, zero, positive small, positive medium, and positive big, respectively.
Table 1 presents the rule base used for adjusting the parameter Δ 2 .The fuzzy rule base contains 49 rules which will generate Δ 2 based distance (, ) and its derivative with respect to the time ḋ (, ).For example, the rule (IF (, ) is PS AND ḋ (, ) is PS THEN Δ 2 is NS) is based on the consideration that if the UAV is flying near the predefined path, the total control command  cmd should not be large.With the negative small parameter Δ 2 , the parameter  2 and the corresponding  cmd are reduced.The well-known minmax inference method and the center-of-area defuzzification procedure are used to execute the fuzzy unit.
Figure 5 shows the input-output characteristics of the fuzzy logic unit.The minimum of the output is −0.0007302.In this paper, the control parameters  1 and  20 are chosen as 0.0006 and 0.0008, respectively.Then one has the fact that  2 is always positive with  2 > 0.00006.

Simulations
The simulations about the proposed controller were studied in the Matlab/Simulink environment [19].The Aerosonde UAV model [22] was applied as a test vehicle while doing the simulation, where the UAV model was designed by using the Aerosim Aeronautical Simulation Block Set [23] which provides a complete set of tools for development of detailed 6-degree-of-freedom nonlinear models.Figure 6 presents  the Simulink model which contains the proposed smooth path following controller, static inner loop controller, and the UAV model used for the simulation studies.The inputs of the smooth path following controller from the states are the inertial position (, ) and velocity (  ,   ) which will be used to generate the vehicle's current course.
The initial position of the UAV was at the origin of the local coordinate system, and its initial heading was set as 360 deg north, respectively.For simulation, the initial inertial speed of the UAV was set as 25 m/s.In order to test the performance of the proposed controller, the wind with 8 m/s from 270 deg west was added to the model of the UAV as shown in Figure 6.The simulation sample time was set as 50 ms.While conducting the simulations, we applied the proposed method to follow three types of planar path, that is, the square-, circular-, and athletics track-style paths in Matlab environment, respectively.
Case 1 (square path following).The desired horizontal square path was defined with four waypoints, (100, 100), (2100, 2100), (100, 4100), and (2100, −1900), as shown in Figure 7(a).The comparison of the path following with the methods PFC and FL_PFC can also be seen in Figure 7(a).Figure 7(b) is the comparison of the distance while following the predefined square path with the controllers PFC and FL_PFC.While executing the square line path following, the predefined behavior that the UAV will switch course in advance with 200 meters was adopted, which results in the sharp changes of about 200 meters.The elliptic marks A, B, C, D, E, and F in Figure 7(b) indicate that the overshoot of the path following and the oscillation amplitude by using the method FL_PFC are both smaller than those using the method PFC.And the maximum overshoots and time difference of arrival (TDOA, defined as the time difference ( PFC −  FL_PFC ) between the two methods for the vehicle to do the switching maneuver near the waypoint) displayed in the areas A, B, C, D, E, and F are listed in Table 2. Figure 7(c) shows the parameterused for the methods FL_PFC and PFC, respectively.With  2 adjusted, the course rate command was derived to drive the UAV to follow the path with better performance as shown in Figure 7(b).Figure 7(d) presents the comparison of the inertial velocity   while following the predefined path with the two proposed methods.The inertial velocity   is changing due to the influence of the constant wind speed.However, the inertial velocity   with the method FL_PFC is smoother than that with the method PFC.It indicates that the following performance is modified by the fuzzy logic rule.By adjusting the parameter  2 , the overshoots and oscillation will be reduced, and the quickness of the path following will be maintained.It can also be seen from the TDOA listed in Table 2 that, by using the method FL_PFC, the vehicle can reach the set waypoints more quickly.So if a predefined flight path is long, the vehicle can finish it with shorter time by using the method FL_PFC.As Figure 7(d) and Table 2 show, while turning near the point (2100, −1900), the maximum overshoot in the area C presents the fact that, with the two orthogonal components of the added wind acting on the fuselage axis and the lateral axis of the UAV, the wind from 270 deg west influences the turning of the UAV dramatically.With the method PLC, the maximum overshoot in area C is 29.26 m; in contrast, that with the method FL_PFC is only 4.576 m.This result demonstrates the effectiveness of the path following controller FL_PFC.
Case 2 (circular path following).The desired horizontal circular path was defined as √  2 + ( − 330) 2 − 250 = 0. Figure 8(a) shows that the vehicle will follow the predefined circular path after the approximation of transition with an approximate invariant course value.The zoom in detail in Figure 8(b) indicates that the vehicle can reach the predefined path with smaller overshoot by using the method FL_PFC.The oscillations that appear from time of 80 s to 110 s were caused by the wind disturbance.
Case 3 (athletics track-style path following).In this case, the athletics track-style path was adopted by combining the line-style and circular-style paths together.The simulation results are shown in Figure 9. Figure 9(b) indicates that, compared with the method PFC, the method FL_PFC will guide the UAV towards the predefined path faster together with smaller oscillation amplitude.

Conclusions
A horizontal smooth path following guidance law for a small unmanned air vehicle is presented in this paper.With the combination of the Lyapunov stability and the inference ability of fuzzy logic, the proposed path following controller FL_PFC still has its stability guaranteed by the mechanism of the Lyapunov stability arguments and adopts the simple structure of the method PFC.With a key parameter of the guidance law adjusted based on fuzzy logic technique, the path following performance was improved with smaller overshoot and oscillation amplitude and shorter reaching time even in the presence of wind with 8 m/s.The proposed methods were successfully implemented in following three types of planar path, that is, the square-, circular-, and athletics track-style paths via simulations in the Matlab/Simulink environment.
Our future work will focus on developing a 3D smooth path following controller; the control parameters will also be adjusted with the help of the fuzzy logic or optimization techniques to improve the path following performance.

Figure 1 :
Figure 1: Position of the UAV with respect to the desired path and the relationship among the ground speed, airspeed, and the wind speed.

Figure 3 :
Figure 3: The structure of the proposed controller.

Figure 4 :
Figure 4: The membership functions used for the fuzzification of the inputs (, ) and ḋ (, ) and the output Δ 2 , respectively.

ḋFigure 5 :
Figure 5: Input-output surface for the fuzzy logic unit.

Figure 6 :
Figure 6: The Simulink block diagram for the simulation studies.

Figure 7 :
Figure 7: Comparison of the square path following with the methods FL_PFC and PFC.(a) The position compassion, (b) the distance (, ) compassion, (c) the parameter  2 compassion, and (d) the inertial velocity   .

Figure 8 :
Figure 8: Comparison of the circular path following with the methods FL_PFC and PFC.(a) The position compassion, (b) the distance (, ) compassion, (c) the parameter  2 compassion, and (d) the inertial velocity   .

Figure 9 :
Figure 9: Comparison of the Athletics track-style path following with the methods FL_PFC and PFC.(a) The position compassion and (b) the distance (, ) compassion.

Table 1 :
Rule base for the fuzzy logic unit.

Table 2 :
Comparison of the maximum overshoot with the two proposed methods.