Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

algorithm/theory for GPS position jitter removal

Tags:

java

android

gps

I'm trying to write a GPS tracking (akin to a jogging app) on android and the issue of GPS location jitter has reared it's ugly head. When accuracy is FINE and accuracy is within 5 meters, the position is jittering 1-n meters per second. How do you determine or filter out this jitter from legitimate movement?

Sporypal etc apps clearly have some way they are filtering out this noise.

Any thoughts?

like image 368
corrumpu Avatar asked Feb 07 '12 21:02

corrumpu


1 Answers

Could you just run the positions through a low pass filter?

Something of the order

x(n) = (1-K)*x(n-1) + K*S(n)

where

S is your noisy samples and x, the low pass filtered samples. K is a constant between 0 and 1 which you would probably have to experiment with for best performance.

Per TK's suggestion:

My pseudocode will look awfully C like:

    float noisy_lat[128], noisy_long[128];
    float smoothed_lat[128], smoothed_lon[128];
    float lat_delay=0., lon_delay=0.;

    float smooth(float in[], float out[], int n, float K, float delay)
    {
       int i;

       for (i=0; i<n; i++) {
          *out = *in++ * K + delay * (1-K);
          delay = *out++;
       }

       return delay;
    }

loop:    
    Get new samples of position in noisy_lat and noise_lon

    // LPF the noise samples to produce smoother position data

    lat_delay = smooth(noisy_lat, smoothed_lat, 128, K, lat_delay);
    lon_delay = smooth(noisy_lon, smoothed_lon, 128, K, lon_delay);

    // Rinse. Repeat.
    go to loop:

In a nutshell, this is a simply a feedback integrator with a one-sample delay. If your input has low frequency white-ish noise on top of the desired signal, this integrator will average the input signal over time, thus causing the noise components to average out to near zero, leaving you with the desired signal.

How well it works will depend on how much noise your signal has and the filter feedback factor K. As I said before, you'll have to play around a bit with the value to see which value produces the cleanest, most desirable result.

like image 127
sizzzzlerz Avatar answered Oct 07 '22 19:10

sizzzzlerz