Skip to content

`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

StrategyWhen to useWhat counts as a rep
cycleRepeated 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.
sequenceReps 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.
compoundReps 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.
holdStatic holds (plank, wall-sit). Reps increment as durationIncrement milliseconds elapse while the user is in primaryPhase.One durationIncrement of held time.

Fields

FieldMeaning
strategyRepDetectionStrategy enum, picks the rep-detection algorithm.
primaryPhaseUsed by cycle and hold. The phase whose entry / continued presence counts as a rep.
phasesUsed by sequence. Ordered list of phase ids the user must traverse for one rep.
sequencesUsed by compound. List of acceptable sequences, any one completes a rep.
countOnWhen 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.
resetOnOptional condition (referenced by id) that aborts an in-flight rep without counting it, e.g. user steps out of frame.
minDuration / maxDurationTempo 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.
durationIncrementHold-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.