Thunderbots Project
Loading...
Searching...
No Matches
Play Class Referenceabstract

#include <play.h>

Inheritance diagram for Play:

Public Member Functions

 Play (TbotsProto::AiConfig ai_config, bool requires_goalie)
 
virtual std::unique_ptr< TbotsProto::PrimitiveSet > get (const WorldPtr &world_ptr, const InterPlayCommunication &inter_play_communication, const SetInterPlayCommunicationCallback &set_inter_play_communication_fun)
 
const std::map< std::shared_ptr< const Tactic >, RobotId > & getTacticRobotIdAssignment () const
 
virtual std::vector< std::string > getState ()
 

Protected Member Functions

virtual void updateTactics (const PlayUpdate &play_update)
 

Protected Attributes

TbotsProto::AiConfig ai_config
 
std::shared_ptr< GoalieTacticgoalie_tactic
 
std::map< std::shared_ptr< const Tactic >, RobotId > tactic_robot_id_assignment
 
std::map< RobotId, TrajectoryPathrobot_trajectories
 
TbotsProto::ObstacleList obstacle_list
 
TbotsProto::PathVisualization path_visualization
 

Detailed Description

In the STP framework, a Play is a collection of tactics that represent some "team-wide" goal. It can be thought of like a traditional play in soccer. Some examples are:

  • A defense play
  • An offense play
  • A corner-kick of free-kick play

Plays are stateful, and use Tactics to implement their behaviour. For the most part, this statefulness is used to created "stages" for each Play. For example, a corner-kick play be broken down into 2 stages:

  • First, get the robots into position and find a good robot to pass to
  • Execute the pass and attempt a one-touch shot on net

These stages are useful in order for us to create more complex behaviour and write it in a more understandable way.

Constructor & Destructor Documentation

◆ Play()

Play ( TbotsProto::AiConfig  ai_config,
bool  requires_goalie 
)
explicit

Creates a new Play

Parameters
ai_configThe AI configuration
requires_goalieWhether this plays requires a goalie

Member Function Documentation

◆ get()

std::unique_ptr< TbotsProto::PrimitiveSet > get ( const WorldPtr &  world_ptr,
const InterPlayCommunication inter_play_communication,
const SetInterPlayCommunicationCallback &  set_inter_play_communication_fun 
)
virtual

Gets Primitives from the Play given the the world, and inter-play communication

Parameters
worldThe updated world
inter_play_communicationThe inter-play communication struct
set_inter_play_communication_funThe callback to set the inter-play communication struct
Returns
the PrimitiveSet to execute

Reimplemented in AssignedTacticsPlay.

◆ getState()

std::vector< std::string > getState ( )
virtual

Gets the state of the Play

Returns
a vector strings representing the state

Reimplemented in BallPlacementPlay, EnemyBallPlacementPlay, FreeKickPlay, PenaltyKickPlay, PenaltyKickEnemyPlay, and ShootOrPassPlay.

◆ getTacticRobotIdAssignment()

const std::map< std::shared_ptr< const Tactic >, RobotId > & getTacticRobotIdAssignment ( ) const

Get tactic to robot id assignment

Returns
a map from tactic to robot id

◆ updateTactics()

void updateTactics ( const PlayUpdate play_update)
protectedvirtual

Updates the priority tactic vector with new tactics

Parameters
play_updateThe PlayUpdate struct that contains all the information for updating the tactics

Reimplemented in AssignedTacticsPlay, BallPlacementPlay, CreaseDefensePlay, DefensePlay, EnemyBallPlacementPlay, EnemyFreeKickPlay, FreeKickPlay, HaltPlay, OffensePlay, PenaltyKickPlay, PenaltyKickEnemyPlay, and ShootOrPassPlay.


The documentation for this class was generated from the following files: