Learning to drive (from a self-driving car!)

Note: Frenet Coordinate System

The article will be covering the use of Frenet coordinates, an alternate coordinate system that can be used to help map out the car’s actions on a road in more of an intuitive way than the traditional x y coordinates.


The motion planning problem

We can define the motion planning problem as given the start configuration (qstart → this will be given from localization and sensors), a goal configuration (qgoal), and the constraints in the environment (physics, map, traffic, etc.), find a sequence of moves in the configuration space (all possible configurations of the car → can be in [x, y, θ] where θ is our heading) that can move the robot from qstart to qgoal without colliding with any obstacles.

Predicting the actions of other cars

We can first start off the overall problem through predicting the actions of other cars given a certain timespan. We want to be able to predict and deduce the actions of other vehicles so that the self-driving car is able to drive without colliding into other vehicles while optimizing for the best path required.

Example pipeline of a model-based vs data-driven approach. Source

Behaviour Planning

The behaviour planning problem can be summarized as given the input of the map, the route that we will be taking from start to end, and the predictions that we’ve acquired of the other objects, create a path that can bring the car to the destination, collision-free, smooth, and safe.

  1. Safe
  2. Legal
  3. Efficient

Polynomial Trajectory Generation

Now that we’ve built a model that will plan for typical situations that might occur when driving, we now need to plan for a specific path that we can use in order to successfully move the car and adjust its speed.

Velocity equation (first-order derivative)
Acceleration equation (second-order derivative)


I’ve implemented this in C++ and here you’ll be able to find the outcome of the Jerk Minimization Trajectory implemented in Udacity’s simulator below:



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store