# Study of Motion Control and a Virtual Reality System for Autonomous Underwater Vehicles
## 3 Design of AUV Motion Control Algorithm
### Design of Neuro-Fuzzy Controller for AUV Path Tracking
The weight function of intelligence is adopted to weight the error and the error change to obtain the following fuzzy control rules:  
\(R_{s}\): if \(e=A_{i}\) and \(\dot{e}=B_{j}\), then  
\[y=-\left(\frac{|e(t)|}{|e(t)|+\left|\dot{e}(t)\right|}A_{i}+\frac{\left|\dot{ e}(t)\right|}{|e(t)|+\left|\dot{e}(t)\right|}B_{j}\right)\,i,j=1,2,\cdots,7 \tag{17}\]  
where, \(A_{i}\) and \(B_{j}\) are the values of the deviation and the deviation variation rate in the initialization rules library, respectively, and \(y\) is the output value corresponding to the new fuzzy rules. Figure 3: Structure of neuro-fuzzy controller for AUV path tracking motion. For the control rules described by the analytical form above, in each control node, the list of fuzzy rules is dynamically generated according to the actual deviation and the deviation change rate. It is not restricted to the quantization level of the output variable. By an online adjustment of the control rules, the system generates excellent performances with a rapid response and a highly stable accuracy. This network adopts a standardized five-layer network structure and a corresponding set of (7 \(\times\) 7 = 49) fuzzy rules. These rules have two input variables and one output variable, which are the propeller thrusts (torques) for each degree of freedom. The domain of the input and output is {\(-6\), \(-5\), \(\ldots\)\(-1\), \(0\), \(1\)\(\ldots\)\(5\), \(6\)}, which are the fuzzy membership functions of the system adopting a Gaussian function. The input and output relationships at each layer are listed as below:  
The first layer (the input layer): This layer has two nodes, and is used to input the transformed error \(e\) and the error change rate \(\dot{e}\) into the network. It only transfers the signal and does not process it. \[f_{i}^{(1)}=x_{i}^{(0)};y_{i}^{(1)}=x_{i}^{(1)}\ \ i=1,2 \tag{18}\]  
The second layer (fuzzification layer): In the node function  
\[f_{ij}^{(2)}=e^{-{(x_{i}^{(2)}-c_{ij})}^{2}/{\sigma_{ij}^{2}}}, \tag{19}\]  
The node accepts the input layer signals and uses a Gaussian function as the membership function to divide the distribution of the input signals. In the formula, \(c_{ij}\) and \(\sigma_{ij}^{2}\) are respectively the central and width value parameters of the Gaussian function. \[x_{i}^{(2)}=y_{i}^{(1)} \tag{20}\]  
\[y_{ij}^{(2)}=e^{-{(x_{i}^{(2)}-c_{ij})}^{2}/{\sigma_{ij}^{2}}}i=1,2;j=1,2, \cdots,7 \tag{21}\]  
The third layer (inference layer): Each node at this layer represents a single rule, with the 49 nodes in total representing 49 distinct rules. Each inference rule adopts the AND operator. The node function is represented as:  
\[y=-<\alpha e+(1-\alpha)\dot{e}> \tag{14}\]0  
\[y=-<\alpha e+(1-\alpha)\dot{e}> \tag{14}\]1  
\[y=-<\alpha e+(1-\alpha)\dot{e}> \tag{14}\]2  
\[y=-<\alpha e+(1-\alpha)\dot{e}> \tag{14}\]3  
The fourth layer (normalization layer): This layer performs the normalization processing on the inference result of each rule. The node function is represented as:  
\[y=-<\alpha e+(1-\alpha)\dot{e}> \tag{14}\]4  
\[y=-<\alpha e+(1-\alpha)\dot{e}> \tag{14}\]5  
\[y=-<\alpha e+(1-\alpha)\dot{e}> \tag{14}\]6The fifth layer (output node layer): All the nodes in the normalization layer connect with this layer to finish solving the ambiguity. The weight \(w_{j}\) of each connection represents the central value of the output membership function for each rule. This layer has only one output, that is, the control force (torque) on the principal axis of the AUV. \[y=-<\alpha e+(1-\alpha)\dot{e}> \tag{14}\]7  
\[y=-<\alpha e+(1-\alpha)\dot{e}> \tag{14}\]8  
The weight \(w_{j}\) in the Equation (30) is substituted by the output value of the consequent network's corresponding node. The error function \(E(W)\) for this is represented as:  
\[y=-<\alpha e+(1-\alpha)\dot{e}> \tag{14}\]9  
where, \(y_{d}\) and \(y\) are the desired output and actual output, respectively. Now, the error back-propagation algorithm is presented to adjust the location \(c_{ij}\) and the width \(\sigma_{ij}\) of the membership degree function.