/Extended-Kalman-Filters

A C++ based implementation of Extended Kalman filters. The simulator has been developed by Udacity which is used to visualize performance.

Primary LanguageC++MIT LicenseMIT

Extended Kalman Filter

Self-Driving Car Engineer Nanodegree Program

This project involves the a Simulator developed by Udacity which can be downloaded here.

Dependencies

  • g++ 9.3 Installation Instructions: Mac Windows
  • Ubuntu Terminal for running UNIX Terminal on Windows. download
  • uWebSocketIO for smooth data flow between simulator and code. download
    <Navigate to the project folder using Ubuntu terminal>
    chmod u+x install-ubuntu.sh
    ./install-ubuntu.sh
    ./install-linux.sh
    
  • cmake 3.5 Installation Instructions
  • make 4.1 (Linux and Mac), 3.81 (Windows) Installation Instructions : Mac Windows

Installation and Usage

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.

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

This enables the application to start listening to the port, which the simulator will connect to. Run the simulator to connect to the port directly.

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"] Root Mean Squared Error for x

["rmse_y"] Root Mean Squared Error for y

["rmse_vx"] Root Mean Squared Error for velocity along x

["rmse_vy"] Root Mean Squared Error for velocity along y


Data

The data is located in a file titled obj_pose-laser-radar-synthetic-input.txt under the directory titled data.

Format:

  • Each row represents a sensor measurement where the first column tells you if the measurement comes from radar (R) or lidar (L).

  • For a row containing RaDAR data, the columns are: sensor_type, rho_measured, phi_measured, rhodot_measured, timestamp, x_groundtruth, y_groundtruth, vx_groundtruth, vy_groundtruth, yaw_groundtruth, yawrate_groundtruth.

  • For a row containing LiDAR data, the columns are: sensor_type, x_measured, y_measured, timestamp, x_groundtruth, y_groundtruth, vx_groundtruth, vy_groundtruth, yaw_groundtruth, yawrate_groundtruth.

If you'd like to generate your own radar and lidar data, see the Udacity Utilities repo for Matlab scripts that can generate additional data.

Custom Libraries

Eigen is already included in the repo. We majorly use two data structures, VectorXd and MatrixXd to build our algorithm. However, it must be noted that it does not initialize VectorXd or MatrixXd objects with zeros upon creation.

Output

The image below shows three points at each timeframe. The red points are inputs from LiDAR, the blue points are inputs from RaDAR, while the green points are the EKF output, which ideally should be the path of the vehicle, as in this case.

alt text