← udacity portfolio
self driving car nd · slam localization · March 2019

Extended Kalman Filter

Fuse LIDAR + RADAR with an EKF to track a moving vehicle. C++, uWebSockets, Udacity simulator. The first project where the math actually mattered.

What it did

Track a single moving vehicle from a mix of LIDAR (2D position only) and RADAR (range, bearing, range-rate) measurements, using an Extended Kalman Filter. Output a smoothed trajectory whose RMSE against ground truth had to clear the rubric thresholds:

Implemented in C++ talking to Udacity’s term-2 simulator over uWebSockets.

The math, abridged

The state is [px, py, vx, vy]. Constant-velocity motion model:

F = [[1, 0, Δt, 0],
     [0, 1, 0, Δt],
     [0, 0, 1,  0],
     [0, 0, 0,  1]]

x' = F · x
P' = F · P · Fᵀ + Q

LIDAR observes [px, py] directly — measurement function H is linear, plain Kalman update.

RADAR observes [ρ, φ, ρ̇] — measurement function is non-linear:

ρ  = √(px² + py²)
φ  = atan2(py, px)
ρ̇  = (px·vx + py·vy) / ρ

Hence “Extended” — linearize via the Jacobian H_j around the current estimate, then apply the standard update equations with H_j in place of H.

What was actually tricky

What I’d do differently with hindsight

What it taught me

This was the first SDC project where the math wasn’t a hidden detail behind a framework call. Writing out P' = F P Fᵀ + Q by hand with Eigen — and watching the state covariance shrink as measurements roll in — is what made probabilistic state estimation feel concrete. Everything later in the nanodegree (the [UKF particle filter, the particle filter localizer, even the path-planning behavior layer) built on the same intuition.


Source archive: Shivam-Bhardwaj/Extended_Kalman_Filter (archived)
Writeup last touched: 2026-05-22