## 2 Materials and Methods
### Adaptive Co-Pilot--Shared Controller
#### 2.1.1. The Vehicle Model  
The prediction model is generally represented as a first-order differential equation. This work uses the representation for the lateral dynamics of a full-size passenger vehicle, which encompasses three sub-models (vehicle dynamics model, tracking-error model, and steering system model). First, the vehicle dynamics model is represented by the non-linear dynamics bicycle model equations for a front steered vehicle as shown in Equations (1)-(6) of Table 2. This model is suitable for maneuvers at high speeds which will allow increasing the testing speed as compared with previous work where a kinematic model was used [35]. The lateral forces in the front and rear tires (\(F_{yf},F_{yr}\)) are defined in Equations (7) and (8),  
Figure 2: Shared controller block diagram based on NMPC. where \((C_{\alpha f},C_{\alpha\sigma})\) are the front and rear cornering stiffness constants, which are calculated according to the estimation method presented in [36]. Second, the tracking-error model includes two differential Equations (9) and (10), related to the lateral and angular error. This model eases the integration of the lane borders constraints, allowing emulation of the behavior of a lane-keeping system. Lastly, the steering system model relates the steering wheel angle with the applied torque. The inertia (\(J\)) and damping (\(b\)) second-order model is used (Equations (11) and (12), where the steering wheel angle is proportional to the steering angle (\(\theta=k_{r}\delta\)). It also uses an approximation of the self-aligning \(T_{sat}=KF_{yf}\). The control torque, \((T_{MPC})\), and its rate change, \((dT_{MPC})\), are defined in Equations (13) and (14) of Table 3. Additionally, the values of the NMPC parameters are given in Table 4. \begin{table}
\begin{tabular}{l l l l l} \hline \hline
**State Vector** & **Prediction Model Function** & **Optimization Function** & **Constraints** & **Equation** \\ \(x\) & \((x(k+1)\)=f\((x(k),\mu(k),I(k)))\) & \(J_{x}\)=\(\sum\limits_{k=0}^{N-1}\|x(k)-x_{r}(k)\|_{W_{x}}^{2}\) & \(x_{min}\leq x\leq x_{max}\) & **N\({}^{\circ}\)** \\ \hline \multicolumn{5}{c}{Vehicle Model} \\ \hline X-coordinate & \(\dot{X}=v_{x}cos(\Psi)-v_{y}sin(\Psi)\) & \(W_{X}=50\) (_Tracking_) & \(\pm\infty\) & (1) \\ Y-coordinate & \(\dot{Y}=v_{x}sin(\Psi)+v_{y}cos(\Psi)\) & \(W_{Y}=50\) (_Tracking_) & \(\pm\infty\) & (2) \\ Yaw angle & \(\dot{\Psi}=\psi\) & \(W_{\Psi}=50\) (_Tracking_) & \(\pm\infty\) & (3) \\ Long. speed & \(\dot{v}_{x}=\left(ma_{x}-F_{yf}sin(\delta)+mv_{y}\psi\right)/m\) & \(W_{v_{x}}=0\) & \(\pm\infty\) & (4) \\ Lateral speed & \(\dot{v}_{y}=\left(F_{yr}+F_{yf}cos(\delta)-mv_{x}\psi\right)/m\) & \(W_{v_{y}}=0\) & \(\pm\infty\) & (5) \\ Yaw rate & \(\dot{\psi}=\left(l_{f}F_{yf}cos(\delta)-l_{r}F_{yr}\right)/l_{z}\) & \(W_{\psi}=100\) (_Comfort_) & \(\pm\) 0.4 rad/s & (6) \\ \hline \multicolumn{5}{c}{**Algebraic Expressions for Tire Model**} \\ \hline Lat. Force front & \(F_{yf}=2C_{\alpha f}\left(\delta-\left(v_{y}+l_{f}\psi\right)/v_{x}\right)\) & & (7) \\ Lat. Force rear & \(F_{yr}=2C_{\alpha r}\left(v_{y}-l_{r}\psi\right)/v_{x})\) & & (8) \\ \hline \multicolumn{5}{c}{Tracking-errors Model} \\ \hline Lateral error & \(\dot{e}_{y}=v_{x}sin(e_{\Psi})+v_{y}cos(e_{\Psi})\) & \(W_{e_{y}}=0\) & \(\pm\) 1.5 m & (9) \\ Angular error & \(\dot{e}_{\Psi}=\dot{\Psi}-\rho v_{x}\) & \(W_{\varphi v}=0\) & \(\pm\infty\) & (10) \\ \hline \multicolumn{5}{c}{Steering Wheel Model} \\ \hline Sw. angle & \(\dot{\theta}=w\); \((\theta=\delta/k_{r}\) ) & \(W_{e_{y}}=0\) & \(\pm\)\(\pi\) rad & (11) \\ Angular speed & \(\dot{w}=(-1/l)\left(b_{\lambda}w+T_{sat}-T_{mpc}\right)\) & \(W_{w}=0.1\) (_Comfort_) & \(\pm\) 4 rad/s & (12) \\ \hline \multicolumn{5}{c}{\(f\): non-linear function representing the road-vehicle model; \(x\): states vector; \(u\): input vector; \(l\): external inputs vector \(l_{x}\): states optimization function; \(W_{x}\): states weights matrix; \(x_{min/max}\): min/max states constraints vector.} \\ \hline \hline \end{tabular}
\end{table}