Thunderbots Project
Loading...
Searching...
No Matches
Pass Class Reference

#include <pass.h>

Public Member Functions

 Pass (Point passer_point, Point receiver_point, double pass_speed_m_per_s)
 
std::array< double, NUM_PARAMS_TO_OPTIMIZE > toPassArray () const
 
Point passerPoint () const
 
Point receiverPoint () const
 
Angle receiverOrientation () const
 
Angle passerOrientation () const
 
double speed () const
 
Duration estimatePassDuration () const
 
bool operator== (const Pass &other) const
 

Static Public Member Functions

static Pass fromPassArray (Point passer_point, const std::array< double, NUM_PARAMS_TO_OPTIMIZE > &pass_array, double pass_speed_m_per_s)
 
static Pass fromDestReceiveSpeed (const Point &ball_position, const Point &pass_destination, double dest_speed_m_per_s, double min_pass_speed_m_per_s, double max_pass_speed_m_per_s)
 
static Pass fromDestReceiveSpeed (const Point &ball_position, const Point &pass_destination, const TbotsProto::PassingConfig &passing_config)
 
static double getPassSpeed (const Point &ball_position, const Point &pass_destination, double receive_speed_m_per_s, double min_pass_speed_m_per_s, double max_pass_speed_m_per_s)
 

Friends

std::ostream & operator<< (std::ostream &output_stream, const Pass &pass)
 

Detailed Description

This class represents a Pass, a receive point with a speed

Constructor & Destructor Documentation

◆ Pass()

Pass ( Point  passer_point,
Point  receiver_point,
double  pass_speed_m_per_s 
)

Create a pass with given parameters

Parameters
passer_pointThe point the pass should start at
receiver_pointThe point the receiver should be at to receive the pass
pass_speed_m_per_sThe speed of the pass, in meters/second

Member Function Documentation

◆ estimatePassDuration()

Duration estimatePassDuration ( ) const

Estimate how long the pass will take, from kicking to receiving

This estimate does not account for friction on the ball

Returns
An estimate of how long the pass will take, from kicking to receiving

◆ fromDestReceiveSpeed() [1/2]

Pass fromDestReceiveSpeed ( const Point ball_position,
const Point pass_destination,
const TbotsProto::PassingConfig &  passing_config 
)
static

Creates a pass from the given destination point and receive speed

Parameters
ball_positionthe current position of the ball (pass starting point)
pass_destinationthe end point of the pass
passing_configthe speed we want the pass to be received at
Returns
the Pass constructed from the start and end points, received at the intended speed clamped by the min and max pass speeds

◆ fromDestReceiveSpeed() [2/2]

Pass fromDestReceiveSpeed ( const Point ball_position,
const Point pass_destination,
double  dest_speed_m_per_s,
double  min_pass_speed_m_per_s,
double  max_pass_speed_m_per_s 
)
static

Creates a pass from the given destination point and receive speed

Parameters
ball_positionthe current position of the ball (pass starting point)
pass_destinationthe end point of the pass
dest_speed_m_per_sthe speed we want the pass to be received at
min_pass_speed_m_per_sthe minimum speed a pass should be taken at
max_pass_speed_m_per_sthe maximum speed a pass should be taken at
Returns
the Pass constructed from the start and end points, received at the intended speed clamped by the min and max pass speeds

◆ fromPassArray()

Pass fromPassArray ( Point  passer_point,
const std::array< double, NUM_PARAMS_TO_OPTIMIZE > &  pass_array,
double  pass_speed_m_per_s 
)
static

Create a pass from the given pass array

Parameters
passer_pointThe location of the passer location
pass_array[receiver_point.x(), receiver_point.y()]
pass_speed_m_per_sthe speed of the pass in m/s
Returns
The Pass constructed from the pass array

◆ getPassSpeed()

double getPassSpeed ( const Point ball_position,
const Point pass_destination,
double  receive_speed_m_per_s,
double  min_pass_speed_m_per_s,
double  max_pass_speed_m_per_s 
)
static

Determines the speed at which a pass should be executed Such that it reaches its destination at the given destination speed Takes into account friction Clamps the speed to the given mix and max speed values

Parameters
ball_positionthe current ball position (starting point of the pass)
pass_destinationthe destination of the pass
receive_speed_m_per_sthe speed we want the pass to be received at
min_pass_speed_m_per_sthe minimum speed a pass should be taken at
max_pass_speed_m_per_sthe maximum speed a pass should be taken at
Returns
the speed the pass should start with

◆ operator==()

bool operator== ( const Pass other) const

Compares Passes for equality. Passes are considered equal if all their member variables are equal.

Parameters
otherthe Pass to compare with for equality
Returns
true if the Passes are equal and false otherwise

◆ passerOrientation()

Angle passerOrientation ( ) const

Given the ball position, returns the angle the passer should be facing to pass.

Returns
The angle the passer should be facing

◆ passerPoint()

Point passerPoint ( ) const

Gets the value of the passer point

Returns
The value of the passer point

◆ receiverOrientation()

Angle receiverOrientation ( ) const

Given the ball position, returns the angle the receiver should be facing to receive the pass.

Returns
The angle the receiver should be facing

◆ receiverPoint()

Point receiverPoint ( ) const

Gets the value of the receiver point

Returns
The value of the receiver point

◆ speed()

double speed ( ) const

Gets the value of the pass speed

Returns
The value of the pass speed, in meters/second

◆ toPassArray()

std::array< double, NUM_PARAMS_TO_OPTIMIZE > toPassArray ( ) const

Converts a pass to an array

Returns
the pass array: [receiver_point.x(), receiver_point.y()]

Friends And Related Symbol Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream &  output_stream,
const Pass pass 
)
friend

Implement the "<<" operator for printing

Parameters
output_streamThe stream to print to
passThe pass to print
Returns
The output stream with the string representation of the class appended

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