# Lateral Control Calibration and Testing in a Co-Simulation Framework for Automated Vehicles
## 2 Vehicle Dynamics and Control
### Vehicle Model  
Figure 1 depicts the vehicle dynamic model as:  
In this model, we assume that the model is simplified as the lateral dynamic model with two degrees of freedom, and vertical movement is ignored since the vehicle drives in a single plane. \(\alpha_{f}\), \(\alpha_{r}\) are steering angles in the front and rear wheels, respectively. The front and rear steering angles are small and noted by \(\delta_{f}\) and \(\delta_{r}\), so the lateral force and side slip angle has a linear relationship, which is acceptable for tire slip angles of about 3 degrees. The lateral load transfer effects which occur due to lateral acceleration are neglected and the suspension system's effect is not considered. \(O\) is the mass center point, \(a\) and \(b\) are the distances from \(O\) to the front and rear axes, \(\varphi\) is the yaw angle, and \(\phi\) is yaw rate. \(C_{f}\) and \(C_{r}\) are the lateral stiffness of the tires in the front and rear wheels, \(F_{yf}\) is the lateral force of the front wheel, and \(F_{yr}\) is the lateral force of the rear wheel. \(v_{x}\), \(v_{y}\) are vehicle's longitudinal and lateral velocity, respectively. The dynamic equations of this model are noted as [38]:  
\[ma_{y}=F_{yf}+F_{yr} \tag{1}\]  
\[I_{z}\ddot{\varphi}=aF_{yf}-bF_{yr} \tag{2}\]  
Figure 1: Vehicle dynamic model. \[\dot{v_{x}}=v_{y}\dot{\varphi}+a_{x} \tag{3}\]  
where \(m\) is the mass of the vehicle, \(I_{z}\) is the rotation inertia of the vehicle around the vertical axis. All of these symbols are listed in the Nomenclature part. Because the front wheel steering angle is small, the lateral force and side slip angle have a linear relationship, and the dynamic Equations (1) and (2) are obtained as follows:  
\[ \begin{cases}\dot{v_{y}}=\frac{C_{f}+C_{r}}{mv_{x}}v_{y}+(\frac{aC_{f}-bC_{r}} {mv_{x}}-v_{x})\dot{\varphi}-\frac{C_{f}}{m}\delta\\ \ddot{\varphi}=\frac{aC_{f}-bC_{r}}{I_{z}v_{x}}v_{y}+\frac{a^{2}C_{f}+b^{2}C_{r} }{I_{z}v_{x}}\dot{\varphi}+\frac{aC_{f}}{I_{z}}\delta\\ \dot{v_{x}}=\dot{y}\dot{\varphi}+a_{x}\end{cases}  \tag{4}\]  
When the vehicle follows a reference path, a lateral error and heading angle error will occur. As illustrated in Figure 1, the lateral error, denoted by \(e_{d}\), represents the shortest distance between the point \(O\) and the projected point \(P\) on the reference path. Meanwhile, the heading angle error, referred to as \(e_{\theta}\), is the difference between the actual heading angle of the vehicle \(\theta\) and the reference heading angle \(\theta_{r}\). For the sake of simplicity, the side slip angle is assumed to be \(\beta=0\) at the point \(O\), and the heading angle error is calculated as \(e_{\theta}=\theta-\theta_{r}\). In practical control, the controller's task is to promptly eliminate these two errors in real-time to ensure that the vehicle stays on track with the planned path. With these errors in mind, it becomes possible to compute the first-order derivatives of the lateral error \(\dot{e_{d}}\) and the heading angle error \(\dot{e_{\varphi}}\):  
\[\dot{e_{d}}=v_{x}e_{\varphi}+v_{y} \tag{5}\]  
\[\dot{e_{\varphi}}=\dot{\varphi}-\dot{\varphi_{r}} \tag{6}\]  
Equations (5) and (6) are substituted in Equation (4), which can obtain:  
\[\dot{e_{d}}=\frac{C_{f}+C_{r}}{mv_{x}}\dot{e_{d}}-\frac{C_{f}+C_{r}}{m}e_{ \varphi}+\frac{aC_{f}-bC_{r}}{mv_{x}}\dot{e_{\varphi}}+(\frac{aC_{f}-bC_{r}}{ mv_{x}}-v_{x})\dot{\theta_{r}}-\frac{C_{f}}{m}\delta_{f} \tag{7}\]  
\[\dot{e_{\varphi}}=\frac{aC_{f}-bC_{r}}{I_{z}v_{x}}\dot{e_{d}}-\frac{aC_{f}-bC_ {r}}{I_{z}}e_{\varphi}+\frac{a^{2}C_{f}+b^{2}C_{r}}{I_{z}v_{x}}\dot{e_{\varphi} }+\frac{a^{2}C_{f}+b^{2}C_{r}}{I_{z}v_{x}}\dot{\theta_{r}}-\frac{aC_{f}}{I_{z} }\delta_{f} \tag{8}\]  
Equations (7) and (8) can be rewritten as:  
\[ \begin{cases}\dot{e_{d}}\\ \dot{e_{d}}\\ \dot{e_{\varphi}}\\ \ddot{e_{\varphi}}\\ \ddot{e_{\varphi}}\\ \ddot{e_{\varphi}}\\ \end{cases} =