## 2 Control Strategies
### Linear Quadratic Lateral Tracking Control
#### 2.1.2 LQR Controller Design  
The main objective of this controller is to ensure the vehicle follows an ideal kinematic behavior, achieving increased lateral stability and optimal driving performance. During a maneuver, lateral and yawing dynamics of the vehicle change over time according to initial drive conditions imposed by the driver. To extrapolate the inner maneuverability characteristics and to independently actuate the wheel's brakes to compensate for under-steering or over-steering vehicle behavior, the steady state values of yaw rate and side-slip angle are calculated by (15)-(17). Since the reference states vary while the vehicle is in motion, they must be represented in a state-space form to be implemented in a control structure. This can be conducted by defining the gradients of \(r_{s}\) and \(\beta_{s}\) using (18), where \(s\) is the Laplace variable, and \(\tau_{i}=0.1\) is the time constant:  
\[\dot{\beta_{s}}=\frac{s\beta_{s}}{(1+\tau_{g}s)};\dot{r_{s}}=\frac{sr_{s}}{(1+ \tau_{s}s)} \tag{18}\]  
Therefore, the state-space of these transfer functions is composed of side-slip angle and yaw rate as states. This represents the reference that the vehicle should follow. Instead,  
Figure 1: LQR-Stability control structure.  
the actual values of yaw rate and side slip angle are modeled as described in the **Vehicle Dynamics** section. Thanks to this, a State-Space of the vehicle is implemented, where (19) are the side-slip angle and the yaw rate, and the input (20) is the desired total yaw moment.  
\[x=[\beta,r] \tag{19}\]  
\[u=[M_{yaw}] \tag{20}\]  
\[A=-\begin{bmatrix}\frac{(2\mathcal{L}_{cf}+2\mathcal{C}_{uf})}{uu}&1+\frac{(2 \mathcal{C}_{sf}a-2\mathcal{C}_{uf}b)}{(mu^{2})}\\ \frac{(2\mathcal{C}_{sf}a^{\beta}+2\mathcal{C}_{uf}b)}{I}&\frac{(2\mathcal{C}_ {sf}a^{\beta}+2\mathcal{C}_{uf}b^{2})}{Iu}\end{bmatrix} \tag{21}\]  
\[B=-\begin{bmatrix}0\\ -\frac{1}{I}\end{bmatrix} \tag{22}\]  
The control task is composed of a given system \(\dot{x}=f(x,u)\) and a feasible target \((x_{tar})\): the aim is to design a compensator of the form \(u=\alpha(x,x_{tar})\) which ensures \(\lim t\rightarrow\inf((x-x_{tar})=0)\). This is known as _Trajectory Tracking Problem_. To design a controller capable of solving this type of problem, the vehicle State-Space model is concatenated with the reference ones, achieving a new dynamic model described by (23)-(26). In this way, it is possible to define the outputs as the errors between the actual and the desired values of the states. Therefore, the goal of the control is to establish the input which minimizes these errors.  
\[X=[\beta,r,\beta_{tar},r_{tar}] \tag{23}\]  
\[Y=[\beta_{r}-\beta_{tar},r_{r}-r_{tar}]=[e_{\beta},e_{r}] \tag{24}\]  
\[A=\begin{bmatrix}A&0\\ 0&A_{tar}\end{bmatrix};B=\begin{bmatrix}B\\ B_{tar}\end{bmatrix}; \tag{25}\]  
\[C=\begin{bmatrix}1&0&-1&0\\ 0&1&0&-1\end{bmatrix};B=\begin{bmatrix}0\\ 0\end{bmatrix}; \tag{26}\]  
Once the dynamic model is specified, the stability is ensured by the Linear Quadratic Regulator, which is an optimal control. This strategy minimizes a quadratic cost function (27) by weighing the output, \(Y\), and the input, \(u\), by the matrices \(Q\) and \(R\), respectively, and solving the Riccati Equations (28) and (29). In this way, specific gains, \(K\) and \(K_{tar}\), are defined for each actual, \(x\), and reference, \(x_{tar}\), state to lead the input (30).  
\[J=\int_{0}^{\infty}(Y^{T}QY+u^{T}Ru)dt \tag{27}\]  
\[P_{k}=Q+A^{\prime}P_{(k+1)}A-A^{\prime}P_{(k+1)}B(R+B^{\prime}P_{(k+1)}B)(-1)B ^{\prime}P_{(k+1)}A \tag{28}\]  
\[K=(R+B^{\prime}PB)^{-1}B^{\prime}PA \tag{29}\]  
\[u=-Kx-K_{tar}x_{tar} \tag{30}\]  
The LQR control is, as already mentioned, an optimal control, i.e., it is optimally referred to as a specific performance index. In this case, the index is the cost function (27), whose minimization allows us to solve the trajectory tracking problem by definition of the control law (30), which at this point is applied in RT.