|
Thunderbots Project
|
Holds the state of the game according to the referee. More...
#include <game_state.h>
Public Types | |
| enum | PlayState { HALT , STOP , SETUP , READY , PLAYING } |
| enum | RestartReason { NONE , KICKOFF , DIRECT , INDIRECT , PENALTY , BALL_PLACEMENT } |
Public Member Functions | |
| GameState (const TbotsProto::GameState &game_state_proto) | |
| void | updateRefereeCommand (RefereeCommand gameState) |
| void | updateBall (const Ball &ball) |
| void | setRestartCompleted () |
| const RefereeCommand & | getRefereeCommand () const |
| RestartReason | getRestartReason () const |
| bool | isHalted () const |
| bool | isStopped () const |
| bool | isPlaying () const |
| bool | isKickoff () const |
| bool | isPenalty () const |
| bool | isBallPlacement () const |
| bool | isOurRestart () const |
| bool | isDirectFree () const |
| bool | isIndirectFree () const |
| bool | isOurKickoff () const |
| bool | isOurPenalty () const |
| bool | isOurDirectFree () const |
| bool | isOurIndirectFree () const |
| bool | isOurFreeKick () const |
| bool | isOurBallPlacement () const |
| bool | isTheirKickoff () const |
| bool | isTheirPenalty () const |
| bool | isTheirDirectFree () const |
| bool | isTheirIndirectFree () const |
| bool | isTheirFreeKick () const |
| bool | isTheirBallPlacement () const |
| PlayState | getPlayState (void) const |
| bool | isSetupRestart () const |
| bool | isSetupState () const |
| bool | isReadyState () const |
| bool | canKick () const |
| bool | stayAwayFromBall () const |
| bool | stayOnSide () const |
| bool | stayBehindPenaltyLine () const |
| bool | operator== (const GameState &other) const |
| bool | operator!= (const GameState &other) const |
| std::optional< Point > | getBallPlacementPoint (void) const |
| std::optional< Ball > | getBall (void) const |
| void | setBallPlacementPoint (Point placementPoint) |
Holds the state of the game according to the referee.
Contains information on what period of the game it is, what type of play to run, team scores, time remaining, etc. During normal gameplay, the information in this class is received from the ssl-game-controller program over the network.
|
explicit |
Creates a new game state based on the TbotsProto::GameState protobuf representation
| game_state_proto | The TbotsProto::GameState protobuf which this game state should be based on |
| bool canKick | ( | ) | const |
Returns true if we can kick the ball.
| std::optional< Ball > getBall | ( | void | ) | const |
Returns the ball
| std::optional< Point > getBallPlacementPoint | ( | void | ) | const |
Returns the point on the field where the ball should be placed if one is specified.
| GameState::PlayState getPlayState | ( | void | ) | const |
Returns the play state
| const RefereeCommand & getRefereeCommand | ( | ) | const |
Returns the current Referee command
| GameState::RestartReason getRestartReason | ( | ) | const |
Returns the current restart reason
| bool isBallPlacement | ( | ) | const |
Returns true if ball placement is occurring. See Robocup SSL Rules Law 9.2.
| bool isDirectFree | ( | ) | const |
Returns true if a direct free kick is occurring. See Robocup SSL Rules Law 13.
| bool isHalted | ( | ) | const |
Returns true if robots may not move.
| bool isIndirectFree | ( | ) | const |
Returns true if an indirect free kick is occurring. See Robocup SSL Rules Law 13.
| bool isKickoff | ( | ) | const |
Returns true if a kickoff is occurring. See Robocup SSL Rules Law 8.2.
| bool isOurBallPlacement | ( | ) | const |
Returns true if we are doing ball placement.
| bool isOurDirectFree | ( | ) | const |
Returns true if we are taking a direct free kick.
| bool isOurFreeKick | ( | ) | const |
Returns true if we are doing any type of free kick.
| bool isOurIndirectFree | ( | ) | const |
Returns true if we are taking an indirect free kick.
| bool isOurKickoff | ( | ) | const |
Returns true if we are taking the kickoff.
| bool isOurPenalty | ( | ) | const |
Returns true if we are taking the penalty kick.
| bool isOurRestart | ( | ) | const |
Returns true if our team is doing the restart, e.g. when we get an indirect kick This function will have undefined behaviour if a restart is not being prepared for or occurring, such as after a transition to HALT or STOP, because of how GameController state transitions work.
| bool isPenalty | ( | ) | const |
Returns true if a penalty is occurring. See Robocup SSL Rules Law 14.
| bool isPlaying | ( | ) | const |
Returns true if the game is in play.
| bool isReadyState | ( | ) | const |
Returns true if we are ready for a kickoff or restart.
| bool isSetupRestart | ( | ) | const |
Returns true if robots should be setting up for a restart e.g. if a free kick is going to occur.
| bool isSetupState | ( | ) | const |
Returns true if we are currently getting ready for a kickoff or restart. e.g. Getting ready to kick the ball for a free kick.
| bool isStopped | ( | ) | const |
Returns true if robots must stay a set distance away from the ball. See Robocup SSL Rules Law 5.5
| bool isTheirBallPlacement | ( | ) | const |
Returns true if opposing side is doing ball placement.
| bool isTheirDirectFree | ( | ) | const |
Returns true if opposing side is taking a direct free kick.
| bool isTheirFreeKick | ( | ) | const |
Returns true if opposing side is taking any type of free kick.
| bool isTheirIndirectFree | ( | ) | const |
Returns true if opposing side is taking an indirect free kick.
| bool isTheirKickoff | ( | ) | const |
Returns true if opposing side is doing kickoff.
| bool isTheirPenalty | ( | ) | const |
Returns true if opposing side is taking a penalty kick.
| bool operator!= | ( | const GameState & | other | ) | const |
| bool operator== | ( | const GameState & | other | ) | const |
| void setBallPlacementPoint | ( | Point | placementPoint | ) |
Sets the point on the field where the ball should be placed. See Robocup SSL Rules Law 9.2.
| placementPoint | the point where the ball should be placed. |
| void setRestartCompleted | ( | ) |
Clears restart state and enters normal play. Should be called when state transitions from a restart setup state such as PREPARE_KICKOFF_FRIENDLY into NORMAL_START.
| bool stayAwayFromBall | ( | ) | const |
Returns true if we should stay a set distance from the ball. See Robocup SSL Rules Law 13.4, 5.5, 8.2.1, 9.2
| bool stayBehindPenaltyLine | ( | ) | const |
Returns true if our robots except the penalty kicker should stay on our side of the field.
| bool stayOnSide | ( | ) | const |
Returns true if robots should stay on their team's side of the field. See Robocup SSL Rules Law 8.2.1.
| void updateBall | ( | const Ball & | ball | ) |
Updates the state of the ball used in calculating game state transitions
| ball | The new ball |
| void updateRefereeCommand | ( | RefereeCommand | gameState | ) |
Updates the game state with a value from backend_input
| gameState | the RefereeCommand from backend_input |