sfwa/ukf

Question: Multiple measurements from the same sensor between updates

Closed this issue · 1 comments

If for a given sensor (such as a single IMU) I have between 0 and n measurements between updates, with each measurement having a timestamp, how can this be modeled in your library? I could add a time field to the measurement, but I can only see a way of adding one measurement per sensor, how can I add an arbitrary number.

In the case you’ve described (a sample rate for the sensor which is higher than the Kalman filter update rate), I would suggest that it’s better to do some decimation filtering on the samples before providing the Kalman filter with a single filtered measurement per update.

This could be as simple as averaging all the samples received in one Kalman filter period, or something more sophisticated like a CIC filter or some kind of minimum-phase IIR low-pass filter with an appropriately set cutoff frequency to avoid aliasing at the Kalman filter update rate.

If your sensor has a non-uniform sample rate where you may receive a variable number of samples per Kalman filter update, you could represent this by adjusting the measurement covariance for the sensor in each period based on the number of samples received (for instance, using a smaller covariance for a larger number of samples). This would make the Kalman filter weight the sensor more heavily in periods where it receives more samples.

In general, since the samples all come from the same sensor, there is no advantage to including them separately within the Kalman filter measurement model as each would have the same expected measurement within a given period (as the system process model is discretised at the filter update rate).