# The Full-Field Path Tracking of Agricultural Machinery Based on PSO-Enhanced Fuzzy Standley Model
## 2 Fuzzy-Based Stanley Model
### Parameter Self-Adaptation Based on Fuzzy Algorithm  
It is notable in Equation (4) that the influence of the lateral deviation on the wheel steering angle is weighted by the gain coefficient of SM. The larger gain coefficient can reduce lateral deviation efficiently and enable the agricultural machinery to converge to the expected path quickly, whereas a large gain coefficient will lead to tracking error fluctuation. The small gain coefficient can make the agricultural machinery run smoothly and thus reduce the steady-state tracking error when the algorithm converges, but the controller converges slowly, especially when a large initial lateral error is given. Therefore, the time-varying gain coefficient should be selected according to different lateral deviations, especially for the full-field path tracking of agriculture machinery, which has stringent requirements on the distance of guided trajectory. What is more, the effect of the heading deviation and lateral deviation work on wheel steering angle is directional. When the lateral deviation and the heading deviation have the same direction of action on the wheel angle, the gain coefficient is decreased appropriately to make the controller stable. Conversely, when the lateral deviation and the heading deviation work on the wheel steering angle in opposite directions, the gain coefficient would be increased appropriately to speed up the algorithm's convergence speed. The fuzzy reasoning rules are initially formulated by taking the actual conditions of agricultural machinery into consideration, where the membership function is constructed with the lateral deviation and heading deviation as input variables, and the steering angle of the front wheel as output whose maximum value is limited to 35 degrees. The maximum value and standard deviation of the lateral deviation are employed as observations, and a trial-and-error procedure is performed to find the optimal gain coefficient under different inputs. The universe for the lateral deviation is [\(-\)3 m, 3 m], which includes right large, right medium, right small, zero, left small, left medium, left large, respectively, corresponding to NP, NM, NS, ZO, PS, PM and PB, as it is shown in Figure 2(a). The universe of the heading deviation is [\(-\)30\({}^{\circ}\), 30\({}^{\circ}\)], as it is shown in Figure 2(b), which includes right large, right medium, right small, zero, left small, left medium and left large, respectively, corresponding to NP, NM, NS, ZO, PS, PM and PB. As it is shown in Figure 2(c), the universe of gain coefficients is [0, 1.2], and the gain coefficients include zero, small, medium and large, respectively, corresponding to ZO, PS, PM and PB. The specific rules of the fuzzy inference table are designed as follows: the smaller the heading deviation and the larger the lateral deviation, then the larger the gain coefficient; if the heading deviation and the lateral deviation work on the wheel angle in the same direction, then the larger the heading deviation, the smaller the gain coefficient; if the heading deviation and lateral deviation work on the wheel angle in opposite directions, then the larger the heading deviation, the larger the gain coefficient; if the heading deviation is large, and the heading deviation and lateral deviation work on the front wheel angle in  
Figure 3: Membership function design for FSM. (**a**) Membership function of lateral deviation; (**b**) Membership function of heading deviation; (**c**) Membership function of gain coefficient. the same direction, then a smaller gain coefficient is selected; and if the heading deviation is large, and the heading deviation and lateral deviation work on the steering angle of the front wheel in opposite directions, then a larger gain coefficient is selected. Finally, after verification by experiment test, a total of 49 fuzzy rules are summarized in Table 1, where \(e\) stands for the lateral deviation and \(\theta_{e}\) represents the heading deviation.