TraveSim Adapters  0.1
Protobuf adapters for TraveSim project
field_state.cpp
Go to the documentation of this file.
1 /**
2  * @file team_command.cpp
3  *
4  * @brief Team command data structure
5  *
6  * @author Lucas Haug <lucas.haug@thunderatz.org>
7  *
8  * @date 04/2021
9  */
10 
11 #include <iomanip>
13 
14 namespace travesim {
15 /*****************************************
16  * FieldState Related
17  *****************************************/
18 
19 FieldState::FieldState(TeamsFormation teams_formation) : 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 }
23 
24 std::ostream& operator <<(std::ostream& output, const FieldState& field_state) {
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 }
51 }
EntityState ball
Field entities.
Definition: field_state.hpp:48
Data structure to hold the field state.
Definition: field_state.hpp:25
std::vector< EntityState > yellow_team
Definition: field_state.hpp:50
FieldState(TeamsFormation teams_formation=TeamsFormation::THREE_ROBOTS_PER_TEAM)
Construct a new Field State object.
Definition: field_state.cpp:19
TeamsFormation
Formation of the teams.
Definition: data_common.hpp:40
std::ostream & operator<<(std::ostream &output, const ReplacerConfigurer &repl_conf)
std::vector< EntityState > blue_team
Definition: field_state.hpp:51