## 3 Model Predictive Control-Based Longitudinal and Lateral Tracking Control
### Online Active Set Algorithm  
There are several feasible algorithms for solving convex quadratic programming (QP) problems subject to the linear inequality and equality constraints, such as active-set method [22], interior-point method [23], gradient projection method [24], null space method [25], etc. However, the MPC based embedded optimisation application is strict to the computation time, and usually the period of vehicle control message is 10 ms. For the MPC embedded application of the autonomous vehicle, the online active-set strategy method is introduced to accelerate the solving process and realise the real-time embedded application. Firstly, combine Equations (13) and (14), and it implies that the primal QP can be presented as a multi-parametric quadratic program (mp-QP), because the gradient (\(\tilde{g}^{T}\)) of the objective function and the right-hand side of the constraints linearly depend on the parameters (\(x_{t,t},u_{t-1,t},Y_{t}^{ref}\)) in the piecewise linearisation area. Consequently, a strictly convex QP problem can be determined and solved, as long as the parameters are determined in the parameter space. Secondly, solving the continuous piecewise linearised QP problem is equivalent to solving the continuous QP sequence (QPs). If the corresponding parameters of every sub QP can be fast determined in the QPs, the QPs can be fast solved. With this ideal, the online active-set strategy method is used for fast solving the QPs. The parameter vector of the sub QP is defined as:  
\[ \begin{array}{l}w_{t}:=\left\{x_{t,t},u_{t-1,t},Y_{t}^{ref}\right\}\\ w_{t}\in\mathbf{\Gamma}\\ \mathbf{\Gamma}:=\left\{\mathbf{x},\mathbf{u},Y^{ref}\right\}\\ \mathbf{x}\in\mathcal{R}^{N_{p}},\mathbf{u}\in\mathcal{R}^{N_{u}},Y^{ref}\in \mathcal{R}^{N_{p}N_{p}}\end{array}  \tag{15}\]where \(w_{t}\) represents the parameter vector in sampling instant of time \(t\), and the convex set \(\mathbf{\Gamma}\) denotes the feasible parameter space. After elimination of the equality constraints, one rewrites the QP in the general form:  
\[ \begin{split}& QP(w_{t}):min\frac{1}{2}\Delta\mathbf{U}^{T} \mathbf{H}x+\Delta\mathbf{U}^{T}g(w_{t})\\ &\mathbf{s.t.M\Delta U}\geq\mathbf{b}(w_{t})\end{split}  \tag{16}\]  
Furthermore, the strategy of online active-set is to renew the gradient and constraint boundaries by linearly updating the parameters, as follows:  
\[ \begin{split}&\left\{\begin{array}{l}\widetilde{w_{0}}\,:=w_{0}+ \tau\Delta w_{0}\\ \widetilde{\mathbf{g}}\,:=\mathbf{g}(w_{0})+\tau\Delta\mathbf{g}\,\,\,\,,\,\, \,\,\tau\,\,\,\in[0,1]\\ \widetilde{\mathbf{b}}\,:=\mathbf{b}(w_{0})+\tau\Delta\mathbf{b}\\ \end{array}\right.\\ & w_{0}\,:=\left\{x_{0},u_{0},\gamma_{0}^{ref}\right\}\\ &\Delta w_{0}\,:=w_{0}^{new}-w_{0}\\ &\Delta\mathbf{g}\,:=\mathbf{g}(w_{0}^{new})-\mathbf{g}(w_{0})=\Theta^{T} \Delta w_{0}\\ &\Delta\mathbf{b}\,:=\mathbf{b}(w_{0}^{new})-\mathbf{b}(w_{0})=\mathbf{P} \Delta w_{0}\end{split}  \tag{17}\]  
where \(\widetilde{w_{0}}\,\widetilde{\mathbf{g}}\), and \(\widetilde{\mathbf{b}}\) are the update of the parameter, gradient and the boundary of the constraints, and \(\tau\) is the step length along the homotopy of parameter. \(\Theta\) and \(\mathbf{P}\) denote the affine matrices during the straight-line moving of the parameter. Based on the proved theorems in [19], the QPs remain feasible and can be solved when the parameter moves along a straight line in the defined parameter space. Above all, with a known initial parameter \(w_{0}\) and the optimal solution \((x_{0}^{*},\lambda_{\Lambda}^{*})\), \(\mathbf{\Lambda}\) is the corresponding working set, and the following new optimal solution \(\left(x_{new}^{*},\lambda_{\Lambda(new)}^{*}\right)\) of \(QP(w_{0}^{new})\) can be fast calculated according to the linear homotopy, which means moving \(w_{0}\) towards/along a straight line. The i homotopies is determined as:  
\[