# Have you ever used a Kalman Filter? If so, for what?

Of you can please post code snippet. Thank you

This: http://nbviewer.jupyter.org/github/rlabbe/Kalman-and-Bayesian-Filters-in-Python/blob/master/table_of_contents.ipynb is one of the best tutorials I’ve found online about Kalman Filters. It does a very good job of explaining the rationale behind the math, which I found to be helpful.

One of my courses had us implement a few in various languages. They were primarily for getting good distance measurements from a noisy ultrasonic sensor. It is kinda the go to filter for robotics though so it is used on everything.

I have used Kalman filtering extensively. I’ve used it for many situations in multi-platform and multi-sensor data fusion, whenever the conditional statistics are such that Bayes Rule…uh…rules.

A typical use is in contact*-to-track** association*** and track-to-track correlation****, where tracks are provided from multiple sensor platforms. This is very useful to people in, say, the Combat Information Center (CIC) of the commanding ship of a battle group. For instance. Coasties also find it useful for smuggler interdiciton.

More relevant to small robots is that it can be used to create a more refined position using multiple sensors. Other uses include time-series data filtering on sensors with a particular dependency relationship. Where, as I said before, you can apply Bayesian statistics. That is, where a change in the information on one sensor feed implies a corelated change in another sensor feed, and the data from the dependent feed is noisy, intermittent, or otherwise less reliable.

It’s certainly possible to use it on VEX platforms. (Fusing sensor information from ultrasonic sensors and comparing to motor encoders, accelerometors, and even gyros, for instance.) However, for the short runs needed, and the sensor types available, it’s probably not worth it. Usually, for VEX purposes, plenty of gains are available from other, simpler techniques.

*A “contact” is a single radar or sonar return.
**A “track” is a time-series of contacts (often one per radar sweep) presumed to have been made by a single ship, sub, or aircraft.
***Contact-to-track association is the process of infering, from a series of single hits (radar or sonar returns,) that those hits were made by a single moving object.
****Track-to-track correlation is the process of infering, from a collection of tracks produced by different operators using different processing stations potentially fed by different sensor arrays and potentially on different moving platforms (ships, planes,) which tracks represent the same object.

I haven’t used a regular Kalman filter for Vex, but an extended kalman filter (ekf) instead because quite often your process isn’t linear so regular kalman filtering will not work. For example, odometry cannot be filtered with a normal kalman filter and so we must use (at a minimum, other filters still apply) an ekf. My team will be doing a code reveal towards worlds covering all of this.