Thunderbots Project
Loading...
Searching...
No Matches
Ball Class Referencefinal

Public Member Functions

 Ball (const Point &position, const Vector &velocity, const Timestamp &timestamp, const Vector &acceleration=Vector(0, 0))
 
 Ball (const BallState &initial_state, const Timestamp &timestamp, const Vector &acceleration=Vector(0, 0))
 
 Ball (const TbotsProto::Ball &ball_proto)
 
BallState currentState () const
 
void updateState (const BallState &new_state, const Timestamp &new_timestamp, const Vector &new_acceleration=Vector(0, 0))
 
Timestamp timestamp () const
 
Point position () const
 
Vector velocity () const
 
Vector acceleration () const
 
BallState estimateFutureState (const Duration &duration_in_future) const
 
bool hasBallBeenKicked (const Angle &expected_kick_direction, double min_kick_speed=0.5, const Angle &max_angle_difference=Angle::fromDegrees(20)) const
 
bool operator== (const Ball &other) const
 
bool operator!= (const Ball &other) const
 

Constructor & Destructor Documentation

◆ Ball() [1/3]

Ball ( const Point position,
const Vector velocity,
const Timestamp timestamp,
const Vector acceleration = Vector(0, 0) 
)
explicit

Creates a new ball with the given initial state

Parameters
positionThe position of the ball, with coordinates in metres
velocityThe velocity of the ball, in metres per second
timestampThe timestamp at which the ball was observed to be at the given position and velocity
accelerationacceleration being applied to the ball

◆ Ball() [2/3]

Ball ( const BallState initial_state,
const Timestamp timestamp,
const Vector acceleration = Vector(0, 0) 
)
explicit

Creates a new ball with the given initial state

Parameters
initial_stateThe initial state of the ball
timestampthe initial timestamp
accelerationacceleration being applied to the ball

◆ Ball() [3/3]

Ball ( const TbotsProto::Ball &  ball_proto)
explicit

Creates a new ball based on the TbotsProto::Ball protobuf representation

Parameters
ball_protoThe TbotsProto::Ball protobuf which this ball should be based on

Member Function Documentation

◆ acceleration()

Vector acceleration ( ) const

Returns the current acceleration of the ball

Returns
the current acceleration of the ball

◆ currentState()

BallState currentState ( ) const

Returns the current state of the ball

Returns
BallState

◆ estimateFutureState()

BallState estimateFutureState ( const Duration duration_in_future) const

Returns the estimated state of the ball at the specified amount of time in the future

Parameters
duration_in_futureThe Duration into the future at which to predict the ball's position
Returns
The future state of the ball

◆ hasBallBeenKicked()

bool hasBallBeenKicked ( const Angle expected_kick_direction,
double  min_kick_speed = 0.5,
const Angle max_angle_difference = Angle::fromDegrees(20) 
) const

Software approximation that finds if a ball has been kicked, regardless of whether the kick was a pass, shot, or chip.

Parameters
expected_kick_directionThe direction that we expect the ball to be kicked towards
min_kick_speedThe minimum speed of the ball to be considered a kick, in metres per second
max_angle_differenceThe maximum angle difference for determining if ball has been kicked in the approximate direction as expected
Returns
True if ball was kicked in the approximate direction we expect, false otherwise

◆ operator!=()

bool operator!= ( const Ball other) const

Defines the inequality operator for a Ball.

Parameters
otherThe ball to compare against for inequality
Returns
True if the other ball is not equal to this ball, and false otherwise

◆ operator==()

bool operator== ( const Ball other) const

Defines the equality operator for a Ball. Balls are equal if their positions and velocities are the same

Parameters
otherThe Ball to compare against for equality
Returns
True if the other ball is equal to this ball, and false otherwise

◆ position()

Point position ( ) const

Returns the current position of the ball

Returns
the current position of the ball

◆ timestamp()

Timestamp timestamp ( ) const

Returns the current timestamp for this ball

Returns
the current timestamp

◆ updateState()

void updateState ( const BallState new_state,
const Timestamp new_timestamp,
const Vector new_acceleration = Vector(0, 0) 
)

Updates the ball with new data

Parameters
new_statethe new state of the ball
new_timestampthe new timestamp
new_accelerationacceleration being applied to the ball

◆ velocity()

Vector velocity ( ) const

Returns the current velocity of the ball

Returns
the current velocity of the ball

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