## 2 Materials and Methods
### Path Tracking and Control
#### 2.4.3 Adaptive Fuzzy Feedback Controller  
When using classic feedback controllers (as a PD) to solve the path tracking problem, the proper tuning of gains will be of great help to accurately reduce error levels when attaining desired trajectories. Furthermore, when using more precise control systems such as a feedforward plus feedback controller, adapting gains could guarantee a better performance and a greater error reduction. This article also details the design of a Fuzzy logic system able to determine which of the gains \(kp\) or \(kd\) would work better during the feedback phase inside the previous control strategies. Based on the error's behavior and its time derivative, the fuzzy controller iteratively defines values for the PD's gains in order to reduce the error rate. Since the goal is to attain high rotation speeds from the moving platform (up to 5 Hz), the control task gets more difficult. At higher flapping frequencies, sudden changes when following preestablished trajectories tend to occur. Hence, an adaptable controller that can adjust based on the change of error will be helpful when computing the limbs acting forces. Figure 8 describes the block diagram of the gain channeling fuzzy logic controller as a previous step for tuning the PD gains inside the feedforward plus feedback control strategy. The Fuzzy logic system for gain tuning was also implemented for the plain feedback controller described in Figure 6.  
Fuzzy logic controllers (FLC) are known for providing human reasoning inside the decision making in the format of rules. The designed FLC is of Mamdani-type. This means that the process of adjusting \(kp\) and \(kd\) gains will consist of a three-part process: fuzzification, rule-based reasoning, and defuzzification [29]. As seen in Figure 8, the designed Fuzzy-PD controller takes the computations of limbs positional error \(e\) and its derivate \(\dot{e}\) as inputs and decides to assign coefficients for \(kp\) and \(kd\) (system's output) according to a \"if-then\" set of rules. This means that the PD controller's gains will be iteratively updated based on the error's behavior from each limb when following the desired path.  
For the fuzzification stage, crisp input values of \(e\) and \(\dot{e}\) are processed by triangle and trapezoid membership functions (MFs). The linguistic terms for \(e\) are large negative (LN),  
Figure 8: Block diagram of the implementation of the gain channeling fuzzy logic system inside the feedforward plus feedback controller.  
Figure 7: Block diagram for the implementation of the feedforward plus feedback controller.  
negative (N), zero (Z), Positive (P) and large positive (LP), where (LN) and (LP) present trapezoid MFs and (N), (Z) and (P) present triangle MFs. On the other hand, only three linguistic terms are defined for \(\dot{e}:\) negative (N), zero (Z) and positive (P), where (Z) is a triangle and the other two trapezoid MFs. Two output variables were defined for the defuzzification process: KP and KD. For the defuzzification stage, all linguistic terms for the output variables present gaussian MFs. Even though both output variables are computed separately, they present the same linguistic terms: zero (Z), small (S), medium (M), high (H) and very high (VH). Figure 9 shows the membership functions and the linguistic terms for the inputs and outputs from each FLC. Three FLCs are implemented to compute the \(kp_{i}\) and \(kd_{i}\), respectively, based on each limb's \(e_{i}(t)\) and \(\dot{e}_{i}(t)\).  
Table 2 shows the 15 rules for the inference stage, where inputs' linguistic terms are associated with outputs' linguistic terms based on an if-then structure. The fuzzy rules follow the [PERSON]'s max-min method, and at the defuzzification stage, the crisp output signal is computed by using the centroid method.