Self-Driving Car Engineer Nanodegree Program
In this project you will utilize a kalman filter 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 than 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 the uWebSocketIO Starter Guide page in the classroom within the EKF Project lesson 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
Tips for setting up your environment can be found in the classroom lesson for this project.
Note that the programs that need to be written to accomplish the project are src/FusionEKF.cpp, src/FusionEKF.h, kalman_filter.cpp, kalman_filter.h, tools.cpp, and tools.h
The program main.cpp has already been filled out, but feel free to modify it.
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
We've purposefully kept editor configuration files out of this repo in order to keep it as simple and environment agnostic as possible. However, we recommend using the following settings:
- indent using spaces
- set tab width to 2 spaces (keeps the matrices in source code aligned)
Please (do your best to) stick to Google's C++ style guide.
This is optional!
If you'd like to generate your own radar and lidar data, see the utilities repo for Matlab scripts that can generate additional data.
Note: regardless of the changes you make, your project must be buildable using cmake and make!
More information is only accessible by people who are already enrolled in Term 2 (three-term version) or Term 1 (two-term version) of CarND. If you are enrolled, see the Project Resources page in the classroom for instructions and the project rubric.
-
You don't have to follow this directory structure, but if you do, your work will span all of the .cpp files here. Keep an eye out for TODOs.
-
Students have reported rapid expansion of log files when using the term 2 simulator. This appears to be associated with not being connected to uWebSockets. If this does occur, please make sure you are conneted to uWebSockets. The following workaround may also be effective at preventing large log files.
- create an empty log file
- remove write permissions so that the simulator can't write to log
-
Please note that the
Eigen
library does not initializeVectorXd
orMatrixXd
objects with zeros upon creation.
Help your fellow students!
We decided to create Makefiles with cmake to keep this project as platform agnostic as possible. Similarly, we omitted IDE profiles in order to ensure that students don't feel pressured to use one IDE or another.
However! We'd love to help people get up and running with their IDEs of choice. If you've created a profile for an IDE that you think other students would appreciate, we'd love to have you add the requisite profile files and instructions to ide_profiles/. For example if you wanted to add a VS Code profile, you'd add:
- /ide_profiles/vscode/.vscode
- /ide_profiles/vscode/README.md
The README should explain what the profile does, how to take advantage of it, and how to install it.
Regardless of the IDE used, every submitted project must still be compilable with cmake and make.
A well written README file can enhance your project and portfolio. Develop your abilities to create professional README files by completing this free course.
First start the simulator and choose "Project 1/2: EKF and UKF". Then from the project root directory, execute ./build/ExtendedKF
. The output should be:
Listening to port 4567
Connected!!!
The command line output "Connected!!!" shows that the EKF program connects to the simulator once the simulator is in the simulation mode.
The following is an image of the simulator:
The simulator provides two datasets. The difference between them are:
- The direction the car (the object) is moving.
- The order the first measurement is sent to the EKF. On dataset 1, the LIDAR measurement is sent first. On the dataset 2, the RADAR measurement is sent first.
Here is the simulator final state after running the EKF with dataset 1:
Here is the simulator final state after running the EKF with dataset 2:
The code compiles without errors.
px, py, vx, vy output coordinates must have an RMSE <= [.11, .11, 0.52, 0.52] when using the file: "obj_pose-laser-radar-synthetic-input.txt" which is the same data file the simulator uses for Dataset 1.
The EKF accuracy was:
- Dataset 1:
Output | RMSE |
---|---|
px | 0.0974 |
py | 0.0855 |
vx | 0.4517 |
vy | 0.4404 |
- Dataset 2:
Output | RMSE |
---|---|
px | 0.0726 |
py | 0.0965 |
vx | 0.4216 |
vy | 0.4932 |
Your Sensor Fusion algorithm follows the general processing flow as taught in the preceding lessons.
The Kalman filter implementation can be found src/kalman_filter.cpp and it is used to predict at src/FusionEKF.cpp line 90 and to update line 117 to 130.
The first measurement is handled at src/FusionEKF.cpp from line 49 to line 88.
The predict operation could be found at src/FusionEKF.cpp line 90 and the update operation from line 117 to 130 of the same file.
Different type of measurements are handled in two places in src/FusionEKF.cpp:
- For the first measurement from line 69 to line 83.
- For the update from line 118 to 129.
, both of which handles different types of sensors.
The following conventions are followed:
- Member variables are all named with an extra underscore (_) to differentiate from other variables
- No big data structures were copied unecessarily large number of times
- Necessary amount of comments were added but not many
- The ProcessMeasurement function of FusionEKF class has been refactored into three separate private functions so that all member functions of FusionEKF follow the paradigm "Single Responsibility"