# Path Tracking of Agricultural Vehicles Based on 4 WIS-4 WID Structure and Fuzzy Control
## 2 Materials and Methods
### Design of Fuzzy Controller  
#### 2.3.1 Input and Output Variables  
In order to obtain the appropriate steering center with a specific deviation, a two-input, two-output fuzzy controller is designed in this paper, the lateral deviation \(d\) and the heading deviation \(\theta\) of the prototype vehicle between the current path and the desired path are set as the input variables, and the universe of discourse is [\(-1.0\) m \(1.0\) m] and [\(-90^{\circ}\) 90\({}^{\circ}\)], respectively. Angle \(\alpha\) and radius \(R\) of the steering center are the output variables. The universe of discourse are [\(0\) m \(5.0\) m] and [\(0^{\circ}\) 90\({}^{\circ}\)]. When the prototype approaches the target path, the steering center's expectation of \(\alpha\) and \(R\) should be close to \(90^{\circ}\) and \(5.0\) m (i.e., the prototype vehicle travels in a straight line along the desired path). If the domain of \(\alpha\) is set to [\(-90^{\circ}\) 90\({}^{\circ}\)] (the output of the fuzzy controller controls both left and right turns of the prototype vehicle), there will be two reasonable expectations, namely, \(-90^{\circ}\) and \(90^{\circ}\). The sudden change in the output value will lead to large fluctuations in the output of the fuzzy controller. Therefore, this paper uses the deviation \(\Delta\theta\) to control the left and right turn of the prototype vehicle. When the value of \(\Delta\theta\) is greater than \(0^{\circ}\), the current prototype heading lies at the left side of the desired path, a right turn of the vehicle is necessary to minus the deviation, the momentary output \(\alpha\) by the fuzzy controller is positive, and vice versa is a negative value.  
In addition, the positive and negative signs of each variable are defined as follows: for the lateral deviation \(d\), a positive sign is considered when the prototype vehicle locates on the left side of the desired path, and a negative when the prototype vehicle is located on the right side of the desired path. For the heading deviation \(\theta\), a positive sign is considered for anticlockwise rotation, whereas a negative convention is considered for clockwise rotation when viewed from the top. Considering the accuracy of control and the flexibility of optimization, the input variables are classified into five fuzzy subsets and defined as positive big (PB), positive small (PS), zero (O), negative small (NS), and negative big (NB). The fuzzy subsets of output variables \(\alpha\) are defined as zero (O), small (S), medium (M), and big (B), and the fuzzy subsets of output variables \(\Delta\alpha\) are defined as zero (O), small (S), and big (B), respectively. A large-scale quantization level obtains higher control stability when the deviation is significant. However, a high-resolution (small-scale) quantization level is used to obtain finer adjustment of position and orientation of the prototype vehicle when the current path is close to the desired path. The triangular membership function is used for each input and output variable. The basic information of each input and each output variable is shown in Figure 6.