• All credit to Wouter Bulten for a light weight javascript kalman filter : https://github.com/wouterbulten/kalmanjs­

    Included the library and :

    var spdFilter = new KalmanFilter({R: 0.01, Q: 2});
    var altFilter = new KalmanFilter({R: 0.01, Q: 2});

    Use the two filters to smooth the speed and alt values of each successive fix :

    // Smooth data

    if ( lf.smoothed !== 1 ) {
      lf.speed = spdFilter.filter(lf.speed);
      lf.alt = altFilter.filter(lf.alt);
      lf.smoothed = 1;
    }
    

    I haven't tried it on the lat/lon position values as the app is not about position as such so would be interested in the results of that. Alt was varying by as much as 10-15 m when stationary but with this filtering is now stabilising within 1-2m of known altitude references. Good enough for what I need.

About

Avatar for user125066 @user125066 started