## 3 MPC Controller Design and Longitudinal Speed Compensation
### Longitudinal Speed Compensation
#### 3.4.1 Influence on Prediction Error
So, without loss of generality, the longitudinal speed varied with constant acceleration, thus the longitudinal velocity in prediction horizon at time \(t\) can be expressed as:  
\[v_{\rm x}(t)=v_{\rm x}+T\cdot a_{\rm x}=v_{\rm x}+\Delta v_{\rm x} \tag{19}\]  
\[v_{\rm x}(t)=[v_{\rm x}^{1},v_{\rm x}^{2},\cdots,v_{\rm x}^{\rm k},\cdots,v_{\rm x }^{\rm NP}] \tag{20}\]  
\[v_{\rm x}(t)=[v_{\rm x},(v_{\rm x}+\Delta v_{\rm x}),\cdots,(v_{\rm x}+k\cdot \Delta v_{\rm x}),\cdots,v_{\rm x}+(Np-1)\cdot\Delta v_{\rm x}] \tag{21}\]  
where \(v_{\rm x}\) is the initial value at time \(t\) in prediction horizon, and \(T\) is the sampling time. The state space model of path tracking system Equation (7) can be expressed as:  
\[\left\{ \begin{array}{ll}\dot{\bf x}(t)=\hat{\bf A}{\bf x}(t)+\hat{\bf B}u(t) +\hat{\bf E}k(s)+\hat{\bf d}\\ {\bf y}={\bf C}{\bf x}+{\bf f}\end{array} \right. \tag{22}\]  
\[\hat{\bf A}=\left[ \begin{array}{cccc}0&(v_{\rm x}+k\cdot\Delta v_{\rm x})&1 &0\\ 0&0&0&1\\ 0&0&-\frac{2\overline{C}_{r}}{m(v_{\rm x}+k\cdot\Delta v_{\rm x})}&\frac{2b \overline{C}_{r}}{m(v_{\rm x}+k\cdot\Delta v_{\rm x})}\\ 0&0&\frac{2b\overline{C}_{r}}{I_{Z}(v_{\rm x}+k\cdot\Delta v_{\rm x})}&\frac{2 b^{2}\overline{C}_{r}}{I_{Z}(v_{\rm x}+k\cdot\Delta v_{\rm x})}\end{array} \right],\ \hat{\bf E}=\left[ \begin{array}{c}0\\ 0\\ -(v_{\rm x}+k\cdot\Delta v_{\rm x})\\ 0\end{array} \right]\]  
\(\hat{\bf B}={\bf B}\), \(\hat{\bf d}={\bf d}\), \(k=0\),..., \(k\),..., \(N_{\rm P}-1\). The discrete time system using the zero-order hold method is expressed as:  
\[\left\{ \begin{array}{ll}{\bf x}(k+1)=\hat{\bf A}_{\rm c}{\bf x}(k)+\hat{\bf B }_{\rm c}u(k)+\hat{\bf E}_{\rm c}k(s)+\hat{\bf d}_{\rm c}\\ {\bf y}(k)={\bf C}{\bf x}(k)+{\bf f}\end{array} \right. \tag{23}\]  
The prediction equation of the state variable in the prediction horizon can be expressed as:  
\[\left\{ \begin{array}{ll}{\bf X}=\Phi_{\rm t}{\bf x}(t)+{\bf H}_{\rm t}{\bf U }+\Omega_{\rm t}{\bf K}+\Theta_{\rm t}{\bf D}\\ {\bf Y}={\bf C}{\bf X}+{\bf f}\end{array} \right. \tag{24}\]  
\[{\bf X}=\left[ \begin{array}{c}{\bf x}_{\rm t}^{1}\\ {\bf x}_{\rm t}^{2}\\ \vdots\\ {\bf x}_{\rm t}^{\rm Nc}\\ \vdots\\ {\bf x}_{\rm t}^{\rm Np}\end{array} \right],{\bf U}=\left[ \begin{array}{c}u_{ \rm t}^{1}\\ u_{\rm t}^{2}\\ \vdots\\ u_{\rm t}^{\rm Nc}\\ \vdots\\ u_{\rm t}^{\rm Nc}\end{array} \right],{\bf K}=\left[ \begin{array}{c}k_{\rm t}^{1} (s)\\ k_{\rm t}^{2}(s)\\ \vdots\\ k_{\rm t}^{\rm Nc}(s)\\ \vdots\\ k_{\rm t}^{\rm Np}(s)\end{array} \right]{\bf D}=\left[ \begin{array}{c}{\bf d}_{ \rm c}\\ {\bf d}_{\rm c}\\ \vdots\\ {\bf d}_{\rm c}\\ \vdots\\ {\bf d}_{\rm c}\\ \vdots\\ {\bf d}_{\rm c}^{\rm Np-1}\hat{\bf A}_{\rm c}^{\rm Nb-2}\cdots\hat{\bf A}_{\rm c }\end{array} \right],\]  
\[{\bf H}_{\rm t}=\left[ \begin{array}{cccc}\hat{\bf B}_{\rm c}&0&\cdots&0&0&0\\ \hat{\bf A}_{\rm c}^{\rm L}{\bf B}_{\rm c}&\hat{\bf B}_{\rm c}&0&\cdots&0&0\\ \vdots&\cdots&\cdots&0&0&0\\ \hat{\bf A}_{\rm c}^{\rm Nc-1}\hat{\bf A}_{\rm c}^{\rm Nc-2}\cdots\hat{\bf A}_{ \rm c}^{\rm 1}{\bf B}_{\rm c}&\cdots&\hat{\bf B}_{\rm c}&0&\cdots&0\\ \vdots&\vdots&\vdots&\ddots&\vdots&\vdots\\ \hat{\bf A}_{\rm c}^{\rm Np-1}\hat{\bf A}_{\rm c}^{\rm Np-2}\cdots\hat{\bf A}_{ \rm c}^{\rm 1}{\bf B}_{\rm c}&\cdots&\hat{\bf A}_{\rm c}^{\rm Np-k-1}\hat{\bf A}_{ \rm c}^{\rm Np-k-2}\cdots\hat{\bf A}_{\rm c}^{\rm 1}{\bf B}_{\rm c}&\cdots&\hat{\bf A}_{\rm c}^{\rm 1}{\bf B}_{\rm c}&\hat{\bf B}_{\rm c}\\ \end{array} \right]\]\[\mathbf{\Omega}_{\rm t}=\left[