TraveSim Adapters  0.1
Protobuf adapters for TraveSim project
travesim::FieldState Class Reference

Data structure to hold the field state. More...

#include "field_state.hpp"

Collaboration diagram for travesim::FieldState:

Public Member Functions

 FieldState (TeamsFormation teams_formation=TeamsFormation::THREE_ROBOTS_PER_TEAM)
 Construct a new Field State object. More...
 

Public Attributes

uint time_step
 
uint8_t robots_per_team
 
EntityState ball
 Field entities. More...
 
std::vector< EntityStateyellow_team
 
std::vector< EntityStateblue_team
 

Friends

std::ostream & operator<< (std::ostream &output, const FieldState &field_state)
 Output stream operator overloading. More...
 

Detailed Description

Data structure to hold the field state.

Definition at line 25 of file field_state.hpp.

Constructor & Destructor Documentation

◆ FieldState()

travesim::FieldState::FieldState ( TeamsFormation  teams_formation = TeamsFormation::THREE_ROBOTS_PER_TEAM)

Construct a new Field State object.

Parameters
teams_formationNumber of robots per team, default is 3

Definition at line 19 of file field_state.cpp.

19  : robots_per_team(teams_formation) {
20  this->yellow_team = std::vector<EntityState>(this->robots_per_team);
21  this->blue_team = std::vector<EntityState>(this->robots_per_team);
22 }
std::vector< EntityState > yellow_team
Definition: field_state.hpp:50
std::vector< EntityState > blue_team
Definition: field_state.hpp:51

References blue_team, robots_per_team, and yellow_team.

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  output,
const FieldState field_state 
)
friend

Output stream operator overloading.

Definition at line 24 of file field_state.cpp.

24  {
25  output << "TIME STEP: " << std::endl;
26  output << field_state.time_step << std::endl;
27 
28  output << "BALL STATE: " << std::endl;
29  output << field_state.ball << std::endl;
30 
31  output << "TEAM YELLOW STATE: " << std::endl;
32 
33  for (int i = 0; i < field_state.robots_per_team; i++) {
34  output << "ROBOT " << i << ":" << std::endl;
35  output << field_state.yellow_team[i] << std::endl;
36  }
37 
38  output << std::endl;
39 
40  output << "TEAM BLUE STATE: " << std::endl;
41 
42  for (int i = 0; i < field_state.robots_per_team; i++) {
43  output << "ROBOT " << i << ":" << std::endl;
44  output << field_state.blue_team[i] << std::endl;
45  }
46 
47  output << std::endl;
48 
49  return output;
50 }

Member Data Documentation

◆ ball

EntityState travesim::FieldState::ball

Field entities.

Definition at line 48 of file field_state.hpp.

◆ blue_team

std::vector<EntityState> travesim::FieldState::blue_team

Definition at line 51 of file field_state.hpp.

◆ robots_per_team

uint8_t travesim::FieldState::robots_per_team

Definition at line 42 of file field_state.hpp.

◆ time_step

uint travesim::FieldState::time_step

ODE time step

Definition at line 40 of file field_state.hpp.

◆ yellow_team

std::vector<EntityState> travesim::FieldState::yellow_team

Definition at line 50 of file field_state.hpp.


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