Comparison of self-tuned Neuro-Fuzzy controllers on 2 DOF helicopter: an application

In this paper, a new approach for Neuro-Fuzzy Controller (NFC) has been presented and compared to previously defined NFCs given in open literature. The proposed controller is based on an on-line Adaptive Neuro-Fuzzy Inference System (ANFIS) and meticulous analysis through simulations is performed to show its robustness. The performance of Neuro-Fuzzy Controllers (NFC) depends on controller inputs. To show the difference and superiority of the proposed controller, many studies in the open literature are examined and compared. Therefore, the advantages and disadvantages of the Neuro-Fuzzy controller are outlined and an optimum Neuro-Fuzzy controller is structured and presented. To test our developed controller for a nonlinear problem, having coupling effects, a 2 DOF helicopter model is chosen. Also to show the robustness, the controller performance which is applied to a 2 DOF helicopter is investigated and compared with other Neuro-Fuzzy controller structures. To better show NFC performance, NFC control results were compared with LQR+I. It is observed that besides being on-line adaptive for all systems, the controller developed has many priorities such as noiseless, strong stability, and better response time.


Introduction
There has been recently tremendous progress in control methods because of the increasing complexity and technology. Besides, the variations of the state and environmental conditions are challenging problems for controllers. Studies have been conducted in the literature on adaptive active controllers to overcome these uncertainties [1,2]. Fuzzy Logic Controller (FLC) is one of the most common nonlinear controllers that are still under research that it can be self-tuned and it can tune other controller' parameters.
In the classical FLC method, the Fuzzy Controller can control any system without any support of other controllers or it can tune controller parameters [3,4]. These classical FLC methods can run perfectly in simulation but it needs full information about the system which is under control. In other words, an FLC can be designed for any system in hand, however when these system parameters changed it may not be possibly worked. Because of that, scientists in this field have developed Neural Network (NN) and ANFIS algorithms for various applications [5]. In literature, these algorithms are used for various disciplines such as structures [6,7], energy [8], fluids etc. [9].
The ANFIS algorithms can be used in controller algorithms as off-line and on-line. Training data must be collected from the system to use the off-line ANFIS algorithm at control studies. In literature, there are different off-line ANFIS controller studies such as tuning PID coefficients [10,11], determining FLC parameters [12] using ANFIS inverse controller by modelling the inverse of system [13]. Off-line ANFIS trained controllers are used in different areas such as robotics [14], aircraft [15] etc. However, these off-line controllers are ineffective against changes in the system and environment. So, self-tuned Neuro-Fuzzy Controllers (NFC) are proposed which tune its own parameters [16]. The advantage of the NFC is that it adapts to the changes in the system [17].
Adaptive NFC is implemented, having two inputs, to Induction motor drive to show the strength of the NFC [18]. The NFC inputs have consisted of two different values. One of which is a normalized error with respect to a target value and the other one is the derivative of output. In this method, the steady-state error is zero but noise is greater compared to classical methods. In 2010, a new adaptive NFC is proposed, having three inputs, which is implemented into a servo system [19]. The NFC inputs are as follows; error, error derivative, and sum of errors. As stated in [19], the NFC response is faster comparing to classical methods but the result is relatively wavy. PI, Fuzzy tuned PID, Fuzzy tuned PI-PD and adaptive NFC, having two inputs which are error and its derivative, are compared on a DC motor [20]. They found that adaptive NFC is the best when compared to the other three controllers. The on-line ANFIS controller outputs are compared with Fuzzy PID+ANFIS, PID+ANFIS, Anti Wind up PID, Fuzzy Anti Wind up PID, etc. [21]. The results obtained indicate that NFC can be operated successfully with other controllers by giving highly accurate results. In 2017, the NFC is compared to PD and Model Predictive Controllers (MPC) on reconfigurable exoskeletons. The NFC is designed with two inputs as error and error derivative. The results show that the NFC is robust and converges faster than others [22]. The NFC parameters have been trained by different methods in literature as gradient descent method, Least Square Estimation (LSE), genetic algorithms, etc. The genetic algorithms and neural network are used to train FLCs in [23] and the results show that the on-line trained FLCs have better performance when compared to LQR. In 2020, interval type-2 FLC (IT2-FLC) supervised ANFIS controller is used to control wheeled mobile robot. The results show that the combined controller performance is better when compared to PD and interval type-2 FLC [24]. In the IT2-Fuzzy Logic System (IT2-FLS) supervised ANFIS controller study, the ANFIS is trained with error and error derivative [24]. The ANFIS is used with particle swarm optimization to control a quadrotor trajectory tracking that the NFC can be used with various methods effectively for highly nonlinear problems [25]. As seen in the literature, the error and error derivative is commonly used inputs for NFC. In this study, the NFC input parameters are tested and the results are compared on a nonlinear 2 DOF helicopter system.
It is well known that helicopters are aerial vehicles that it can take off and land in small areas and its maneuverability is very high. However, it is a nonlinear system, as mentioned above, and has cross-coupling effects, since it is hard to control. There are many proposed control methods in the literature for these challenging control problems [26][27][28]. Tuning PID coefficients by Type-2 FLC is successfully carried out and discussed in [29,30] for 2 DOF helicopter control. Another applied example is tested on the 2 DOF helicopter by using FLC with Sliding Mode Control (SMC) [31,32]. Because of NFC's high efficiency, Type1 NFC has applied alone to 2 DOF helicopter system, as in [33], with two NFC inputs having error and its derivatives.
Within the scope of this study, the NFC controllers proposed in the open literature have been tested and tried to reach the best NFC controller combination. So, the 6 different NFC structures are tested as: (normalized error, output derivative [18]), (error, error derivative, summation of error [19]), (error, output derivative, summation of error), (error, output derivative, error integral), (normalized error, error derivative, summation of error), (normalized error, output derivative, error integral). As a result of these tests, (error, output derivative, the summation of error) inputs structure NFC is found to be better than other NFC combinations. The proposed NFC input combination is tested on the nonlinear 2 Degree of Freedom (DOF) helicopter system and compared to other NFC combinations those given in open literature as (normalized error, output derivative [18]), (error, error derivative, the summation of error [19]). So, the performance of the proposed controller is tested for a nonlinear dynamical system. The rest of this paper is organized as follows. In Sect. 2, the 2 DOF helicopter dynamic and control structure are introduced. In Sect. 3, the NFC system is introduced and different input combinations with our offering are examined. In Sect. 4, the tested different NFC combinations' simulation results are compared and conclusion is given in Sect. 5.

System dynamics
The 2 DOF helicopter free body diagram model is identified in Fig. 1. There are two propellers perpendicular to each others. The front propeller controls the pitch angle and the back propeller controls the yaw angle. The 2 DOF helicopter system can rotate at pitch angle within the limits − 40.5 • and 40.5 • but the system can rotate at yaw angle without any limit [34].
While the front propeller affects the yaw angle, the back propeller affects the pitch angle because of the momentum balance on the system. So, the controller must be designed by considering the coupling effects.
The nonlinear dynamics equations can be given in terms of pitch angle and yaw angle [33].The parameters of the model are given in Table 1. (1) (J eq,y + m heli l 2 cm cos 2 )̈= K yp V m,p + K yy V m,y − B ẏ+ 2m heli l 2 cm sin coṡḞ ig. 1 2 DOF helicopter free body diagram The 2 DOF helicopter control structure is given in Fig. 2 that the 2 DOF helicopter system contains two inputs as pitch motor voltage ( V m,p ) and yaw motor voltage ( V m,y ). So the controller must determine the two voltage values. The 2 DOF Helicopter model is controlled with Linear Quadratic Regulator+Integral (LQR+I) in [34]. The LQR+I control matrix is given as [34]:

Neuro Fuzzy controller
Neuro-Fuzzy Controller (NFC) has occurred in two steps. The first step is the on-line Adaptive Neuro-Fuzzy Inference System (ANFIS) and the second step is the FLC. In this study, the ANFIS structure is based on a linear Sugeno Fuzzy Inference System (FIS). The general ANFIS structure for two inputs and two Membership Function (MF) is given in Fig. 3. In the tests in this paper, three membership functions are used. The following equations are used in on-line ANFIS for two inputs. Layer 1: x and y are system inputs. A is the first input and B is second input MFs. Trapezoid MFs are used as linguistic term. defines the value of membership functions. So, for every input, there are two membership values.
Layer 2: Number of the "i" nodes is the rule number. Every "i" node represents a fuzzy rule. Weights are calculated for every rule by using the "and-prod" method. "w" represents the weights.
Layer 3: Weights are normalized. In the Sugeno (FIS), there is two defuzzification step as "wtaver" and "wtsum". In this study, the "wtaver" defuzzification method is used and so in Sugeno ANFIS weights are normalized. Layer 4: The rule outputs are calculated where "p, q, r" is the consequent parameters of the first-order Sugeno model. In this layer, all y i defines the normalized rule outputs.
Layer 5: The aggregation step is represented that all output values are gathered. This result gives the same results with Sugeno FIS "wtaver" method.
The output "y" can be defined in matrix form as: where "w" is the weights, "x" is the inputs and "W" is the output parameters. As seen in the literature, the ANFIS trains the input Membership Functions (MF) and the consequent parameters (p, q, r) according to input and output values [5]. The error value is determined with the difference between the desired value ( y d ) and the actual/measured value (y). as proved by [35].
In off-line ANFIS, a defined data set can be trained simply by choosing the desired value and the actual value. However, it is well known that off-line ANFIS is a weak tool for control problems. Therefore, a logical approach must be conducted in control problems, i.e., the main target in the control problem is to minimize error it means that the system is being stabilized. In other words, for a desired constant target, the change in output must be zero. For a desired linearly changing target, the change in output must be constant.
In this study, the outputs are the pitch angle , the yaw angle , and learning rate is lr that is set to 1. So the error term for ANFIS is defined as given below.
For pitch angle:

For yaw angle:
In ANFIS training, Gradient Descent (GD) method is used for consequent parameters' training. So, the update law is given as: where It is stated in Eq. (9) that y = XW . So, the E W term can be defined as where y defines the ( , ) angles and y d defines ( d , d ) angles.

Two input NFC
As mentioned before, in the classical FLC method, the Fuzzy Controller can control any system without any support of other controllers or it can tune controller parameters. The classical FLC can be trained by off-line ANFIS, but such a FLC can not optimize its own parameters. The trained FLC can only work for well-defined cases. It is possible to define such a powerful Neuro-Fuzzy Controller (NFC) [18] which adapts itself for every given case. The proposed NFC structure can be shown in Fig. 4.
The controller inputs,N error , d dt , are normalized error and rotational velocity. The normalized error and angular velocity can be limited in the desired intervals [18].
where dt is sampling time, (n) is present angular velocity and (n − 1) is previous angular velocity and des is desired angular velocity. The similar equations are implemented to the yaw angle.
As mentioned before, to implement NFC effectively, the training algorithm must be executed by a target value. The target value is defined and applied to an Induction motor drive in [18] as y = error . So, when the error minimized the ANFIS training error input will be minimized, and when the error becomes bigger the ANFIS training error will be bigger. So the training will be slower or faster depending on the target value.

Three input NFC
The two input NFC results show that the steady-state error of the two input NFC is zero, however, it is noisy as seen in Fig. 10. This leads to oscillation in real-time applications, results in mechanical vibration for the system and fatigue. Because of that, three input NFC is tested. In the ANFIS step, the Gradient descent method is used to train FIS parameters as did in two inputs NFC.

e,de,sum(e) inputs NFC
The three input NFC is proposed in [19] where controller inputs are given as error, error derivative and sum of errors as shown in (18). It is defined in [19] that there is always oscillation in the outputs. Besides, the 2 DOF helicopter model has coupling effects. Because of that, the results are very oscillatory and unacceptable as seen from Figs. 5, 6. The coupling effects of 2 DOF helicopter makes the system behave worse, i.e. the response of the system output amplitude is increasing. So, this NFC approach is not compared to other controllers.

e,dy,sum(e) inputs NFC
To enhance the NFC controller effects, different NFC method combinations were tested. These test results indicate that three-input NFC controller with three inputs which are error, output derivative, and summation of error, gives better outputs compared to other methods. The three-input NFC 2 DOF helicopter model structure is given in Fig. 7. The calculation of de dt can result in some numerical errors, however, if d dt is taken from the governing Eqs.

Simulation results and discussions
The performance of proposed NFCs has been widely examined for a nonlinear system in simulation. Desired pitch ( ) angle is square wave [ − 10, 10 ] as seen in Fig. 16 and desired yaw ( ) angle is a constant as seen in Fig. 17.
The sampling time is set to 1 ms for all studies. In figures two input NFC is stated as (ne,dy), three input NFC is stated as (e,dy,sume) and (e,de,sume). These statements express NFC inputs. The used LQR+I controller coefficients are given in Eq. (3). For two inputs NFC, W matrix is started as ( 3 × 9 ) zero matrices and for three inputs NFC, W matrix  is started as [ 4 × 27 ] zero matrices. The W matrices are changed by ANFIS as on-line to adapt FLC optimally. Figures 8, 10 shows two-input oscillatory NFC, these inputs are normalized error and output derivative. For pitch angle, the output of the system is smooth, however, two input NFC shows small perturbations as seen in seventh seconds in Fig. 8. Such type of behavior is more effective and more frequent for lower sampling times. As seen from Fig. 10, for yaw angle, the two input NFC has noise. The same noise was obtained from DC motor NFC simulation results in [18]. When this is implemented in real system, this noise leads to dynamically instability. The control signals are given in Figs. 9, 11 for two input NFC. It is seen from the figures that the psi angle control signal is noisy. So, it is clear that the two input structure is not enough for highly nonlinear cases.
When the NFC controllers are compared to LQR+I controller to show better the performance of the proposed controller, it is seen in Fig. 16, steady-state error is zero for the three controllers. NFCs have not any overshoot but LQR+I has overshoot as shown in Fig. 16. The settling times of NFCs are smaller than LQR+I settling times. As seen in Fig. 17 in the tenth and twentieth seconds there are some When compared the two and three input NFC, it is stated in [33] that two input (error, error derivative) NFC controller performance on 2 DOF helicopter is close to classical PID. Besides, the two input NFC has some unexpected behaviors [33]. The same unexpected behaviors are seen in our two input NFC controllers.  The results are presented in Table 2, it is easy to notice that the three-inputs NFC has better settling time and its Root Mean Square (RMSE) is smaller than two-input NFC. It is noticed that the pitch angle RMSE is nearly same as stated in [33] but yaw angle RMSE is very different from the LQR+I controller results.

Conclusion
In this study, 2 DOF helicopter trajectory tracking is conducted by NFCs and LQR+I controller. The most important characteristics of NFC is the ability to change its own parameters, therefore it is more flexible to adapt itself to any change in the system, even some part of the system physically damaged during the operation, it will continue hold the system in operation.
In order to show the robustness of the NFC, 2 DOF helicopter is chosen as a target model since in this model the nonlinear coupling effects were created by the, i.e., pitch and yaw effects. Also, by using the NFC, a DC motor  is tested and an aircraft is tested by applying pitch, roll and yaw effects. For all these cases mentioned, the NFC shows strong performance to control the systems. This system developed can be applied to any mechanical system which has nonlinear behavior to be controlled.
By comparing the NFC structures, it was decided which would be the most suitable structure and this structure will be used in future studies. In future works, the NFCs that is stated in this paper will be implemented to air vehicles like quadrotor and tilt rotor unmanned aircrafts. Type-1 and interval type-2 FLCs will be tested. However, it is known that online trained interval type-2 FLC is a challenging problem. The classical ANFIS can not be used to train interval type-2 FLS parameters. To overcome this challenge, we developed an ANFIS training model by modifying Karnik-Mendel Algorithm. This new algorithm is tested and it will be used to control air vehicles.

Compliance with ethical standards
Conflict of interest The authors declare that they have no conflict of interest.
Open Access This article is licensed under a Creative Commons Attribution 4.0 International License, which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons licence, and indicate if changes were made. The images or other third party material in this article are included in the article's Creative Commons licence, unless indicated otherwise in a credit line to the material. If material is not included in the article's Creative Commons licence and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder. To view a copy of this licence, visit http://creat iveco mmons .org/licen ses/by/4.0/.