Thunderbots Project
Loading...
Searching...
No Matches
FreeKickPlayFSM Struct Reference

#include <free_kick_play_fsm.h>

Classes

struct  ControlParams
 

Public Member Functions

DEFINE_PLAY_UPDATE_STRUCT_WITH_CONTROL_AND_COMMON_PARAMS FreeKickPlayFSM (const TbotsProto::AiConfig &ai_config)
 
void setupPosition (const Update &event)
 
bool setupDone (const Update &event)
 
void updateReceiverPositioningTactics (const WorldPtr world, unsigned int num_tactics, const std::vector< Point > &existing_receiver_positions={}, const std::optional< Point > &pass_origin_override=std::nullopt)
 
void setReceiverAndDefenderTactics (PriorityTacticVector &tactics_to_run, const Update &event, int ideal_num_receivers, int num_tactics_already_assigned, const std::vector< Point > &existing_receiver_positions={}, const std::optional< Point > &pass_origin_override=std::nullopt)
 
void updateAlignToBallTactic (const WorldPtr &world_ptr)
 
void startLookingForPass (const Update &event)
 
void lookForPass (const Update &event)
 
void shootBall (const Update &event)
 
void passBall (const Update &event)
 
void chipBall (const Update &event)
 
bool shotFound (const Update &event)
 
bool passFound (const Update &event)
 
bool shouldAbortPass (const Update &event)
 
bool timeExpired (const Update &event)
 
bool shotDone (const Update &event)
 
bool passDone (const Update &event)
 
bool chipDone (const Update &event)
 
auto operator() ()
 

Detailed Description

This FSM implements the free kick play. The logic of this play is:

  • One robot (the kicker) attempts to shoot first. If there is a good shot, then it will shoot the ball.
  • If there is no good shot, the kicker will attempt to pass. Two robots try to get in good receiving positions to receive a pass.
  • If we cannot find a pass in time, the kicker will chip the ball towards the friendly robot furthest up the field.

Constructor & Destructor Documentation

◆ FreeKickPlayFSM()

FreeKickPlayFSM ( const TbotsProto::AiConfig &  ai_config)
explicit

Creates a free kick play FSM

Parameters
ai_configthe play config for this play FSM

Member Function Documentation

◆ chipBall()

void chipBall ( const Update &  event)

Action to chip the ball towards the enemy net

Parameters
eventthe FreeKickPlayFSM Update event

◆ chipDone()

bool chipDone ( const Update &  event)

Guard that checks if the chip is completed

Parameters
eventthe FreeKickPlayFSM Update event
Returns
whether the chip is completed

◆ lookForPass()

void lookForPass ( const Update &  event)

Action that looks for a pass between the kicker and another robot

Parameters
eventthe FreeKickPlayFSM Update event

◆ passBall()

void passBall ( const Update &  event)

Action to pass the ball to a friendly robot

Parameters
eventthe FreeKickPlayFSM Update event

◆ passDone()

bool passDone ( const Update &  event)

Guard that checks if the pass is completed

Parameters
eventthe FreeKickPlayFSM Update event
Returns
whether the pass is completed

◆ passFound()

bool passFound ( const Update &  event)

Guard that checks if we should pass the ball to a friendly robot

Parameters
eventthe FreeKickPlayFSM Update event
Returns
whether we should pass the ball

◆ setReceiverAndDefenderTactics()

void setReceiverAndDefenderTactics ( PriorityTacticVector &  tactics_to_run,
const Update &  event,
int  ideal_num_receivers,
int  num_tactics_already_assigned,
const std::vector< Point > &  existing_receiver_positions = {},
const std::optional< Point > &  pass_origin_override = std::nullopt 
)

Sets the receiver and defender tactics for the free kick play

Parameters
tactics_to_runThe priority tactic vector to add the tactics to
eventThe update event
ideal_num_receiversThe ideal number of receivers to assign. This value may be adjusted based on the number of available tactics.
num_tactics_already_assignedThe number of tactics already assigned from event.common.num_tactics
existing_receiver_positionsA set of positions of existing receiver positions that should be taken into account when assigning additional offensive tactics.
pass_origin_overrideAn optional point that the pass origin should be overridden to

◆ setupDone()

bool setupDone ( const Update &  event)

Guard that checks if the robots are in position to start the free kick

Parameters
eventthe FreeKickPlayFSM Update event
Returns
whether the robots are in position to start the free kick

◆ setupPosition()

void setupPosition ( const Update &  event)

Action that sets up the robots in position to perform the free kick

Parameters
eventthe FreeKickPlayFSM Update event

◆ shootBall()

void shootBall ( const Update &  event)

Action to shoot the ball towards the enemy goal directly

Parameters
eventthe FreeKickPlayFSM Update event

◆ shotDone()

bool shotDone ( const Update &  event)

Guard that checks if the shot is completed

Parameters
eventthe FreeKickPlayFSM Update event
Returns
whether the shot is completed

◆ shotFound()

bool shotFound ( const Update &  event)

Guard that checks if we should shoot the ball towards the enemy goal

Parameters
eventthe FreeKickPlayFSM Update event
Returns
whether we should shoot the ball directly

◆ shouldAbortPass()

bool shouldAbortPass ( const Update &  event)

Guard on whether to abort the pass

Parameters
eventthe FreeKickPlayFSM Update event
Returns
whether the pass should be aborted

◆ startLookingForPass()

void startLookingForPass ( const Update &  event)

Action that starts the process of looking for a pass

Parameters
eventthe FreeKickPlayFSM Update event

◆ timeExpired()

bool timeExpired ( const Update &  event)

Guard that checks if the allotted time to search for a pass is over

Parameters
eventthe FreeKickPlayFSM Update event
Returns
whether the time to search for a pass is over

◆ updateAlignToBallTactic()

void updateAlignToBallTactic ( const WorldPtr &  world_ptr)

Updates the kicker to align to the ball

Parameters
worldthe latest world

◆ updateReceiverPositioningTactics()

void updateReceiverPositioningTactics ( const WorldPtr  world,
unsigned int  num_tactics,
const std::vector< Point > &  existing_receiver_positions = {},
const std::optional< Point > &  pass_origin_override = std::nullopt 
)

Updates the offensive positioning tactics

Parameters
worldthe world
num_tacticsthe number of tactics to assign
existing_receiver_positionsA set of positions of existing receiver positions that should be taken into account when assigning additional offensive tactics.
pass_origin_overrideAn optional point that the pass origin should be overridden to

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