strautomator / core

Strautomator Core
MIT License
45 stars 6 forks source link

Wrong Cadence on Running Activities #25

Closed zecanard closed 1 year ago

zecanard commented 1 year ago

Strautomator reports half the cadence for running activities. You can see on activity ID 9066037696 that Strava correctly reports the value recorded by my Apple Watch (182 SPM), whereas Strautomator printed out 91.2.

(I’ve manually adjusted the value to 182.4 in my description, but it was 91.2 coming out of Strautomator.)

From looking at the code under recipes/lists.ts, I see that cadenceAvg is interpreted as RPM. It would make sense that in cycling, the RPM would be equal to half the SPM.

Thank you for the great utility!

Note: Other foot-based activities can report the cadence to Strava, not just running. This includes walking, hiking, snowshoeing, trail running, and possibly others (like cross-country skiing).

igoramadas commented 1 year ago

Can you share here (or via email) the activity ID? I'll check the logs. There's no post-processing done on the cadence data, so I just display what Strava gives me. If the SQM is always cut in half, I'll post-process the cadence for certain activity types.

The suffix is already fixed, but not pushed yet, will do it tonight. Now lists can have specific suffixes for ride, run, etc.

zecanard commented 1 year ago

I did; it’s activity ID 9066037696 🙂

igoramadas commented 1 year ago

Oh sorry I missed it. 🥸

So checking the data from Strava and also the logs, I can confirm Strava does treat cadence as RPM for runs as well. I'll add a new cadenceSpmAvg field that will be populated only for runs and walks (for now). I still want to run some more tests with random activity types to catch all use cases, and if needed I'll enable the SPM version of the cadence for other sports.

One thing to note: the SPM will be just the RPM x 2, so might be off by 1 (ie. Garmin shows SPM 181, but you'll get 90 RPM x 2 = 180 on Strautomator).

igoramadas commented 1 year ago

Deployed to production: https://github.com/strautomator/web/releases/tag/v23.203.11945

You can replace ${cadenceAvg} with ${cadenceSpm} on your runs / walks / hikes automations.

zecanard commented 1 year ago

I went on a hike yesterday with both ${cadenceAvg} and ${cadenceSpm}, and I can confirm that everything looks good: 34.9rpm and 69.8spm. Thank you!

However, I then changed the activity type to Snowshoeing, since Apple Watch doesn’t allow recording Snowshoeing directly, then triggered a manual sync. ${cadenceSpm} no longer produced a value, even though Strava still shows my cadence. ${cadenceAvg} was also half the SPM.

One thing to note: the SPM will be just the RPM x 2, so might be off by 1 (ie. Garmin shows SPM 181, but you'll get 90 RPM x 2 = 180 on Strautomator).

I don’t think that will be an issue. The RPM value includes a decimal digit, so eg. 90.5 RPM × 2 = 181 SPM. In my automatic sync yesterday, ${cadenceSpm} produced 69.8 SPM.

igoramadas commented 1 year ago

SPM is active only for a handful of activity types. I'm finishing testing some other activity types tonight, to see what Strava returns, and if I don't find any blockers, I'll enable the SPM for all activities except bike rides.

igoramadas commented 1 year ago

Cadence SPM now available to all activities, even rides, there was no reason to keep it exclusive for specific activity types. https://github.com/strautomator/web/releases/tag/v23.204.12240

zecanard commented 1 year ago

Great, I was thinking the same thing 🙂 Just like speed/pace, which may be interesting to both foot- and vehicle-based.