Driverless simulation of path tracking based on PID control

In order to realize the path tracking of autonomous vehicles, this paper first simplifies the complex structure of the vehicle into a two-degree-of-freedom kinematic and dynamic vehicle model. based on PID control, the vehicle path tracking controller is designed to calculate the lateral deviation between the expected path and the actual path, and outputs the front wheel rotation angle through the controller, so that the autonomous vehicle can travel well according to the expected path. The control system model is built in the MATLAB/Simulink, and the vehicle path tracking control system is simulated and verified jointly with the CarSim software platform. Simulation results show that the designed control strategy can ensure the path tracking performance of intelligent vehicles at different speeds, and has good tracking accuracy, real-time performance and vehicle driving stability.


Introduction
Lateral motion control is one of the key technologies to realize the autonomous driving of intelligent vehicles. among them, path tracking (that is, controlling the vehicle always along the desired path through autonomous steering, while ensuring the driving safety and ride comfort of the vehicle) is the ultimate goal facing unmanned driving [1]. Intelligent vehicle requires the lateral motion control system to have accurate, efficient and reliable control performance under wide range driving conditions. However, some control algorithms can not effectively coordinate the control requirements of autonomous steering control system under different operating conditions [2]. At the same time, the intelligent autonomous steering system requires high real-time control, some controller design is difficult to ensure the steering performance under different working conditions, but also can make the controller design simple and easy to achieve.
From the point of view of the accuracy, stability and easy realization of the lateral motion control of intelligent vehicle, different working conditions should have different control objectives and emphases, so that the overall comprehensive performance can be optimized. For example, when the vehicle is in the low speed operating condition, the kinematics characteristics of the vehicle are more prominent, while in the high speed operating condition, the dynamic characteristics of the vehicle have a great influence on its own operating state [3][4][5]. In reference [6][7][8][9], the lateral control problem of intelligent vehicle is studied by using the model predictive control method. The algorithm first predicts the output state of the object in the future, and then determines the control action at the current moment. Because it has certain predictability, it can track the target path quickly and accurately, at the same time, it can guarantee the safety and stability of the vehicle driving, but the controller design is more complex, the overall calculation is large, and the implementation is relatively difficult [10]. Aiming at the above problems, this paper designs an intelligent vehicle path tracking control strategy controlled by PID feedback. Considering that the vehicle is in relatively safe working condition, the PID feedback control law, which is simple and easy to calculate, is adopted to improve the speed and easy realization of the path tracking control, and to improve the safety and stability of the vehicle path tracking.

Vehicle dynamics model
In order to describe the vehicle motion at a certain time, the vehicle dynamics model generally considers the relatively complex interaction between the tire and the road. In a dynamic model, we usually need to consider the effects of various forces, which can be roughly divided into two categories: longitudinal force and lateral force. The longitudinal force is the force that makes the vehicle move forward and backward in the longitudinal plane of the vehicle, while the lateral force is the force that makes the vehicle move in the transverse plane of the vehicle [11][12][13]. Figure 1 shows is the vehicle coordinate system based on the body and is the inertia coordinate system based on the ground. As mentioned above, the model has two degrees of freedom, the yaw movement around the axis and the longitudinal movement along the longitudinal plane of the vehicle body, and the longitudinal movement of the axis. Longitudinal refers to the longitudinal plane along the vehicle body, the direction of the axle, while lateral or transverse refers to the transverse plane along the vehicle body, the direction of the axle.
In the longitudinal plane of the vehicle: In the transverse plane of the vehicle:  represents the force applied to the rear tire in the y-direction. represents the moment of inertia of the vehicle.
According to the Figure 1,we can get: According to the Figure 2, the front wheel offset angle is Where， represents the angle between the speed direction of the front wheel and the longitudinal plane of the vehicle，and is the angle of the front wheel of the vehicle.
The rear wheel offset angle is Where, represents the angle between the speed direction of the rear wheel and the longitudinal plane of the vehicle.
When the vehicle is running on the ground normally, the relationship between the lateral deflection angle and the lateral reaction force can be regarded as a linear relationship： Among them, k represents the sideslip stiffness and represents the sideslip angle of the tire.
According to formula (7), the lateral force of front wheel is The lateral force on the rear wheel is Because of ̇ ， and can be obtained from the following formula: Where, and are the distances from the vehicle mass center to the front axle and rear axle respectively.
Carry in the formula here, and substitute the formulas (10) and (11) into the formulas (8)and (9) x r x r r Substitute the formulas (12) and (13) into the formulas (2) and (3) to get: The matrix can be converted to:

Model building based on Simulink system
Based on the goal of co-simulation of CarSim software and Simulink software, Figure 3 shows the model established in Simulink. In the model, there are several operation function modules, delay function modules and PID control function modules used in the Simulink system [14][15]. Among them, the PID control module provided by Simulink software is used to compare the lateral offset of the target path calculated by the PID path tracking controller of the autopilot vehicle with the lateral deviation of the vehicle's desired travel path. After adjusting the PID parameters, the error is reduced, and the front wheel angle information is input into the CarSim software to complete the vehicle's route according to the target path. The lateral control of driving makes the vehicle realize the function of path tracking. In the MATLAB / Simulink system model [16], CarSim software will import the data into the MATLAB / Simulink system as a function module to participate in the operation, and input the two-dimensional coordinate value of the target path, the real-time two-dimensional coordinate value of the vehicle and the heading angle of the vehicle to the whole system. The PID lateral distance between the vehicle is predicted by the PID controller in the system, and the vehicle lateral offset distance is calculated, and the front wheel angle is output to the CarSim software.

Automatic Driving Vehicle Co-simulation Control System
The control software MATLAB / Simulink and the multi-body dynamics simulation software CarSim are used to complete the co-simulation [17][18][19]. The main process is as follows: through the   IWMSME 2020 IOP Conf. Series: Materials Science and Engineering 892 (2020) 012050 IOP Publishing doi:10.1088/1757-899X/892/1/012050 5 establishment of multi-body dynamic model in CarSim software, And the data information needed to be output and input is imported and exported. The exported data information passes through the model established in the Simulink system, carries out a series of solving operations on the system equation through the ode45 solver set up [20], and finally imports the required data into the CarSim software.

Analysis of Co-simulation Results
Co-simulation analysis of path tracking of reference path.First, the reference path is a circular path with a radius of 100 meters and Mu = 0.85. Figure 4 shows the selected reference path. The vehicle uses the designed automatic driving vehicle PID path tracking controller to track the reference path at the speed of 30 kilometers per hour. Figure 5 shows the result that the front wheel angle of the car changes smoothly, which can meet the normal driving of the car. The graph shows that there will be a certain degree of volatility before the vehicle reaches a steady speed, especially in the initial response 2S.It can be known that after 4S, the front wheel angle of the car is stable and keeps at a certain angle. The conclusion shows that the PID path tracking controller designed in this paper can track the reference path steadily, thus ensuring the normal driving of the vehicle.
First of all, the path selection is 8-word path as described above, that is, 8-word path in CarSim software. Figure 6 shows the selected reference path.   Figure 7 shows that the curve obtained is not stable. It can be observed that the change of the front wheel angle is not very stable, though it does not affect the normal driving of the vehicle. But in the period from 12s to 42s, the front wheel angle should have remained unchanged, but there are still some small abrupt changes in the curve drawn by simulation, which also causes the steering is not very stable. In addition, due to the fact that many variables of the vehicle are ignored during the establishment of the vehicle model, only some parameters are retained, and the degree of freedom is small, so there are many unstable factors, which lead to the instability of the final curve. In the whole tracking process of vehicle, the design of the automatic driving vehicle PID path tracking controller is applied to control the vehicle front wheel angle.

Conclusion
In this paper, first builds a simple two-degree-of-freedom vehicle kinematic model and dynamic model, builds a vehicle multi-body dynamics model in CarSim software, designs the self-driving vehicle PID path tracking controller, and carries on the simulation experiment to the model in the CarSim software and the MATLAB/Simulink software. Based on the analysis of the results, the path tracking controller based on PID control can track the reference path, and the simulation curve changes smoothly, so the designed control strategy can ensure the path tracking under different speeds of smart cars can, with good tracking accuracy, real-time and vehicle driving stability.