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

#include <robot.h>

Classes

struct  cmpRobotByID
 

Public Member Functions

 Robot (RobotId id, const Point &position, const Vector &velocity, const Angle &orientation, const AngularVelocity &angular_velocity, const Timestamp &timestamp, const std::set< RobotCapability > &unavailable_capabilities=std::set< RobotCapability >(), const RobotConstants_t &robot_constants=DEFAULT_ROBOT_CONSTANTS)
 
 Robot (RobotId id, const RobotState &initial_state, const Timestamp &timestamp, const std::set< RobotCapability > &unavailable_capabilities=std::set< RobotCapability >(), const RobotConstants_t &robot_constants=DEFAULT_ROBOT_CONSTANTS)
 
 Robot (const TbotsProto::Robot &robot_proto)
 
void updateState (const RobotState &state, const Timestamp &timestamp)
 
RobotState currentState () const
 
Timestamp timestamp () const
 
RobotId id () const
 
Point position () const
 
Vector velocity () const
 
Angle orientation () const
 
AngularVelocity angularVelocity () const
 
const std::set< RobotCapability > & getUnavailableCapabilities () const
 
Polygon dribblerArea () const
 
std::set< RobotCapability > getAvailableCapabilities () const
 
std::set< RobotCapability > & getMutableRobotCapabilities ()
 
const RobotConstants_trobotConstants () const
 
bool isNearDribbler (const Point &test_point, double TOLERANCE=BALL_TO_FRONT_OF_ROBOT_DISTANCE_WHEN_DRIBBLING) const
 
Duration getTimeToOrientation (const Angle &desired_orientation, const AngularVelocity &final_angular_velocity=AngularVelocity::zero()) const
 
Duration getTimeToPosition (const Point &destination, const Vector &final_velocity=Vector()) const
 
bool operator== (const Robot &other) const
 
bool operator!= (const Robot &other) const
 

Detailed Description

Defines an SSL robot

Constructor & Destructor Documentation

◆ Robot() [1/3]

Robot ( RobotId  id,
const Point position,
const Vector velocity,
const Angle orientation,
const AngularVelocity angular_velocity,
const Timestamp timestamp,
const std::set< RobotCapability > &  unavailable_capabilities = std::set<RobotCapability>(),
const RobotConstants_t robot_constants = DEFAULT_ROBOT_CONSTANTS 
)
explicit

Creates a new robot given robot data

Parameters
idThe id of the robot to create
positionthe new position of the robot. Coordinates are in metres.
velocitythe new velocity of the robot, in metres / second.
orientationthe new orientation of the robot, in Radians.
angular_velocitythe new angular velocity of the robot, in Radians per second
timestampThe timestamp at which the robot was observed to be in the given state
unavailable_capabilitiesThe set of unavailable capabilities for this robot
robot_constantsThe robot constants for this robot

◆ Robot() [2/3]

Robot ( RobotId  id,
const RobotState initial_state,
const Timestamp timestamp,
const std::set< RobotCapability > &  unavailable_capabilities = std::set<RobotCapability>(),
const RobotConstants_t robot_constants = DEFAULT_ROBOT_CONSTANTS 
)
explicit

Creates a new robot with the given initial state

Parameters
idThe id of the robot to create
initial_stateThe initial state of the robot
timestampThe timestamp at which the robot was observed to be in the given state
unavailable_capabilitiesThe set of unavailable capabilities for this robot
robot_constantsThe robot constants for this robot

◆ Robot() [3/3]

Robot ( const TbotsProto::Robot &  robot_proto)
explicit

Creates a new robot based on the TbotsProto::Robot protobuf representation NOTE: TbotsProto::Robot does not store the robot constants and the original robot constants is lost in the conversion, as a result, the 2021 robot constants are used as default.

Parameters
robot_protoThe TbotsProto::Robot protobuf which this robot should be based on

Member Function Documentation

◆ angularVelocity()

AngularVelocity angularVelocity ( ) const

Returns the current angular velocity of the robot

Returns
the current angular velocity of the robot

◆ currentState()

RobotState currentState ( ) const

Gets the current state of the robot

Returns
current state of the robot

◆ dribblerArea()

Polygon dribblerArea ( ) const

Creates and returns a rectangle representing the dribbler area

Returns
the dribbler area rectangle

◆ getAvailableCapabilities()

std::set< RobotCapability > getAvailableCapabilities ( ) const

Returns all available capabilities this robot has

Returns
Returns all available capabilities this robot has

◆ getMutableRobotCapabilities()

std::set< RobotCapability > & getMutableRobotCapabilities ( )

Returns the mutable hardware capabilities of the robot

Returns
the mutable hardware capabilities of the robot

◆ getTimeToOrientation()

Duration getTimeToOrientation ( const Angle desired_orientation,
const AngularVelocity final_angular_velocity = AngularVelocity::zero() 
) const

Estimate the minimum time it would take to turn to the desired orientation

Parameters
desired_orientationThe orientation which we want the robot to be at
final_angular_velocityThe desired angular velocity which the robot will be moving at, once it reaches the desired orientation
Returns
The time required for this robot to rotate to the given orientation

◆ getTimeToPosition()

Duration getTimeToPosition ( const Point destination,
const Vector final_velocity = Vector() 
) const

Estimate the minimum time it would take to reach the desired point

Parameters
destinationThe destination that the robot is going to
final_velocityThe desired final velocity which the robot should be moving at
Returns
The minimum theoretical time it would take this robot to reach the destination

◆ getUnavailableCapabilities()

const std::set< RobotCapability > & getUnavailableCapabilities ( ) const

Returns the missing capabilities of the robot

Returns
the missing capabilities of the robot

◆ id()

RobotId id ( ) const

Returns the id of the robot

Returns
the id of the robot

◆ isNearDribbler()

bool isNearDribbler ( const Point test_point,
double  TOLERANCE = BALL_TO_FRONT_OF_ROBOT_DISTANCE_WHEN_DRIBBLING 
) const

Decides if a point is near the dribbler of the robot

Parameters
test_pointThe point to check
TOLERANCEThe tolerance for the distance between the dribbler and the ball
Returns
whether the test_point is near the dribbler of the robot

◆ operator!=()

bool operator!= ( const Robot other) const

Defines the inequality operator for a Robot.

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

◆ operator==()

bool operator== ( const Robot other) const

Defines the equality operator for a Robot. Robots are equal if their IDs and all other parameters (position, orientation, etc) are equal. The last update timestamp is not part of the equality.

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

◆ orientation()

Angle orientation ( ) const

Returns the current orientation of the robot

Returns
the current orientation of the robot

◆ position()

Point position ( ) const

Returns the current position of the robot

Returns
the current position of the robot

◆ robotConstants()

const RobotConstants_t & robotConstants ( ) const

Returns the robot constants for this robot

Returns
the robot constants for this robot

◆ timestamp()

Timestamp timestamp ( ) const

Returns the current timestamp of this robot

Returns
the current timestamp

◆ updateState()

void updateState ( const RobotState state,
const Timestamp timestamp 
)

Updates the robot with new data

Parameters
robot_stateA robot state containing new robot data
timestampNew timestamp

◆ velocity()

Vector velocity ( ) const

Returns the current velocity of the robot

Returns
the current velocity of the robot

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