The Extended Kalman Filter

  1. Read chapters 2, 3, and 4 in this tutorial about the Discrete Kalman Filter and Extended Kalman Filter.

  2. Download my code starter kit for Java or C++. Build and run it. You must pass two command-line arguments to this program, which specify the transition noise and the observation noise. (The first time you run it, just use "0 0" for these arguments.) When run it, you will see a simulator of a crane system. You can move this crane around using the arrow keys. This simulator is powered by two artificial neural networks. The "observation" model maps from a two-dimensional representation of state to the image you see. The "transition" model maps from the current state and an "action" to the next state.

  3. Implement the extended Kalman filter (EKF).

  4. Hook up your EKF with this simulator to estimate the state. You may initialize your EKF with a perfectly correct knowledge of the state. Thereafter, however, the state should be kept hidden from your EKF. Your EKF will only know about: (1) The noisy images, (2) The chosen actions, and (3) the noise parameters. Draw red cross-hairs (two red crossing lines) on the grid to show where the EKF thinks the state is. Let the height and width of the cross-hairs indicate the deviation of uncertainty.

  5. Play around with it. See how much noise it can handle and still estimate the state with reasonable accuracy.

  6. Zip up your source code. Submit your archive using the hyperlink on the main class page. If you have any trouble with the submission server, just send your archive to the instructor.


  • When you compute the Jacobian matrix of the neural network that predicts transitions, f, actions should not be included. The easiest way to do that is to just compute the full Jacobian matrix, then throw out the last few columns.

  • Inverting the full observation matrix is too computationally expensive, so it is okay to just sample the observations. That is, pick some number of pixels and only consider their values for the Kalman filter.

  • A great way to test your Jacobians is to compare against finite differencing.

  • A good test to isolate issues related to the observation function is to swap it out with the identity function. If the observation function were the identity function, then it would accept two inputs values (the state), and output two values. Noise would still be added to the two output values, so your Kalman filter would not be able to directly observe the state. The Jacobian of the identity function is easy to compute too. (It's also the identity function.) If your Kalman filter works with an identity observation function, then that tells you that the rest of your Kalman filter is working.