Model Predictive Control (MPC) is an effective control strategy for vehicle lateral dynamics challenges because it uses a dynamic model to predict future system behavior and optimize control actions over a prediction horizon, enabling proactive responses to upcoming driving scenarios rather than reactive corrections. The controller minimizes a cost function that balances tracking error and control effort, making it particularly suitable when preview information about future targets is available.
Deep Dive
Prerequisite Knowledge
- No data available.
Where to go next
- No data available.
Deep Dive
Comma.ai Controls Challenge - Solved w/ MPC ControllerAdded:
Hey everyone, in this video, I'll talk about the Comma AI Controls Challenge.
We'll go over what the challenge is exactly and how I solved it.
If you aren't familiar with the company Comma AI, their goal is to {quote} "make driving chill", which is a concise way of saying that they're building hardware and software to add self-driving capabilities to cars.
There are a bunch of videos reviewing their product and it seems pretty cool.
What I also like about the company is their recruiting method. Their code is open source, so anyone can contribute.
You can solve what they call bounties and challenges for money, and if you do well enough, it seems like it's a great first step to get a job there.
I saw they had a controls challenge and gave it a try.
So, let's start by giving an overview of the challenge. In a nutshell, you're supposed to design a controller that controls the lateral acceleration of a car. You're given a lightweight learned simulator called Tiny Physics.
Internally, Tiny Physics behaves like an auto-regressive model, which was trained on a real-world data set.
This data set is called Comma Steering Control.
You give the Tiny Physics model a driving scenario that contains speed, acceleration, road roll, and target lateral acceleration, while your controller outputs steer commands.
And the model outputs the resulting lateral acceleration of the car.
Your job is to design a controller that achieves the lowest cost possible.
The cost is defined here.
There's a lateral cost and a jerk cost, and the total is a combination of the two.
All right. Now, I'll go over how I decided to solve this challenge.
It says that the Tiny Physics model was trained to mimic a bicycle model-based simulator given realistic driving noise.
I found a very nice video talking about modeling the lateral dynamics of the bicycle model by Professor Georg Schildbach.
I hope I said that correctly.
Uh it seems like the lateral dynamics are all based on constant parameters such as the cornering stiffness of the tires, the distance between the tires and the center of gravity, etc. Except for the longitudinal velocity.
That's ostensibly the only varying parameter.
I don't have the full state of the system though.
Lateral velocity is missing in my available data for example. So, if I want to use some model for my controller, I'm going to need to model the dynamics of the system.
And since I have a ton of input-output data given by comma AI for this challenge containing many different driving scenarios, I can take some generic model with lots of parameters, ideally chosen so that they make sense and actually have something to do with the dynamics, and tune those parameters based on the data I have.
Based on these two observations, I settled on what's called an LPV-ARX model.
The LPV stands for linear parameter varying with the longitudinal speed acting as the varying parameter.
And the ARX stands for auto-regressive exogenous. The auto-regressive part means I'm predicting the next lateral acceleration based on previous measurements. Just like the tiny physics model is an auto-regressive model.
So, the auto-regressive part of my model should be a good match to the actual tiny physics model.
And the exogenous part means that I'm also using external inputs to predict the lateral acceleration.
These include the road roll and essentially any other relevant signal I have.
I could also create my own synthetic inputs to try to fit the model better.
Something like longitudinal acceleration times steer command. Maybe there is some interaction between the two that might model the system better.
I built a script that lets me choose certain parameters for this LPV-ARX model.
For example, how many past accelerations should my model have?
Likewise with steer command and any additional signal I choose, which is row in this case.
For the LPV part, I can choose the basis functions used to determine speed dependence. For example, constant, linear, and quadratic speed terms.
After the LPV-ARX parameters are chosen, I build a regression problem to identify the model coefficients from data.
What that essentially means is that I create a large feature matrix X, where each row represents one sample, and contains all the chosen regressors for that time step.
So, that's the previous lateral accelerations, steering commands, etc. All of these are expanded by the LPV basis functions. So, multiplied by 1 and V and V squared, depending on what the LPV basis functions are.
Then, this feature matrix is multiplied by the parameter vector theta, which contains the unknown coefficients for each regressor.
Their multiplication is compared to the target vector Y, which contains the measured output we want to predict, which is in this case the next lateral acceleration.
This defines the regression problem, where we try to find a theta so that X * theta gets us as close as possible to the actual Y.
We then solve this problem using some solver. I use the least squares formulation in this case to find the coefficients in theta.
Okay, but why did I go through all this work to get a model of the system?
Well, I decided to use a controller that requires a model. It's called model predictive control or MPC.
Let's go over how an MPC controller works and why I think it's a pretty good fit for this challenge.
Let's take this controls challenge as an example.
We have a car and in addition to current data, we're given preview information, meaning future target lateral accelerations as well as future vehicle states and inputs such as speed, acceleration and roll.
We also have a dynamic model, so we know how the car responds to steer commands.
Our goal is to know what the steer command should be to follow the desired targets in the best way possible.
Now, we're the ones that need to define the best way.
We do that by designing a cost function.
We can define whatever we wish. We can choose to minimize error, minimize the size of the steer command, minimize the steer command rate, etc., etc. Let's say we have a sharp turn up ahead.
Every controller cycle, we look a few steps ahead and choose a sequence of steer commands for each step that will give the best desired response.
Once we have that, we only use the first steer command.
This allows for anticipation of future events compared to reactive controllers like the PID.
Let's assume our model has some delay.
The MPC controller will be aware of the sharp turn ahead and will start outputting steer commands in time.
A PID controller, on the other hand, will react only once we've reached the corner, which will make minimizing the cost function much more difficult.
This controls challenge seems like an ideal scenario to use an MPC controller.
We have a clear cost function, future information, and due to lots of input-output data can get a pretty good dynamic model.
So, after tuning the LPV RX model on some data I generated and tuning the MPC parameters, I ran the evaluation script given in the challenge.
It shows you a cost comparison between your controller and the baseline controller, which is a PID controller with some default parameters.
If we take a look at the leaderboard, it seems I would have reached the 54th place.
Eh, I'll take it.
When looking at the top scorers, it seems like they designed specific controllers for each segment.
This gave them great results in the challenge at the cost of not having a general solution. Also, I see MPC showing up here quite a lot, which makes sense.
All right, that's it for this video.
Please consider trying the challenge and sharing your designs. I'd be interested to see other people's solutions.
Thanks for watching and see you next time.
Related Videos
U.S. Military Just Flexed The Most Dangerous Aircraft Ever Built The F-47
MaxAfterburnerusa
11K viewsβ’2026-05-29
Heating Staying On On The Hottest Day Of The Year
PlumbLikeTom
507 viewsβ’2026-05-29
λ°μ ν¨μ¨μ λμ΄λ νμκ΄ μΆμ μμ€ν μ κΈ°μ μ μ리 #곡ν #곡μ #νμκ΄ #μκ³ λ¦¬μ¦ #μ¬μμλμ§
μ°νμ₯κΈ°μ
2K viewsβ’2026-05-29
Peterborough to Newark Northgate Driver's Eye View aboard an InterCity 225 - East Coast Main Line
TrainsTrainsTrains
822 viewsβ’2026-05-31
AI turbine design: hypersonic cooling leap #shorts #ai #hypersonic
bobbby_rn
671 viewsβ’2026-05-31
μ§κ΄ λ° κ³‘κ΄ λ°°κ΄ κ²°ν© κ³ μ μμ #worker #process #fabrication #pipework #clamp
μλμ΄μ΄
2K viewsβ’2026-05-30
How Far Can A Tomahawk Missile Actually Travel?
WarCurious
13K viewsβ’2026-05-28
Wire To Wire Connection Trick | Strong And Secure Electrical Joint #shortvideo #wireworks
ElectricianTips-b1h
5K viewsβ’2026-06-02











