In this project, we will use an extended kalman filter relying on a noisy Radar and a Lidar measurements to estimate the state of a moving object on a 2D map. We can see the results in the image bellow:
Lidar measurements are red circles, radar measurements are blue circles with an arrow pointing in the direction of the observed angle, and estimation markers are green triangles. On the bellow image we can see them better:
-
Kalman.cpp
is the script file containing the Kalman class use to predict and update the state of our car. -
FusionEKF.cpp
is the script file use to initialise the variables and decide which kalman function to use in which order. -
Tools.cpp
is the script use to implement the RMSE (Root Main Square Error) of our kalman filter and also use to implement the jacobian function which is needed for the extended kalman filter update function.
This project involves the Term 2 Simulator from Udacity which can be downloaded here.
Download the Udacity project on extended kalman filter and then replace the kalman.cpp
, FusionEKF.cpp
and Tools.cpp
files in the src
folder by the ones from this repository.
The Udacity 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 run by doing the following from the project top directory.
- mkdir build
- cd build
- cmake ..
- make
- ./ExtendedKF
Then you only need to open the executable file in the simulation folder to see your algorithm evolving.
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
["sensor_measurement"] => the measurement that the simulator observed (either lidar or radar)
OUTPUT: values provided by the c++ program to the simulator
["estimate_x"] <= kalman filter estimated position x
["estimate_y"] <= kalman filter estimated position y
["rmse_x"]
["rmse_y"]
["rmse_vx"]
["rmse_vy"]
- 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 deal as make - install Xcode command line tools
- Windows: recommend using MinGW
- Clone this repo.
- Make a build directory:
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:
./ExtendedKF
If you'd like to generate your own radar and lidar data, see the utilities repo for Matlab scripts that can generate additional data.