filterkalman-filtersensor-fusion

How to deal with asyncronous data in a kalman filter


I'm implementing a Kalman Filter which fuses 3d position data (provided from 2 different computer vision algorithms). I am modeling the problem with a 9-dimensional state vector (position, velocity, and acceleration). However, the data from each sensor does not come at the same time. Since I compute the velocity by considering the time step between the reception of the previous data and the current data point, two consecutive data points can be quite different but separated by only a very small time step, thus making it seem like the position has changed rapidly.

I am wondering if anyone has insight or direction on the best way to approach this problem- will the kalman filter itself be tolerant of this behaviour? Or should I place all data received within a time window into a bin, and perform the update/predict cycle less frequently on a batch of data? The resources I've seen for utilizing kalman filter in object tracking have used only one camera (i.e. synchronous data), so I'm having trouble finding information related to my use case.

Any help is very much appreciated! Thank you!


Solution

  • From all what I got to know from your question and our conversation in the comments let me first shortly describe the issue and suggest the solution.

    A quick recap

    You have a system with two independent sensors, which take measurements with different rates (30Hz and 5Hz) (and maybe have some time jitter). The good news is that each such measurement is completely sufficient to proceed an update step of your kalman filter. Each measurement have a time stamp.

    Another important point is, that the measurements (maybe) have poor precision, so that the change in position looks not plausible.

    A possible solution

    1. Define a smallest time interval for calling your kalman filter, so that none of the recieved measurements has to wait too long to be processed. It looks for me like a 100Hz rate could be a good first choice. In this case your dt would be 0.01s.

    2. Design your F and Q matrices based on the chosen dt (they both strongly depend on this value).

    3. In each call without measurement execute the prediction step. As soon as a measurement comes, do update. So your call sequence would look like:

    call sequence:

     init()
     predict()
     predict()
     predict()
     predict()
     update(sensor1)
     predict()
     update(sensor2)
     update(sensor1)
     predict()
     predict()
     update(sensor1)
     predict()
     and so on...
    
    1. To deal with the precision issue you could use a reference signal (the ground truth). Analyze the error in each sensor reading for each signal (x, y, z) compared to the reference. A kalman filter can work well ONLY with readings, whose error is normally distributed with a zero mean. If you see some systematical offset, may be you can get rid of it. From the observed error you can calculate the standard deviation (and the variance), so you can tell your filter how good the measurements are. It will be your R matrix.

    2. If you don't have a reference you can take some measurements while standing still on the same place. So your reference position would be constant and you could have a look at the dispersion of the readings.

    3. Tune elements of your Q matrix and describe the possible dynamic of your state elements. A smaller Q element for position would tell the filter not to change it too fast. So the (possible) poor performance of your sensors will be partially eliminated (think of a low pass filter as intuition).

    I hope it can help you. Please correct me if I understood something wrong. It would be helpful to see a plot of your sensor readings (and if possible of the reference trajectory).