PSO-Based Variable Parameter Linear Quadratic Regulator for Articulated Vehicles Snaking Oscillation Yaw Motion Control

: In this paper, the seven degrees of freedom (DOF) nonlinear system model of articulated vehicles, including the vehicle dynamics model, tire and hydraulic steering system model, and the linearized ideal reference model, is constructed. A layered stability controller for the articulated vehicle is built. The particle swarm optimization (PSO)-based variable parameter linear quadratic regulator (LQR) for the upper-level yaw torque controller and the lower-level torque distributor based on the principle of the minimum tire utilization are established. The effectiveness of the LQR upper-level yaw torque controller for an articulated vehicle at different speeds and control references are compared and analyzed through feedforward and feedback control. We optimize the parameters in the LQR controller using PSO and verify the improvement in the controller’s performance with optimized parameters. Overall, the effect of front and rear-integrated control is best, followed by rear-based and front-based control. The PSO algorithm to optimize the LQR controller parameters for snaking oscillation control is effective.


Introduction
Due to their small radius, excellent maneuverability, and wide adaptability, articulated vehicles are widely used in agriculture, forestry, construction, rescue and military, and other fields [1,2]. Since articulated vehicles are special configurations where a hydraulic steering system connects two separate bodies, the lateral stability is poor, especially at high speeds. The articulated vehicles show the instability phenomenon in forms such as snaking oscillation. Corresponding studies on snaking oscillation and influencing factors have been conducted by relevant scholars [3][4][5]. These studies reinforce that snaking oscillation can limit the speed of articulated vehicles, increase the operational burden and hazards for drivers, and reduce the operational efficiency of articulated vehicles. Therefore, it is necessary and meaningful to study the snaking oscillation suppression of articulated vehicles.
The study of snaking oscillation suppression of articulated vehicles can be categorized into two main research methods. The passive method includes improving the hydraulic steering system [6,7], optimizing the friction and damping of articulated points, and locking the differential [8]. The other is the active control method, which includes hydraulic system control [9], differential braking control, direct transverse moment control [10], and other active control methods. Due to the perfection of the electric drive, the distributed drive is realized, and the controllability of the vehicle chassis is greatly improved. The corresponding control strategies and algorithms improve vehicle stability under complex working conditions and avoid the adverse effects of passive control, such as limited control effects and large energy consumption. The most current applications for distributed electric drive vehicle stability active control are direct yaw control and the layered control (1) The front and rear body centers are located on the longitudinal central axis, and the vehicle is symmetrical with respect to the longitudinal central axis; (2) The influence of the tire camber angle and return torque are disregarded; (3) Air resistance is disregarded, and the road surface is flat and two-dimensional.
The articulated vehicle dynamics model is shown in Figure 1; the related quantities applied in this paper are in the nomenclature. The force analysis of the articulated vehicle is carried out to obtain the equilibrium equations for the lateral, longitudinal, and yaw of the front and rear vehicles. After simplification, the articulated vehicle dynamics equations are shown in Equation (1). The tire force and the equivalent moment of the hydraulic steering system acting on the articulation point in the equation can be obtained from the tire model Actuators 2022, 11, 337 3 of 23 and the hydraulic steering system model. The initial Newtonian mechanics' equations and the simplification process are shown in Appendix A.
(1) draulic steering system acting on the articulation point in the equation can be obtained from the tire model and the hydraulic steering system model. The initial Newtonian mechanics' equations and the simplification process are shown in Appendix A.
{ ( 1 + 2 )̇1 = ( 2 + 1 ) 1 1 + 2 4̇2 − 2 2 1 2 − 2 4 2 2 + 1 + 2 + ( 3 + 4 ) + ( 3 + 4 ) ( 1 + 2 )̇1 = 2 2̇1 − ( 1 + 2 ) 1  (1) The vertical force of each tire will change with the change of the articulated angle, and the lateral and longitudinal acceleration will cause axial load transfer. Therefore, in addition to its gravity, the transferred load should be distributed. The analysis of the articulated vehicle's vertical force is shown in Figure 2. The vertical force of each tire is shown in Equation (2), and the specific calculation process is included in Appendix A.   The vertical force of each tire will change with the change of the articulated angle, and the lateral and longitudinal acceleration will cause axial load transfer. Therefore, in addition to its gravity, the transferred load should be distributed. The analysis of the articulated vehicle's vertical force is shown in Figure 2. The vertical force of each tire is shown in Equation (2), and the specific calculation process is included in Appendix A.
The vertical force of each tire will change with the change of the articulated angle, and the lateral and longitudinal acceleration will cause axial load transfer. Therefore, in addition to its gravity, the transferred load should be distributed. The analysis of the articulated vehicle's vertical force is shown in Figure 2. The vertical force of each tire is shown in Equation (2), and the specific calculation process is included in Appendix A.

Tire Models
This study uses the Dugoff tire model, which complements the elastic base analysis model established by Fiala and the integrated lateral force-vertical force model of Pacejka and Sharp. The tire model provides a method to calculate the forces under the combined action of lateral and longitudinal forces. The characteristics are fast computation and require fewer parameters. The lateral and longitudinal forces of the tire can be obtained from the vertical force of the tire, the tire side slip angle, and the longitudinal slip rate. The model equations are as follows: . Other parameters and the calculation process are included in Appendix A.

Hydraulic Steering System Model
The hydraulic steering system model is shown in Figure 3. When articulated vehicles travel in a straight line or at a fixed radius, the inlet and outlet ports of the steering valve are closed, and the hydraulic steering system is equivalent to a torsion spring acting at the steering hinge point and connecting the front and rear bodies.

Tire Models
This study uses the Dugoff tire model, which complements the elastic base analysis model established by Fiala and the integrated lateral force-vertical force model of Pacejka and Sharp. The tire model provides a method to calculate the forces under the combined action of lateral and longitudinal forces. The characteristics are fast computation and require fewer parameters. The lateral and longitudinal forces of the tire can be obtained from the vertical force of the tire, the tire side slip angle, and the longitudinal slip rate. The model equations are as follows: . Other parameters and the calculation process are included in Appendix A.

Hydraulic Steering System Model
The hydraulic steering system model is shown in Figure 3. When articulated vehicles travel in a straight line or at a fixed radius, the inlet and outlet ports of the steering valve are closed, and the hydraulic steering system is equivalent to a torsion spring acting at the steering hinge point and connecting the front and rear bodies. The left and right hydraulic cylinder forces are as follows: The left and right hydraulic cylinder forces are as follows: The hydraulic steering system has torque on the articulation points of the articulated vehicles: The specific calculation process and related parameters are included in Appendix B.

Articulated Vehicle Three DOF Reference Model
Due to the special configuration of articulated vehicles and the existence of hydraulic steering systems, the front and rear body of the articulated vehicle will oscillate, and snaking oscillation with the road excitation and other external interference will occur at Actuators 2022, 11, 337 5 of 23 high speed. Thus, a three DOF linear reference model with a hydraulic system for dynamics control needs to be constructed. The three DOF reference model with front-based control is shown in Figure 4.
The specific calculation process and related parameters are included in Appendix B.

Articulated Vehicle Three DOF Reference Model
Due to the special configuration of articulated vehicles and the existence of hydraulic steering systems, the front and rear body of the articulated vehicle will oscillate, and snaking oscillation with the road excitation and other external interference will occur at high speed. Thus, a three DOF linear reference model with a hydraulic system for dynamics control needs to be constructed. The three DOF reference model with front-based control is shown in Figure 4. The forward velocity is assumed to be constant. Longitudinal forces are small compared with lateral forces, and the articulated vehicle maintains longitudinal motion balance. The hydraulic steering system is simplified to a torsion spring. We can assume that the road surface is smooth without slope, air resistance is ignored, and the tire lateral force varies in the linear range. The longitudinal force of two wheels can be equated to the yaw moment applied to the vehicle. Articulated vehicles have a relatively small articulated angle when snaking oscillation occurs during high-speed, straight-line driving. It should be noted that we have enlarged the articulated angle in the figure to facilitate interpretation; the actual angle is not as significant as shown in the figure. Since β is considerably small, it is acceptable to assume cos ≈ 1.
The dynamics equations for the lateral and yaw of the articulated vehicle are as follows: 1 (̇1 + 1 1 ) + 2 (̇2 + 2 2 ) = 1 + 2 + 3 + 4 (6) ( 1 + 1 2 2 )̇1 = + ( 1 + 2 )( 1 + 2 ) + 1 (7) The front and rear vehicles have the following kinematic relationships: The forward velocity is assumed to be constant. Longitudinal forces are small compared with lateral forces, and the articulated vehicle maintains longitudinal motion balance. The hydraulic steering system is simplified to a torsion spring. We can assume that the road surface is smooth without slope, air resistance is ignored, and the tire lateral force varies in the linear range. The longitudinal force of two wheels can be equated to the yaw moment applied to the vehicle. Articulated vehicles have a relatively small articulated angle when snaking oscillation occurs during high-speed, straight-line driving. It should be noted that we have enlarged the articulated angle in the figure to facilitate interpretation; the actual angle is not as significant as shown in the figure. Since β is considerably small, it is acceptable to assume cosβ ≈ 1.
The dynamics equations for the lateral and yaw of the articulated vehicle are as follows: The front and rear vehicles have the following kinematic relationships: . .
The lateral speeds of the front and rear wheels are as follows: Tire forces can be expressed as follows: 6 of 23 The equivalent spring stiffness of the hydraulic system and the equivalent moment acting on the articulation point are as follows: In conjunction with Equations (6)- (16), the sideslip angle can be expressed as α = v y1 v x ; the front-based control reference model dynamical equation is as follows: i.e., .
The feedforward controller is designed to make the articulated vehicle sideslip angle and yaw velocity tend to the ideal stable value. The feedforward compensation torque is related to the articulation angle as follows: where G f 1 is the feedforward controller gain factor. Laplace transforms and simplifies Equation (17); the feedforward controller gain factor is as follows: G f 1 = (a 11 a 12 − a 12 a 21 )α 0 − (a 12 a 24 − a 14 a 22 )β (a 12 a 23 − a 15 a 22 )β (19) According to the steering geometry [23], The articulated vehicle desired state space equation is as follows: .
where Similarly, the rear-based control reference model dynamical equation is as follows: i.e., .
The feedforward compensation torque related to the articulation angle is as follows: The articulated vehicle desired state space equation is as follows: .

Variable Parameter LQR(VLQR) Yaw Motion Controller
The controller is designed in layers. The sideslip angle and yaw velocity characterizing the vehicle state are used as control variables. The LQR algorithm is used to solve for the direct yaw moment applicable to the vehicle. The PSO algorithm optimizes the parameters in the LQR to improve the controller control in the upper yaw torque calculation layer. In the lower torque distribution layer, the principle of minimum tire utilization is used to distribute the vehicle drive forces and additional yaw moments. The detailed process is shown in Figure 5.
The articulated vehicle desired state space equation is as follows:

Variable Parameter LQR(VLQR) Yaw Motion Controller
The controller is designed in layers. The sideslip angle and yaw velocity characterizing the vehicle state are used as control variables. The LQR algorithm is used to solve for the direct yaw moment applicable to the vehicle. The PSO algorithm optimizes the parameters in the LQR to improve the controller control in the upper yaw torque calculation layer. In the lower torque distribution layer, the principle of minimum tire utilization is used to distribute the vehicle drive forces and additional yaw moments. The detailed process is shown in Figure 5.  Optimal control theory can be achieved under a certain model. It is reasonable to use the LQR optimal control theory to design the yaw moment feedback controller, considering the characteristics of the articulated vehicle. The vehicle condition tends to the target value with feedback compensation. The error equation between the real and desired values of the vehicle can be obtained from the 7 DOF nonlinear vehicle model with the desired state space equation: where X is the sideslip angle and yaw velocity from the 7 DOF nonlinear vehicle model, and X d f is the sideslip angle and yaw velocity from the desired state space equation.
For the derivative of the error, we can ignore higher-order and interference terms. The error deviation equation can be obtained as follows: It is not desirable to introduce excessive feedback control while reducing the error. Therefore, it is necessary to limit the direct yaw moment of the feedback. The controller performance metric needs to be established to ensure that the LQR controller obtains the optimal solution. The design optimization objective function is as follows: The optimal yaw moment is obtained when the minimum value of J is obtained, They are, respectively, the weighting matrices of the sideslip angle and yaw velocity in the LQR controller. Q is a semi-positive definite matrix, and R is a positive definite matrix. q α indicates the weight of the control system for the error between the sideslip angle and the desired value. q w indicates the weight of the error between the angular velocity and the desired value. r f b indicates the degree of limitation on the yaw moment. The standard linear quadratic (LQR) problem can be solved by establishing the infinite time optimal control Riccati equation.
We can solve the Riccati equation to obtain the state feedback gain matrix based on the LQR method.
The direct yaw moment feedback torque is as follows: From the LQR algorithm deduction process and the optimal control law, we learn that the control effect of the controller depends entirely on the choice of parameters in the matrices Q and R. However, there is no analytical method for selecting parameters in the matrices. The selection of the parameters is different when the control and the optimization objectives are different.
Therefore, researchers often rely on subjective experience to select the parameters in the matrix and use extensive testing and simulation analysis to select the set of parameters with better control. This can consume a lot of time and effort, and in many cases, the parameters can only be adjusted qualitatively. The chosen matrix parameters are not guaranteed to obtain the optimal performance of the controller. Therefore, when selecting the matrix parameters, the "optimal matrix parameters" of the LQR controller for an articulated vehicle driving in a straight line at high speed are determined by the PSO algorithm according to the law of vehicle stability control.

Optimization of VLQR Controller Based on PSO
The particle swarm optimization (PSO) algorithm is a group collaboration stochastic search algorithm simulating birds' foraging behavior. PSO is an ergodic optimization method, and the particle follows the optimal particle in a certain space to search for the optimal value iteratively. The position and velocity of the ith particle are denoted by X i and V i , respectively. The fitness value of each particle is calculated by the objective optimization function. In each iteration, the particle updates itself by following two optimal results; one is the optimal result found by the particle itself, i.e., the individual optimum, and the other is the optimal result currently found by the whole population, i.e., the global optimum. The updated equations for the velocity and position of each particle are as follows: where t is the current iteration number, w is the inertia weight factor, c 1 and c 2 are the positive learning factors, and r 1 and r 2 are random numbers within [0, 1]. The particle swarm search space is three-dimensional when front-based or rear-based control is used. The front-based control parameters are q α f , q w f , and r f b f , and the rear-based control parameters are q αr , q wr , and r f br . The particle swarm search space is six-dimensional when the front and rear integrated control are (q α f , q w f , r f b f , q αr , q wr , r f br ). After generating the initial particle swarm, assigning the LQR control parameters, calculating the feedback gain, invoking the vehicle dynamics model, calculating the fitness, seeking and updating, and verifying the termination condition, the optimal LQR control parameters are eventually obtained. The specific process is shown in Figure 6. articulated vehicle driving in a straight line at high speed are determined by the PSO algorithm according to the law of vehicle stability control.

Optimization of VLQR Controller Based on PSO
The particle swarm optimization (PSO) algorithm is a group collaboration stochastic search algorithm simulating birds' foraging behavior. PSO is an ergodic optimization method, and the particle follows the optimal particle in a certain space to search for the optimal value iteratively. The position and velocity of the ith particle are denoted by i X and i V , respectively. The fitness value of each particle is calculated by the objective optimization function. In each iteration, the particle updates itself by following two optimal results; one is the optimal result found by the particle itself, i.e., the individual optimum, and the other is the optimal result currently found by the whole population, i.e., the global optimum. The updated equations for the velocity and position of each particle are as follows: where is the current iteration number, is the inertia weight factor, 1 and 2 are the positive learning factors, 1 and 2 are random numbers within [0,1]. The particle swarm search space is three-dimensional when front-based or rear-based control is used. The front-based control parameters are , , and , and the rearbased control parameters are , , and . The particle swarm search space is sixdimensional when the front and rear integrated control are ( , , After generating the initial particle swarm, assigning the LQR control parameters, calculating the feedback gain, invoking the vehicle dynamics model, calculating the fitness, seeking and updating, and verifying the termination condition, the optimal LQR control parameters are eventually obtained. The specific process is shown in Figure 6. The fitness function is the basic element of PSO. According to the characteristics of the articulated vehicle and the working conditions, considering the relationship between frequency and time domain, the sum of integrated time and absolute error (ITAE) of the sideslip angle and yaw velocity is selected as the fitness function to improve the response characteristics of the vehicle. It is expressed as: The fitness function is the basic element of PSO. According to the characteristics of the articulated vehicle and the working conditions, considering the relationship between frequency and time domain, the sum of integrated time and absolute error (ITAE) of the sideslip angle and yaw velocity is selected as the fitness function to improve the response characteristics of the vehicle. It is expressed as:

The Lower Torque Distribution Layer
The yaw moment generated by the PSO-LQR controller needs to be achieved by controlling the articulated vehicle with each wheel's driving force. Due to the articulated configuration, the additional yaw moment of the front and rear vehicles can only be achieved by the tires on the respective vehicle. According to the friction ellipse principle of tires, the sum of the utilization rate of the four tires should be minimized for a high stability margin of the vehicle, as shown in Equation (33). The drive torque can be distributed according to the wheel load so that the vehicle has a large lateral traction margin to improve vehicle safety.
Here, C j is the weight factor of each wheel. Since the differences between the drive motors of each wheel are not considered, the weighting factor of each wheel C j is set to 1. When the vehicle is driving, it is more difficult to obtain the lateral force of the tire compared with the longitudinal force of the tire, and the lateral force of the tire and the vertical load of each wheel do not change suddenly. Therefore, Equation (33) can be simplified as follows: The total longitudinal drive force of the articulated vehicle should be first satisfied when the yaw moment is distributed. In addition, the longitudinal force is limited by the road adhesion conditions, and the driving force of each wheel cannot exceed the maximum driving force that each drive motor can provide or the maximum friction between the tires and the ground. Thus, the parameters in the target equation should satisfy the following constraints: where F d is the total required longitudinal drive force. When the vehicle performs stability control with the front-based or rear-based control, the other vehicle is without a yaw moment. However, when the vehicle performs stability control with front and rear integrated control, both front and rear vehicles apply yaw moment. Compared with the front-based or rear-based control individually, more units are controlled, and the front and rear integrated control effects are most likely better in theory.

Simulation Analysis
To comprehensively analyze the effectiveness and characteristics of the control system, the stability controller constructed in Section 3 is simulated at 5 m/s under low-speed conditions and 15 m/s under high-speed conditions. Simulation and comparative analysis of the LQR controller with unoptimized parameters (later denoted by LQR) and the optimized parameters of PSO (later denoted by PSO-LQR) are conducted under four conditions: uncontrolled, front-based control, rear-based control, and front and rear integrated control. The simulation and analysis validate the effectiveness and advantages of LQR control methods and PSO optimization. The parameters in the model are shown in Table 1.

Comparative Analysis of Uncontrolled Conditions and LQR Control
This subsection compares the simulation of the uncontrolled condition and various LQR controllers for articulated vehicles at 5 m/s and 15 m/s to initially verify the validity of the controller. After debugging, the LQR controller parameters are taken as follows: frontbased control (q α f = 10 6 , q w f = 10 5 , r f b f = 10 −4 ), rear-based control (q ar = 10 5 , q wr = 10 3 , r f br = 10 −6 ), and front and rear integrated control (q α f = 10 6 , q w f = 10 4 , r f b f = 10 −6 , q αr = 10 6 , q wr = 10 2 , r f br = 10 −6 ). With the articulated vehicle traveling at 5 m/s, the articulated angle is shown in Figure 7, and the other parameters of the articulated vehicle without control and under various base controls are shown in Figure 8. From the simulation results, it is obvious that the LQR controller, whether it is frontbased control, rear-based control, or front and rear-integrated control, has a more obvious control effect compared to the uncontrolled condition. They can limit the articulated angle's amplitude and accelerate the convergence speed. However, the front and rear integrated control effects are significantly better than the front-based control and the rear-based control both in terms of oscillation amplitude and convergence speed. The rear-based control is intermediate, and the front-based control is the least effective.
The angular velocity of the front and rear vehicle body is similar to the articulated angle, and all three controls limit the amplitude of oscillation and accelerate the convergence speed. However, the front and rear integrated control effects are the best, and front-based control is the worst. In terms of the front and rear vehicle body lateral acceleration, frontbody lateral acceleration is slightly greater than that of rear-body acceleration. Although the front and rear integrated control amplitude is the largest, the convergence speed is the fastest. Because of the relationship between acceleration and force, this indicates that the front and rear integrated control response is faster, and the yaw moment is larger, so it has a better convergence speed. Therefore, when the articulated vehicle is driving at 5 m/s, all three controls have a good suppression effect on snaking oscillation. However, the front and rear integrated control are the best, rear-based control is the second best, and front-based control is the worst.  Table  1.

Comparative Analysis of Uncontrolled Conditions and LQR Control
This subsection compares the simulation of the uncontrolled condition and various LQR controllers for articulated vehicles at 5 m/s and 15 m/s to initially verify the validity of the controller. After debugging, the LQR controller parameters are taken as follows: front-based control ( = 10 6 , = 10 5 , = 10 −4 ), rear-based control ( = 10 5 , = 10 3 , = 10 −6 ), and front and rear integrated control ( = 10 6 , = 10 4 , = 10 −6 , = 10 6 , = 10 2 , = 10 −6 ). With the articulated vehicle traveling at 5 m/s, the articulated angle is shown in Figure 7, and the other parameters of the articulated vehicle without control and under various base controls are shown in Figure 8. From the simulation results, it is obvious that the LQR controller, whether it is frontbased control, rear-based control, or front and rear-integrated control, has a more obvious control effect compared to the uncontrolled condition. They can limit the articulated angle's amplitude and accelerate the convergence speed. However, the front and rear integrated control effects are significantly better than the front-based control and the rearbased control both in terms of oscillation amplitude and convergence speed. The rearbased control is intermediate, and the front-based control is the least effective.  The angular velocity of the front and rear vehicle body is similar to the articulated angle, and all three controls limit the amplitude of oscillation and accelerate the conver gence speed. However, the front and rear integrated control effects are the best, and front based control is the worst. In terms of the front and rear vehicle body lateral acceleration front-body lateral acceleration is slightly greater than that of rear-body acceleration. Alt hough the front and rear integrated control amplitude is the largest, the convergenc speed is the fastest. Because of the relationship between acceleration and force, this indi cates that the front and rear integrated control response is faster, and the yaw moment i larger, so it has a better convergence speed. Therefore, when the articulated vehicle i driving at 5 m/s, all three controls have a good suppression effect on snaking oscillation However, the front and rear integrated control are the best, rear-based control is the sec ond best, and front-based control is the worst.
With the articulated vehicle driving at 15 m/s, the articulated angle is shown in Figur  9, and the other parameters of the articulated vehicle without control and under variou base controls are shown in Figure 10. With the articulated vehicle driving at 15 m/s, the articulated angle is shown in Figure 9, and the other parameters of the articulated vehicle without control and under various base controls are shown in Figure 10.
All three controls have significant control effects. In the uncontrolled condition, the vehicle's articulated angle is in the convergence state, but the convergence speed is slow, and the mean amplitude centerline gradually deviates from zero. The angular velocity of the front and rear vehicle body, the lateral acceleration, and the lateral velocity gradually increases. At this point, the vehicle appears to be running off course. After control, all vehicle parameters can be quickly converged, i.e., the snaking oscillation can be better suppressed, and the run-out phenomenon can be suppressed. These results are still based on the best-combined control of the front and rear body, followed by that of the rear body and that of the front body, which is the worst. Similar to at lower speeds, front and rear-integrated control is still obviously best, rear-based control is the second best, and front-based control is the worst. However, the effect of rear-based control is not as advantageous as front-based control at low speeds. Especially at convergence speeds, the front-base convergence speed is slightly better. on the best-combined control of the front and rear body, followed by that of the rear body and that of the front body, which is the worst. Similar to at lower speeds, front and rearintegrated control is still obviously best, rear-based control is the second best, and frontbased control is the worst. However, the effect of rear-based control is not as advantageous as front-based control at low speeds. Especially at convergence speeds, the frontbase convergence speed is slightly better.

Comparative Analysis of LQR and PSO-LQR
In this section, the PSO effect is verified by comparing the artificially rectified parameter controller with the PSO-LQR controller under the three controls: front-b control, rear-based control, and front and rear integrated control. Due to the space lim tions, this section analyzes the articulated vehicle based on three types of control wh is driving at 15 m/s.

Comparative Analysis of LQR and PSO-LQR
In this section, the PSO effect is verified by comparing the artificially rectified LQR parameter controller with the PSO-LQR controller under the three controls: front-based control, rear-based control, and front and rear integrated control. Due to the space limitations, this section analyzes the articulated vehicle based on three types of control when it is driving at 15 m/s.

Comparative Analysis of Front-Based Control
To improve the algorithm search efficiency, according to experience and simulation, the initial population number is assumed to be 50, and the iteration number is assumed to be 80. The search space is limited to a certain range. The optimal value is finally found, and the optimized control parameters are shown in Table 2. The articulated angle is shown in Figure 11, and the other parameters after controlling the LQR and PSO-LQR are shown in Figure 12.   According to the simulation results, the PSO-LQR controller has a better supp effect on the snaking oscillation both in amplitude and convergence speed. For the velocity, lateral velocity, and lateral acceleration of the front and rear vehicle b PSO-LQR controller still works better. Although the amplitudes of the front and hicle body accelerations are larger under PSO-LQR control at the initial moment, sequent convergence time is shorter. This also indicates that the response is fast feedback control is better. The PSO algorithm's effectiveness and the vehicle stab provement after optimization are demonstrated. According to the simulation results, the PSO-LQR controller has a better suppression effect on the snaking oscillation both in amplitude and convergence speed. For the angular velocity, lateral velocity, and lateral acceleration of the front and rear vehicle body, the PSO-LQR controller still works better. Although the amplitudes of the front and rear vehicle body accelerations are larger under PSO-LQR control at the initial moment, the subsequent convergence time is shorter. This also indicates that the response is fast and the feedback control is better. The PSO algorithm's effectiveness and the vehicle stability improvement after optimization are demonstrated. effect on the snaking oscillation both in amplitude and convergence speed. For the angular velocity, lateral velocity, and lateral acceleration of the front and rear vehicle body, the PSO-LQR controller still works better. Although the amplitudes of the front and rear vehicle body accelerations are larger under PSO-LQR control at the initial moment, the subsequent convergence time is shorter. This also indicates that the response is fast and the feedback control is better. The PSO algorithm's effectiveness and the vehicle stability improvement after optimization are demonstrated.

Comparative Analysis of Rear-Based Control
The initial population and iteration numbers are the same as those of front-based control. The rear-based control search range and optimized control parameters are shown in Table 3. The articulated angle is shown in Figure 13, and the other parameters after controlling the LQR and PSO-LQR are shown in Figure 14. The initial population and iteration numbers are the same as those of front-based control. The rear-based control search range and optimized control parameters are shown in Table 3. The articulated angle is shown in Figure 13, and the other parameters after controlling the LQR and PSO-LQR are shown in Figure 14.  Figure 13. Articulated angle. Figure 13. Articulated angle.

Comparative Analysis of Front and Rear Integrated Control
The search range and optimized parameters are shown in Table 4. The articulated angle is shown in Figure 15, and the parameters in integrated front and rear body control of LQR and PSO-LQR are shown in Figure 16.

Comparative Analysis of Front and Rear Integrated Control
The search range and optimized parameters are shown in Table 4. The articulated angle is shown in Figure 15, and the parameters in integrated front and rear body control of LQR and PSO-LQR are shown in Figure 16. Table 4. Front and rear integrated control search range and optimization results.

Name
q αf q wf r fbf q αr q wr r fbr Range 10 3 , 10 7 10 −9 , 10 −6 10 −9 , 10 −6 10 3 , 10 5 10 2 , 10 4 10 −9 , 10 −6 Optimal result 4.15 × 10 4 1.05 × 10 −9 1.59 × 10 −9 3.69 × 10 4 8.47 × 10 2 1.31 × 10 −9 Actuators 2022, 11, 337 17 of 25 Table 4. Front and rear integrated control search range and optimization results.   According to the simulation results, the overall control effect of the PSO-LQR controller is better. Particularly, the optimization effect on the control of the articulated angle is obvious. The oscillation amplitude is greatly reduced, and the convergence speed is accelerated. The optimization effect on the amplitude of the front and rear vehicle angular velocity is not obvious, but the convergence speed is accelerated. The oscillation amplitude is greater in the lateral acceleration of the front and rear car bodies while the convergence speed is increased. Overall, the LQR controller parameters optimized by the PSO algorithm have a better control effect and can improve the suppression effect of the articulated vehicle snaking in the time and frequency domains to improve vehicle stability. According to the simulation results, the overall control effect of the PSO-LQR controller is better. Particularly, the optimization effect on the control of the articulated angle is obvious. The oscillation amplitude is greatly reduced, and the convergence speed is accelerated. The optimization effect on the amplitude of the front and rear vehicle angular velocity is not obvious, but the convergence speed is accelerated. The oscillation amplitude is greater in the lateral acceleration of the front and rear car bodies while the convergence speed is increased. Overall, the LQR controller parameters optimized by the PSO algorithm have a better control effect and can improve the suppression effect of the articulated vehicle snaking in the time and frequency domains to improve vehicle stability.

Range
The articulated angle is shown in Figure 17, and the other parameters of the articulated vehicle under three PSO-LQR controls at 15 m/s are shown in Figure 18. The articulated angle is shown in Figure 17, and the other parameters of the articulated vehicle under three PSO-LQR controls at 15 m/s are shown in Figure 18. After PSO algorithm optimization, the effect of the snaking oscillation suppression based on front and rear integrated control for articulated vehicles is still the best, and the advantage is obvious. Rear-based control is significantly more effective than front-based control. Overall, rear-based control is better than front-based control for snaking oscillation suppression. The advantage is greater than when the LQR controller parameters are not optimized by PSO. Rear-based control has better oscillation amplitude suppression, and although the convergence speed is slowed down, the convergence process is rela-  The articulated vehicle driving force of each tire under the three PSO-LQR co is shown in Figure 19. The tire force based on the front and rear integrated control moment of snaking oscillation emergence shows the greatest amplitude. Howeve oscillation frequency during the convergence is the highest, and the convergence sp the fastest. Since force is the reason for changing the motion state, front and rear integ control is the most effective for articulated vehicle snaking oscillation suppression co Compared with rear-based control, front-based control has a slightly faster conver rate and higher oscillation frequency because the tires have rolling friction wit ground, and the front and rear vehicle weights and center of gravity positions are d ent. Therefore, the driving force of each tire is not zero, and the driving force of the of the front and rear vehicles are different during articulated vehicle stable driving suppressing the snaking oscillation. After PSO algorithm optimization, the effect of the snaking oscillation suppression based on front and rear integrated control for articulated vehicles is still the best, and the advantage is obvious. Rear-based control is significantly more effective than front-based control. Overall, rear-based control is better than front-based control for snaking oscillation suppression. The advantage is greater than when the LQR controller parameters are not optimized by PSO. Rear-based control has better oscillation amplitude suppression, and although the convergence speed is slowed down, the convergence process is relatively smooth. In terms of the front and rear vehicle angular velocity, rear-based control is also better than front-based control, with no significant difference in the convergence speed, and the amplitude decreases significantly and changes smoothly. However, in terms of the front vehicle lateral velocity, front body-based control is better.
The articulated vehicle driving force of each tire under the three PSO-LQR controls is shown in Figure 19. The tire force based on the front and rear integrated control at the moment of snaking oscillation emergence shows the greatest amplitude. However, the oscillation frequency during the convergence is the highest, and the convergence speed is the fastest. Since force is the reason for changing the motion state, front and rear integrated control is the most effective for articulated vehicle snaking oscillation suppression control.
Compared with rear-based control, front-based control has a slightly faster convergence rate and higher oscillation frequency because the tires have rolling friction with the ground, and the front and rear vehicle weights and center of gravity positions are different. Therefore, the driving force of each tire is not zero, and the driving force of the tires of the front and rear vehicles are different during articulated vehicle stable driving after suppressing the snaking oscillation.

Conclusions
The articulated vehicle 7 DOF nonlinear system model and the three control desirable reference models were obtained herein. The PSO-LQR upper-level yaw torque controller and the lower torque distribution layer for snaking oscillation yaw motion control were established.
The effectiveness of the front-based, rear-based, and front and rear-integrated LQR controllers was initially verified by comparing them with uncontrolled conditions at different speeds. All three controls can limit the articulated angle oscillation amplitude and convergence speed. The three controls can also suppress the snaking oscillation at higher speeds while ensuring the straightness of vehicle driving. The front and rear integrated control effects are significantly better than the front-based and rear-based control. The rear-based control effect is medium, and the front-based control effect is the worst.
PSO optimizes the parameters in the LQR controller, and the control effect of the three controllers after parameter optimization is improved both in oscillation amplitude and convergence speed. In contrast, the front and rear integrated control effects improved the most after parameter optimization. After parameter optimization, comparing the control effect under the three controls shows that the front and rear integrated control effect is obviously the best, followed by rear-based control, and the front-based control effect is the worst. The front and rear integrated control tire forces have the largest amplitude, highest oscillation frequency, and fastest convergence rate. In conclusion, the proposed layered stability controller and the PSO algorithm to optimize LQR controller parameters for snaking oscillation control are effective.

Discussion
This paper focuses on the three control modes and compares LQR and PSO-LQR control for articulated vehicles' snaking oscillation control. The proposed front and rear integrated control and PSO-LQR can substantially improve the articulated vehicles' snaking oscillation suppression effect. The control method proposed in the study is under the condition that the parameters of articulated vehicles are known and invariable. However, due to the inherent characteristics of PSO and LQR optimization algorithms and the performance limitations of controller hardware, the method proposed in the study does not allow PSO to optimize the parameters in the LQR controller in real time under different operating conditions and variable vehicle parameters. Therefore, the real-time optimization of the articulated vehicles' snaking suppression with variable body parameters and operating conditions should be the focus of subsequent research.

Conclusions
The articulated vehicle 7 DOF nonlinear system model and the three control desirable reference models were obtained herein. The PSO-LQR upper-level yaw torque controller and the lower torque distribution layer for snaking oscillation yaw motion control were established.
The effectiveness of the front-based, rear-based, and front and rear-integrated LQR controllers was initially verified by comparing them with uncontrolled conditions at different speeds. All three controls can limit the articulated angle oscillation amplitude and convergence speed. The three controls can also suppress the snaking oscillation at higher speeds while ensuring the straightness of vehicle driving. The front and rear integrated control effects are significantly better than the front-based and rear-based control. The rear-based control effect is medium, and the front-based control effect is the worst.
PSO optimizes the parameters in the LQR controller, and the control effect of the three controllers after parameter optimization is improved both in oscillation amplitude and convergence speed. In contrast, the front and rear integrated control effects improved the most after parameter optimization. After parameter optimization, comparing the control effect under the three controls shows that the front and rear integrated control effect is obviously the best, followed by rear-based control, and the front-based control effect is the worst. The front and rear integrated control tire forces have the largest amplitude, highest oscillation frequency, and fastest convergence rate. In conclusion, the proposed layered stability controller and the PSO algorithm to optimize LQR controller parameters for snaking oscillation control are effective.

Discussion
This paper focuses on the three control modes and compares LQR and PSO-LQR control for articulated vehicles' snaking oscillation control. The proposed front and rear integrated control and PSO-LQR can substantially improve the articulated vehicles' snaking oscillation suppression effect. The control method proposed in the study is under the condition that the parameters of articulated vehicles are known and invariable. However, due to the inherent characteristics of PSO and LQR optimization algorithms and the performance limitations of controller hardware, the method proposed in the study does not allow PSO to optimize the parameters in the LQR controller in real time under different operating conditions and variable vehicle parameters. Therefore, the real-time optimization of the articulated vehicles' snaking suppression with variable body parameters and operating conditions should be the focus of subsequent research. Acknowledgments: The authors would like to thank all anonymous reviewers and editors for their helpful suggestions for the improvement of this paper.

Conflicts of Interest:
The authors declare no conflict of interest. The funders had no role in the design of the study; in the collection, analyses, or interpretation of data; in the writing of the manuscript; or in the decision to publish the results.

Nomenclature
O 1 x 1 y 1 Front vehicle coordinate system O 2 x 2 y 2 Rear vehicle coordinate system v x1 Longitudinal velocity of the front vehicle v x2 Longitudinal velocity of the rear vehicle v y1 Lateral velocity of the front vehicle v y2 Lateral velocity of the front vehicle Distance from the center of the front vehicle gravity to the front axles L 2 Distance from the articulated point to the center of the front vehicle gravity L 3 Distance from the center of the rear vehicle gravity to the front axles L 4 Distance from the articulated point to the center of the rear vehicle gravity F zj Vertical tire force (j = 1, 2, 3, 4) C σ Longitudinal tire stiffness C α Lateral tire stiffness β Swing angle I 1 Vehicle rotational inertia about the z-axis of the front vehicle I 2 Vehicle rotational inertia about the z-axis of the rear vehicle F xj Longitudinal tire force (j = 1, 2, 3, 4) F yj Lateral tire force (j = 1, 2, 3, 4) M O1 Torque of the steering mechanism on the front vehicle M O2 Torque of the steering mechanism on the rear vehicle m 1 Mass of the front vehicle m 2 Mass of the rear vehicle F ox1 Longitudinal force of the steering mechanism on the front vehicle F ox2 Longitudinal force of the steering mechanism on the rear vehicle F oy1 Lateral force of the steering mechanism on the front vehicle F oy2 Lateral force of the steering mechanism on the rear vehicle The kinematic relationships between the front and rear vehicles are as follows: . ω 1 cosβ − L 4 . ω 2 + v x1 cosβ − v y1 sinβ + L 2 ω 1 sinβ (ω 1 −ω 2 ) (A4) . β = ω 1 − ω 2 (A5) Accordingly, the vehicle dynamics model (Equation (1)) can be obtained by combining Equations (A1)-(A5).

Appendix B
Hydraulic Steering System Model Related Calculation. The lengths of the left and right steering cylinders and the lengths of the two cylinders when β = 0 are as follows: The force arms corresponding to the thrust of the hydraulic cylinders on both sides are as follows: h 1 = Rrsin(θ+β) where V cl , V c2 is the fluid volume of the P 1 ,P 2 chamber, V 0 is the volume of the fluid in the initial position, A 1 and A 2 are the cross-sectional area of the rod less and rod cavities, respectively, Q 1 is the amount of oil supplied to the steering cylinder and Q 2 is the amount of oil discharged from the steering cylinder When the articulated vehicle is traveling straight or at a fixed radius, Q 1 = Q 2 = 0 Accordingly, the hydraulic steering system model (Equations (4) and (5)) can be obtained by combining Equations (A15)-(A19).