Self-Driving Car Engineer Nanodegree Program
In this project a kalman filter is used to estimate the state of a moving object of interest with noisy lidar and radar measurements. Passing the project requires obtaining RMSE values that are lower that the tolerance outlined in the project rubric.
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. Please see this concept in the classroom for the required version and installation scripts.
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
The code consists of the following files:
- src
- FusionEKF.cpp
- FusionEKF.h
- kalman_filter.cpp
- kalman_filter.h
- tools.cpp
- tools.h
- .clang-format
- first measurement: the filter will receive initial measurements of an object's position relative to the car. These measurements will come from a radar or lidar sensor.
- initialize state and covariance matrices: the filter will initialize the object's position based on the first measurement then the car will receive another sensor measurement after a time period Δt.
- predict: the algorithm will predict where the bicycle will be after time Δt. One basic way to predict the bicycle location after Δt is to assume the object's velocity is constant; thus the object will have moved velocity * Δt.
- update: the filter compares the "predicted" location with what the sensor measurement says. The predicted location and the measured location are combined to give an updated location. The Kalman filter will put more weight on either the predicted location or the measured location depending on the uncertainty of each value then the car will receive another sensor measurement after a time period Δt. The algorithm then does another predict and update step.
The extended Kalman filter is almost the same as a basic Kalman filter except the H, and F are different. However, in this case, since I‘m assuming a constant velocity model which is linear, the F is the same.
RMSE Values:
- X: 0.09
- Y: 0.09
- Vx: 0.47
- Vy: 0.44
RMSE Values:
- X: 0.08
- Y: 0.09
- Vx: 0.46
- Vy: 0.49
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
["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: 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
A modified version of the Google's C++ style guide has been used. Clang format was used to make sure of the style format.
No additional data was generated for this project.
To generate extra radar and lidar data, see the utilities repo for Matlab scripts that can generate additional data.