Self Driving Cars: Calculating Actuation

A lot of tech goes into self driving cars. Sensors, perception, effectors, control systems, safety systems, even power systems. One of the most important parts is planning where to drive — and then turning that into the steering wheel and speed regulation commands to get us to follow the planned path.
Model Predictive Control is the last project in term two of Udacity’s Self Driving Car Engineer Nanodegree. In it, we’re presented with a simulated car in a simulated world, with waypoints (a series of <x, y> co-ordinates in the world) of a planned path ahead of it. The car’s task is to calculate what the steering wheel and acceleration and brake pedal commands should be to send to the car for it to follow the planned path smoothly and safely.
If you think about how humans drive, we don’t just look at the scene in front and base our steering and speed adjustment movements on that one single frame. We’re always planning ahead a few seconds with paths of where we can go, and taking into account how we’ll likely spin the wheel in a few seconds in order to make that right or left turn the best way possible.
That’s what Model Predictive Control does. It models out the car’s predicted movement based on a simple model, which basically says “if I’m pointing this way, with this speed, and this steering wheel angle, after a second, I believe I’ll be here in the world.”
We do this at every time step (i.e. every 100ms), and we plot out what our path will be over the next few seconds, given the current state of the car and the world.
We then actuate, that is, follow our calculated plan, adjusting our steering wheel and speed based on the very first time step’s commands (i.e. what we should be doing right now). But — we don’t just blindly follow our entire series of many computed actuations the entire way trough the few seconds that we calculated ahead of us in time; just as a human doesn’t plan out a path and then carry it out with closed eyes for few seconds. Things change. So while we need to compute the path a few seconds ahead in order to execute complex, optimal, and smooth moves, we only actually ever use the very first computed steering and speed commands.
In other words: solving simultaneous equations in order to drive is fun. For computers at least. I’ll stick with my neuron-based world modelling and muscle memory for driving for now.


