Skip to content
Network Embedded System Modeling class project, for modeling an autonomous car in a racing track. Objective is to model a car on a track to go about it as quickly as possible, with a given vehicle controller, path planner, and motion controller.
Branch: master
Clone or download

Latest commit

Fetching latest commit…
Cannot retrieve the latest commit at this time.


Type Name Latest commit message Commit time
Failed to load latest commit information.

Self-Driving Race Car Simulation

This is an attempt to model a self-driving race car on a track.


We made an organization called CarSimClassProj

This includes:

  • Yushuo Niu (yun13001)
  • Reynaldo Morillo (rjm11010)

Note: The reason you only see rjm11010 as a contributor is because he is the only one that knows how to use Github. yun13001 did contribute to the project!


How to run code

Download/clone the project. You can download a zip if that's easier. Otherwise, you can clone it like so:

git clone

Once you have processing installed, and you have downloaded the project. Open processing, and navigate to the folder containing our project. Open the simulation.pde file (it's the main file of our project).

When the project is open just press run and you should see something like this:

simulation example

What's Happening?

The Track

The track is defined as a series of nodes in a graph. The black line you see defines a path through the track, which the is the middle line of the track. It's a path that avoid collisions, but is not the optimal path through the course.

The Cars

The cars (vehicle.pde) are defined by the bicycle model. We took into consideration forces on the vehicle, and limitations to their capabilities. Such as applying a maxspeed and maxforce to each.

The cars follow a path they're given, and try not to deviate from that path. The cars are controlled by the pure pursuit controller. This algorithm uses a notion of look-ahead points that the car tries to pursue. So a path for each car is defined as a series of look-ahead points.

The setup (i.e. the experiment)

What you currently see on the track is two cars, both assigned the same path, which is the center line through the track. Both are initially placed near the center line, and the only differential factors between them is their maxforce. The maxforce is essentially the acceleration of the vehicle, and this influences the car's steering behavior. Having a higher maxforce will cause the car to respond sooner to turns so it can make the turn. Ideally we would model the full kinematics of the vehicle to account for slipping, but for now, a car with a maxforce can noticeably move faster around the track.

Why does it do something weird during the first lap half way around the track?

We wanted to introduce some noise into the experiment. By that we mean to purposely move the cars off course of their path and see how well they respond to this disturbance. You'll find that the pure pursuit algorithm goes a good job of getting them back on track.

Note: because we're not modeling all the kinematics and dynamics of the car, the car does not oscillate about the set point (i.e. the path). So you can think of it in the most ideal conditions without friction and other complex forces acting on the car

Path Planning?

There is a branch called astar that has an implementation of the A-Star path planning. The code for this is incomplete (at least at the time of submitting the project May 2, 2018 11:59pm).

The idea for this branch is that the cars do path planning offline. They're given a map of the track, and using the A-Star algorithm they will find an optimal path through the track. Where optimal is defined in terms of time to get around the track. The decisions the A-Star algorithm makes are determined by the g cost , h cost , and f cost. We manipulate these costs to consider various things to make decisions on moving along the track.

To use A-Star on the track we needed to make a fine grained graph of the entire track. The track was split into layers that progressively make progress towards the finish line. Each layer has a number of nodes in it. Each node on the track had to calculate it's own h cost and g cost. The h cost is the distance of the node away from the finish line of the track (in number of node/edge hoops). The g cost could be determined by the distance of the car away from the given node. The cost functions were designed to discourage radical turns between layers.

You can’t perform that action at this time.