Reputation: 27
I have real-time GPS data coming at 5 updates per second. On average 80% of the data is fairly accurate; but around 20% of the data is jerky. Plus occasionally we also get an outlier i.e. an erroneous data point far away from the actual trajectory.
I am looking for an algorithm that could me do achieve the following:
To give some context, I first searched stackoverflow.com site for some similar topic and found the following link:
My software engineer implemented the KalmanLatLong routine that was provided in the above link; but we encountered the following issues:
The algorithm is lagging behind meaning while the algo is generating extrapolated values, more GPS data points arrive (remember the data is coming in real-time).
In case of an occasional outlier, the algo smooths it out is well. Whereas out goal is to eliminate such outliers because they are erroneous data.
I am looking for an algorithm that could work in real-time and handle GPS updates at 5 Hz and smoothen the data while eliminating outliers.
Your help would be highly appreciated.
Upvotes: 2
Views: 5873
Reputation: 4431
You can incorporate observation rejection within the kalman filter itself. This is sometimes called data snooping.
I'll suppose that you have the simple case where you have just the GPS data and want either to incorporate an instant's measurments, or throw them all away (rather than throwing away just the latitude say).
The notation is conformant with the Wiki article
In the update step, compute
V = y'*inv(S)*y
(y is the residual vector, S the residual covariance) If your filter is correctly tuned, this has a a chi-square(2) distribution, if you are using just lat and lon, or chi-square(3) if you are using height too. If V exceeds say the upper 0.1% percentile of this distribution, reject the observations, ie do not compute the gain or update your state or state covariance.
Upvotes: 1
Reputation: 11968
A basic approach could be like this:
You need to experiment with values for X, P and threshold and see what works for you. What's good for high speed racing is not good for walking applications. Also add a check if you have too many extrapolated nodes since that means that this algorithm thinks most of the data is wrong and that shouldn't be true. You can empty the list of points and start from scratch.
Upvotes: 1