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 wonder if just using an inclinometer would be a better way of measuring grade.

    The following likely doesn't stream grade values and it might not have sufficient battery life. But it doesn't seem too far off from something that would work.

    www.sra-shops.com/.../

  • IMHO the lag is because Garmin has to do SOME smoothing, otherwise  you would look like you're jumping up and down (this is even true, when you just sit in a room and look at the raw barometer readings, even more so when you're riding a bike - even on smooth surface, not to talk about real jumps with som mountain bike on a downhill - or just think about a runner, who inevitably jumps up-down about 8-10 cm with each step) and either they didn't think the lag will matter to users, or they had some problem shortening it until now (which according to DCRainmaker should be improved how on x40, x50 devices - I hope it'll also come to edge explore 2 soon...)

  • I know these inclinometers from woodworking :) Though I haven't tried them personally. In theory you could glue one on your bike's frame, but I'm pretty sure the same problem that Garmin has with the barometer would happen:

    these are designed to be held absolutely motionless for a few seconds, which make sense for woodworking or building construction, but wouldn't make sense on a bike even on smooth road. So to make it give some reasonable values they would need to smooth it out somehow, and then the same issues with some amount of lag will arise.

  • Of course, you'd have to do some data smoothing. Nothing indicates (AFAIK) they'd be as problematic as barometers or that one couldn't make it work.

    You need a precise and stable measurement for woodworking. You definitely don't need that for cycling. So, the woodworking case might be misleading (kind of like talking about airplanes): it's a different use case (with different expectations).

    It's possible that the wouldn't need the same lag. Heck, apparently, the barometer doesn't need the same lag (Garmin reduced it recently).

    Note that the inclinometer is only dealing with one number. The grade currently is dealing with two numbers (each with their own independent variability).

  • Inclinometer IMHO deals with at least 3 numbers: accelerometer x,y,z. Though I can see how you call this 1 "thing".

    Grade: as far as I understand: elevation and time or barometric pressure and time or GPS altitude and time, though I think we can agree that the time part shouldn't be a problem for a watch maker :) 

  • It certainly could be worse! You only need one number. It's possible that the data from the inclinometer produces better results than using a barometer and the GPS (which isn't very good for very small distances).

  • I'm not sure about specific edge devices, but it probably doesn't matter for this discussion. At least some of the Garmin devices (i.e some of my watches) have accelerometer. I'm pretty sure that that is actually the raw data for these inclinometers. So from here it's just software...

    BUT that would only give you some (more or less accurate) incline of let's say your frame (compared to some calibrated 0%) at any "given time" (where maybe the real world use case would mean it's smoothed over a few seconds) That might be already useful on smooth roads, but less useful on offroad. Think about a dirt road going uphill. You could go and measure the elevation difference over 10 meters very accurately (not by Gramin) and sat: this portion of the hill has 3.56% grade, but then you ride up the same 10 meters and because of the bumps, stones, tree roots you would see many different numbers ranging from let's say 1-5%. So I can see why Garmin choose the barometer and not the accelerometer to calculate grades.

  • Maybe, using the barometer and GPS is a bad way of measuring grade and not worth spending time improving.

    The rough terrain could be an issue.

  • This is also getting to a philosophical debate. What is the grade of an offroad dirt road? It's similar to what is the length of the coast of the UK. Depending on the scale (i.e 1km, 10m, 1cm, 1mm, atomic) you could have measurements that differ in at least 2 orders of magnitude I guess.

    As for a grade: on a bumpy road maybe one user would like to see the actual inclination of the frame at every given second, and maybe other user would prefer to see something that is more like: how much height I gain in 10 seconds. Of course in this case (unless you go to meaninglessly small scales on the order of the size of stones or sand particles, or for that matter anything less than the distance between your bike's axles, so for the sake of this argument we could agree anything less than 1m) is not relevant

  • This is also getting to a philosophical debate. What is the grade of an offroad dirt road?

    This is a basic problem of grade. And of elevation gain. It might be a reason not to worry too much about it.