# Fuzzy Model Predictive Control for Unmanned Helicopter
## 3 Control Methodology
### Takagi-Sugeno Inference Algorithm  
Takagi-Sugeno (sometimes referred to as Takagi-Sugeno-Kang)-type controllers were introduced in 1985 by [PERSON] and [PERSON]. In their first application, they served the purpose of identifying nonlinear dynamical systems using fuzzy inference mechanisms described in the paper [34]. Contrary to classical two-valued logic, the idea behind fuzzy logic allows for the formalization of an approach in which elements of the set \(\mathbf{X}\) are assigned a degree of membership to the set \(\mathbf{A}\) using a number from the range \([0,1]\). The mathematical formulation of the membership function \(\mu_{A}(x)\), which maps the set \(\mathbf{X}\) to the interval \([0,1]\), is described by expression (20). \[\mu_{A}:X\rightarrow[0,1] \tag{20}\]  
In controllers of this type, the function \(f:\mathbf{X}\rightarrow\mathbf{U}\) is defined by a set of rules adopted according to the following definition:  
\[\text{Rule i: If }x_{1}\text{ is }X_{1}^{i}\text{ and }\ldots\text{and }x_{n}\text{ is }X_{n}^{i}\text{, then }u^{i}=f(x_{1},\ldots,x_{n})\text{,}\]  
where  
* \(x_{j}\) are input signals;
* \(X_{1}^{i},\ldots,X_{n}^{i}\) are fuzzy sets;
* \(u^{i}\) is a crisp output signal from rule \(i\). In the above definition, it can be noticed that, unlike the rules defined within the Mamdani controller, the consequents are not defined by assigning the output quantity to a fuzzy set, but are defined as functions of the input quantities. This means that the Takagi-Sugeno approach allows for the combination of different (local) control laws depending on the values of the input signals. To determine the output value of the control signal from a Takagi-Sugeno-type controller, it is necessary to use Formula (21), which is a weighted average of the control signals from all local controllers. The weights in the formula below are the firing strengths of the individual \(l\) rules. \[u=\frac{\sum_{i=1}^{l}w_{i}\cdot u^{i}}{\sum_{i=1}^{l}w_{i}} \tag{21}\]  
The final scheme for determining the output value of the control signal in a Takagi-Sugeno-type controller can be divided into three main stages:Performing fuzzification, i.e., determining the degree of membership of the input signal values to fuzzy sets. 2. Determining the activation levels of the rules (\(w_{i}\)) based on the values from the fuzzification stage. 3. Determining the output signal value according to Formula (21). The application of the discussed approach is highly effective in controlling nonlinear systems. It allows for the approximation of the nonlinear dynamics of the analyzed object with multiple linear local models, developed, for example, from identification experiments. This approach can be widely used for controlling flying objects whose dynamics strongly depend, among other factors, on altitude and forward flight speed. The presented algorithm utilizes three separate regulators, whose outputs are combined using Formula (21), where weights in one-dimensional reasoning are computed directly from membership function values designed for this application. For the presented control system, membership functions were described as normalized Gaussian functions (22), where for the entire domain of the proposed membership functions, the condition is satisfied that the sum of all these functions is equal to one (23). \[\mu_{i}(V_{x})=\exp\left(\frac{-\left(V_{x}-V_{x_{i}}^{\ ref}\right)^{2}}{2 \sigma_{i}^{2}}\right) \tag{22}\]  
where  
* \(V_{x}\) is the measured forward flight velocity;
* \(V_{x_{i}}^{\ ref}\) is the reference forward flight velocity, corresponding to the center of each membership function;
* \(\sigma_{i}\) is the standard deviation of each membership function. In order to properly compute the output signals from the fuzzy system, it is necessary to provide the condition, where weights are normalized and their sum is equal to one in the whole domain. The condition is represented by the equation below: (23).