Commit Graph

24 Commits

Author SHA1 Message Date
Lars Berning 2210c46162
improves metrics of first stroke by setting reasonable initial values 2022-01-31 19:55:27 +01:00
Lars Berning 9471ff758b
fixes some code duplications in the engine initialization routine 2022-01-28 20:23:50 +01:00
Jaap van Ekris 335083c37d
Improvement of the startup behaviour and external stroke definition (#46)
* Improvement of the startup behaviour

These changes improve the startup behaviour: ORM will now always start with a detected drive-phase, which will trigger recording etc. This changes several initialisations of variables to make sure they enable the triggering of a "Drive" at the beginning of a stroke. Also workoutHandler.handleStrokeEnd has been renamed to workoutHandler.handleDriveEnd, as this is the clear end of that stroke-phase.

* Renamed handleStrokeEnd to handleDriveEnd

Renamed handleStrokeEnd to handleDriveEnd, as this is the clear end of that stroke-phase, as the current model alternates between Drive+Recovery and Recovery+Drive strokes to keep feeding the metrics, there isn't a very clear "End of the Stroke".

* Redefinition of a stroke

Traditionally, a stroke is defined as a Drive phase, followed by a Recovery Phase. This is also expected by Garmin and EXR as Concept2 implements it this way as well. This implementation makes it more consistent with that interpretation, while leaving room for intermediate updates. This should make Bluetooth behaviour and metrics recording more consistent.
2022-01-28 19:56:55 +01:00
Jaap van Ekris 47e71ea5ef
Drag poising bugfix (#44)
* Bugfix for dragfilter poisoning prevention

Implementation of a more refined version of the dragfactor calculation to prevent the dragfactor being stuck at certain values after pauses, etc.

* Addition of new settings

Implementation of a more refined version of the dragfactor calculation to prevent the dragfactor being stuck at certain values after pauses, etc.

Two changes:
* Made the smoothing function of the dragfactor configurable from the config-file (dampingConstantSmoothing) instead of hardcoded. as it should have been from day one
* Implementation of a new filter to prevent dragfactor poisoning by noisy data, based on another setting (dampingConstantMaxChange). The new filter will not get stuck but will follow the direction of the change but is limited to the setting..
2022-01-10 21:41:21 +01:00
Jaap van Ekris e85491acb9
More refined session state (#33)
* A more refined rowing session state (PM5)

Introduces a more refined session state needed for the PM5 rower session simulation, as well as a cleaner setup for the metrics to stop when the rower is stopped.

* Added the WorkoutState and rowingState

Added the WorkoutState and rowingState to the PM5 interface, to prevent EXR to start too early.

* Added a link to the brilliant work of Nomath

Added a link to Nomath's work, as it is a brilliant piece of work that independently verifies our calculations and provides a basis for support of the Concept2 rower.

* Bugfix in Instantanous Torque calculation

The Instantanous Torque calculation wasn't cleaned up sufficiently, causing issues in the powercurve.

* unifies reset of heartrate value at different places

* unifies naming with other variables status -> state

* just some minor link adjustments in documentation

Co-authored-by: Lars Berning <151194+laberning@users.noreply.github.com>
2022-01-09 12:09:02 +01:00
Jaap van Ekris 19ec4f28bb
Code Cleanup and Documentation Update (#30)
* Moved .doc to .md

Moved the Word document to a more open format

* Update of the file based on the new settings

Update of the settings documentation due to the introduction of the new RowingEngine

* Moved .doc to .md

Moved the information to the .md file, updated with the design decissions made in the new RowingEngine.

* Splitting the hardware set-ups for specific rowers

Split off the WRX700 hardware set-up from the generic setup, to allow for other rower-specific set-ups to be created (easier to read and better for search engines).

* Removal of generic text

* SPlit the generic from the WRX700

* Fixed a very rare bug

A very rare condition can cause the noise correction filter to get stuck and dismiss all subsequent values. Now the number of corrections is maximised preventing that situation.

* Code refactoring

Refactoring of the code (added calculateLinearVelocity(), calculateCyclePower(), calculateTorque() functions) to reduce code duplication across phases.

* Fixed a very rare bug

A very rare condition can cause the noise correction filter to get stuck and dismiss all subsequent values. Now the number of corrections is maximised preventing that situation.

* Code refactoring

Refactoring of the code (added calculateLinearVelocity(), calculateCyclePower(), calculateTorque() functions) to reduce code duplication across phases.

* fixes some typos, fixes some links, renames some files

Co-authored-by: Lars Berning <151194+laberning@users.noreply.github.com>
2021-12-13 20:01:28 +01:00
Lars Berning 67e7dbb36c
unifies interface of averagers 2021-11-08 09:00:45 +01:00
Lars Berning 36fe899e81
adds more tests to averagers 2021-11-08 08:47:56 +01:00
Lars Berning 02359e819d
updates documentation, fixes typos 2021-11-07 21:51:11 +01:00
Lars Berning 8f064a0aab
fixes typos, updates documentation to new names 2021-11-07 15:14:51 +01:00
Jaap van Ekris 7ee25292fc
Improved Rowing Engine (#24)
* Update to accomodate the new RowingEngine

Update of the MovingFlankDetector to provide the values needed to determine the speeds at the beginning of the flank.

* Created the MovingAverager for RowingEngine 2.0

Added the MovingAverager to accomodate the RowingEngine 2.0

* Update to RowingEngine 2.0

Update based on the great theoretical work of Anu Dudhia and the practical experiences of Dave Venrooy.

* Added to explain RowingEngine 2.0 design

A rationale for explaining the RowingEngine 2.0 design, based on the great theoretical work of Anu Dudhia, and the practical work of Dave Venrooy and Marinus van Holst, as well as the great feedback from Lars Berning.

* Update to accomodate the new RowingEngine

Update to the rower settings to accommodate the new RowingEngine. Please note that the modifications need to be verified by the respective users.

* Modifications to the RX800 tests

Modifications to the RX800 to bring it in line with the Concept2 Power and distance measurements.

* BUGFIX: Prevent ghost-strokes at end of session

This change to isAccelerating prevents stroke-detection to detect a stroke when the currentDt "flatlines". This typically happens when the error correction kicks in when you quit rowing (and thus the rowerSettings.maximumTimeBetweenImpulses is exceeded). It is bad (flatlining isn't acceleration), and this ghost-stroke causes havoc in the GUI: all measurements are reset again to random values instead of the nice indicators normally used.

* BUGFIX: Prevent ghost-strokes at end of session

This change to isAccelerating prevents stroke-detection to detect a stroke when the currentDt "flatlines". This typically happens when the error correction kicks in when you quit rowing (and thus the rowerSettings.maximumTimeBetweenImpulses is exceeded). It is bad (flatlining isn't acceleration), and this ghost-stroke causes havoc in the GUI: all measurements are reset again to random values instead of the nice indicators normally used.

* Added defensive programming

In some rare cases not rounding led to a buffer overflow, so added defensive programming to prevent this.

* Update MovingFlankDetector.js

* Improved stroke detection algorithm accuracy

Improvement of the Stroke detection algorithm: when naturalDeceleration is specified in the settings, it will only consider something a Revocery when this level of deceleration is encountered for the FlankLength.

* Made the RowingEngine more stateful

Removed some bugs, added a lot of defensive programming and made the RowingEngine report the key statistics every impuls to create a more fluid experience on the monitor. To do this, the rowingEngine maintins and reports absolute values to rowingStatistics, instead of relative.

* Improved stroke detection algorithm accuracy

Improvement of the Stroke detection algorithm: when naturalDeceleration is specified in the settings, it will only consider something a Revocery when this level of deceleration is encountered for the FlankLength.

* Modification to fit new RowingEngine

* Addition of new parameters for stroke detection

Added new parameters for stroke detection and monitor fluidity

* Fixed missing bracket

* Updated to more fluid RowingStatistics

Moved the timer from a static timer to the raw measurements of the flywheel, and the distance more frequently updated, to keep all data consistent. Also made the GUI-updates more fluid, responsive and dependent on settings: this more fluid GUI update mechanism is dependent on the screenUpdateInterval setting and moving averager dependent on a setting (numOfPhasesForAveragingScreenData)

* Made all monitor updates consistent

* Accommodate more frequent update of the monitors

Update to accommodate the more frequent updates, and to accommodate the reset for the RowingEngine

* improves some testcases, fixes some minor code styling and duplicate definitions

* Fixed a comment about dragfactor

* Added parameters for the new RowingStatistics.js

Added screenUpdateInterval, numOfPhasesForAveragingScreenData and maxCycleTimeBeforePause as config parameters to remove statically determined parameters in RowingStatistics.js

* Added RX800 as second testbed

* fixes some problems that caused the engine to crash

* uses non sanitized durations for now

* updates some settings, fixes some typos

* wires the correct timer configuration, fixes a problem where SPM would not reset to 0

* fixes a crash problem in workout recorder, fixes fallback value for strokeTime

* relaxes constraint on stroke time

* updates some explanatory text, updates some rower parameters

Co-authored-by: Lars Berning <151194+laberning@users.noreply.github.com>
2021-11-07 14:53:11 +01:00
Lars Berning c87e78b000
fixes auto adjustment for rowed distance 2021-05-13 10:11:00 +02:00
Lars Berning b019fb3bd4
adds more settings, adds auto adjust for damping 2021-05-05 12:16:04 +02:00
Jaap van Ekris 1b895972af
refactores FlankDetector, extracts some flank settings
* Improvement of the MovingflankDetector

Simplified the call of the moving flank detector, making it dependent on the settings

* Update MovingFlankDetector.js

Cleaned up the call to the MovingFlankDetector

* Added heartrate data to TCX

* Added parameters for the flankdetector

Added parameters for the flankdetector (flankLength and numberOfErrorsAllowed)

* Gave the RX800 some room as the settings haven't stabilised yet (and I think the recording is with a different damper setting than the source tree)
2021-05-05 05:41:11 +02:00
Lars Berning 475f0f4835
improves regression tests, renames some settings 2021-05-02 15:02:58 +02:00
JaapvanEkris 2c6819ca02
implements better flank detection, adds spreadsheet for analysis
Added the flankdetector, to reliably detect an acceleration or deceleration of the flywheel
Added extra metrics for the creation of TCX-files
Added extra metrics (speed in m/s and cadence) to allow future export of this data to Garmin TCX files, which everybody seems to love.
I increased the priority of the GPIO-service, as I noticed that much of the measurement noise originates from delayed read-outs of the GPIO.
An Excel tool to "play" with the settings of a rower, to adjust the settings found in the rowerprofiles.js
Adds test and data for RX800 rower
Lightweight version of Excel file

Co-authored-by: Lars Berning <151194+laberning@users.noreply.github.com>
2021-04-30 22:03:47 +02:00
JaapvanEkris 5c9630d0e5
This constant c isn't as constant....
The constant C isn't as constant as you'd hope it would be. As http://eodg.atm.ox.ac.uk/user/dudhia/rowing/physics/ergometer.html states: "The figure used for c is somewhat arbitrary - selected to indicate a 'realistic' boat speed for a given output power."
2021-04-29 14:29:54 +02:00
Lars Berning 55cde69ce6 moves rower configuration into a config file and adds rower presets 2021-04-20 21:48:34 +02:00
Lars Berning e5e579f3fc notifies PM5 central when stroke state changes 2021-03-20 22:04:52 +00:00
Lars Berning d90fa9ea1f adds config file and additional metrics 2021-03-19 19:56:02 +00:00
Lars Berning 37c32829d8 implements PM5 protocol, simplifies code 2021-03-18 20:17:57 +00:00
Lars Berning 3d08f06336 implements handling of rowing pauses 2021-03-10 19:08:56 +00:00
Lars Berning 361e1c65f8 adds logging framework, cleans documentation 2021-03-09 19:39:42 +00:00
Lars Berning 6a4779dfa3 first commit 2021-03-06 21:15:37 +01:00