Path Tracking Control of an Autonomous Tractor Using Improved Stanley Controller Optimized with Multiple-Population Genetic Algorithm

To improve the path tracking accuracy of autonomous tractors in operation, an improved Stanley controller (IMP-ST) is proposed in this paper. The controller was applied to a two-wheel tractor dynamics model. The parameters of the IMP-ST were optimized by multiple-population genetic algorithm (MPGA) to obtain better tracking performance. The main purpose of this paper is to implement path tracking control on an autonomous tractor. Thus, it is significant to study this field because of smart agricultural development. According to the turning strategy of tractors in field operations, five working routes for tractors were designed, including straight, U, Ω, acute-angle and obtuse-angle routes. Simulation tests were conducted to verify the effectiveness of the proposed IMP-ST in tractor path tracking for all routes. The lateral root-mean-square (RMS) error of the IMP-ST was reduced by up to 36.84% and 48.61% compared to the extended Stanley controller and the original Stanley controller, respectively. The simulation results indicate that the IMP-ST performed well in guiding the tractor to follow all planned working routes. In particular, for the U and Ω routes, the two most common turning methods in tractor field operations, the path tracking performance of the IMP-ST was improved by 41.72% and 48.61% compared to the ST, respectively. Comparing and analyzing the e-Ψ and β-γ phase plane of the three controllers, the results indicate that the IMP-ST has the best control stability.


Introduction
The automatic navigation technology of agricultural vehicles is an important part of an intelligent agricultural system, which can effectively address labor shortages and inefficient production in agriculture. In the study of autonomous tractor navigation technology, path tracking is one of the key and difficult points that directly affects the operating accuracy of autonomous tractors. Therefore, research on navigation path tracking control algorithms of tractors is of great significance in improving the operation quality and achieving the autonomous operation of tractors.
In recent years, navigation path tracking control of tractor navigation has been studied by many scholars, and several control algorithms have been proposed, mainly including geometric/kinematic control [1,2], PID control [3,4], fuzzy control [5][6][7], sliding mode control [8], model predictive control [9,10] and optimal control [11,12]. Pure pursuit is an algorithm based on geometric/kinematic control and is the most widely used agricultural machine path tracking algorithm because of its simplicity and efficiency [13,14]. However, the path tracking effect is directly affected by the value of the forward-looking distance. To solve this problem, Li et al. proposed a path tracking method for tractors based on the fuzzy adaptive pure tracking model. It was combined with the kinematics model of tractors, and the forward-looking distance was adjusted online using the fuzzy adaptive algorithm [15]. Although the forward-looking distance studied by many scholars is tuned the inertial coordinate system, which is fixed on the ground surface, and x-z-y is the tractor coordinate system. The origin of x-z-y is located at the center of the tractor mass, with the x axis along the direction the tractor is working, and the y axis pointed to the driver's right and perpendicular to the x axis. The nomenclature of the 2-wheel tractor dynamic model is shown in Table 1.  According to Newton's second law, the dynamic differential equations of longitudinal motion, lateral motion and yaw motion can be obtained [26].  According to Newton's second law, the dynamic differential equations of longitudinal motion, lateral motion and yaw motion can be obtained [26].
where m is the tractor mass and I z is the tractor moment of inertia around the z axis. Slip rate control is a complex problem and is not considered in this paper. According to the geometric relation of tractor motion and supposing the tires act on a linear region and the value of the slip rate is small, the longitudinal and lateral forces of each tire are written as follows [27]: F xr = k xr s r (5) where k xf and k xr are the longitudinal stiffnesses of the front and rear tires, respectively. k yf and k yr are the cornering stiffnesses of the front and rear tires, respectively. s f and s r are the slip rates of the front and rear tires, respectively. The slip rate of the tire is obtained using the following equations: where r t is the tire effective radius. w t is the angular speed of the tire rotation. By combining Equations (1)~(8), the simplified two-wheel tractor dynamics equation can be obtained as follows: x sin ψ + . y cos ψ . X = .

Tractor Turning Strategy
The working path of tractors is unique compared with the working path of passenger vehicles. In particular, the turning condition of tractors needs to be considered during the process of agricultural production. The turning path is used to connect two linear working paths. There are two kinds of linear working paths: one is the working path in the working area, in which the paths are parallel, and the other is the operation path in the head of the field, which has an intersecting relationship. If there are two straight working paths connected by a turning path and located in different plot areas, the two working paths intersect each other.
According to the connection relationship between working paths, two groups of different turning strategies are adopted in this paper. When the directions of the working paths are parallel, the tractor carries out a 180 • steering motion at the head of the field. According to the relationship between the minimum turning radius r and the operating width w of the tractor, different steering modes at the head of the field are selected. As shown in Figure 2a, a U-turn is performed when w ≥ 2r. A Ω-turn is performed when w < 2r in Figure 2b.
According to the connection relationship between working paths, two groups of d ferent turning strategies are adopted in this paper. When the directions of the work paths are parallel, the tractor carries out a 180° steering motion at the head of the fie According to the relationship between the minimum turning radius r and the operat width w of the tractor, different steering modes at the head of the field are selected. shown in Figure 2a, a U-turn is performed when w ≥ 2r. A Ω-turn is performed when 2r in Figure 2b. When two working paths intersect, the tractor is steered less than 180° at the int section near the two working paths at the head of the field. According to the angle of two intersecting working paths, there are two types of turning shown in Figure 3: acute angle and the obtuse angle. The algorithm for generating the two turning path the same, which translates the distance r from the intersection of the two working pa to the inside of the angle. The intersection point of the translated working paths is tak as the center of the circle, and the distance r is taken as the radius to make an arc, wh is the desired turning path tangent to the two working paths.

Tractor Working Route Development
According to the turning strategy above, several tractor working routes were used test the path tracking controller designed in this study. Unlike previous studies that cused on how to plan the path to make tractors more efficient or complete specific tas this paper focuses on the development of path tracking control with predefined trajec ries rather than relying on an advanced path planner. Every tractor working path cons of a series of points on a geodetic coordinate system. The coordinates (X, Y) of each po represent the actual field position. During the path tracking operation, the real-time po tion of the tractor on the geodetic coordinate system will be compared with these poin Then, the lateral error and trajectory states will be obtained. Figure 4 shows the five routes used to test the path tracking controllers in this stu These routes were defined in MATLAB. They were straight, U, Ω, acute angle, and obt When two working paths intersect, the tractor is steered less than 180 • at the intersection near the two working paths at the head of the field. According to the angle of the two intersecting working paths, there are two types of turning shown in Figure 3: the acute angle and the obtuse angle. The algorithm for generating the two turning paths is the same, which translates the distance r from the intersection of the two working paths to the inside of the angle. The intersection point of the translated working paths is taken as the center of the circle, and the distance r is taken as the radius to make an arc, which is the desired turning path tangent to the two working paths.
According to the connection relationship between working paths, two groups of different turning strategies are adopted in this paper. When the directions of the working paths are parallel, the tractor carries out a 180° steering motion at the head of the field. According to the relationship between the minimum turning radius r and the operating width w of the tractor, different steering modes at the head of the field are selected. As shown in Figure 2a, a U-turn is performed when w ≥ 2r. A Ω-turn is performed when w < 2r in Figure 2b. When two working paths intersect, the tractor is steered less than 180° at the intersection near the two working paths at the head of the field. According to the angle of the two intersecting working paths, there are two types of turning shown in Figure 3: the acute angle and the obtuse angle. The algorithm for generating the two turning paths is the same, which translates the distance r from the intersection of the two working paths to the inside of the angle. The intersection point of the translated working paths is taken as the center of the circle, and the distance r is taken as the radius to make an arc, which is the desired turning path tangent to the two working paths.

Tractor Working Route Development
According to the turning strategy above, several tractor working routes were used to test the path tracking controller designed in this study. Unlike previous studies that focused on how to plan the path to make tractors more efficient or complete specific tasks, this paper focuses on the development of path tracking control with predefined trajectories rather than relying on an advanced path planner. Every tractor working path consists of a series of points on a geodetic coordinate system. The coordinates (X, Y) of each point represent the actual field position. During the path tracking operation, the real-time position of the tractor on the geodetic coordinate system will be compared with these points. Then, the lateral error and trajectory states will be obtained. Figure 4 shows the five routes used to test the path tracking controllers in this study. These routes were defined in MATLAB. They were straight, U, Ω, acute angle, and obtuse

Tractor Working Route Development
According to the turning strategy above, several tractor working routes were used to test the path tracking controller designed in this study. Unlike previous studies that focused on how to plan the path to make tractors more efficient or complete specific tasks, this paper focuses on the development of path tracking control with predefined trajectories rather than relying on an advanced path planner. Every tractor working path consists of a series of points on a geodetic coordinate system. The coordinates (X, Y) of each point represent the actual field position. During the path tracking operation, the real-time position of the tractor on the geodetic coordinate system will be compared with these points. Then, the lateral error and trajectory states will be obtained. Figure 4 shows the five routes used to test the path tracking controllers in this study. These routes were defined in MATLAB. They were straight, U, Ω, acute angle, and obtuse angle routes. It should be noted that the turning radius required for different turning methods was different. The values of the working width w and minimum turning radius r were determined by the size of the mounted agricultural implements. In this paper, w and r were set to 12 m and 5 m for U-turns, respectively. Additionally, w and r were set to 12 m and 8.2 m for Ω-turns, respectively. angle routes. It should be noted that the turning radius required for different turning methods was different. The values of the working width w and minimum turning radius r were determined by the size of the mounted agricultural implements. In this paper, w and r were set to 12 m and 5 m for U-turns, respectively. Additionally, w and r were set to 12 m and 8.2 m for Ω-turns, respectively.

Stanley Controller (ST)
The original Stanley controller was used by the Stanford University team for the first time in the DARPA Grand Challenge 2005. It is a kind of nonlinear feedback control for lateral error, which makes the tractor follow the desired path by inputting the steering command of the front wheel. The relationship between the parameters of the Stanley controller is shown in Figure 5. The original steering command is shown in Equation (10) [17].
where () t  is the heading error between the tractor and path and ( ) is the lateral error between the center of the front axle and the nearest point on the trajectory. v(t) is the tractor speed, and k is an adjustable gain.

Path Tracking Control Strategies 2.2.1. Stanley Controller (ST)
The original Stanley controller was used by the Stanford University team for the first time in the DARPA Grand Challenge 2005. It is a kind of nonlinear feedback control for lateral error, which makes the tractor follow the desired path by inputting the steering command of the front wheel. The relationship between the parameters of the Stanley controller is shown in Figure 5. The original steering command is shown in Equation (10) [17].
where φ(t) is the heading error between the tractor and path and φ(t) = ψ(t) − ψ route (t). e(t) is the lateral error between the center of the front axle and the nearest point on the trajectory. v(t) is the tractor speed, and k is an adjustable gain.

Extended Stanley Controller (EXT-ST)
An extended version of the Stanley controller was proposed by Hoffmann. The error between the instantaneous path and tractor yaw rate was added to the ST. The term ( . ψ(t) − . ψ route (t)) was associated with an adjustable gain k ψ to improve the motion stability of the tractor. Amer et al. added an adjustable gain k φ to the first part. The steering command is now composed of three parts, which are shown in Equation (11) [28] with the parameters defined in Figure 5.

Improved Stanley Controller (IMP-ST)
This is the proposed controller for the tractor. The EXT-ST is improved by adding one additional part, the integral of the heading error, t 0 φdt, which is associated with an adjusted gain, k 2 . The purpose of this improvement is to reduce the steady-state error of the steering system. At the same time, another gain k 1 is added to the second part to increase the sensitivity of tuning the controller. Therefore, the complete steering command for the study now includes five adjustable parameters for its four parts, as presented in Equation (12). The control model is shown in Figure 6.

Extended Stanley Controller (EXT-ST)
An extended version of the Stanley controller was proposed by Hoffmann. The error between the instantaneous path and tractor yaw rate was added to the ST. The term ( ( ) ( )) route tt   was associated with an adjustable gain k  to improve the motion stability of the tractor. Amer et al. added an adjustable gain k  to the first part. The steering command is now composed of three parts, which are shown in Equation (11) [28] with the parameters defined in Figure 5.

Improved Stanley Controller (IMP-ST)
This is the proposed controller for the tractor. The EXT-ST is improved by adding one additional part, the integral of the heading error, 0 t dt   , which is associated with an adjusted gain, k2. The purpose of this improvement is to reduce the steady-state error of the steering system. At the same time, another gain k1 is added to the second part to increase the sensitivity of tuning the controller. Therefore, the complete steering command for the study now includes five adjustable parameters for its four parts, as presented in Equation (12). The control model is shown in Figure 6.  Each part in Equation (12) plays an important role in agricultural automated tractor path tracking. The first part, with the heading error, is a proportional term, which observes the direction of the tractor. The second part, with the lateral error, represents the relative position between the tractor and desired path. The third part, with the heading error integral, will reduce the cumulative error in the steering process. The fourth part, with the yaw rate error, is a differential term, which will stabilize the yaw dynamics, especially for a low-speed off-road tractor.

IMP-ST Parameter Tuning Using the MPGA
In this study, a series of controller parameters will be optimized to obtain better path tracking performance for methods, such as ST (k), EXT-ST (k φ , k 1 , k and k ψ ), and IMP-ST (k φ , k 1 , k, k 2 and k ψ ). The multiple-population genetic algorithm will be used to look for the optimal parameters of each controller. In the field of control, the integral of time and absolute error (ITAE) is often used as an index to evaluate the performance of the control system. The system designed with ITAE index can consider the control speed and accuracy simultaneously, with small overshoot, good dynamic performance, and other advantages. The lateral error e is the best index for the tractor path tracking performance. Therefore, ITAE is chosen as the objective function F, as shown in Equation (13) [29]. When F reaches the minimum value, the tractor can achieve the best tracking performance.
The optimization procedure of the MPGA is shown in Figure 7. The MPGA introduces multiple populations and assigns different control parameters to optimize the search at the same time. The various populations are connected through the immigration operator to perform coevolution of multiple populations. The optimal individuals in each evolutionary generation of various groups are saved by manual selection operators and used as the basis for judging the convergence of the algorithm. When the optimization reaches the maximum number of iterations or the value of objective function F is less than the termination threshold, the optimization procedure is finished and optimal value of multiple parameters is output. According to the MPGA optimization process, the values of k  , k1, k, k2, and k  for the IMP-ST are determined for each tractor working route. The well-tuned parameters are shown in Table 2. Then, simulations are carried out for each tractor working route.

Results and Discussion
To verify the effectiveness of the proposed IMP-ST in tractor path tracking, simulations were carried out in MATLAB/SIMULINK. The path tracking performance of the IMP-ST was evaluated on the Dongfanghong LA3004 tractor model with a constant work- According to the MPGA optimization process, the values of k φ , k 1 , k, k 2 , and k ψ for the IMP-ST are determined for each tractor working route. The well-tuned parameters are shown in Table 2. Then, simulations are carried out for each tractor working route.

Results and Discussion
To verify the effectiveness of the proposed IMP-ST in tractor path tracking, simulations were carried out in MATLAB/SIMULINK. The path tracking performance of the IMP-ST was evaluated on the Dongfanghong LA3004 tractor model with a constant working speed of 1.5 m/s. The LA3004 tractor parameters are shown in Table 3. The controller performance was compared with ST, as shown in Equation (10), and EXT-ST, as shown in Equation (11). All the gains of the three controllers were optimized with the MPGA. To evaluate the effectiveness of the IMP-ST, several responses were chosen. A comparison of the actual trajectory of the tractor and the expected path shows the tracking performance. At the same time, the lateral error of the path tracking is a specific numerical indicator for evaluating the tracking performance. The real-time dynamic responses of each route for each controller are shown in Figures 8-12.   Figure 8a shows that all controllers could make the tractor better track the straight working route, and the actual trajectory obtained by the improved Stanley controller was closer to the desired path. This can also be proven by the lateral deviation data in Figure 8b. The lateral error RMS value of the improved Stanley controller was 0.0188 m, which was 5.05% less than that of the extended Stanley controller and 6% less than that of the original Stanley controller. From Figure 8b, it can be seen that the lateral deviation of the tractor was large at the beginning. This was caused by the inconsistency between the direction of the straight route and the starting heading angle. However, it can be seen from the partially enlarged view that the IMP-ST could make the tractor track the working route faster and more stably.    Figure 9 shows the simulation results for the U route. In Figure 9a, compared with the other two controllers in the article, the IMP-ST proposed in this paper could steer the tractor to better track the operation route, especially when the tractor was turning at the edge of the field. As shown in Figure 9b, the lateral errors of the three controllers increased and fluctuated, but the fluctuation of the IMP-ST, ranging from −0.0792 m to 0.0861 m, was smaller. On average, the RMS value of the lateral error for the IMP-ST was 0.0257 m, which was 34.77% less than that of the EXT-ST and 41.72% less than that of the ST. The path tracking performance was significantly improved.
As shown in Figure 10, the results for the Ω route are similar to those for the U route. Figure 10a indicates that all three controllers could guide the tractor to follow the working route with no visible error. The effect of the improved Stanley controller was closer to the desired Ω route. This can be proven by the lateral error curves in Figure 10b. Due to the characteristics of the Ω route, the tractor needed to turn continuously when it was at the edge of a field, which caused the lateral deviation of the three controllers to increase.     Figures 11a and 12a show that the path tracking performance of all controllers was good, and the proposed controller could guide the tractor closer to the two routes. This is also proven by the lateral error data shown in Figures 11b and 12b. For the acute angle route, the lateral error RMS of the IMP-ST is 0.0188 m, which is 6.93% less than that of the EXT-ST and 35.40% less than that of the ST. For the obtuse angle route, the proposed controller recorded a lateral error RMS of 0.0150 m, which is 1.96% and 27.54% less than that of the extended Stanley controller and original Stanley controller.
From the overall path tracking performance of all three controllers for all working routes, one can conclude that all controllers could achieve good results in following the five predefined desired operation routes. However, the lateral error of the ST sometimes reached 0.2 m, especially when tracking the U and Ω routes. As shown in Figure 13a, the tracking performance of the EXT-ST and IMP-ST was obviously better than that of the ST. This is because their multiple parameters were tuned by the MPGA. The IMP-ST could achieve the smallest lateral error RMS compared to the other two controllers. Figure 13b indicates that the lateral error RMS of the IMP-ST ranged from 6% to 48.61% less than that of the ST. Moreover, for the two most common turning methods of tractor field work, i.e., the U and Ω routes, the improved Stanley controller had significant improvements of 34.77% and 36.84% less error than the EXT-ST. The stability of tractor path tracking control is very important to normal field operations. The global asymptotic convergence of the Stanley controller has been proven in detail by Hoffmann et al. [17]. This paper takes the most commonly used U route for tractors as an example, and analyzes the stability of the improved Stanley controller through the phase plane of e-Ψ and β-γ, where As shown in Figure 14a, the coordinate origin is the globally asymptotically stable equilibrium point of the three controllers. The phase plane convergence region of e-Ψ is bounded. If the e-Ψ phase plane area of the controller is large, it is easy to cross the phase plane saturation area, causing the control system to not converge. Comparing the three controllers, IMP-ST has the smallest e-Ψ phase plane area. The lateral error generated under the same heading angle is the smallest, and the phase plane is closer to the stable point, indicating that IMP-ST has the best control effect. As shown in Figure 14b, the β-γ phase plane of the three controllers can all converge. The coordinate origin is its stable point, and the motion state of the tractor is always kept in a stable area during the process of tracking the path. If the area of the β-γ phase plane is large, the possibility of tractor operation instability increases. It can be seen from the comparison that the maximum values of the sideslip angle of tractor's mass center and the yaw rate are smaller than those of the other two controllers, and the β-γ phase plane area is closer to the stable point, so IMP-ST has the best control stability.  The stability of tractor path tracking control is very important to normal field operations. The global asymptotic convergence of the Stanley controller has been proven in detail by Hoffmann et al. [17]. This paper takes the most commonly used U route for tractors as an example, and analyzes the stability of the improved Stanley controller through the phase plane of e-Ψ and β-γ, where β = . y/ .
x. As shown in Figure 14a, the coordinate origin is the globally asymptotically stable equilibrium point of the three controllers. The phase plane convergence region of e-Ψ is bounded. If the e-Ψ phase plane area of the controller is large, it is easy to cross the phase plane saturation area, causing the control system to not converge. Comparing the three controllers, IMP-ST has the smallest e-Ψ phase plane area. The lateral error generated under the same heading angle is the smallest, and the phase plane is closer to the stable point, indicating that IMP-ST has the best control effect. As shown in Figure 14b, the β-γ phase plane of the three controllers can all converge. The coordinate origin is its stable point, and the motion state of the tractor is always kept in a stable area during the process of tracking the path. If the area of the β-γ phase plane is large, the possibility of tractor operation instability increases. It can be seen from the comparison that the maximum values of the sideslip angle of tractor's mass center and the yaw rate are smaller than those of the other two controllers, and the β-γ phase plane area is closer to the stable point, so IMP-ST has the best control stability. The stability of tractor path tracking control is very important to normal field operations. The global asymptotic convergence of the Stanley controller has been proven in detail by Hoffmann et al. [17]. This paper takes the most commonly used U route for tractors as an example, and analyzes the stability of the improved Stanley controller through the phase plane of e-Ψ and β-γ, where / y x   .
As shown in Figure 14a, the coordinate origin is the globally asymptotically stable equilibrium point of the three controllers. The phase plane convergence region of e-Ψ is bounded. If the e-Ψ phase plane area of the controller is large, it is easy to cross the phase plane saturation area, causing the control system to not converge. Comparing the three controllers, IMP-ST has the smallest e-Ψ phase plane area. The lateral error generated under the same heading angle is the smallest, and the phase plane is closer to the stable point, indicating that IMP-ST has the best control effect. As shown in Figure 14b, the β-γ phase plane of the three controllers can all converge. The coordinate origin is its stable point, and the motion state of the tractor is always kept in a stable area during the process of tracking the path. If the area of the β-γ phase plane is large, the possibility of tractor operation instability increases. It can be seen from the comparison that the maximum values of the sideslip angle of tractor's mass center and the yaw rate are smaller than those of the other two controllers, and the β-γ phase plane area is closer to the stable point, so IMP-ST has the best control stability.

Conclusions
In this paper, a path tracking controller for tractors called the IMP-ST is proposed by improving the original Stanley controller. The ST, EXT-ST, and IMP-ST were optimized by the MPGA and evaluated on a two-wheel tractor dynamic model. Then, the three controllers were tested on five routes considering different working turning strategies of the tractor.
The simulation test results of all working routes showed that the lateral error RMS of the proposed controller (IMP-ST) had significant improvements of up to 36.84% and 48.61% compared to the EXT-ST and the original ST, respectively. The simulation verification indicated that the IMP-ST performed better in guiding the tractor to follow the planned working routes. The results of e-Ψ and β-γ phase plane of the three controllers indicate that the IMP-ST has the best control stability.
The proposed controller could satisfy the requirements of tractor working path tracking. In the future research, real tractor tests will be carried out to further verify the practical application effect of the method.