/** Executes a selected kick by pressing a button on the robot */
option manual_kick_test {

  /** The action id of the kick that was selected */
  @action [0..] "int";
  /** The speed of the robot while approaching the ball */
  @walk_speed [-300..300] "mm/s";

  initial state stand {
    decision {
      /** head pressed */
      if (robot_state.middle_back_button_pressed_short) {
        /** walk speed is set */
        if (@walk_speed != 0) {
          goto(walk);
        }
        else {
          goto(kick);
        }
      }
      else {
        stay();
      }
    }
    action {
      sound_request = bark1;
      stand();
    }
  }

  state walk {
    decision {
      /** at least 500ms */
      if (state_time < 500) {
        stay();
      }
      /** head pressed */
      else if (robot_state.middle_back_button_pressed_short) {
        goto(kick);
      }
      else {
        stay();
      }
    }
    action {
      walk(speed_x = @walk_speed, speed_y = 0, rotation_speed = 0);
    }
  }

  state kick {
    decision {
      /** kick finished */
      if (action_done) {
        goto(wait);
      }
      else {
        stay();
      }
    }
    action {
      execute_kick(__action = @action);
    }
  }

  state wait {
    decision {
      /** wait 2000 ms */
      if (state_time < 2000) {
        stay();
      }
      else {
        goto(stand);
      }
    }
    action {
      sound_request = none;
      stand();
    }
  }

}

