Keywords

1 Introduction

Model predictive control (MPC) is a suitable tool for autonomous racing due to its ability to handle constraints like vehicle dynamics and track boundaries. However, the time-optimal control problem for autonomous racing is nonlinear [5]. The direct use of nonlinear MPC (NMPC) leads to high computation time that is undesirable for racing [3], and the use of linear or adaptive MPC fails to accurately incorporate nonlinear objectives and constraints. Although linear-time-variant-MPC (LTV-MPC) can strike a balance between computational speed and accuracy, it is mainly used in trajectory tracking tasks and its application to autonomous racing is scarce in the literature.

Another limitation of MPC is model mismatch, which occurs when the control model differs from the actual plant, causing the degradation of control performance. Several techniques, e.g. error observers and Gaussian process regression (GPR) [2], are adopted to tackle this issue. However, linear models like error observers omit the nonlinear portion of the error, and the learning-based method in [2] that learns the error of all state variables lacks interpretability and hinders further analysis of model mismatch.

To address the aforementioned problems, this work presents a time-optimal LTV-MPC with its min-time objective function and friction ellipse constraint successively linearized over the prediction horizon, and a GPR-based lateral tire force error model to adjust the control model and friction ellipse constraint.

2 Time-Optimal LTV-MPC Formulation

2.1 Vehicle Control Model

A 3-DOF single-track rear-wheel-drive vehicle dynamics model is adopted:

$$\begin{aligned} \dot{\textbf{x}} = \begin{bmatrix} \dot{v}_{x} \\ \dot{v}_{y} \\ \ddot{\psi } \\ \dot{s} \\ \dot{n} \\ \dot{\chi } \\ \dot{T} \\ \dot{\delta } \end{bmatrix} = \boldsymbol{f}(\textbf{x}, \textbf{u}) = \begin{bmatrix} \left( F_{x} - F_{y,f} \sin \delta \right) / m_t+ \dot{\psi } v_{y} \\ \left( F_{y, f} \cos \delta + F_{y, r}\right) / m_t - \dot{\psi } v_{x} \\ \left( F_{y, f} l_{f} \cos \delta -F_{y, r} l_{r}\right) / I_{z} \\ \frac{v_{x} \cos \chi -v_{y} \sin \chi }{1-n \kappa (s)} \\ v_{x} \sin \chi +v_{y} \cos \chi \\ \dot{\psi }-\kappa (s) \dot{s} \\ T_{\text {rate}} \\ \delta _{\text {rate}} \end{bmatrix}, \end{aligned}$$
(1)

where there are eight state variables \(\textbf{x} = [v_x, v_y, \dot{\psi }, s, n, \chi , T, \delta ]^\top \) and two control variables \(\textbf{u} = [T_{\text {rate}}, \delta _{\text {rate}}]^\top \), \(v_x, v_y\), and \(\dot{\psi }\) denote longitudinal velocity, lateral velocity, and yaw rate in vehicle coordinate frame, s, n, and \(\chi \) denote vehicle pose in curvilinear coordinate frame, T and \(\delta \) denote torque on the rear wheel and front-wheel steering angle. The above variables are depicted in Fig. 1.

Fig. 1.
figure 1

3-DOF single-track vehicle model in curvilinear coordinate frame.

In (1), \(\kappa (s)\) is the road curvature at progress s, \(l_f\) and \(l_r\) denote the location of the center of gravity (CoG) behind the front axle and location of CoG in front of the rear axle, \(m_t\) and \(I_z\) are the total mass of the vehicle and the vehicle inertia about z axis, \(F_{x} = T/R\) is the longitudinal force of the rear wheel, R is the tire radius, \(F_{y, i}, i = \{f, r\}\) are the lateral forces of the front and rear wheels. The longitudinal force of the front wheel is assumed to be zero. The lateral forces are calculated as

$$\begin{aligned} F_{y, i} = f_{\text {MF},i}(\alpha _{i}) = \mu _c F_{z, i} D_{y} \sin \left[ C_{y} {\text {atan}} \left\{ B_{y} \alpha _{i}-E_{y}\left( B_{y} \alpha _{i}- {\text {atan}} \left( B_{y} \alpha _{i}\right) \right) \right\} \right] , \end{aligned}$$
(2)

where \(F_{z,f} = m_t g l_r / l\), \(F_{z,r} = m_t g l_f / l\), \(\mu _c\) is the road adhesion coefficient of the control model, \(B_{y}\), \(C_{y}\), \(D_{y}\), and \(E_{y}\) are parameters of the magic formula (MF) tire model, l is the wheelbase, \(\alpha _{f} = {\text {atan}} ((v_y + \dot{\psi } l_f)/v_x) - \delta \) and \(\alpha _{r} = {\text {atan}} ((v_y - \dot{\psi } l_r)/v_x)\) are the slip angles of the front and rear wheels.

2.2 Problem Formulation

The objective function of the time-optimal LTV-MPC is given as

$$\begin{aligned} \boldsymbol{\eta }_{\text {tr}} = \left[ \tfrac{1 - n \kappa (s)}{v_x \cos \chi - v_y \sin \chi }, \dot{\psi }\right] ^\top , \; \boldsymbol{\eta }_{\text {ref}} =[0, 0]^\top , \end{aligned}$$
(3)

where \(\boldsymbol{\eta }_{\text {tr}}\) is the controlled output vector, \(\boldsymbol{\eta }_{\text {ref}}\) contains the desired output values. The first element in \(\boldsymbol{\eta }_{\text {tr}}\) equals \(1/\dot{s}\), which means the time required to progress 1 m in curvilinear coordinate frame. Therefore, its 0 reference value serves the min-time purpose. The second element in \(\boldsymbol{\eta }_{\text {tr}}\) serves to enhance vehicle stability.

The friction ellipse constraint is formulated as a hard constraint:

$$\begin{aligned} \boldsymbol{\eta }_{\text {c}} = \left[ \tfrac{F_x}{\mu _c D_{x} F_{z,r}}^2 + \tfrac{{F}_{y,r}}{\mu _c D_{y} F_{z,r}}^2 \right] ^\top , \end{aligned}$$
(4)

where \(\boldsymbol{\eta }_{\text {c}}\) is the hard constrained output vector, \(D_{x}\) is a parameter of the MF model. Due to the symmetry of the friction ellipse, the linearized hard constrained output is limited between -1 and 1.

The velocity and track constraints are formulated as soft constraints to prevent problem infeasibility when the constraints are temporarily violated by vehicle sensor noise. The soft constrained output vector is given as \(\boldsymbol{\eta }_{\text {sc}} = [v_x, n]^\top \). Similar to the curvature \(\kappa \), the upper and lower bounds for n are functions of s.

The final output vector is the concatenation of controlled, hard constrained, and soft constrained output vectors \(\boldsymbol{\eta } = \boldsymbol{h}(\textbf{x}) = [\boldsymbol{\eta }_{\text {tr}}, \boldsymbol{\eta }_{\text {c}}, \boldsymbol{\eta }_{\text {sc}}]^\top \). For the k-th (\(k = 1, \cdots , H\)) discrete time step in the prediction horizon, the system equation \(\dot{\textbf{x}} = \boldsymbol{f}(\textbf{x}, \textbf{u})\) and output equation \(\boldsymbol{\eta } = \boldsymbol{h}(\textbf{x})\) are linearized at a reference point \([\hat{\textbf{x}}^k, \hat{\textbf{u}}^k]\). In this work, it is assumed that the difference between the solution of one control step and its subsequent (1/f s later, where f is the control frequency) is small. Therefore, the solution of the last control step is used as the linearization reference point at the current step. After linearization, the system is discretized using the explicit fourth-order Runge-Kutta method. We refer the readers to [4] for further formulation of the LTV-MPC problem.

3 GPR-Based Lateral Tire Force Error Learning

GPR is a non-parametric machine learning method suited for small datasets. From the data collected when racing with LTV-MPC, the lateral forces \(F_{y, i}\) can be solved from two linear equations with two unknowns, extracted from (1):

$$\begin{aligned} \left\{ \begin{aligned} \dot{v}_{y}&=\left( F_{y, f} \cos \delta + F_{y, r}\right) /m_t - \dot{\psi } v_{x}\\ \ddot{\psi }&=\left( F_{y, f} l_{f} \cos \delta -F_{y, r} l_{r}\right) /I_z \\ \end{aligned} \right. . \end{aligned}$$
(5)

We choose to learn the dimensionless lateral tire force error with features \([|T|, |\alpha |]^\top \in \mathbb {R}^2\). The absolute value is taken to form a denser dataset. The corresponding dataset output is calculated as \([(|F_{y,r,\text {true}}| - |F_{y,r,\text {pred}}|) / F_{z,r}] \in \mathbb {R}^1\), where \(F_{y,r,\text {true}}\) is solved based on vehicle states from sensors, \(F_{y,r,\text {pred}}\) is solved based on predicted states from LTV-MPC. The predicted mean dimensionless error from GPR is denoted as g. The predicted variance is omitted. It is assumed that the characteristics of the front and rear tires are the same. Consequently, the error model learned from the rear tire is also applied to the front tire:

$$\begin{aligned} \begin{aligned} F^k_{y, f} &= f_{\text {MF},f}(\alpha ^k_{f}) - F_{z, f} \tfrac{g(0, |\hat{\alpha }^k|)}{\hat{\alpha }^k_f} \alpha ^k_{f} , \\ F^k_{y, r} &= f_{\text {MF},r}(\alpha ^k_{r}) - F_{z, r} \tfrac{g(|\hat{T}^k|, |\hat{\alpha }^k|)}{\hat{\alpha }^k_r} \alpha ^k_{r} , \end{aligned} \end{aligned}$$
(6)

where \(\hat{T}^k\) and \(\hat{\alpha }^k_f\) are reference points at which to evaluate error compensation at the k-th discrete time in the prediction horizon. Same as linearization, these reference points are calculated from the solution of the last control step. The slope of the learned dimensionless error is multiplied by the slip angle to establish a linear-time-variant relationship between error compensation and state variables. If the compensation is only added as a constant, its effect will be mitigated after linearization. For reference slip angle smaller than 0.0025, the error compensation is set to zero.

The friction ellipse constraint is adjusted in (7) based on the predicted dimensionless error at zero torque and maximum slip angle. Negative signs in (6) and (7) before g are because \(D_{y}\) has a negative value. For faster prediction, sparse GPR is adopted in this work. We refer the readers to [6] for more details.

$$\begin{aligned} \boldsymbol{\eta }_{\text {c}} = \left[ \tfrac{F_x}{\mu _c D_{x} F_{z,r}}^2 + \tfrac{{F}_{y,r}}{(\mu _c D_{y} - g(0, |\hat{\alpha }_{\max }|))F_{z,r}}^2 \right] ^\top . \end{aligned}$$
(7)

4 Algorithm Validation

4.1 Simulation and Experimental Setup

The simulation is performed on the racing track of Formula Student Autonomous China (FSAC) and executed on a laptop with an i7-12700H CPU and 32 GB RAM. We use a 7-DOF vehicle dynamics model [7] for simulation. The experiment is performed on a self-designed thin track with a steer-by-wire and drive-by-wire electric chassis and executed on a Jetson AGX Xavier with Carmel CPU. The directions of both tracks are clockwise. The following parameters are set to be the same for both the simulation and experiment: discretization step \(\varDelta t = 34\) ms, prediction horizon \(H = 60\), and control horizon \(H_c = 30\). Limited by the performance of Carmel CPU, the control frequency f is set to 100 Hz for simulation and 50 Hz for experiment.

4.2 Results

In the simulation, the proposed LTV-MPC is compared with an NMPC implemented using CasADi [1] with identical parameters. The NMPC also uses identical objectives and constraints (both nonlinear). The comparisons are plotted in Fig. 2, which shows the accuracy and improved computational speed of the proposed LTV-MPC. The lap time is 44.57 s for LTV-MPC and 44.29 s for NMPC (a slight increase of 0.6 %). The average computation time is 2.5 ms for LTV-MPC and 66 ms for NMPC (96 % reduction).

Fig. 2.
figure 2

Comparisons between the proposed LTV-MPC and NMPC on simulation trajectory, friction ellipse constraint violation, and computation time.

The robustness of the proposed LTV-MPC is validated in real-world experiments. The experiment data are exhibited in Fig. 3. The maximum velocity is set to 4 m/s and small adhesion coefficients are chosen for safety concerns.

Fig. 3.
figure 3

Experimental trajectory and vehicle state plots with two different \(\mu _c\).

With \(\mu _c\) set to 0.3, two simulation scenarios are used to validate the learning-based LTV-MPC: low adhesion (true adhesion coefficient is also 0.3 but with tire combined slip property not modeled in LTV-MPC) and higher adhesion (true adhesion coefficient is 0.7). The corresponding GP error models and the effects in mitigating model mismatch are shown in Fig. 4. The lap time in the low adhesion scenario is 44.57 s without GPR and 44.64 s with GPR (safer after learning the combined slip property). The lap time in the higher adhesion scenario is 44.16 s without GPR and 43.23 s with GPR (2% faster after learning).

Fig. 4.
figure 4

GPR error models and the effects in mitigating model mismatch.

5 Conclusions

This work first presents a time-optimal LTV-MPC with min-time objective function and friction ellipse constraint. The proposed LTV-MPC is further combined with GPR to learn the lateral tire force error.

The efficiency, accuracy, and robustness of the proposed LTV-MPC are validated in simulation and experiment. The GPR error model successfully learns from the simulation data and improves the control performance. Experimental validation of the learning-based LTV-MPC will be performed in our future work.