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

Classes

struct  ControlParams
 

Public Member Functions

 DribbleFSM (TbotsProto::DribbleTacticConfig dribble_tactic_config)
 
Point findInterceptionPoint (const Robot &robot, const Ball &ball, const Field &field)
 
void getPossession (const Update &event)
 
void dribble (const Update &event)
 
void loseBall (const Update &event)
 
bool havePossession (const Update &event)
 
bool lostPossession (const Update &event)
 
bool dribblingDone (const Update &event)
 
bool shouldLoseBall (const Update &event)
 
auto operator() ()
 

Static Public Member Functions

static DEFINE_TACTIC_UPDATE_STRUCT_WITH_CONTROL_AND_COMMON_PARAMS Point robotPositionToFaceBall (const Point &ball_position, const Angle &face_ball_angle, double additional_offset=0.0)
 
static Point getDribbleBallDestination (const Point &ball_position, std::optional< Point > dribble_destination)
 
static Angle getFinalDribbleOrientation (const Point &ball_position, const Point &robot_position, std::optional< Angle > final_dribble_orientation)
 
static std::tuple< Point, AnglecalculateNextDribbleDestinationAndOrientation (const Ball &ball, const Robot &robot, std::optional< Point > dribble_destination_opt, std::optional< Angle > final_dribble_orientation_opt)
 

Constructor & Destructor Documentation

◆ DribbleFSM()

DribbleFSM ( TbotsProto::DribbleTacticConfig  dribble_tactic_config)
inlineexplicit

Constructor for DribbleFSM

Parameters
dribble_tactic_configThe config to fetch parameters from

Member Function Documentation

◆ calculateNextDribbleDestinationAndOrientation()

std::tuple< Point, Angle > calculateNextDribbleDestinationAndOrientation ( const Ball ball,
const Robot robot,
std::optional< Point dribble_destination_opt,
std::optional< Angle final_dribble_orientation_opt 
)
static

Calculates the next dribble destination and orientation

Parameters
ballThe ball
robotThe robot
dribble_destination_optThe dribble destination
final_dribble_orientation_optThe final dribble orientation
Returns
the next dribble destination and orientation

◆ dribble()

void dribble ( const Update &  event)

Action to dribble the ball

This action will orient the robot towards the destination, dribble to the destination, and then pivot to face the expected orientation

Parameters
eventDribbleFSM::Update

◆ dribblingDone()

bool dribblingDone ( const Update &  event)

Guard that checks if the ball is at the dribble_destination and robot is facing the right direction with possession of the ball

Parameters
eventDribbleFSM::Update
Returns
if the ball is at the dribble_destination, robot is facing the correct direction and ahs possession of the ball

◆ findInterceptionPoint()

Point findInterceptionPoint ( const Robot robot,
const Ball ball,
const Field field 
)

Calculates the interception point for intercepting balls

Parameters
robotThe robot to do the interception
ballThe ball to intercept @field The field to intercept on
Returns
the best interception point

◆ getDribbleBallDestination()

Point getDribbleBallDestination ( const Point ball_position,
std::optional< Point dribble_destination 
)
static

Gets the destination to dribble the ball to from the update event

Parameters
eventDribbleFSM::Update
Returns
the destination to dribble the ball to

◆ getFinalDribbleOrientation()

Angle getFinalDribbleOrientation ( const Point ball_position,
const Point robot_position,
std::optional< Angle final_dribble_orientation 
)
static

Gets the final dribble orientation from the update event

Parameters
eventDribbleFSM::Update
Returns
the final orientation to finish dribbling facing

◆ getPossession()

void getPossession ( const Update &  event)

Action to get possession of the ball

If the ball is moving quickly, then move in front of the ball If the ball is moving slowly, then chase the ball

Parameters
eventDribbleFSM::Update

◆ havePossession()

bool havePossession ( const Update &  event)

Guard that checks if the robot has possession of the ball

Parameters
eventDribbleFSM::Update
Returns
if the ball has been have_possession

◆ loseBall()

void loseBall ( const Update &  event)

Action to lose possession of the ball

Parameters
eventDribbleFSM::Update

◆ lostPossession()

bool lostPossession ( const Update &  event)

Guard that checks if the robot has lost possession of the ball

Parameters
eventDribbleFSM::Update
Returns
if the ball possession has been lost

◆ robotPositionToFaceBall()

Point robotPositionToFaceBall ( const Point ball_position,
const Angle face_ball_angle,
double  additional_offset = 0.0 
)
static

Converts the ball position to the robot's position given the direction that the robot faces the ball

Parameters
ball_positionThe ball position
face_ball_angleThe angle to face the ball
additional_offsetAdditional offset from facing the ball
Returns
the point that the robot should be positioned to face the ball and dribble the ball

◆ shouldLoseBall()

bool shouldLoseBall ( const Update &  event)

Guard that checks if the the robot should lose possession to avoid excessive dribbling

Parameters
eventDribbleFSM::Update
Returns
if the ball possession should be lost

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