## 3 Collision Avoidance Strategy
### Two-Layer Model Predictive Control (MPC) Modeling
#### 3.2.2 Reference Trajectory Tracking Layer  
The target of the MPC controller in this layer is tracking the local reference trajectory re-planned by the MPC controller of trajectory re-planning layer. Similar to the re-planning layer, the cost function is defined as:  
\[ \begin{array}{l}\min\limits_{\Delta U_{t},\varepsilon}J_{2}(\xi(t),u(t-1), \Delta U(t),\varepsilon)=\\ \sum\limits_{i=1}^{N_{p,2}}\left\|\eta_{2}(t+i|t)-\eta_{ref,local}(t+i|t) \right\|_{Q_{2}}^{2}+\sum\limits_{i=1}^{N_{p,2}-1}\left\|\Delta U(t+i-1|t) \right\|_{R_{2}}^{2}+\rho\varepsilon^{2}\end{array}  \tag{17}\]  
where \(\eta_{ref,local}(t+i|t)\), with \(i=1,\ldots,N_{p,2}\), is the reference, which is generated by re-planning layer, for the output tracking variable. \(U=\delta_{f}\) is control vector. \(Q_{2}\ \in\ \mathbb{R}^{p_{y}2\times p_{y}2}\), \(R_{2}\ \in\ \mathbb{R}^{m_{2}\ \times m_{2}}\) are weighting matrices. \(\varepsilon\) is a slack variable. The above variables and constraints will be explained in detail in the following. In this function, the first term suppresses the lateral deviation and heading deviation of the ego vehicle relative to the reference trajectory while the second item requires the smooth change of the control quantity. Since this study considers the low-to-medium-speed urban conditions where there is no emergency, and this MPC contains two layers, this layer uses a bicycle model (Figure 11) that is advantageous to reduce the calculation. In this scenario, the vehicle tires operate in the linear region under small lateral acceleration, so vehicle lateral forces can be calculated based on the simple linear tire model, which adopts the equivalent tire cornering stiffness \(\overline{C}_{af}\) and \(\overline{C}_{ar}\):  
\[F_{yf} =\overline{C}_{af}\alpha_{f} \tag{18}\] \[F_{yr} =\overline{C}_{ar}\alpha_{r} \tag{19}\]  
Figure 11: Bicycle model for trajectory tracking layer. where \(\alpha_{f},\alpha_{r}\) denote slip angles of the front and rear axle, respectively. Moreover, due to the small tire deflection, the tire slip angles, \(\alpha_{f},\alpha_{r}\), can be expressed as:  
\[\alpha_{f}=\arctan\left(\frac{v_{y}+l_{f}r}{v_{x}}\right)-\delta_{f}\approx \frac{v_{y}+l_{f}\dot{\varphi}}{v_{x}}-\delta_{f} \tag{20}\]  
\[\alpha_{r}=\arctan\left(\frac{v_{y}-l_{r}r}{v_{x}}\right)\approx\frac{v_{y}-l _{r}\dot{\varphi}}{v_{x}} \tag{21}\]  
where \(v\) is the velocity. \(r\) is the yaw rate. \(l_{f}\) and \(l_{r}\) are the distances from the center of gravity to the front and rear axles, respectively. \(\varphi\) and \(\delta_{f}\) are the yaw angle and the front wheel steering angle, respectively. Thus, based on small deflection angle of front wheels and the linear tire model, the vehicle dynamics can be described by the following mathematical equations  
\[m\dot{v}_{y}=-mv_{x}\dot{\varphi}+2\left[\overline{C}_{xf}\left(\delta_{f}- \frac{v_{y}+l_{f}\dot{\varphi}}{v_{x}}\right)+\overline{C}_{xx}\frac{l_{r}\dot {\varphi}-v_{y}}{v_{x}}\right] \tag{22}\]  
\[m\dot{v}_{x}=mv_{y}\dot{\varphi}+2\left[C_{lf}s_{f}+\overline{C}_{\alpha f} \left(\delta_{f}-\frac{v_{y}+l_{f}\dot{\varphi}}{v_{x}}\right)\delta_{f}+C_{ lr}s_{r}\right] \tag{23}\]  
\[I_{zz}\ddot{\varphi}=2\left[l_{f}\overline{C}_{xf}\left(\delta_{f}-\frac{v_{y }+l_{f}\dot{\varphi}}{v_{x}}\right)-l_{r}\overline{C}_{\alpha r}\frac{l_{r} \dot{\varphi}-v_{y}}{v_{x}}\right] \tag{24}\]  
\[\dot{\varphi}=r \tag{25}\]  
\[\dot{Y}=v_{x}\sin\varphi+v_{y}\cos\varphi \tag{26}\]  
\[F_{yr} =\overline{C}_{ar}\alpha_{r} \tag{19}\]0  
where \(m\) is the vehicle mass. The yaw moment of inertia and vehicle mass are represented by \(m\) and \(I_{zz}\). \(s_{[f,r]}\) is the slip rate of [front, rear] tire. \(\overline{C}_{x[f,r]}\) is the longitudinal stiffness of [front, rear] tire. The state vector is \(\vec{\zeta}=\left[\dot{y}\ \dot{x}\ \varphi\ \dot{\varphi}\ Y\ X\right]^{T}\) and the input vector is \(u=\delta_{f}\). And we define that \(-10^{\circ}\leq\delta_{f}\leq 10^{\circ}\), \(-0.85\leq\Delta\delta_{f}\leq 0.85\).