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 you will implement a 2 dimensional particle filter in C++. Your particle filter will be given a map and some initial localization information (analogous to what a GPS would provide). At each time step your filter will also get observation and control data.
To test it, Term 2 Simulator need to be used.
If you are looking for Udacity's started code project, you can find it here.
- Udacity's Self Driving Car Simulator
cmake >= 3.5
make >= 4.1
(Linux / Mac),3.81
(Windows)gcc/g++ >= 5.4
(Linux / Mac),MinGW
(Windows)uWebSockets
commite94b6e1
. See the following section for installation instructions and additional details.
This repository includes two files that can be used to set up and intall uWebSocketIO:
install-mac.sh
for Mac.install-ubuntu
for either Linux or Windows 10 Bash on Ubuntu (please, make sure it is updated).
For Windows, Docker or VMware coulso also be used as explained in the course lectures. Details about enviroment setup can also be found there.
If you install from source, checkout to commit e94b6e1
, as some function signatures have changed in v0.14.x
:
git clone https://github.com/uWebSockets/uWebSockets
cd uWebSockets
git checkout e94b6e1
See this PR for more details.
Once the install is complete, the main program can be built and run by doing the following from the project top directory:
- Create a build directory and navigate to it:
mkdir build && cd build
- Compile the project:
cmake .. && make
- Run it:
./PF
Or, all together (from inside the build
directory): clear && cmake .. && make && ./PF
Tips for setting up your environment can be found here.
Tips for setting up your environment can be found here
Note that the programs that need to be written to accomplish the project are src/ParticleFilter.cpp, and ParticleFilter.h
The program main.cpp has already been filled out, but feel free to modify it.
Here is the main protcol 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
["sense_x"]
["sense_y"]
["sense_theta"]
// get the previous velocity and yaw rate to predict the particle's transitioned state
["previous_velocity"]
["previous_yawrate"]
// receive noisy observation data from the simulator, in a respective list of x/y values
["sense_observations_x"]
["sense_observations_y"]
OUTPUT: values provided by the c++ program to the simulator
// best particle values used for calculating the error evaluation
["best_particle_x"]
["best_particle_y"]
["best_particle_theta"]
//Optional message data used for debugging particle's sensing and associations
// for respective (x,y) sensed positions ID label
["best_particle_associations"]
// for respective (x,y) sensed positions
["best_particle_sense_x"] <= list of sensed x positions
["best_particle_sense_y"] <= list of sensed y positions
Your job is to build out the methods in particle_filter.cpp
until the simulator output says:
Success! Your particle filter passed!
The directory structure of this repository is as follows:
root
| build.sh
| clean.sh
| CMakeLists.txt
| README.md
| run.sh
|
|___data
| |
| | map_data.txt
|
|
|___src
| helper_functions.h
| main.cpp
| map.h
| particle_filter.cpp
| particle_filter.h
The only file you should modify is particle_filter.cpp
in the src
directory. The file contains the scaffolding of a ParticleFilter
class and some 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 your particle filter and calling the associated methods.
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
- x position
- y position
- landmark id
- Map data provided by 3D Mapping Solutions GmbH.
If your particle filter passes the current grading code in the simulator (you can make sure you have the current version at any time by doing a git pull
), then you should pass!
The things the grading code is looking for are:
-
Accuracy: your particle filter should localize vehicle position and yaw to within the values specified in the parameters
max_translation_error
andmax_yaw_error
insrc/main.cpp
. -
Performance: your particle filter should complete execution within the time of 100 seconds.
-
Self-Driving Car Project Q&A | Kidnapped Vehicle
https://www.youtube.com/watch?v=-3HI3Iw3Z9g&feature=youtu.be