# Kalman or FIR Filter for my IMU? In configuring my Inertial Measurement Unit (IMU) for post-filtering of the data after the sensor, I see options for both a decimation FIR filter and also a Kalman filter. Which one is best for my application?

Each of these filter options provides a decidedly different function within the IMU. For the most part, they are independent in their operation. Their use will depend upon the requirements of the end-system. Let’s take a further look to understand the details and how they can apply to a sensor system.

The use of decimation in conjunction with a Finite Impulse Response (FIR) filter is a method to reduce the full input bandwidth of the IMU in order to focus only on a narrow low-pass frequency band of activity. This can be especially useful when a system is subjected to many rotational and acceleration frequency movements, only a subset of which are important to observe within the sensor. Additionally, any unnecessary or ignored higher frequency activity has the potential to alias back into the band of interest without the filtering rejection of a FIR pass band filter.

The FIR filter is most valuable when the full bandwidth of the sensor is not needed. Instead, if a known signal frequency bandwidth within a low-pass region is of interest, unwanted signals can be filtered. For example, a system may have a rotational frequency of interest only between 20-50Hz. Although there may be other higher frequency noise that can be detected, it is not of concern for measuring within the IMU. Figure 1 shows a method to use a decimation and FIR filter option ‘B’ to low pass filter the full bandwidth by a factor of 16.

Figure 1 The FIR filter response of the ADIS16480 (left) and an example use case of the B filter (right) where unwanted signals can be filtered to focus within the low-pass frequency bandwidth of interest.

The Kalman filter, named after electrical engineer co-inventor Rudolf Kalman, provides a different benefit as that of the decimation and FIR filter combination. The word ‘filter’ describing the Kalman filter may actually be a bit of a misnomer. It is more akin to a ‘recursive estimator’. The Kalman filter is most valuable in systems where a predicted location can be more useful than an otherwise unfiltered noisy solution that could have positional error. The Kalman filter estimates orientation angles using all of the sensor axis contributions within the IMU.

Although much more complex than a single equation, we can simplify the use case here by dropping out the state matrices and we can obtain the math shown below: We can treat each subscript k as identifying discrete time intervals or samples of each sensor axis output. The new best estimation is a prediction made from the previous best estimation, plus a gain correction weighting for known external influences. The initial Kalman Gain or Covariance coefficients are used within the IMU register settings to establish expected correlation between the Isensor output vectors. The optimal covariance values to use within the IMU can often depend on the specific observations. Therefore, it can be an iterative process of measuring, observing data, analysis, adjustment, and repeating. The ADIS16480 incorporates an internal algorithm, using innovation residuals, which can adaptively adjust the covariance terms in real time.

Figure 2 An example Kalman filter model where two variables, in this case velocity and position, have some amount of correlation. A current position can be estimated based upon the previous position, a measured acceleration value from the IMU, and the covariance weighting of the correlation between the two.

Additional sources for FIR and Kalman filtering within IMUs:

Looney, M and Romano, G AN-1157 -Tuning the Extended Kalman Filter in the ADIS16480

## 5 comments on “Kalman or FIR Filter for my IMU?”

1. DSPer
April 6, 2016

Hi. The equation you posted looks an awful lot like what we call an “exponential averager”, also called a “leaky integrator.” It's a 1st-order IIR lowpass filter.

2. mohitmannu
April 7, 2016

Hi DSPer,

The equation discussed is for a Kalman filter which is used for prediction of position. Obviously, position cannot go down zero and would always be relative till infinite time, if you add a GPS at intial/start then it would be initial + predicted change + error/noise,

The discussion of FIR is for applications needing lower bandwidth signal of interest/detection and we are trying to reduce the processing burden by band limiting the signal to the required band in an FIR and then decimating which would not reduce any information and could make the processing easier with less data..

Hope you can read through and understand the different application aspects..

Mohit

3. DSPer
April 7, 2016

Hi Mohit. Thanks for your reply. If I rewrite the article's posted difference equation in common DSP notation we have:

y[n] = ax[n] + (1-a)y[n-1]                (1)

where n is the time index, x[n] is the current input sample, y[n] is the current output sample, and 0 < a < 1.

All I was saying was that the article's posted difference equation looks like the equation describing a popular 1st-order IIR lowpass filter (an exponential averager). Based on your comment, am I correct to believe the above Equation (1) does indeed describe a Kalman filter?  Thanks.

4. Victor Lorenzo
April 8, 2016

I agree with you, this equation resembles that of the first order IIR filter, but it contains one subttle difference. In digital filter (IIR/FIR) implementations we don't make constant filter coefficient adjustments, they remain mostly constant.

This filter equation (Kalman) assumes that observations and previous results are to be used for constantly adjusting the filter transfer function.

5. jacquesfenek
August 18, 2016

What benefits for the Kalman? Equation has however succeeded air

This site uses Akismet to reduce spam. Learn how your comment data is processed.