4

I have a sequence of gps values each containing: timestamp, latitude, longitude, n_sats, gps_speed, gps_direction, ... (some subset of NMEA data). I'm not sure of what quality the direction and speed values are. Further, I cannot expect the sequence to be evenly spaced w.r.t. the timestamp. I want to get a smooth trajectory at an even time step.

I've read the Kalman Filter is the tool of choice for such tasks. Is this indeed the case?

I've found some implementations of the Kalman Filter for Python:

These however appear to assume regularly spaced data, i.e. iterations. What would it take to integrate support of irregularly spaced observations?

One thing I could imagine is to repeat/adapt the prediction step to a time-based model. Can you recommend such a model for this application? Would it need to take into account the NMEA speed values?

moooeeeep
  • 31,622
  • 22
  • 98
  • 187
  • did you find any answers to this you self? – Poul K. Sørensen Sep 06 '14 at 16:10
  • @pksorensen Eventually I didn't needed to (yet) - but as I re-read the question now, it might be a little to fit this site. – moooeeeep Sep 06 '14 at 16:28
  • sure. Kalman filter should be a good tool for this though. Just looking for implementation details and ran across the question – Poul K. Sørensen Sep 06 '14 at 18:15
  • How far apart are the points you want to interpolate between? What is the object being tracked - if it is a plane, interpolation is simple, cars - not so much, people - very difficult. The interpolation algo can be made simpler and more accurate if you can make some assumptions about motion behavior of the object. Also are sensors like compass, accelerometer, gyro, altimeter available? – Dojo Oct 11 '14 at 15:20
  • @Dojo Usually the distance between successive points is up to few meters, with updates every <5 seconds. It's recorded in a car. The vehicle's speed is usually available. No compass, gyro, or IMU is available. – moooeeeep Oct 11 '14 at 18:36

2 Answers2

1

Having looked all over for an understandable resource on Kalman filters, I'd highly recommend this one: https://github.com/rlabbe/Kalman-and-Bayesian-Filters-in-Python

To your particular question regarding irregularly spaced observations: Look at Chapter 8 in the reference above, and under the heading "Nonstationary Processes". To summarize, you'll need to use a different state transition function and process noise covariance for each iteration. Those are the only things you'll need to change at each iteration, since they're the only components dependent on delta t.

Chad Kennedy
  • 1,716
  • 13
  • 16
1

You could also try kinematic interpolation to see if the results fit to what you expect.

Here's a Python implementation of one of these algorithms: https://gist.github.com/talespaiva/128980e3608f9bc5083b