Model Predictive Control
What is it?
Basic overview
Model Predictive Control (MPC) is a method of control that essentially simulates a short time into the future, and chooses the inputs that produce the best future. This relies on two things: the dynamics of the system, and the optimization constraints.
The dyamics of the system are what allow it to simulate possible futures. The more accurate the dynamics, the more accurate the simulated future will be. However, the more complex the dynamics are, the more computationally expensive it will be to run the simulations and optimization. Our system is heavily nonlinear, which means it will be very complex.
The optimization constraints determine which future will be chosen. The constraints inform the system about which inputs are possible, and which outputs are ideal. For example, the constraints might say that keeping the car close to the path is good, going fast is good, and hitting cones is bad. Then, the most optimal future will be one that stays close to the path while driving fast and not hitting any cones.
We will be using the dynamics and optimization constraints described in this paper.
Videos
The first five videos in this series by MATLAB explains MPC conceptually: MPC videos by MATLAB
This video goes more in-depth about MPC: MPC video by Steve Brunton
Dynamics
The dynamics of the car are modeled as a dynamic bicycle model with nonlinear tire force laws. The model holds under four assumptions: the vehicle drives on a flat surface, load transfer can be neglected, combined slip can be neglected, and the longitudinal drive-train forces can be neglected.
The final system dyanmics consists of the linear combination of two different models, a dynamical model and a kinematic model. This is because the dynamical model is not accurate at low speeds due to slip angles. Similarly, the kinematic model is not accurate at high speeds because they neglect the interaction between the tires and ground. A linear combination of the two models allows both models to be used in their ideal regions.
Dynamical model
The dynamical model is accurate at high speeds:
The states and parameters are defined in the "Variables and parameters" section below.
Kinematic model
The kinematic model is accurate at low speeds. Note how it uses both and
as inputs:
The states and parameters are defined in the "Variables and parameters" section below.
Blended model
The final model is given by a linear combination of the dynamical model and kinematic model. At high speeds, the entire dynamical model will be used. At low speeds, the entire kinematic model will be used. In between, a mix of the dynamical and kinematic model will be used:
is a blending parameter defined in the "Variables and parameters" section below.
Variables and parameters
For reference, here is an image of the bicycle model with all parameters. You don't need to understand everything about it, but it can be useful to look at.

The state of the model is . The individual states are defined as:
, the 2D coordinates of the center of the car
, the heading of the car
, the x (longitudal) velocity of the center of the car
, the y (lateral) velocity of the center of the car
, the yaw rate (angular velocity) of the car
The control input is . The individual inputs are defined as:
, the steering angle
, the driving command. 1 for full throttle, -1 for full braking
Note that the kinematic model depends on . We discretize
, where
. In the optimization problem, it is assumed that we can only control
.
The parameters used in the dynamical and kinematic models are as follows:
-
, the mass of the car
-
, the intertia
-
, the distance from the center of gravity to the rear wheel
-
, the distance from the center of gravity to the front wheel
-
, the lateral tire force of the rear wheel
, the rear slip angle
are experimentally identified coefficients
-
, the lateral tire force of the front wheel
-
-
, the front slip angle
-
are experimentally identified coefficients
-
-
-
, the longitudinal combined force produced by the drivetrain
-
-
, the experimentally identified motor model
-
, the experimentally identified rolling resistance
-
, the experimentally identified drag coeficcient
-
-
-
, the additional moment produced by the torque vectoring system
-
-
, the kinematic yaw rate
-
, the proportional gain of the low level torque vectoring controller
-
-
-
, the blending parameter
-
-
, the velocity below which the kinematic modely is purely used. Determined to be 3 m/s
-
, the velocity above which the dynamical modely is purely used. Determined to be 5 m/s
-
-
Optimization
The final optimization problem will be structured as a constrained optimization problem. This means that there will be an objective function that will be minimized, subject to contstraints.
The objective function will be constructed from several cost functions, which each govern a part of how we choose the optimal solution. As evidenced by the name, the higher the cost function is, the worse our car is performing, which is why we try to minimize the cost.
The constraints will mostly be physical constraints that our car is subject to, such as the maximum force the tires can exert and the limits of the track (cones).
Contouring formulation
The goal of the contouring formulation is to follow the path given to us as closely as possible. It is assumed that the path is given by a function that allows us to compute a point on the path with a variable.
To follow the path, the position of the car must be linked to a point on the path, which is the arc-length
. However, it is computationally too expensive to find the true arc-length
, so instead we introduce a new state
which approximates the arc length. This approximation is given by a double integrator:
-
, the velocity of the car relative to the reference path
-
, the acceleration of the car relative to the reference path
Note that is the double integral of acceleration, which results in a position.
To keep as a good approximation of the true
, we construct a cost function which minimizes the error, given by:
With parameters:
-
, the contouring error, the error perpendicular to the reference path
-
, the angle of the tangent to the reference path at point
-
-
, the lag error, the error along to the reference path
-
, the angle of the tangent to the reference path at point
-
-
, weights
on the objectives
Note that this cost function minimizes the errors and
while maximizing the velocity along the path
.
This image shows how the error looks on the path.

Cost functions
We can construct further cost functions that help to choose the optimal future. The first is a penalty to control inputs:
The second is a slip slide angle cost, which controls the aggressiveness of the MPC:
The parameters for these two cost functions are:
-
, a matrix which defines the cost of each control input
-
, a matrix which defines the cost of changing each control input
-
, the kinematic slide slip angle
-
, the dynamic slide slip angle
Tire constraints
To simplify the dynamical bicycle model, it was assumed that combined slip can be neglected. However, this is not strictly true. A tire has a maximum elliptice force budget it can transfer to the ground, called the friction ellipse. This budget can be introduced as a constraint, which allows us to ignore combined slip in our dynamical model. The constraints are given by:
with parameters
-
, tire specific ellipse parameter. Lowering this parameter allows the vehicle to corner more while accelerating
-
, tire specific ellipse parameter. Increasing this parameter allows the vehicle to go closer to the force limit
Track constraints
We must add constraints to the MPC problem that tell it to stay within the track boundaries. The constraint is given by:
with parameters:
-
, the safe radius around the track at point
.
-
, a slack variable to soften the constraint, which may be needed to guarantee the equation is solvable
With the addition of a slack variable , we can define a final cost function:
with parameters:
, weights
that penalize the use of the slack variable
Final MPC Problem
Finally, we can construct our MPC problem. We can combine vehicle model, input dynamics, and arc-length dynamics into one equation:
We then discretize the system as:
Which allows us to write our final MPC problem, with a prediction horizon of N:
Our MPC problem can now be solved using an optimization solver. The output is , which we can apply to our control inputs.