views:

511

answers:

3

Working on a tracking application using GPS. It is all fine, but sometimes because of the closed areas or bad weather I get inaccurate points. When you plot them, it just doesn't look right, with lots of hops/jumps.

What algorithm should I run to filter out the bad signals It looks like an application of a blurring algorithm to me, but what do you think?

+2  A: 

Use Kalman filter.

Quassnoi
+6  A: 

There are a few options:

  1. Throw out the outliers
  2. Filter
  3. Use a better GPS
  4. Use an external data source (snap to road)
  5. Combination of the above

I like to use filters - A Kalman filter is the typical (and often best) solution - it uses an amount of predictive averaging which is better than a cheap IIR (Infinite Impulse Response) filter:

FilteredValue = FilteredValue * 0.75 + NewValue * 0.25

You can get GPS modules which give you 4-5 fixes per second, which will allow you to use the above 'cheap' filter with reasonable response times.

You can also simply get a better GPS (SiRF III or better) that isn't as noisy and has better indoor reception (where possible).

Consumer GPS units "snap to road" where possible, so errors off the road are not seen by the consumer, as well as a few of the other techniques.

A Kalman isn't easy to implement, but without an external dataset or sensor (such as road speed), it's the best option. Check out http://www.google.com/search?q=open%20source%20kalman%20filter for code and tutorials on it.

Adam Davis
+3  A: 

re: filtering in the presence of "pop" noise--

One of the easiest ways I've found to do this is:

delta = newValue - filteredValue;
delta = delta > LARGEST_SANE_DELTA ? LARGEST_SANE_DELTA
     : (delta < -LARGEST_SANE_DELTA ? -LARGEST_SANE_DELTA : delta);
filteredValue += alpha*delta;

where alpha = 1/tau and tau is the time constant of the low-pass-filter in question, expressed in multiples of the time between iterations of the above code. The value LARGEST_SANE_DELTA represents a large possible change in newValue and clips excessively large variation in input. There are perhaps better ways of rejecting this type of noise, but they are more complicated, and the one I mentioned is pretty simple.

Jason S