• I'm thinking about how to improve navigation to waypoints and routes and what is / what is not possible.

    Did some experiments with the GPS against my Garmin eTrex and noticed at one point I seemed to be suddenly 20m from my previous position when in fact I was standing still. The eTrex kept solid but the UBLUX GPS wobbles a fair amount.

    I wrote some code that set the GPS in SuperE mode and waited for at least 2 fixes then started to log the distance, average and max distance between subsequent fixes. The results are below:

    distance: 3
    avg=3.36624203821 max_dist 18

    So it might be necessary in some situations to use a rolling average of 3-5 fixes (when stationary).

  • That is surprising - although maybe it suddenly got another satellite and then updated its position?

    Definitely when I've graphed the data from the GPS logger I see the GPS location move around a little sometimes, but probably only by 5m or so.

    Did you use the AGPS upload beforehand? It might help with this kind of thing

  • I didn't use the AGPS but I had previously been doing a lot of testing with the GPS on so it should have been warmed up to recent satelite positions. I am assuming here that AGPS just speeds up the first satelite aquisition phase and once you have had a recent fix (last 5-10 minutes) it does not take very long to get a fix again and at that point AGPS would not make any difference ? I can still see this kind of behaviour when I stand on a spot I can see the lat/lon switching around which is why I wrote some code to work out the average and max differences between 2 fixes from the same spot.

  • I'm not 100% sure - I thought AGPS contained some correction data as well, but I may be wrong there.

    It looked from the UBlox docs like it was possible to set certain 'modes' like walking/driving/etc. It might be that if the walking mode is enabled, it employs some more sensible filtering to the data to stop it jumping around.

    Until recently BangleRun had a Kalman filter (it stopped working after a change to how GPS coordinates were grabbed and I felt like the bet option was to remove it). As I understand it, the kalman filter effectively looks at the GPS coordinates and how confident the GPS is of them, and updates the position by an amount based on that.

    It would likely remove a lot of jitter from GPS coordinates. Actually because the on('GPS,...)` event passes the same object between all event handlers, it would be possible to make a 'kalman filter' widget that you could just install and which would magically filter all GPS coordinates for you

  • Its not that big an issue really. Unless you want to find geocaches you dont need 1m accuracy. It is just something to take into account when writing waypoint and route following Apps. I'm thinking once you get within 20m of the target you have effectively arrived.

    I'll pass on the Kalman filter for now. I have walkers waypoint finder app in progress and after that I am thinking about looking at the GPS rceorder to setup from parameters to control the frequency and distance between logs.

  • Yes, not sure if you spotted this but there's kindof a running/route following app at https://banglejs.com/apps/#route

    The 'near enough' value I used for that was 30m :) https://github.com/espruino/BangleApps/b­lob/master/apps/route/custom.html#L110

  • Currently testing an updated version of speedalt (GPS Adv Sports) app that I have included a Kalman filter in for both the alt and speed readings. Massive improvement in reading stability and has completely stopped readings jumping around with each gps fix. Alt will now stabilise on a surprisingly accurate figure within 60 seconds or so.

  • Great! Would you be willing to share your Kalman filter code?

    I think I mentioned in another thread but it would be possible to turn it into a Widget, such that you could install it and improve accuracy in all applications that used the GPS.

  • 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.

  • Nice! There is a dop value in the GPS fix which is an indication of how accurate the GPS fix is, and it's possible to feed that into the Kalman filter (somehow!).

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview

GPS accuracy when sat on a window ledge, avg distance between fixes = 3.36m, max dist = 18m

Posted by Avatar for HughB @HughB