Grade Calc - Community Project

I'm still not happy with CIQ Grade calcs. I live in Florida (mostly flat) so I really don't have a lot of real world opportunities to test Grade. On the other hand, these subtle rollers are some of the most challenging use cases to test the algorithm. The problem seems to be that barometric values aren't updated quickly - and then they tend to jump in a step function when they do change.

Even up steeper grades like Colorado passes that I got to ride last weekend, barometric data isn't smooth. A balance is needed between grade being noisey (due to barometric jumps) or slow to respond (due to smoothing out those jumps). I've tried to make the balance factor adaptive. So it detects a slope inversion or a transition to/from flat roads faster.

Even the native grade values are slow to respond. However, Garmin apparently did a lot of work on this problem in the new Garmin EDGE 1050 (according to DC Rainmaker's beta evals) and now the native grade is dramatically better. As soon as you hit a steep grade from a flat road, for example, grade will reflect a legit value, not slowly adjust over 10-15 seconds. Maybe using the accelerometer sensor to assist?

Anyway, Garmin still refuses to expose native Grade to CIQ. So we have to figure this out on our own.

I am thinking about a Community Effort to optimize the CIQ Grade calcs. I'll create a DF that only generates grade, and that writes to the FIT file, with some User Settings for various variables. I'll display the current grade as well as a line graph of grade to show how our algorithm adapts to slope changes, slope inversion, and transitions to/from flat roads. And I can display this and the EDGE's native grade on the same screen to compare.

I'll post the CIQ Code in GIT Hub and allow contributors to check out, and update. I bet we can come up with a barrel pretty quick that does a great job.

This image shows a pretty steep sustained grade (grey is the elevation profile, blue is my current GRADE calc). Now that I write a FIT graph I have more visibility into the dynamics and I clearly need to smooth it a bit more. I had tried a Kalman Filter at one point that also seemed ok, but not good enough.

If you are interested in joining the project, let me know.

  • I tend to fall into the rabbit holes of this kind, but seeing how much debate about the lag of the grade there is all over the internet, plus that people rightfully want their garmin device be the best in the market, so they compare their experience to competitors, I think it's fare to say there is a real issue here. Ang again I can only base my bad experience on my Edge Explore 2, maybe the Edge 1050 is much better. I guess some users will soon see.

  • People didn't complain (much?) about the lag for old units. I have no idea what the quality of the data was!

    Garmin (apparently) was able to improve the lag in newer units.

    Thus, a long lag isn't "fate".

    That might be already useful on smooth roads, but less useful on offroad.

    Quite a lot of people would be happy with good grade data for smooth roads.

    --------------------------------

    The lag on the inclinometer on an iPhone is near instantaneous.

    A moving average of that over 1 (or a bit more) second might be more than good enough.

    --------------------------------

    You've convinced me that using an inclinometer for rough roads wouldn't work. (But it's possible that an average over a longer period would improve this enough.)

    Seems like it could be fine (or better) for smooth roads though.

  • I don't know about how much "people" complained about it, but i definitely noticed it multiple times when I started to climb and it was still displaying 0% (or even -1) for a "long time" (you know, when you climb, time passes slowly :) and I saw that DCRainmaker also complained about it (at least in the recent video about edge1050), so it's 2 out of 2 people :) even if you don't it's 2/3 ;)

  • People complain about it for newer units and didn't for the older units.

    If you noticed it, it's likely a fair number of people noticed it too.

    This thread is predicated on there being a problem.

  • I guess that a while ago Garmin's opder devices either were better than the new devices now (before last week), or that they were at least as good as the competitors at the same time, and clearly that is not the case any more.

  • I don't think it makes much sense that the performance got worse. That they were able (apparently) to improve it makes it make even less sense.

  • I haven't follow the grade story for long, but unfortunately there are things that got worse. I have Garmin force years and I remember that the elevation calculation got suddenly worse after a firmware "up"grade. Everyone noticed and the forums were full with it. Nobody knew the reason but the gossip said that Garmin might have used some algorithm that worked well but got used by someone so had to change the algorithm, that's why it was suddenly worse and all devices got this "downgrade".

    Regressions regarding battery life are also not uncommon.

    Garmin's hardware usually improves with time, but the software isn't always. Nowadays if the forced quarterly firmware upgrade haven't screw up something that worked previously you can call yourself lucky.

  • Here are my 2 cents regarding Grade calculation:

    I have a grade display in nearly all my datafields.
    When I started to develop IQ datafields a year ago, I tried many things to get a reliable grade reading as best as possible.

    I found out:

    1) It is a big difference in grade calculation between mountainbiking and road cycling. The slower the speed on climbs - the less precise is the result of grade calculation.
    I'm doing mountainbiking only - so I focussed on that.

    2) I tried some filters like Kalman to smooth altimeter readings - and I found out, it was counterproductive.
    The altimeter readings need no smoothing as far as I have observed - they are more or less steady up on climbs, and steady down on descents. A Kalman filter did only rise the lag.

    3) The main lag results of a lag in reaction of altimeter readings.

    4) To find an optimum in lag and accuracy, one has to play with smoothing values over time.

    5) You need a speed sensor for getting reliable results. Speed/distance out of GPS is useless!

    6) I finally found out, that a time smoothing over a sample of 12 seconds delivered the best result for my mountainbiking, where climbs are done with a speed around 5 km/h.

    7) The new Edge 1050 brings a new experience in altimeter and grade accuracy. I do not own this device yet, but luckily Garmin released a Beta 23.09 for Edge 1040 with the new accuracy of Edge 1050.
    So, I was able to play around with the new experience.

    For my Edge 1040 with this beta I found out:
    -with a sample of 5 seconds the grade readings on my datafields are nearly the same as Garmin's. But for the slow speed during MTB climbs, grade overshoot: jumps too much (Garmin's as well!).
    -with a sample of 7 seconds I got good results in balance of accuracy and lag.

    If you want to play with this values, too:
    you can download my datafields "Edge Radar Overlay" - the main and clone #2.
    (no need to connect to a radar!)

    https://apps.garmin.com/apps/03f85cb9-bf83-490d-86ca-63525d720f51

    apps.garmin.com/.../0808f5d5-d2bb-4534-96b7-11d09bf40986

    Set one datafield to Grade, and select sample rate in settings (possible on the fly during tests...).
    And set the clone to Elevation (which I spent a decimal place for that).
    As third datafield set Garmin's original Grade field.
    Now you can play around and compair!

    Ok, that's my own experience...

  • As far as I can guess Garmin uses the barometer for elevation, so they smooth it out, probably similar to how you smooth things, and from the comparsion of the old 1040 behavior with the new 1040 it sounds like they decreased the time they smooth it over, that explains why it is faster now (less lag), and I'm not sure about the new grade overshoot thing. How do you know the correct actual value? Or maybe I didn't understand what you mean by overshoot.

    Anyway if you use elevation as input to your grade calculation, and you smooth it, then you got the raw barometer data -> garmin smoothed it over some time to get the elevation -> you smoothed over 12/7 seconds to get the grade, in other words it's smoothed twice, and there are 2 lags in it. If you would use the barometric pressure and do your smoothing from that, then I THINK you might be able to get a smaller lag (and maybe even more precise data)

  • If you would use the barometric pressure and do your smoothing from that, then I THINK you might be able to get a smaller lag (and maybe even more precise data)

    …a good idea! Thumbsup