What are filters and how would I implement it?

I’ve heard of biquad and kalman filters but I don’t know for what are they used for or how would I implement it.

Used in this contex, a “filter” is a mathematical calculation applied to time series sensor data to enhance some signal and suppress some noise. A biquad filter is very configurable (“tuneable”) by adjusting the filter coefficients, a small set of numbers. Based on how you set the coefficients, you can use exactly the same code to implement lowpass, highpass, bandpass, notch, peak, low shelf, or high shelf filters.

Kalman filtering is usually done when there is a conditional relationship between two or more signals. That is, when knowing something about one sensor value will help you predict something about another. It’s a repetitive application of Baye’s rule (conditional probability) over multi-variate time series data. Frequently used to help improve location estimates based on multiple sensor inputs. In that case, the reason you can predict one sensor’s contribution based on a different sensor is because both sensors should show different data if “ownship” (here, “ownRobot”) is in a different location.

Colloquially, you can think of it as filtering smooths out glitches in the data. Good filtering can seem almost magical in its ability to pull signal from noise. If done poorly, on the other hand, filtering can create “data” where non exists, and surpress things you really care about.

Here’s a link to a Biquad implementaion @JMarple committed to robotc-openlib.

Here’s @JMarple’s implementation of Kalman Filtering, contained in BNSLibrary, also on GitHub:

Here is a link to a very simple overview of Kalman filtering as it applies to a couple of robotics problems.