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

#include <ball_state.h>

Public Member Functions

 BallState (const Point &position, const Vector &velocity, double distance_from_ground=0.0)
 
 BallState (const TbotsProto::BallState &ball_state_proto)
 
Point position () const
 
Vector velocity () const
 
double distanceFromGround () const
 
bool operator== (const BallState &other) const
 
bool operator!= (const BallState &other) const
 

Detailed Description

Represents the state of a ball

Constructor & Destructor Documentation

◆ BallState() [1/2]

BallState ( const Point position,
const Vector velocity,
double  distance_from_ground = 0.0 
)
explicit

Creates a new ball state with the given position and velocity

Parameters
positionThe position of the ball, with coordinates in metres
velocityThe velocity of the ball, in metres per second
distance_from_groundThe distance of the bottom of the ball from the ground in metres. For example, a ball rolling along the ground has a distance from ground of 0

◆ BallState() [2/2]

BallState ( const TbotsProto::BallState &  ball_state_proto)
explicit

Creates a new ball state based on the TbotsProto::BallState protobuf representation

Parameters
ball_state_protoThe TbotsProto::BallState protobuf which this ball state should be based on

Member Function Documentation

◆ distanceFromGround()

double distanceFromGround ( ) const

Returns the distance of the bottom of the ball from the ground in metres

Returns
the distance of the bottom of the ball from the ground in metres

◆ operator!=()

bool operator!= ( const BallState other) const

Defines the inequality operator for a BallState.

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

◆ operator==()

bool operator== ( const BallState other) const

Defines the equality operator for a BallState. BallStates are equal if their positions and velocities are the same

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

◆ position()

Point position ( ) const

Returns the position of the ball represented by this state

Returns
the position of the ball represented by this state

◆ velocity()

Vector velocity ( ) const

Returns the velocity of the ball represented by this state

Returns
the velocity of the ball represented by this state

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