RoboCup-SPL / GameController3

This is the official GameController used in the RoboCup Standard Platform League
MIT License
16 stars 8 forks source link

Change state model #19

Open ahasselbring opened 1 year ago

ahasselbring commented 1 year ago

After German Open: The members of game_controller::types::Game after sides and before teams should be represented about as follows:

enum PenaltyShootoutActiveState {
  Wait,
  Playing,
  AfterShot,
}

enum PenaltyShootoutState {
  BeforePenaltyShootout,
  Timeout(Timer),
  Active {
    timer: Timer,
    state: PenaltyShootoutActiveState,
    for: Side
  },
}

enum Half {
  First,
  Second,
}

enum SetPlayType {
  KickOff,
  GoalKick,
  KickIn,
  CornerKick,
  // ...
}

enum SetPlayPhase {
  Setup(Timer), // TODO: timeout-rewind-timer
  Wait, // TODO: timeout-rewind-timer
  Playing(Timer),
}

enum BeforeKickOffState {
  BeforeHalf,
  Timeout(Timer),
}

enum NormalState {
  BeforeKickOff {
    state: BeforeKickOffState,
    next_for: Side,
  },
  SetPlay {
    ty: SetPlayType,
    phase: SetPlayPhase,
    for: Side,
  },
  Playing,
  AfterHalf,
}

enum State {
  Normal {
    half: Half,
    timer: Timer,
    state: NormalState,
  },
  PenaltyShootout(PenaltyShootoutState),
}

The control message can still be created from this.