B2 GPS accuracy after AGPS is very good.

Posted on
  • I ran the code below after downloading from the AGPS app and was delighted to see that
    when it is stationary the GPS is really accurate and hdop was coming back as 0.8.
    It took quite a while for the max difference between points to reach 1.
    This means taking a fix every second on a B2 after its had AGPS is not going to cause any issues with apps like run.

    I did something similar on Bangle 1 (but AGPS mind) and it came out as a max of 18m between points.

    { "lat": 54.93713, "lon": -1.59312883333, "alt": 121.5, "speed": 0,
      "course": 0,
      "time": Date: Thu Jan 20 2022 21:59:14 GMT+0000,
      "satellites": 12, "fix": 1, "hdop": 0.8 }
    distance: 0
    avg=0 max_dist 0
    { "lat": 54.93713033333, "lon": -1.59312883333, "alt": 121.5, "speed": 0,
      "course": 0,
      "time": Date: Thu Jan 20 2022 21:59:15 GMT+0000,
      "satellites": 12, "fix": 1, "hdop": 0.8 }
    distance: 0
    avg=0 max_dist 0
    >
    
    let last_fix = {
      fix: 0,
      alt: 0,
      lat: 0,
      lon: 0,
      speed: 0,
      time: 0,
      satellites: 0
    };
    
    function radians(a) {
      return a*Math.PI/180;
    }
    
    function degrees(a) {
      var d = a*180/Math.PI;
      return (d+360)%360;
    }
    
    function distance(a,b){
      var x = radians(a.lon-b.lon) * Math.cos(radians((a.lat+b.lat)/2));
      var y = radians(b.lat-a.lat);
      return Math.round(Math.sqrt(x*x + y*y) * 6371000);
    }
    
    var total_dist = 0;
    var max_dist = 0;
    var avg_dist = 0;
    var fix_cnt = 1;
    
    function onGPS(fix) {
      if (fix.fix) {
        if (fix_cnt < 2) {
          last_fix = fix;
          fix_cnt++;
          return;
        }
        
        fix_cnt++;
        console.log("\n");
        console.log(fix);
        var dist = distance(last_fix, fix);
    
        last_fix = fix;
    
        console.log("distance: " + dist);
        if (dist > max_dist) max_dist = dist;
        total_dist = total_dist + dist
        avg_dist = total_dist / fix_cnt;
        console.log("avg=" + avg_dist + " max_dist " + max_dist);
    
      } else {
        console.log("Sats: " + fix.satellites);
      }
    
    }
    
    Bangle.setGPSPower(1);
    Bangle.on('GPS',onGPS);
    
  • That's great! Looks really promising

  • What does this do?

  • Switches on the gps
    Waits for a proper fix
    Waits for the next fix
    Works out the distance between 2 fixes and the next and the next.

    If the GPS is good and stationery the distance between two fixes should be zero. A bad or inaccurate GPS might have as much as 20m between 2 stationery fixes.

    Leave it running a while and it will show you the average and the max.

  • How can the script be used for an outdoor trip?

  • Suggest that you use one of the existing GPS apps in the App loader. This script was just a quick hack to show the gps accuracy for discussion.

  • @HughB my problem is that GPS accuracy is lacking for me. So the question how could I help to debug the situation. I've thought this script could make my problem report more detailed, but I had no quick idea how to run it, when being on the road.

  • GPS accuracy depends on how many satellites are visible and where they are in the sky. The more satellites, the better it is. Also, where they are in the sky is important. It is best if they are not grouped together in one part of the sky and also if they are not too low to the horizon.

    As an example, I tracked my run this morning and there were times when GPS lock was lost. Note some of the distances between points were huge. Typically, they would be about 10m or so.

    The satellite skyplot that I generated from the Trimble website show where the satellites were in the sky at the beginning of my run and the projected paths for the next 6 hours. There were 7 satellites visible but two were low in the sky and were setting. Four satellites are required for a 3D fix.


    2 Attachments

    • skyplot1.jpg
    • track1.jpg
  • my problem is that GPS accuracy is lacking for me.

    So what does this mean in practice for you. What app are you using to use the GPS on a Bangle JS2. What are your expectations ? What are your observations ?

  • What app are you using to use the GPS on a Bangle JS2.

    gpsrec
    set to record a point every 3 seconds (because with Bangle JS1 that was the presumed interval that the old banglerun app used to make it comparable).

    What are your expectations ?

    Expecting that: Accuracy is on par with Bangle JS1, my smartphone or in the range of the 2.5m precision as I remember reading in the technical specs for the new chip. (This seems possible from the satellites, urban and weather conditions as BangleJS1 and my mobile can do it in the same track.)

    What are your observations ?

    Testing is mainly done outside away from buildings.
    Accuracy is off more than 2.5 meters, sometimes a lot, the picture of @BillM above is comparable in parts.
    Comparison with maps from the Bangle JS1 and my smartphone show that more precision is possible with the satellites.

    Conclusion: We either have a GNSS chip that is significantly less accurate than others, or there are missing settings that could be tuned.

  • Bangle 1 in my experience was only accurate to within 20m. 2.5 is extremely good accuracy.
    The only application I can think of where you might need better than 2.5m accuracy is geo-caching. Different chips will have different accuracy, you cant expect them to be the same. These chips will be priced down to rock bottom, probably less than $1. At that price compromises will be made (eg quality control).

  • I posted a reply in another thread about GPS recently but the US's own website states they expect ~5m from a phone (where it can download live correction data), so I'm really not sure where the 2.5m figure came from - if you achieved that, it may have just been by chance you had extremely good conditions that day

  • Accuracy also depends on an antenna, and even on a ground plate.
    The 2.5m accuracy stated in a chip's docs usually presumes a good (active) antenna, good ground plate and good weather and sky conditions.
    The antenna in the watch is very little, passive, and there is no ground plate.
    So, we should not expect, the accuracy will always be high.
    I am working on speedometer app, it uses Doppler velocity from GPS fixes (rather then calculates speed from coordinates). Though it can detect correct speed (compared to car speed), very often time lag can be up to minute. Like, I am driving already 40 km/h, but the watch still shows 10 km/h, then after ~40 sec, it finally shows 40 km/h.
    This is kind of frustrating, but I understand why it cannot be precise enough.
    I am thinking about to use a separate GPS unit with bigger antenna, and use the watch as a display only, sending data via Bluetooth.

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

B2 GPS accuracy after AGPS is very good.

Posted by Avatar for HughB @HughB

Actions