Particle Filter Project for Self-Driving Car ND
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


Particles Filter Project for Self-Driving Car ND

Udacity - Self-Driving Car NanoDegree

Particles Filter

The car has been kidnapped and transported to a new location! Luckily it has a map of this location, a (noisy) GPS estimate of its initial location, and lots of (noisy) sensor and control data.

The goal of this project is to implement a 2 dimensional particle filter in C++. The particle filter will be given a map and some initial localization information (analogous to what a GPS would provide). At each time step the filter will also get observation and control data.


Starting to work on this project consists of the following steps:

  1. Install uWebSocketIO and all the required dependencies
  2. Clone this repository
  3. Build the main program
    • mkdir build
    • cd build
    • cmake ..
    • make
  4. Launch ./particle_filter
  5. Launch the Udacity Term 2 simulator
  6. Enjoy!

Alternatively some scripts have been included to streamline the build and run parts, these can be leveraged by executing the following in the top directory of the project:

  1. ./
  2. ./
  3. ./

Directory Structure

The directory structure of this repository is as follows:

|   CMakeLists.txt
|   |   
|   |   map_data.txt
    |   helper_functions.h
    |   main.cpp
    |   map.h
    |   particle_filter.cpp
    |   particle_filter.h

The particle_filter.cpp file in the src directory contains the code for the ParticleFilter class and its associated methods. Read through the code, the comments, and the header file particle_filter.h to get a sense for what this code is expected to do.

If you are interested, take a look at src/main.cpp as well. This file contains the code that will actually be running the particle filter and calling the associated methods.

Inputs to the Particle Filter

You can find the inputs to the particle filter in the data directory.

The Map*

map_data.txt includes the position of landmarks (in meters) on an arbitrary Cartesian coordinate system. Each row has three columns

  1. x position
  2. y position
  3. landmark id

All other data the simulator provides, such as observations and controls.

* Map data provided by 3D Mapping Solutions GmbH.

Installation and Dependencies

This project involves the Udacity Term 2 Simulator which can be downloaded here

This repository includes two files that can be used to set up and install uWebSocketIO for either Linux or Mac systems. For windows you can use either Docker, VMware, or even Windows 10 Bash on Ubuntu to install uWebSocketIO. Please see this concept in the classroom for the required version and installation scripts.

Once all the dependencies have been installed clone the project:

git clone

and follow the steps 3 to 6 of the Overview section in order to build and run the main program.

Questions or Feedback

Contact me anytime for anything about my projects or machine learning in general. I'd be happy to help you 😉