laberning / openrowingmonitor

A free and open source performance monitor for rowing machines
https://laberning.github.io/openrowingmonitor
GNU General Public License v3.0
98 stars 19 forks source link

linearDistance counted during `Paused` is considered when restarting rowing #108

Closed Abasz closed 1 year ago

Abasz commented 1 year ago

So on the v1beta I noticed a behaviour that I suppose is intentional but I am not sure that its correct:

When the maximumStrokeTimeBeforePause is exceeded the metrics update stops. However, the linearDistance (as continuous metric) keeps updating and when restarting the rowing after the pause but before a stop (lets say after 10 sec if the max time before puase is 6) the distance made during the pause is added rather than continue counting from the distance at moment the pause.

In my opinion this is not desirable as the point of the pause time is to simulate a halt of the rowing boat instead of drifting and counting that drifting distance to the distance done. I believe that the PM5 stops counting the meters after the 7 second pause time as well (not that I want to copy the PM5 in every aspect, its just that to me this seems logical).

JaapvanEkris commented 1 year ago

It simply can't.

In Rower.js line 83, this condition is checked. First real action it does (after logging it), is flywheel.maintainStateOnly(). This function sets the semaphore maintainMetrics, which blocks updating the flywheel position entirely (as totalNumberOfImpulses += 1 is skipped).

Are you sure the logs indicate that rowing is paused?

Abasz commented 1 year ago

I did more debug of this and you are right, pause is not called after the maximumStrokeTimeBeforePause (that is 6 second for me)

2023-01-15_10-11-17_raw.csv

There are the log output:

stroke: 4, dist: 8.2m, speed: 1.56m/s, pace: 5:21/500m, power: 11W, cal: 0.6kcal, SPM: 29.8, drive dur: 0.85s, rec. dur: 1.16s, stroke dur: 2.02s df: 110.31545528130754
*** RECOVERY phase started at time: 8.0464 sec
*** DRIVE phase started at time: 9.0145 sec
*** Calculated drag factor: 111.8848, no. samples: 24, Goodness of Fit: 0.9954
*** Calculated recovery slope: 0.003210, Goodness of Fit: 0.9954, not used as autoAdjustRecoverySlope isn't set to true
stroke: 5, dist: 11.0m, speed: 1.73m/s, pace: 4:50/500m, power: 14W, cal: 0.8kcal, SPM: 36.3, drive dur: 0.68s, rec. dur: 0.97s, stroke dur: 1.65s df: 111.88480109175087
*** RECOVERY phase started at time: 9.6092 sec
*** DRIVE phase started at time: 10.5303 sec
*** Calculated drag factor: 111.4892, no. samples: 24, Goodness of Fit: 0.9953
*** Calculated recovery slope: 0.003199, Goodness of Fit: 0.9953, not used as autoAdjustRecoverySlope isn't set to true
stroke: 6, dist: 13.8m, speed: 1.84m/s, pace: 4:31/500m, power: 18W, cal: 0.9kcal, SPM: 39.6, drive dur: 0.59s, rec. dur: 0.92s, stroke dur: 1.52s df: 111.48917512916441
*** RECOVERY phase started at time: 11.0251 sec
*** WARNING: currentDt of 0.51119 sec is above maximumTimeBetweenImpulses (0.5 sec)
*** WARNING: currentDt of 0.52367 sec is above maximumTimeBetweenImpulses (0.5 sec)
*** WARNING: currentDt of 0.537051 sec is above maximumTimeBetweenImpulses (0.5 sec)
*** WARNING: currentDt of 0.566509 sec is above maximumTimeBetweenImpulses (0.5 sec)
*** WARNING: currentDt of 0.583305 sec is above maximumTimeBetweenImpulses (0.5 sec)
*** WARNING: currentDt of 0.601476 sec is above maximumTimeBetweenImpulses (0.5 sec)
*** PAUSED rowing at time: 71.8702 sec, rower hasn't moved in 61.3399 seconds and flywheel is dwelling
*** Calculated drag factor: 184.7818, not used because reliability was too low. no. samples: 533, fit: 0.9208
*** Paused rowing ***
*** PAUSE MOVING command recieved by RowingEngine at time: 71.8702 sec, distance: 52.86 meters
stroke: 6, dist: 52.8m, speed: 0.00m/s, pace: Infinity/500m, power: 0W, cal: 0.9kcal, SPM: 0.0, drive dur: NaNs, rec. dur: NaNs, stroke dur: NaNs df: 111.48917512916441
saving session as raw data file data/recordings/2023/01/2023-01-15_10-19-14_raw.csv...
saving session as RowingData file data/recordings/2023/01/2023-01-15_10-19-14_rowingData.csv...

these are my settings:

export default {
  // example: change the default log level:
  loglevel: {
    default: 'debug',
    RowingEngine: 'debug'
  },

  heartRateMode: 'ANT',
  bluetoothMode: 'CSC',
  antplusMode: 'FE',
  numOfPhasesForAveragingScreenData: 1,
  createTcxFiles: false,
  createRawDataFiles: true,
  gzipRawDataFiles: false,

  rowerSettings: { ...rowerProfiles.Generic_Air_Rower, numOfImpulsesPerRevolution: 3 }
}

My expectation was that after 6s of inactivity (i.e. being in RECOVERY) ORM pauses and stops counting distance (i.e. disregards rotation pulses). But it does not. Actually on the GUI distance increases slowly.

JaapvanEkris commented 1 year ago

Look at lowering the maximumTimeBetweenImpulses: the condition for a pause are

  1. maximumTimeBetweenImpulses is exceeded for all measurements in a flank
  2. you exceed maximumStrokeTimeBeforePause since the last drive ends

This is to prevent a pause kicking in when a stroke is missed (and thus maximumStrokeTimeBeforePause since the last drive is exceeded quite easily)

Abasz commented 1 year ago

Yes, thanks that was the issue... I was not aware that there are two conditions. However this is a deviation from the PM5's approach (I think), as it pauses rowing after 6 (or 7) seconds regardless of time between impulses. This is not a problem just something for me to be aware when comparing metrics between devices