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.

  • So you're trying to do everything that the edge is already doing? How do you "calibrate" the elevation? Just accepting what Garmin gives you at the start of the DF? Or it doesn't matter because this POC is for grade calculation, not for continous elevation calculation based on some algorithm that is maybe better than Garmin's?
    Also wouldn't it be interesting to display both Garmin's elevation and grade and your calculation?

  • remember, the pressure can change if you stand in the same place long enough.  Say there is a front moving in

    Not going to affect grade much (not really at all).

    Counting floors is also done with the baro, and I've seen "floors" if I'm in front of a vent when the AC kicks on.

    How do you manage to get anything done? This is a fairly pathological example. It's a barometer. It has limitations. Nothing is perfect. You know that GPS doesn’t really work indoors, right?

    People would be happy to get better values for regular, normal situations. They aren't going to care about odd/rare situations.

  • Toybox.Activity.Info.altitude 

    The altitude above mean sea level in meters (m).

    Elevation is derived from the most accurate source: Barometer or GPS

    So if you have good gps you should have good altitude, planes based on gps data so I think it's enough to bicycle ride.

  • perfect is the enemy of good. it’s easy to shut down any criticism of the status quo, any attempts to improve things, any feature requests and/or any debatable bug reports by saying the alternative isn’t perfect. it’s also a fun debating tool if you like being a contrarian for its own sake.

    I see this a lot when ppl criticize garmin products in general. “you know apple/suunto/polar aren’t perfect, right!!!1!”

  • "Elevation is derived from the most accurate source: Barometer or GPS"

     

    I think this is a key part of the problem.  How does garmin determine which source IS the most accurate at any point in time?  Is it just if there is no GPS signal that it uses Barometric?  

    I'm keen to see the results from Dave's test DF to compare baro readings (and derived alt calculation) to the garmin "altitude" reading…  (I'm not riding at the moment otherwise I'd test it too).

  • In my own tests of a device with a baro altimeter and one without at the same time, what I see on watches themselves, GPS is far less accurate,  When you upload an activity to Garmin Connect, if there isn't a baro, GC by default applies elevation correction making the data look much better. 

  • GPS was designed more for horizontal measurements. Also, being off by 1000 ft horizontally is no big deal while being off by 1000 ft is something people start caring about.

    Barometers are much more sensitive and better-suited for grade (which is being measured over short distances).

    For elevation, Garmin considers barometric data as higher quality than GPS data.

    GPS is used when a barometer isn’t available. 

    Garmin Connect turns off the elevation correction if the device has a barometer.

  • So if you have good gps you should have good altitude, planes based on gps data so I think it's enough to bicycle ride.

    Not the same thing. 

    Airplanes are traveling much, much faster than bicycles (which could be as slow as 3 mph going uphill). Being faster means getting better data (the signal to noise ratio is much better).

    Pilots only care about absolute elevation. Cyclists care about changes in elevation. Also, airplanes will generally have better access to more satellites (giving better accuracy).

  • I don't think planes use GPS for altitude measurement. Maybe if both the other sensors are dead.

    Firstly they use barometer + frequent reports from nearest airport's weather station to calibrate the airports's known altitude above the see with the measured ambient pressure => from the difference they know their altitude over the airport.

    Secondly, mainly during landing, they use radio altimeter, where a device emits radio signals downward and measure the reflection. This is very precise over land, not so much over water.

    While airplanes do care about grade, mostly to fit the appropriate glide slope on landing, they measure it in feet per minute, and though they usually descend with a rate of a few hundred feet per minute to 1500 ft/min (hardly more) they also travel lot horizontally in a minute, even when landing (slowest).

    This thread in the forum is not about elevation, it's about grade. I don't think the Garmin grades are off by value (I have no way to know, but never heard about that problem), the problem is that when grade is changing it takes lot of time to adjust. Often I reached the top of a hill, started a downhill, I look at it and it's still showing some positive grade.

  • I don't think planes use GPS for altitude measurement.

    It looks like they can/might.

    https://pilotinstitute.com/altimeter-vs-gps-altitude/

    https://pilotworkshop.com/tips/vfr_altitude_gps/

    While airplanes do care about grade, mostly to fit the appropriate glide slope on landing, they measure it in feet per minute, and though they usually descend with a rate of a few hundred feet per minute to 1500 ft/min (hardly more) they also travel lot horizontally in a minute, even when landing (slowest).

    Err. Forgot about the glide path thing. Still it's fits with what I said about being faster giving better data.

    In any case, I'm not sure if the issues with airplanes/flying has much to do with cycling.

    This thread in the forum is not about elevation, it's about grade.

    The Garmins measure grade by determining elevation (and distance). While grade doesn't require accurate absolute elevation, it does require accurate relative elevation.

    the problem is that when grade is changing it takes lot of time to adjust.

    It's not clear why there's this lag. I don't think it's a lag in measuring pressure or location.