Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sensor fusioning with Kalman filter

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

like image 620
Theodor Avatar asked Oct 19 '10 07:10

Theodor


People also ask

Is Kalman filter used for sensor fusion?

Specifically, Kalman filters are used in Sensor fusion. Sensor fusion helps to determine the State (and also the overall Context) of an IoT based computing system which relies on inferring the combined meaning from different sensors.

What is sensor fusion technique?

Sensor fusion is the ability to bring together inputs from multiple radars, lidars and cameras to form a single model or image of the environment around a vehicle. The resulting model is more accurate because it balances the strengths of the different sensors.

What are the types of sensor fusion strategies?

With respect to the abstraction level of data processing, Multi-sensor fusion has been classified into three categories [6,18]: fusion at the data-level, fusion at the feature-level, and fusion at the decision-level.

Is sensor fusion a machine learning?

TinyML, Machine Learning. Sensor fusion is a popular technique in embedded systems where you combine data from different sensors to get a more encompassing or accurate view of the world around your device.


2 Answers

Usually, the sensor fusion problem is derived from the bayes theorem. Actually you have that your estimate (in this case the horizon level) will be a weighted sum of your sensors, which is caracterized by the sensor model. For dual sensors, you have two common choices: Model a two sensor system and derive the kalman gain for each sensor (using the system model as the predictor), or run two correction stages using different observation models. You should take a look at Bayesian Predictors (a little more general than Kalman Filter) which is precisely derived from minimizing the variance of an estimate, given two different information sources. If you have a weighted sum, and minimize the variance of the sum, for two sensors, then you get the Kalman Gain.

The properties of the sensor can be "seen" in two parts of the filter. First, you have the error matrix for your observations. This is the matrix that represents the noise in the sensors observation (it is assumed to be zero mean gaussian noise, which isn't a too big assumption, given that during calibration, you can achieve a zero mean noise).

The other important matrix is the observation covariance matrix. This matrix gives you an insight about how good is the sensor at giving you information (information meaning something "new" and not dependent on the other sensors reading).

About "harvesting the good characteristics", what you should do is do a good calibration and noise characterization (is that spelled ok?) of the sensors. The best way to get a Kalman Filter to converge is to have a good noise model for your sensors, and that is 100% experimental. Try to determine the variance for your system (dont always trust datasheets).

Hope that helps a bit.

like image 54
Pablo Hevia-Koch Avatar answered Oct 04 '22 12:10

Pablo Hevia-Koch


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.

like image 27
Ahti Avatar answered Oct 04 '22 14:10

Ahti