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

Data structure to hold the state of a robot in the simulation. More...

#include "robot_state.hpp"

Inheritance diagram for travesim::RobotState:
Collaboration diagram for travesim::RobotState:

Public Member Functions

 RobotState ()
 Construct a new Robot State object. More...
 
 RobotState (Vector2D position, double angular_position, Vector2D velocity, double angular_velocity, bool is_yellow, int id)
 Construct a new Robot State object. More...
 
 RobotState (EntityState *entity_state, bool is_yellow, int id)
 Construct a new Robot State object from EntityState object. More...
 
- Public Member Functions inherited from travesim::EntityState
 EntityState ()
 Construct a new Entity State object. More...
 
 EntityState (Vector2D position, double angular_position, Vector2D velocity, double angular_velocity)
 Construct a new Entity State object. More...
 
virtual ~EntityState ()=default
 

Public Attributes

bool is_yellow
 Public attributes. More...
 
int id
 
- Public Attributes inherited from travesim::EntityState
Vector2D position
 Position in meters. More...
 
Vector2D velocity
 Velocity in m/s. More...
 
double angular_position
 Angular position in radinans. More...
 
double angular_velocity
 Angular velocity in rad/s. More...
 

Friends

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

Detailed Description

Data structure to hold the state of a robot in the simulation.

Definition at line 23 of file robot_state.hpp.

Constructor & Destructor Documentation

◆ RobotState() [1/3]

travesim::RobotState::RobotState ( )

Construct a new Robot State object.

Definition at line 20 of file robot_state.cpp.

20  : RobotState(Vector2D(), 0, Vector2D(), 0, true, 0) {
21 }
RobotState()
Construct a new Robot State object.
Definition: robot_state.cpp:20

◆ RobotState() [2/3]

travesim::RobotState::RobotState ( Vector2D  position,
double  angular_position,
Vector2D  velocity,
double  angular_velocity,
bool  is_yellow,
int  id 
)

Construct a new Robot State object.

Parameters
positionPosition in meters
angular_positionAngular position in radinans
velocityVelocity in m/s
angular_velocityAngular velocity in rad/s
is_yellowWheter the robot is from the yellow team or not
idIdentification number

Definition at line 23 of file robot_state.cpp.

24  :
26  this->is_yellow = is_yellow;
27  this->id = id;
28 }
double angular_velocity
Angular velocity in rad/s.
EntityState()
Construct a new Entity State object.
Vector2D velocity
Velocity in m/s.
double angular_position
Angular position in radinans.
Vector2D position
Position in meters.
bool is_yellow
Public attributes.
Definition: robot_state.hpp:64

References id, and is_yellow.

◆ RobotState() [3/3]

travesim::RobotState::RobotState ( EntityState entity_state,
bool  is_yellow,
int  id 
)

Construct a new Robot State object from EntityState object.

Parameters
entity_stateObject to be promoted
is_yellowWheter the robot is from the yellow team or not
idIdentification number

Definition at line 30 of file robot_state.cpp.

30  :
31  EntityState(entity_state->position,
32  entity_state->angular_position,
33  entity_state->velocity,
34  entity_state->angular_velocity) {
35  this->is_yellow = is_yellow;
36  this->id = id;
37 }
EntityState()
Construct a new Entity State object.
bool is_yellow
Public attributes.
Definition: robot_state.hpp:64

References id, and is_yellow.

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  output,
const RobotState robot_state 
)
friend

Output stream operator overloading.

Definition at line 39 of file robot_state.cpp.

39  {
40  output << std::fixed << std::setprecision(PRINTING_DECIMAL_PRECISION);
41 
42  output << "TEAM YELLOW: " << robot_state.is_yellow << std::endl;
43  output << "ROBOT ID: " << robot_state.id << std::endl;
44 
45  output << "POSITION: ";
46  output << robot_state.position << " | ";
47  output << "THETA: "<< std::setw(PRINTING_MIN_WIDTH) << robot_state.angular_position << std::endl;
48 
49  output << "VELOCITY: ";
50  output << robot_state.velocity << " | ";
51  output << "THETA: "<< std::setw(PRINTING_MIN_WIDTH) << robot_state.angular_velocity << std::endl;
52 
53  return output;
54 }
#define PRINTING_DECIMAL_PRECISION
Definition: data_common.hpp:22
#define PRINTING_MIN_WIDTH
Printing output configuration constants.
Definition: data_common.hpp:21

Member Data Documentation

◆ id

int travesim::RobotState::id

Definition at line 65 of file robot_state.hpp.

◆ is_yellow

bool travesim::RobotState::is_yellow

Public attributes.

Definition at line 64 of file robot_state.hpp.


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