# Nonlinear Model Predictive Control with Terminal Cost for Autonomous Vehicles Trajectory Follow
## 3 Controller Design and Numerical Simulation Verification
### Algorithm Numerical Verification
#### 3.2.1 Control Open-Loop Simulation  
Our study included model predictive control open-loop simulation, that is, taking the planned trajectory as the input, after solving a series of control inputs of the vehicle in the future limited time domain, and we applied all the control inputs to the vehicle. The same simulation is also covered in the paper [3], and the higher the open-loop path tracking accuracy, the higher the closed-loop path tracking accuracy. Inspired by the paper [3], the open-loop path tracking simulation comparison simulation based on NMPC and the proposed NMPC-WTC path tracking method is carried out in Section 3.2.1, and the closed-loop path tracing simulation comparison is carried out in Section 3.2.2.  
The commonly used cubic Bezier curve is chosen as the planned trajectory of the vehicle, and the slope of the planned trajectory is used as the reference heading angle to verify the effectiveness of the proposed algorithm.  
\begin{table}
\begin{tabular}{c c} \hline \hline
**The Parameter of Vehicle Model** & **Value** \\ \hline Wheelbase, L & 2.9 m \\ Value range of front wheel angle, \(\delta_{f}\) & \(-\)0.26 rad\(\sim\)0.26 rad \\ Longitudinal speed of the vehicle, \(v\) & 0\(\sim\)33.3 m/s \\ Forward Euler discrete time, T & 200 ms \\ Predictive horizon, \(N_{p}\) & 20 \\ \hline \hline \end{tabular}
\end{table}
Table 1: Basic parameters of vehicle model.  
We chose the path tracking diagram of the vehicle as shown in Figure 3. The black solid line in Figure 3 is the reference trajectory. The dotted line with star marker in Figure 3 is the tracking trajectory of proposed NMPC-WTC path tracking method and the dotted line with triangle marker is the tracking trajectory of traditional NMPC path tracking method.  
In Figure 3, the NMPC controller without terminal cost will lead to a squeezing phenomenon at the end of the predictive horizon, which will cause the vehicle to deviate from the reference trajectory. The squeezing phenomenon means that the tracking error will increase as the prediction step size increases and the error is accumulated. The accumulation and forward propagation along predictive horizon of the error leads to the larger error at the end. The paper [3] also shows that the mean and standard deviation of step n are bigger than step n\(-\)1. The step n is equal to 2\(-\)4 in paper [3]. Figures 3 and 4 demonstrate that proposed NMPC-WTC path tracking method improves the squeezing phenomenon of traditional NMPC greatly. The open-loop trajectory calculated by the proposed method will converge to reference trajectory eventually.  
Figure 4: Schematic diagram of open-loop prediction error of vehicle lane change.  
Figure 3: Schematic diagram of vehicle lane changing path tracking.  
The error between the control predicted trajectory and the reference trajectory is shown in Figure 4. In open-loop simulation, maximum error in the NMPC-based scenario was reduced by 80%. In order to distinguish the tracking accuracy of the two different path tracking methods significantly, the error bound is used in Figure 3, and the value of error bound is set to 0.1 m.  
In Figure 3, we have verified the validity of the terminal cost, but we have not explained how to set value of the terminal cost coefficient \(\alpha\). In Figure 3, the value of \(\alpha\) is 10. We will verify the influence of different terminal cost coefficients on the open-loop prediction trajectory under the same planning trajectory.