1 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.

2 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^{\circ }\) and \(40.5^{\circ }\) but the system can rotate at yaw angle without any limit [34].

Fig. 1
figure 1

2 DOF helicopter free body diagram

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 \(\theta\) and yaw angle \(\psi\) [33].The parameters of the model are given in Table 1.

$$\begin{aligned} (J_{eq,p}+m_{heli}l_{cm}^2)\ddot{\theta }&=K_{pp}V_{m,p}+K_{py}V_{m,y}\nonumber \\&\quad -\,m_{heli}gl_{cm}cos{\theta }-B_p{\dot{\theta }}\nonumber \\&\quad -\,m_{heli}l_{cm}^2sin{\theta }cos{\theta }{\dot{\psi }}^2 \end{aligned}$$
(1)
$$\begin{aligned} (J_{eq,y}+m_{heli}l_{cm}^2cos^2{\theta })\ddot{\psi }&=K_{yp}V_{m,p}+K_{yy}V_{m,y}\nonumber \\&\quad -\,B_y{\dot{\psi }}+2m_{heli}l_{cm}^2sin{\theta }cos{\theta }{\dot{\psi }}{\dot{\theta }} \end{aligned}$$
(2)

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]:

$$\begin{aligned} K_i= \begin{bmatrix} 18.9 &{} 1.98 &{} 7.49 &{} 1.53 &{} 7.03 &{} 0.77 \\ -\,2.22 &{} 19.4 &{} -\,0.45 &{} 11.9 &{} -\,0.77 &{} 7.03 \end{bmatrix} \end{aligned}$$
(3)
Table 1 Physical parameters of the 2 DOF helicopter system [34]
Fig. 2
figure 2

2 DOF helicopter control structure

3 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.

Fig. 3
figure 3

ANFIS structure

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. \(\mu\) defines the value of membership functions. So, for every input, there are two membership values.

$$\begin{aligned} O_i^1=\mu _{A_i}(x) \quad O_i^1=\mu _{B_i}(y) \end{aligned}$$
(4)

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.

$$\begin{aligned} O_i^2=\mu _{A_i}(x)\mu _{B_i}(y)=w_i \end{aligned}$$
(5)

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.

$$\begin{aligned} O_i^3=\overline{w_i}=\frac{w_i}{\sum _{i=1}^{n} w_i} \end{aligned}$$
(6)

Layer 4: The rule outputs are calculated where “pqr” is the consequent parameters of the first-order Sugeno model. In this layer, all \(y_i\) defines the normalized rule outputs.

$$\begin{aligned} O_i^4=y_i=\overline{w_i}f_i=\overline{w_i}(p_ix_1+q_ix_2+r_i) \end{aligned}$$
(7)

Layer 5: The aggregation step is represented that all output values are gathered. This result gives the same results with Sugeno FIS “wtaver” method.

$$\begin{aligned} \begin{aligned} O_i^5&=y=\sum _{i=1}^{n}y_i=\sum _{i=1}^{n}\overline{w_i}f_i=({\overline{w}}_1x_1)p_1+({\overline{w}}_1x_2)q_1\\&\quad +\, {\overline{w}}_1r_1+({\overline{w}}_2x_2)p_2+({\overline{w}}_2x_2)q_2+{\overline{w}}_2r_2 ... \end{aligned} \end{aligned}$$
(8)

The output “y” can be defined in matrix form as:

$$\begin{aligned} y=\begin{bmatrix} {\overline{w}}_1x_1 \quad {\overline{w}}_1x_2 \quad {\overline{w}}_1 \quad {\overline{w}}_2x_1 \quad {\overline{w}}_2x_2 \quad {\overline{w}}_2 \end{bmatrix} \begin{bmatrix} p_1 \\ q_1 \\ r_1 \\ p_2 \\ q_2 \\ r_2 \end{bmatrix} =XW \end{aligned}$$
(9)

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).

$$\begin{aligned} E=0.5(y_d-y)^2 \end{aligned}$$
(10)

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 \(\theta\), the yaw angle \(\psi\), and learning rate is lr that is set to 1. So the error term for ANFIS is defined as given below.


For pitch angle:

$$\begin{aligned} E=0.5(\theta _d-\theta )^2 \end{aligned}$$
(11)

For yaw angle:

$$\begin{aligned} E=0.5(\psi _d-\psi )^2 \end{aligned}$$
(12)

In ANFIS training, Gradient Descent (GD) method is used for consequent parameters’ training. So, the update law is given as:

$$\begin{aligned} W(n)=W(n-1)-lr\frac{\partial E}{\partial W} \end{aligned}$$
(13)

where

$$\begin{aligned} W= \begin{bmatrix} p_1&q_1&r_1&p_2&q_2&r_2&\dots \end{bmatrix} \end{aligned}$$
(14)

It is stated in Eq. (9) that \(y=XW\). So, the \(\frac{\partial E}{\partial W}\) term can be defined as

$$\begin{aligned} \frac{\partial E}{\partial W}=0.5*(y_d-y)X \end{aligned}$$
(15)

where y defines the (\(\theta\), \(\psi\)) angles and \(y_d\) defines (\(\theta _d\), \(\psi _d\)) angles.

3.1 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.

Fig. 4
figure 4

Two input NFC structure for 2 DOF helicopter

The controller inputs,\(N_{error},\frac{d\theta }{dt}\), are normalized error and rotational velocity. The normalized error and angular velocity can be limited in the desired intervals [18].

$$\begin{aligned}&N_{error}=\frac{\theta _{des}-\theta {n}}{\theta _{des}} \end{aligned}$$
(16)
$$\begin{aligned}&\frac{d\theta }{dt}(rad/s^2)=\frac{\theta (n)-\theta (n-1)}{dt} \end{aligned}$$
(17)

where dt is sampling time, \(\theta (n)\) is present angular velocity and \(\theta (n-1)\) is previous angular velocity and \(\theta _{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.

3.2 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.

3.2.1 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.

$$\begin{aligned} e=\theta _{des}-\theta {n}, \quad de=\frac{e_n-e_{n-1}}{dt}, \quad \sum e \end{aligned}$$
(18)

3.2.2 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 \(\frac{de}{dt}\) can result in some numerical errors, however, if \(\frac{d\theta }{dt}\) is taken from the governing Eqs. (1), (2), the possible numerical errors are minimized.

$$\begin{aligned} e=\theta _{des}-\theta {n}, \quad \frac{d\theta }{dt}=\frac{\theta (n)-\theta (n-1)}{dt} , \quad \sum e \end{aligned}$$
(19)
Fig. 5
figure 5

Theta angle three inputs (e,de,sume) NFC results

Fig. 6
figure 6

Psi angle three inputs (e,de,sume) NFC results

Fig. 7
figure 7

Three input NFC structure for 2 DOF helicopter

4 Simulation results and discussions

The performance of proposed NFCs has been widely examined for a nonlinear system in simulation. Desired pitch (\(\theta\)) angle is square wave [\(-\,10,10\)] as seen in Fig. 16 and desired yaw (\(\psi\)) 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\times 9\)) zero matrices and for three inputs NFC, W matrix is started as [\(4\times 27\)] zero matrices. The W matrices are changed by ANFIS as on-line to adapt FLC optimally.

Fig. 8
figure 8

Theta angle two inputs (ne,dy) NFC results

Fig. 9
figure 9

Theta angle two inputs (ne,dy) NFC control signal

Fig. 10
figure 10

Psi angle two inputs (ne,dy) NFC results

Fig. 11
figure 11

Psi angle two inputs (ne,dy) NFC control signal

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.

Fig. 12
figure 12

Theta angle three inputs (e,dy,sume) NFC results

Fig. 13
figure 13

Theta angle three inputs (e,dy,sume) NFC control signal

Fig. 14
figure 14

Psi angle three inputs (e,dy,sume) NFC results

Fig. 15
figure 15

Psi angle three inputs (e,dy,sume) NFC control signal

As seen from Figs. 12, 14, three input (e,dy,sume) NFC results have no overshoot and noise. Besides, their control signals are noiseless (Figs. 13, 15).

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 breakdowns because of the sudden effect of pitch angle motions. NFCs give faster answers to the sudden effect of pitch angle comparing to LQR+I.

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.

Fig. 16
figure 16

Comparison of NFCs for theta angle

Fig. 17
figure 17

Comparison of NFCs for psi angle

Table 2 Comparison of controllers performance

5 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.