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.
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
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
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.