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.
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.
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:
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
You can find the inputs to the particle filter in the
map_data.txt includes the position of landmarks (in meters) on an arbitrary Cartesian coordinate system. Each row has three columns
All other data the simulator provides, such as observations and controls.
- Map data provided by 3D Mapping Solutions GmbH.
I tried to stick to the Google’s C++ style guide.
In order to check the guidelines I installed cpplint using
pip install cpplint
Success! Your particle filter passed!
The simulator visualizes the particle filter:
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: