Sensor fusioning with Kalman filter

Viewed 18331

I'm interested, how is the dual input in a sensor fusioning setup in a Kalman filter modeled?

Say for instance that you have an accelerometer and a gyro and want to present the "horizon level", like in an airplane, a good demo of something like this here.

How do you actually harvest the two sensors positive properties and minimize the negative?

Is this modeled in the Observation Model matrix (usually symbolized by capital H)?


Remark: This question was also asked without any answers at math.stackexchange.com

3 Answers

The gyro measures rate of angle change (e.g. in radians per sec), while from accelerometer reading you can calculate the angle itself. Here is a simple way of combining these measurements:

At every gyro reading received:

angle_radians+=gyro_reading_radians_per_sec * seconds_since_last_gyro_reading

At every accelerometer reading received:

angle_radians+=0.02 * (angle_radians_from_accelerometer - angle_radians)

The 0.02 constant is for tuning - it selects the tradeoff between noise rejection and responsiveness (you can't have both at the same time). It also depends on the accuracy of both sensors, and the time intervals at which new readings are received.

These two lines of code implement a simple 1-dimensional (scalar) Kalman filter. It assumes that

  • the gyro has very low noise compared to accelerometer (true with most consumer-grade sensors). Therefore we do not model gyro noise at all, but instead use gyro in the state transition model (usually denoted by F).
  • accelerometer readings are received at generally regular time intervals and accelerometer noise level (usually R) is constant
  • angle_radians has been initialised with an initial estimate (f.ex by averaging angle_radians_from_accelerometer over some time)
  • therefore also estimate covariance (P) and optimal Kalman gain (K) are constant, which means we do not need to keep estimate covariance in a variable at all.

As you see, this approach is simplified. If the above assumptions are not met, you should learn some Kalman filter theory, and modify the code accordingly.

Related