`RepDetectionConfig`
RepDetectionConfig lives on an MovementConfig
and tells the rep counter how to interpret completed phase
traversals as rep boundaries. Studio populates it automatically
based on the authored phase graph; you rarely construct one by
hand.
Shape
class RepDetectionConfig { final RepDetectionStrategy strategy; // cycle / sequence / compound / hold final String? primaryPhase; // for cycle strategy final List<String>? phases; // for sequence strategy final List<List<String>>? sequences; // for compound (multiple alt sequences) final String countOn; // 'sequenceComplete' (default), 'phaseExit', ... final String? resetOn; // optional condition that resets the in-flight rep final int? minDuration; // milliseconds, gate fast / momentum reps final int? maxDuration; // milliseconds, gate slow / paused reps final int? durationIncrement; // ms per count, for hold strategy}Strategies
| Strategy | When to use | What counts as a rep |
|---|---|---|
cycle | Repeated motion through a single primary phase (e.g. squat down → up → down → up). One phase is marked primaryPhase; each return to it = 1 rep. | One return to primaryPhase. |
sequence | Reps that traverse multiple phases in a fixed order (e.g. push-up: top → down → top). The full ordered traversal of phases = 1 rep. | One full sequence traversal. |
compound | Reps where any one of several authored sequences counts (e.g. lunge: forward-left OR forward-right). Provide multiple sequences via sequences. | One traversal of any sequence in sequences. |
hold | Static holds (plank, wall-sit). Reps increment as durationIncrement milliseconds elapse while the user is in primaryPhase. | One durationIncrement of held time. |
Fields
| Field | Meaning |
|---|---|
strategy | RepDetectionStrategy enum, picks the rep-detection algorithm. |
primaryPhase | Used by cycle and hold. The phase whose entry / continued presence counts as a rep. |
phases | Used by sequence. Ordered list of phase ids the user must traverse for one rep. |
sequences | Used by compound. List of acceptable sequences, any one completes a rep. |
countOn | When inside the chosen strategy the rep increments. 'sequenceComplete' (default) waits for the full sequence; 'phaseExit' increments on leaving the primary phase; rarer values exist for advanced timing. |
resetOn | Optional condition (referenced by id) that aborts an in-flight rep without counting it, e.g. user steps out of frame. |
minDuration / maxDuration | Tempo bounds in milliseconds. Reps faster than minDuration are flagged as momentum (and may not count under a RepScoringConfig gate); reps slower than maxDuration are flagged as paused. |
durationIncrement | Hold-strategy only. How many ms of held time = 1 rep tick. |
Patterns
Cycle (squat)
const RepDetectionConfig( strategy: RepDetectionStrategy.cycle, primaryPhase: 'up', countOn: 'phaseExit',);A rep counts each time the user leaves the up phase (which they do
when they descend into the squat, the next up arrival completes the
rep).
Sequence (push-up)
const RepDetectionConfig( strategy: RepDetectionStrategy.sequence, phases: ['top', 'bottom', 'top'], countOn: 'sequenceComplete',);The user must visit top → bottom → top in order for one rep.
Compound (alternating lunge)
const RepDetectionConfig( strategy: RepDetectionStrategy.compound, sequences: [ ['stand', 'left_forward', 'stand'], ['stand', 'right_forward', 'stand'], ], countOn: 'sequenceComplete',);Either lunge direction completes a rep.
Hold (plank)
const RepDetectionConfig( strategy: RepDetectionStrategy.hold, primaryPhase: 'plank', durationIncrement: 1000, // 1 rep per second);The counter increments once per second the user is in the plank
phase.
JSON
RepDetectionConfig round-trips via toJson / fromJson. Stored
inside the .pose file’s config.repDetection block. See the
.pose file spec.
Read next
- Rep counting, full walk-through of the algorithm.
- Phase sequences (Studio), author-side view of the same config.
RepScoringConfig, the optional rep-quality gate that runs afterRepDetectionConfigdecides a rep is done.