TugTask constructor

TugTask({
  1. required String identifier,
})

Constructs the TugTask and initializes all required steps and configurations. Sets up the TUG test sequence, sensor selection, and subscribes to sensor selection changes.

Implementation

TugTask({required super.identifier}) : super(steps: []) {
  // Initialize probe with default smartphone sensor configuration
  _probe = MobilityProbe(
    config: TugConfig(),
    sensor: SmartphoneSensor(),
  );

  // Build the complete test sequence with all required steps
  steps.addAll([
    // Introduction and overview step
    RPInstructionStep(
        identifier: 'intro',
        title: 'tug_test_title',
        text: 'tug_test_description',
      )
      ..detailText =
          'tug_test_detail',
    // Sensor selection step for choosing between smartphone and Movesense
    _buildSensorSelectionStep(),
    // Calibration step to establish turn detection parameters
    _buildTugCalibrationStep(),
    // Equipment and positioning preparation
    TugPreparationStep(
      identifier: 'tug_preparation',
      title: 'preparation',
    ),
    // Test instructions and procedure explanation
    TugInstructionsStep(
      identifier: 'tug_instructions',
      title: 'instructions',
    ),
    // Countdown timer before test execution
    RPTimerStep(
      identifier: 'prepare',
      title: 'get_ready',
      timeout: const Duration(seconds: 3),
      autoSkip: true,
    ),
    // Main TUG test execution step
    _buildTugStep(),
    TugResultStep(
      identifier: 'Tug_result',
      title: 'test_completed',
      text: 'test_completed_tug',
    ),
  ]);
  subscribeToSensorSelectionStep();
}