This code as is will interact with the Simulator found here
- cmake >= 3.5 * All OSes: click here for installation instructions
- make >= 4.1 (Linux, Mac), 3.81 (Windows) * Linux: make is installed by default on most Linux distros * Mac: install Xcode command line tools to get make * Windows: Click here for installation instructions
- gcc/g++ >= 5.4 * Linux: gcc / g++ is installed by default on most Linux distros * Mac: same as make - install Xcode command line tools * Windows: recommend using MinGW
The main program can be built and run by running the following commands from the project's top directory(this has already been done):
If no changes made to code just run:
- Run it:
./build/particle_filter
Or build with changes and run:
- Remove old build directory and make new one:
rm -r build && mkdir build && cd build
- Compile:
cmake .. && make
- On windows, you may need to run:
cmake .. -G "Unix Makefiles" && make
- On windows, you may need to run:
- Run it:
./particle_filter
Here is the main protocol that main.cpp uses for uWebSocketIO in communicating with the simulator.
In src the following files:
- main.cpp: Loads map data from file and handles server interaction, receives telemetry data, initial state from 'GPS', velocity and yaw rate of the car, and updates from sensors of relative position of observed landmarks to car. Passes velocity, yaw rate, and observations to particle filter
- particle_filter.cpp: Contains and manages particles, updating their states using velocity, and yaw rate passed to it in main. Then matches observations to landmarks for each particle to determine likelihood that particle is in same state as actual car given observations from the car's sensors. Then resamples the particles it is managing based on this likelihood.
// sense noisy position data from the simulator(at initialization to simulate GPS data)
["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"]
// 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
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.