TraveSim Adapters  0.1
Protobuf adapters for TraveSim project
entity_state.hpp
Go to the documentation of this file.
1 /**
2  * @file entity_state.hpp
3  *
4  * @brief Entity state data structure
5  *
6  * @author Lucas Haug <lucas.haug@thunderatz.org>
7  *
8  * @date 04/2021
9  */
10 
11 #ifndef __ENTITY_STATE_H__
12 #define __ENTITY_STATE_H__
13 
14 #include <iostream>
15 
16 namespace travesim {
17 /**
18  * @brief Data structure to hold a two dimensional vector
19  *
20  */
21 class Vector2D {
22  public:
23  /**
24  * @brief Construct a new Vector2D object
25  *
26  * @param x x quota
27  * @param y y quota
28  */
29  Vector2D(double x = 0, double y = 0);
30 
31  /**
32  * @brief Perform a counter-clockwise rotation of the vector
33  *
34  * @param theta Rotation angle in radians
35  */
36  void rotate(double theta);
37 
38  /**
39  * @brief Output stream operator overloading
40  *
41  */
42  friend std::ostream& operator <<(std::ostream& output, const Vector2D& vector_2d);
43 
44  /**
45  * @brief Public attributes
46  *
47  */
48  double x;
49  double y;
50 };
51 
52 /**
53  * @brief Data structure to hold the state of a entity in the simulation
54  *
55  */
56 class EntityState {
57  public:
58  /**
59  * @brief Construct a new Entity State object
60  *
61  */
62  EntityState();
63 
64  /**
65  * @brief Construct a new Entity State object
66  *
67  * @param position Position in meters
68  * @param angular_position Angular position in radinans
69  * @param velocity Velocity in m/s
70  * @param angular_velocity Angular velocity in rad/s
71  */
73 
74  virtual ~EntityState() = default;
75 
76  /**
77  * @brief Output stream operator overloading
78  *
79  */
80  friend std::ostream& operator <<(std::ostream& output, const EntityState& entity_state);
81 
82  /**
83  * @brief Position in meters
84  *
85  */
87 
88  /**
89  * @brief Velocity in m/s
90  *
91  */
93 
94  /**
95  * @brief Angular position in radinans
96  *
97  */
99 
100  /**
101  * @brief Angular velocity in rad/s
102  *
103  */
105 };
106 }
107 
108 #endif // __ENTITY_STATE_H__
double angular_velocity
Angular velocity in rad/s.
EntityState()
Construct a new Entity State object.
Vector2D velocity
Velocity in m/s.
Data structure to hold a two dimensional vector.
double x
Public attributes.
friend std::ostream & operator<<(std::ostream &output, const EntityState &entity_state)
Output stream operator overloading.
double angular_position
Angular position in radinans.
Vector2D position
Position in meters.
void rotate(double theta)
Perform a counter-clockwise rotation of the vector.
Vector2D(double x=0, double y=0)
Construct a new Vector2D object.
friend std::ostream & operator<<(std::ostream &output, const Vector2D &vector_2d)
Output stream operator overloading.
virtual ~EntityState()=default
Data structure to hold the state of a entity in the simulation.