Navigation Menu

Skip to content


Repository files navigation


Udacity Self-Driving Car Nanodegree - Kidnapped Vehicle project


This project implements a Particle Filter applied to a Kidnapped robot(car) problem. A simulator is provided by Udacity (it could be downloaded here). This simulator will generate noisy landmark observation from a car to the Particle Filter using WebSocket. The Particle Filter uses the uWebSockets WebSocket implementation to respond to this observation with the estimated car position. Udacity provides a seed project to start from on this project (here).


The project has the following dependencies (from Udacity's seed project):

  • cmake >= 3.5
  • make >= 4.1
  • gcc/g++ >= 5.4
  • Udacity's simulator.

For instructions on how to install these components on different operating systems, please, visit Udacity's seed project. As this particular implementation was done on Mac OS, the rest of this documentation will be focused on Mac OS. I am sorry to be that restrictive.

In order to install the necessary libraries, use the

Compiling and executing the project

In this project, Udacity's seed repo provides scripts to clean, compile and run it. These are the following commands you need to run from this repo directory

> ./
> ./
> ./

You will see a message indicating the filter is listening:

> ./
Listening to port 4567

When you open the simulator the following screen appears:

Simulator first screen

Using the right arrow, you need to go to the Kidnapped Vehicle project:

Simulator Kidnapped Vehicle project

Clicking on "Select," the simulator for the Kidnapped project start and the Particle Filter informs it is connected:

Simulator Kidnapped Vehicle project first screen

Clicking on "Start" button, the vehicle starts moving, and the blue circle(the filter calculated position) moves with it. After a while, the simulator informs you if your Particle Filter passed or failed. Here is an example of the filter passing the test:

Simulator Kidnapped Vehicle Passed

Code description

The Particle Filter is implemented in src/particle_filter.cpp:

Almost the rest of the magic happens on src/main.cpp. The event handler declared at line 49 parse the received message and call the above described Particle Filter methods.


No releases published


No packages published