CarND-Kidnapped-Vehicle-Project

View the Project on GitHub MarkBroerkens/CarND-Kidnapped-Vehicle-Project

Udacity - Self-Driving Car NanoDegree

The Project

Your robot 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.

In this project I implemented a 2 dimensional particle filter in C++. My particle filter is given a map and some initial localization information (analogous to what a GPS would provide). At each time step the filter also gets observation and control data.

Running the Code

This project involves the 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.

Once the install for uWebSocketIO is complete, the main program can be built and ran by doing the following from the project top directory.

  1. mkdir build
  2. cd build
  3. cmake ..
  4. make
  5. ./particle_filter

Alternatively some scripts have been included to streamline this process, these can be leveraged by executing the following in the top directory of the project:

  1. ./clean.sh
  2. ./build.sh
  3. ./run.sh

Interaction with the Term 2 Simulator

Tips for setting up your environment can be found here

Here is the main protocol that main.cpp uses for uWebSocketIO in communicating with the simulator.

INPUT: values provided by the simulator to the c++ program

// sense noisy position data from the simulator

// get the previous velocity and yaw rate to predict the particle’s transitioned state

// receive noisy observation data from the simulator, in a respective list of x/y values

OUTPUT: values provided by the c++ program to the simulator

// best particle values used for calculating the error evaluation

//Optional message data used for debugging particle’s sensing and associations

// for respective (x,y) sensed positions ID label

// for respective (x,y) sensed positions

Inputs to the Particle Filter

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

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.

Code Style

I tried to stick to the Google’s C++ style guide. In order to check the guidelines I installed cpplint using pip install cpplint

Results

Success! Your particle filter passed!

The simulator visualizes the particle filter: alt text

Further Reading

If you are interested in the topic you might want to check:

You can study more on random number generation in C++ by refering to: