#include <team.h>
◆ Team() [1/3]
Create a new team
- Parameters
-
| robot_expiry_buffer_duration | The Duration for which a robot must not have been updated for before it is removed from the team |
◆ Team() [2/3]
Create a new team
- Parameters
-
| team_robots | The robots on the team |
| robot_expiry_buffer_duration | The Duration for which a robot must not have been updated for before it is removed from the team |
◆ Team() [3/3]
Creates a new team based on the TbotsProto::Team protobuf representation
- Parameters
-
| team_proto | The TbotsProto::Team protobuf which this robot should be based on |
◆ assignGoalie()
| void assignGoalie |
( |
RobotId |
new_goalie_id | ) |
|
Assigns the goalie id for this team
- Parameters
-
| new_goalie_id | The id of the new goalie for this team |
◆ clearAllRobots()
Removes all Robots from this team. Does not affect the goalie id.
◆ clearGoalie()
Clears the goalie for this team. There will be no goalie assigned after this operation
◆ getAllRobots()
| const std::vector< Robot > & getAllRobots |
( |
| ) |
const |
Returns a vector of all the robots on this team.
- Returns
- a vector of all the robots on this team.
◆ getAllRobotsExceptGoalie()
| std::vector< Robot > getAllRobotsExceptGoalie |
( |
| ) |
const |
Returns a vector of all the robots on this team excluding the goalie
- Returns
- a vector of all the robots on this team excluding the goalie
◆ getGoalieId()
| std::optional< unsigned int > getGoalieId |
( |
| ) |
const |
Returns the ID of the goalie for this team, if one has been specified. Otherwise returns std::nullopt
- Returns
- The ID of the goalie robot for this team if one is specified, otherwise returns std::nullopt
◆ getMostRecentTimestamp()
◆ getNearestRobot() [1/2]
| std::optional< Robot > getNearestRobot |
( |
const Point & |
ref_point | ) |
const |
Finds the robot on a team that is closest to the reference point
- Parameters
-
| ref_point | The point where the distance to each robot will be measured. |
- Returns
- Robot that is closest to the reference point. std::nullopt otherwise
◆ getNearestRobot() [2/2]
| std::optional< Robot > getNearestRobot |
( |
const std::vector< Robot > & |
robots, |
|
|
const Point & |
ref_point |
|
) |
| |
|
static |
Given a list of robots, finds the robot on that team that is closest to a reference point.
- Parameters
-
| robots | the list of robots |
| ref_point | The point where the distance to each robot will be measured. |
- Returns
- Robot that is closest to the reference point.
◆ getRobotById()
| std::optional< Robot > getRobotById |
( |
const unsigned int |
id | ) |
const |
Returns the robot with the given id. If this team does not have that robot, returns an std::nullopt
- Parameters
-
| id | the id of the desired Robot |
- Returns
- the Robot on the team with the given id if it exists, otherwise std::nullopt
◆ getRobotExpiryBufferDuration()
| const Duration & getRobotExpiryBufferDuration |
( |
| ) |
const |
Returns the Duration for which a Robot must not have been updated for before being removed from this team.
- Returns
- the Duration for which a Robot must not have been updated for before being removed from this team.
◆ goalie()
| std::optional< Robot > goalie |
( |
| ) |
const |
Returns the goalie robot for this team, if one is specified. Otherwise returns std::nullopt
- Returns
- the goalie robot for this team if one is specified, otherwise returns std::nullopt
◆ numRobots()
| std::size_t numRobots |
( |
| ) |
const |
Gets the number of robots on this team
- Returns
- the number of robots on this team
◆ operator!=()
| bool operator!= |
( |
const Team & |
other | ) |
const |
Defines the inequality operator for a Team.
- Parameters
-
| other | The team to compare against for inequality |
- Returns
- True if the other team is not equal to this team, and false otherwise
◆ operator==()
| bool operator== |
( |
const Team & |
other | ) |
const |
Defines the equality operator for a Team. Teams are equal if their robots are equal and have the same robot assigned as the goalie
- Parameters
-
| other | The team to compare against for equality |
- Returns
- True if the other team is equal to this team, and false otherwise
◆ removeExpiredRobots()
| void removeExpiredRobots |
( |
const Timestamp & |
timestamp | ) |
|
Removes expired robots from the team. Robots are expired if it has been more than the expiry_buffer time has passed since they were last updated. This would happen if a robot is removed from the field, so that it is no longer seen by the cameras. After a short amount of time, we should treat robots that we can no longer see (and therefore have not been updating) as removed from the field, so we should remove them from the team.
- Parameters
-
| timestamp | The timestamp for when this removal is taking place |
◆ removeRobotWithId()
| void removeRobotWithId |
( |
unsigned int |
robot_id | ) |
|
Remove the robot with the given ID from the team
If there is no robot with the given id on the team, does nothing
- Parameters
-
| robot_id | The id of the robot to remove |
◆ setRobotExpiryBuffer()
| void setRobotExpiryBuffer |
( |
const Duration & |
new_robot_expiry_buffer_duration | ) |
|
Sets the Duration for which a Robot must not have been updated for before being removed from this team.
- Parameters
-
| new_robot_expiry_buffer_duration | the Duration for which a Robot must not have been updated for before being removed from this team. |
◆ setUnavailableRobotCapabilities()
| void setUnavailableRobotCapabilities |
( |
RobotId |
id, |
|
|
const std::set< RobotCapability > & |
new_unavailable_robot_capabilities |
|
) |
| |
Updates the unavailable capabilities of a specific robot. If the team does not have that robot, does not do anything.
- Parameters
-
| id | the id of the desired Robot |
| new_unavailable_robot_capabilities | a set of the updated unavailable robot capabilities |
◆ timestamp()
| std::optional< Timestamp > timestamp |
( |
| ) |
const |
Returns the timestamp of the most recently updated robot on this team
- Returns
- the timestamp of the most recently updated robot on this team, or std::nullopt if this team is empty
◆ updateRobots()
| void updateRobots |
( |
const std::vector< Robot > & |
team_robots | ) |
|
Updates this team with new robots.
- Exceptions
-
| std::invalid_argument | if multiple robots have the same id |
- Parameters
-
| team_robots | the new robots for this team |
◆ updateState()
| void updateState |
( |
const Team & |
new_team_data | ) |
|
Updates this team with new data from the given team object. This is different from a copy constructor because the team object is only used to store data, we don't take the entire state of the new_team_data. For example, the robots on this team may have complex internal state for predicting movement. The "simple" robot data such as position, velocity... from the new_team_data is used to update the state of the robots on this team, rather than the robots simply being copied over (because if we copied we would lose our state).
- Parameters
-
| new_team_data | A team with the new team data |
The documentation for this class was generated from the following files:
- src/software/world/team.h
- src/software/world/team.cpp