# Sensorimotor Control Using Adaptive Neuro-Fuzzy Inference for Human-Like Arm Movement
## 3 Control Architecture for Human-like Arm Movement
### Adapt the ANFIS Architecture for Human-like Movement Problem  
The proposed ANFIS structure comprises two soft-computing methods: Artificial Neural Network (ANN) and fuzzy logic. A single input variable \(E_{f}\), obtained from the force difference, is selected as the input for the ANFIS. The null-space vector \(\vartheta\) is expectedto have an output vector of the ANFIS. We express rule sets with a fuzzy if-then rule for the system as  
\[\begin{array}{ccc}\textbf{Rule 1 = IF}&E_{f}&\text{is}&\textbf{SMALL},&\textbf{THEN}&z_{1}=a_{1}E_{f}+a_{0}\\ \textbf{Rule 2 = IF}&E_{f}&\text{is}&\textbf{LARGE},&\textbf{THEN}&z_{2}=b_{1}E_{f}+b_{0} \end{array}\]  
where \(a_{0},a_{1},b_{0},\) and \(b_{1}\) are the consequent linear parameters. The proposed ANFIS structure is shown in Figure 3. The ANFIS structure comprises five layers: fuzzy layer, product layer, normalized layer, de-fuzzy layer, and total output layer. The process begins by selecting the input and output variables. For each input variable, fuzzy sets are defined, and fuzzy rules are established for each set. The membership functions of the fuzzy system are then tuned using a hybrid learning algorithm based on neuro-adaptive inference. Finally, the ANFIS model is constructed and trained.  
Layer 1 (fuzzy layer): The main function of the first layer is to fuzzify the input variable. Illustrated in Figure 3, the nodes are denoted by squares and labeled \(A_{1}\) and \(A_{2}\). Here, \(A_{1}\) and \(A_{2}\) represent the linguistic labels as SMALL and LARGE, respectively. The node function for each rule is given by  
\[O_{1,1}=\mu_{A1}(E_{f})\;\;\text{and}\;\;O_{1,2}=\mu_{A2}(E_{f}) \tag{16}\]  
where \(O_{1,1}\) and \(O_{1,2}\) denote the output functions of each rule, and \(\mu_{A1}\) and \(\mu_{A2}\) are the membership functions.  
Layer 2 (product layer): This layer's main role is to calculate the firing strength of each fuzzy rule. The node in this layer performs a multiplication operation on the membership grades received from Layer 1. The nodes are denoted by circles in Figure 3.  
\[O_{2,1}=w_{1}=\mu_{A_{1}}\;\;\text{and}\;\;O_{2,2}=w_{2}=\mu_{A_{2}} \tag{17}\]  
where \(w_{1}\) and \(w_{2}\) denote the firing strength of each rule, respectively.  
Layer 3 (normalized layer): The third layer normalizes the firing strengths of the rule obtained from the product layer. The purpose of this layer is to calculate the ratio of the firing strength of the rule to the sum of all rules' firing strengths, ensuring that the sum of all output signals of this layer equals 1.  
The output node is computed based on the proportion between the the rule firing strength and the sum of the firing strengths as  
Figure 3: The proposed ANFIS structure.  
\[O_{3,1}=\bar{w}_{1}=\frac{w_{1}}{w_{1}+w_{2}}\;\;\text{and}\;\;O_{3,2}=\bar{w}_{2}= \frac{w_{2}}{w_{1}+w_{2}} \tag{18}\]  
where \(\bar{w}_{1}\) and \(\bar{w}_{2}\) are the normalized firing strengths.  
Layer 4 (de-fuzzy layer): The adaptive node function in the fourth layer is described as  
\[O_{4,1}=\bar{w}_{1}z_{1}=\bar{w}_{1}(a_{1}E_{f}+a_{0})\;\;\text{and}\;\;O_{4,2} =\bar{w}_{2}z_{2}=\bar{w}_{2}(b_{1}E_{f}+b_{0}) \tag{19}\]  
where \(\bar{w}_{1}\) and \(\bar{w}_{2}\) are from the third layer, \(z_{1}\) and \(z_{2}\) denote the value of the function in the consequent part of each fuzzy rule, and \(O_{4,1}\) and \(O_{4,2}\) are the outputs of the fourth layer.  
Layer 5 (total output layer): The single node in this layer synthesizes the data from the fourth layer and calculates the _overall output_ as  
\[\hat{\sigma}=O_{5}=\bar{w}_{1}z_{1}+\bar{w}_{2}z_{2}. \tag{20}\]  
In addition, a hybrid learning algorithm comprised of recursive least square (RLS) and gradient descent algorithms is used to estimate the unknown constant parameters in the ANFIS structure. The reader is referred to [32] for the detailed description of the ANFIS architecture.