Introduction to Vehicle Models for Self Driving Cars
Introduction to Concepts like Dynamic Models, State, Errors and Actuator Constraints in Self Driving Car Development
One approach to writing a good controller is to first model the vehicle’s dynamics and constraints. That way, we can analyze and tune the controller more efficiently. In this medium article, we’ll learn about vehicle models. The models describe mathematically how the vehicle moves, some models being more realistic than others. Typically, more realistic models are also more complex and more challenging to work with, so there’s always a trade-off to make. We’ll work with a relatively simple type of model, the kinematic model. Kinematic models ignore many elements like gravity and tire forces, but they’re relatively simple to work with and they often perform well. We’ll also learn about dynamic models, which capture more realistic forces and accelerations.
State
Think about how to keep track of the state of a vehicle. The vehicle is located at a position which we track with “x” and “y”. If we’re talking about a car, then the vehicle also has an orientation which we’ll denote with “y”. This is a good model of a stationary vehicle, but what if our vehicle is in motion?
In that case, it will also have a velocity which we’ll call “v”. This captures the vehicle’s state. So the next task is to model how that state evolves through time. If we know the current state of the vehicle, can we tell where we’ll be in the future?
Errors
Within a set of design requirements, a controller actuates the vehicle to follow the trajectory of reference. To minimize the area between the reference trajectory and the vehicle’s actual path is one of the most important requirement. We can minimize this error by predicting the vehicle’s actual path and then adjusting the control inputs to minimize the difference between that prediction and the reference trajectory. That’s how to use a kinematic model to predict the vehicle’s future state. Next, we’ll define the predicted area between the trajectory and that predicted path of the vehicle. Once we’ve predicted the error we can actuate with the vehicle to minimize the error over time.
Dynamic Models
The vehicle dynamics models i.e. the complex interactions between the tires and the road are the factors that determine the motion of the vehicle. We don’t delve too heavily into the mathematical details here. Rather we’ll focus more on the intuition of what these forces do. Out of the many forces in a dynamic model, they essentially boil down to lateral and longitudinal forces acting on the vehicle. Think of the two forces i.e. longitudinal & lateral force moving the vehicle. Longitudinal force is the force pushing the vehicle forward or backward and lateral force is a force pushing the vehicle side to side. Tires play a huge role here. Forces on the tires is the sum of the longitudinal and lateral force on the vehicle.
The slip angle can be interpreted as the angle between the velocity vector of the wheel and the orientation of the wheel. You’re probably familiar with the sound of a tire squealing in a parking lot. That’s a result of having a slip angle. The slip angle can be expressed as the arc tangent of the wheel longitudinal velocity divided by the wheel lateral velocity. The vehicle actually turns due to the force generated by the slip angle. Otherwise, inertia would carry the vehicle off the road. Different tires have different characteristics though. Racing tires generate much more force from the same slip angle than conventional tires.
The ratio between the speed of the vehicle wheel and the expected longitudinal velocity is called slip ratio. This means, there is always some slipping when the vehicle is moving on roads. So, there’s also a slipping motion in addition to the tire’s natural rolling motion,. As the slip angle is required to generate lateral force, the longitudinal force is generated by slip ratio. In either case, all of this begins when the contact patch of the tire meets the road.
Race car drivers have a fantastic mental model of the graph and can usually capture optimal longitudinal or lateral force for the situation. The slip angle is the only one component used to calculate the lateral & longitudinal forces of tires. There is a lot of literature around tire dynamics. We could have an entire course just on tire forces. The most popular Magic Tire Formula model.
Actuator Constraints
Great. We now know how to model the dynamics for a vehicle. One last thing before we move on, actuator constraints. In a real world or fundamental physics, the design of the vehicle is limited by actuators. As we know, a vehicle can’t have a steering angle of 90 degrees. It’s impossible. Thus, it doesn’t make sense to even consider these kinds of inputs. There’s actually a vocabulary for describing this constraint. We call this model nonholonomic, because the vehicle can’t move in arbitrary directions. It’s limited by its steering angle constraints. This problem can be solved on actuators by setting lower and upper bounds. For example, we may set the steering angle to be between minus 30 and 30 degrees, and the acceleration to be between minus one and one. (-1) signifying full brake, and (+1) signifying full acceleration.
Summary
Congratulations, you’re now familiar with kinematic and dynamic vehicle models. These models along with the actuator constraints are the foundations of model predictive control. In order to develop an optimal controller, we need to define a cost function that captures the errors we want to minimize. The cost function will require us to use the model to predict where the vehicle will go into the future. The cost is actually the difference between where we want the vehicle to go and where we predict it will go based on that model. That’s what’s it’s called Model Predictive Control.
With this, we have come to the end of this article. Thanks for reading this and following along. Hope you loved it! Bundle of thanks for reading it!
My Linkedin :)