Cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Some altitude help required please ...

I am attempting to ascertain the total ascent and descent during an activity.

 

Can anyone see anything wrong with the logic below please:

 

if (this.altitude>this.lastAltitude) {
  this.totalAscent+=(this.altitude-this.lastAltitude);
} else {
  this.totalDescent+=(this.lastAltitude-this.altitude);
}
this.lastAltitude=this.altitude;

 

The reason I ask is that I appear to be a factor of 10 out from what I expect (getting 490m instead of 49m). The above code is run on each geolocation watch update. I am comparing to my Suunto Ambit results so know roughly what to expect.

Best Answer
0 Votes
5 REPLIES 5

Must be an issue of GPS accuracy. It typically ranges from 6 to 20 meters. GPS position randomly jumps in a circle of such a size every second. I doubt your vertical speed is comparable to 1 meter per second, therefore it's hard to get the reliable data from GPS in your case. Therefore, taking the difference every second as you do must act more like the random number generator.

That's unless vertical accuracy is much greater than horizontal. You can check that looking at the coords.altitudeAccuracy field, and/or looking at the raw sequence of the altitude measurements (don't forget to step out of the building).

I think your Ambit watches use the barometer to estimate elevation (and Ionic uses the barometer to count floors), so should probably do you.

https://dev.fitbit.com/build/guides/sensors/barometer/ 

Best Answer
0 Votes

The barometer can't tell you the current altitude, but you can use it to detect the changes in air pressure, and use that to calculate the change in altitude. 

 

https://dev.fitbit.com/build/guides/sensors/barometer/

Best Answer
0 Votes

Thank you @JonFitbit@gaperton

 

Logic is sound. Wrong sensor. Funny thing is GPS altitude itself looks correct. Go figure.

 

I will code and test the barometer. I will also add in a reference to the gps altitude accuracy.

 

Calculating the distance from gps is about spot on. 🙂

Best Answer
0 Votes

> Calculating the distance from gps is about spot on. 🙂

 

You can expect the same problems with distance as well if you will take the difference between samples taken every second. One of the simplest possible solutions would be to increase the interval, i.e. update the distance every 3 or 5 seconds instead of one. It should give you more reliable results.

One of the ideas for a more sophisticated approach is to track significant changes of the GPS heading to detect the turns and align the smoothed route points to them. When you know that you're going straight, you can use the lesser amount of GPS location points to measure the distance on the line so it will be more accurate.

Best Answer
0 Votes

@gaperton

 

I know I keep relating back to the Suunto Ambit, but I also have a Wahoo Bolt (which replaced a Mio 305) for my biking.

 

All record GPS every second, as does the Ionic built in exercise app. I would expect the Ionic to be no less accurate than any of the other devices.

 

Once I am able to get the GPX data out of the unit myself,  and compare to my other trusted sources, I will then look at "tuning" the logging rate and how distance is calculated. I very much appreciate your input, and will more fully engage in your response above when the time comes. Smiley Happy

 

Back onto the ascent calculation. This is quite strange. I have tied into the barometer readings, and am getting very strange readings indeed. I am going to shelve the ascent for now until I have moved the app more on from where it is now, and then come back to it.

 

The funny thing is, the gps altitude appears to be returning quite an accurate reading! I need to get the data logged and out of the Ionic to perform more analysis to see what is going on.

Best Answer
0 Votes