Fawkes API  Fawkes Development Version
ObjectPositionInterface.h
1 
2 /***************************************************************************
3  * ObjectPositionInterface.h - Fawkes BlackBoard Interface - ObjectPositionInterface
4  *
5  * Templated created: Thu Oct 12 10:49:19 2006
6  * Copyright 2007-2008 Tim Niemueller
7  *
8  ****************************************************************************/
9 
10 /* This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version. A runtime exception applies to
14  * this software (see LICENSE.GPL_WRE file mentioned below for details).
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU Library General Public License for more details.
20  *
21  * Read the full text in the LICENSE.GPL_WRE file in the doc directory.
22  */
23 
24 #ifndef __INTERFACES_OBJECTPOSITIONINTERFACE_H_
25 #define __INTERFACES_OBJECTPOSITIONINTERFACE_H_
26 
27 #include <interface/interface.h>
28 #include <interface/message.h>
29 #include <interface/field_iterator.h>
30 
31 namespace fawkes {
32 
34 {
35  /// @cond INTERNALS
36  INTERFACE_MGMT_FRIENDS(ObjectPositionInterface)
37  /// @endcond
38  public:
39  /* constants */
40  static const uint32_t TYPE_OTHER;
41  static const uint32_t TYPE_BALL;
42  static const uint32_t TYPE_OPPONENT;
43  static const uint32_t TYPE_TEAMMEMBER;
44  static const uint32_t TYPE_LINE;
45  static const uint32_t TYPE_SELF;
46  static const uint32_t TYPE_GOAL_BLUE;
47  static const uint32_t TYPE_GOAL_YELLOW;
48  static const uint32_t FLAG_NONE;
49  static const uint32_t FLAG_HAS_WORLD;
50  static const uint32_t FLAG_HAS_RELATIVE_CARTESIAN;
51  static const uint32_t FLAG_HAS_RELATIVE_POLAR;
52  static const uint32_t FLAG_HAS_EULER_ANGLES;
53  static const uint32_t FLAG_HAS_EXTENT;
54  static const uint32_t FLAG_HAS_VOLUME_EXTENT;
55  static const uint32_t FLAG_HAS_CIRCULAR_EXTENT;
56  static const uint32_t FLAG_HAS_COVARIANCES;
57  static const uint32_t FLAG_HAS_WORLD_VELOCITY;
58  static const uint32_t FLAG_HAS_Z_AS_ORI;
59  static const uint32_t FLAG_IS_FIXED_OBJECT;
60 
61  private:
62 #pragma pack(push,4)
63  /** Internal data storage, do NOT modify! */
64  typedef struct {
65  int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */
66  int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
67  uint32_t object_type; /**<
68  Object type, use constants to define
69  */
70  uint32_t flags; /**<
71  Bit-wise concatenated fields of FLAG_* constants. Denotes features that the
72  writer of this interfaces provides. Use a bit-wise OR to concatenate multiple
73  flags, use a bit-wise AND to check if a flag has been set.
74  */
75  bool visible; /**< True, if object is visible. */
76  bool valid; /**< True, if this position is valid. */
77  int32_t visibility_history; /**<
78  The visibilitiy history indicates the number of consecutive positive or negative
79  sightings. If the history is negative, there have been as many negative sightings
80  (object not visible) as the absolute value of the history. A positive value denotes
81  as many positive sightings. 0 shall only be used during the initialisation of the
82  interface or if the visibility history is not filled.
83  */
84  float roll; /**<
85  Roll value for the orientation of the object in space.
86  */
87  float pitch; /**<
88  Pitch value for the orientation of the object in space.
89  */
90  float yaw; /**<
91  Yaw value for the orientation of the object in space.
92  */
93  float distance; /**<
94  Distance from the robot to the object on the ground plane. The distance is given
95  in meters.
96  */
97  float bearing; /**<
98  Angle between the robot's forward direction and the object on the ground plane.
99  This angle is in a local 3D coordinate system to the robot and given in radians.
100  */
101  float slope; /**<
102  Angle between the robot's center position on the ground plane and the middle point
103  of the object (e.g. this denotes the height of the object combined with the distance.
104  The angle is given in radians.
105  */
106  float dbs_covariance[9]; /**<
107  Covariance of Distance/Yaw/Pitch values. This is a 3x3 matrix ordered line by line,
108  first three values represent row, next tree values second row and last three values
109  last row from left to right each.
110  */
111  float world_x; /**<
112  This is the X coordinate in the cartesian right-handed world coordinate system.
113  This coordinate system has its origin in the center of the field, Y pointing to
114  the opponent's goal and X pointing to the right.
115  */
116  float world_y; /**<
117  This is the Y coordinate in the cartesian right-handed world coordinate system.
118  This coordinate system has its origin in the center of the field, Y pointing to
119  the opponent's goal and X pointing to the right and Z pointing downwards.
120  */
121  float world_z; /**<
122  This is the Z coordinate in the cartesian right-handed world coordinate system.
123  This coordinate system has its origin in the center of the field, Y pointing to
124  the opponent's goal and X pointing to the right.
125  */
126  float world_xyz_covariance[9]; /**<
127  Covariance of WorldX/WorldY/WorldZ values. This is a 3x3 matrix ordered line by line,
128  first three values represent row, next tree values second row and last three values
129  last row from left to right each.
130  */
131  float relative_x; /**<
132  This is the X coordinate in the cartesian right-handed robot coordinate system.
133  */
134  float relative_y; /**<
135  This is the Y coordinate in the cartesian right-handed robot coordinate system.
136  */
137  float relative_z; /**<
138  This is the Z coordinate in the cartesian right-handed robot coordinate system.
139  */
140  float relative_xyz_covariance[9]; /**<
141  Covariance of relative x/y/z values. This is a 3x3 matrix ordered line by line,
142  first three values represent row, next tree values second row and last three values
143  last row from left to right each.
144  */
145  float extent_x; /**<
146  Extent of the seen object given in the relative x cartesian coordinate in m.
147  */
148  float extent_y; /**<
149  Extent of the seen object given in the relative y cartesian coordinate in m.
150  */
151  float extent_z; /**<
152  Extent of the seen object given in the relative z cartesian coordinate in m.
153  */
154  float world_x_velocity; /**<
155  Velocity of object in the world coordinate system in X-direction in meter per second.
156  */
157  float world_y_velocity; /**<
158  Velocity of object in the world coordinate system in Y-direction in meter per second.
159  */
160  float world_z_velocity; /**<
161  Velocity of object in the world coordinate system in Z-direction in meter per second.
162  */
163  float world_xyz_velocity_covariance[9]; /**<
164  Covariance of WorldX/WorldY/WorldZ velocity values. This is a 3x3 matrix ordered line
165  by line, first three values represent row, next tree values second row and last three
166  values last row from left to right each.
167  */
168  float relative_x_velocity; /**<
169  Velocity of object in the world coordinate system in X-direction in meter per second.
170  */
171  float relative_y_velocity; /**<
172  Velocity of object in the world coordinate system in Y-direction in meter per second.
173  */
174  float relative_z_velocity; /**<
175  Velocity of object in the world coordinate system in Z-direction in meter per second.
176  */
177  float relative_xyz_velocity_covariance[9]; /**<
178  Covariance of relative x/y/z velocity values. This is a 3x3 matrix ordered line
179  by line, first three values represent row, next tree values second row and last three
180  values last row from left to right each.
181  */
182  } ObjectPositionInterface_data_t;
183 #pragma pack(pop)
184 
185  ObjectPositionInterface_data_t *data;
186 
187  public:
188  /* messages */
189  virtual bool message_valid(const Message *message) const;
190  private:
193 
194  public:
195  /* Methods */
196  uint32_t object_type() const;
197  void set_object_type(const uint32_t new_object_type);
198  size_t maxlenof_object_type() const;
199  uint32_t flags() const;
200  void set_flags(const uint32_t new_flags);
201  size_t maxlenof_flags() const;
202  bool is_visible() const;
203  void set_visible(const bool new_visible);
204  size_t maxlenof_visible() const;
205  bool is_valid() const;
206  void set_valid(const bool new_valid);
207  size_t maxlenof_valid() const;
208  int32_t visibility_history() const;
209  void set_visibility_history(const int32_t new_visibility_history);
210  size_t maxlenof_visibility_history() const;
211  float roll() const;
212  void set_roll(const float new_roll);
213  size_t maxlenof_roll() const;
214  float pitch() const;
215  void set_pitch(const float new_pitch);
216  size_t maxlenof_pitch() const;
217  float yaw() const;
218  void set_yaw(const float new_yaw);
219  size_t maxlenof_yaw() const;
220  float distance() const;
221  void set_distance(const float new_distance);
222  size_t maxlenof_distance() const;
223  float bearing() const;
224  void set_bearing(const float new_bearing);
225  size_t maxlenof_bearing() const;
226  float slope() const;
227  void set_slope(const float new_slope);
228  size_t maxlenof_slope() const;
229  float * dbs_covariance() const;
230  float dbs_covariance(unsigned int index) const;
231  void set_dbs_covariance(unsigned int index, const float new_dbs_covariance);
232  void set_dbs_covariance(const float * new_dbs_covariance);
233  size_t maxlenof_dbs_covariance() const;
234  float world_x() const;
235  void set_world_x(const float new_world_x);
236  size_t maxlenof_world_x() const;
237  float world_y() const;
238  void set_world_y(const float new_world_y);
239  size_t maxlenof_world_y() const;
240  float world_z() const;
241  void set_world_z(const float new_world_z);
242  size_t maxlenof_world_z() const;
243  float * world_xyz_covariance() const;
244  float world_xyz_covariance(unsigned int index) const;
245  void set_world_xyz_covariance(unsigned int index, const float new_world_xyz_covariance);
246  void set_world_xyz_covariance(const float * new_world_xyz_covariance);
247  size_t maxlenof_world_xyz_covariance() const;
248  float relative_x() const;
249  void set_relative_x(const float new_relative_x);
250  size_t maxlenof_relative_x() const;
251  float relative_y() const;
252  void set_relative_y(const float new_relative_y);
253  size_t maxlenof_relative_y() const;
254  float relative_z() const;
255  void set_relative_z(const float new_relative_z);
256  size_t maxlenof_relative_z() const;
257  float * relative_xyz_covariance() const;
258  float relative_xyz_covariance(unsigned int index) const;
259  void set_relative_xyz_covariance(unsigned int index, const float new_relative_xyz_covariance);
260  void set_relative_xyz_covariance(const float * new_relative_xyz_covariance);
261  size_t maxlenof_relative_xyz_covariance() const;
262  float extent_x() const;
263  void set_extent_x(const float new_extent_x);
264  size_t maxlenof_extent_x() const;
265  float extent_y() const;
266  void set_extent_y(const float new_extent_y);
267  size_t maxlenof_extent_y() const;
268  float extent_z() const;
269  void set_extent_z(const float new_extent_z);
270  size_t maxlenof_extent_z() const;
271  float world_x_velocity() const;
272  void set_world_x_velocity(const float new_world_x_velocity);
273  size_t maxlenof_world_x_velocity() const;
274  float world_y_velocity() const;
275  void set_world_y_velocity(const float new_world_y_velocity);
276  size_t maxlenof_world_y_velocity() const;
277  float world_z_velocity() const;
278  void set_world_z_velocity(const float new_world_z_velocity);
279  size_t maxlenof_world_z_velocity() const;
280  float * world_xyz_velocity_covariance() const;
281  float world_xyz_velocity_covariance(unsigned int index) const;
282  void set_world_xyz_velocity_covariance(unsigned int index, const float new_world_xyz_velocity_covariance);
283  void set_world_xyz_velocity_covariance(const float * new_world_xyz_velocity_covariance);
285  float relative_x_velocity() const;
286  void set_relative_x_velocity(const float new_relative_x_velocity);
287  size_t maxlenof_relative_x_velocity() const;
288  float relative_y_velocity() const;
289  void set_relative_y_velocity(const float new_relative_y_velocity);
290  size_t maxlenof_relative_y_velocity() const;
291  float relative_z_velocity() const;
292  void set_relative_z_velocity(const float new_relative_z_velocity);
293  size_t maxlenof_relative_z_velocity() const;
294  float * relative_xyz_velocity_covariance() const;
295  float relative_xyz_velocity_covariance(unsigned int index) const;
296  void set_relative_xyz_velocity_covariance(unsigned int index, const float new_relative_xyz_velocity_covariance);
297  void set_relative_xyz_velocity_covariance(const float * new_relative_xyz_velocity_covariance);
299  virtual Message * create_message(const char *type) const;
300 
301  virtual void copy_values(const Interface *other);
302  virtual const char * enum_tostring(const char *enumtype, int val) const;
303 
304 };
305 
306 } // end namespace fawkes
307 
308 #endif
void set_world_y_velocity(const float new_world_y_velocity)
Set world_y_velocity value.
void set_world_z_velocity(const float new_world_z_velocity)
Set world_z_velocity value.
float relative_y() const
Get relative_y value.
static const uint32_t FLAG_HAS_COVARIANCES
FLAG_HAS_COVARIANCES constant.
float relative_x_velocity() const
Get relative_x_velocity value.
uint32_t object_type() const
Get object_type value.
void set_world_x_velocity(const float new_world_x_velocity)
Set world_x_velocity value.
virtual Message * create_message(const char *type) const
Create message based on type name.
void set_relative_y_velocity(const float new_relative_y_velocity)
Set relative_y_velocity value.
float * world_xyz_velocity_covariance() const
Get world_xyz_velocity_covariance value.
Base class for all messages passed through interfaces in Fawkes BlackBoard.
Definition: message.h:43
float relative_x() const
Get relative_x value.
void set_valid(const bool new_valid)
Set valid value.
ObjectPositionInterface Fawkes BlackBoard Interface.
size_t maxlenof_world_z() const
Get maximum length of world_z value.
size_t maxlenof_relative_y() const
Get maximum length of relative_y value.
size_t maxlenof_distance() const
Get maximum length of distance value.
static const uint32_t FLAG_HAS_EULER_ANGLES
FLAG_HAS_EULER_ANGLES constant.
size_t maxlenof_world_xyz_covariance() const
Get maximum length of world_xyz_covariance value.
static const uint32_t FLAG_HAS_VOLUME_EXTENT
FLAG_HAS_VOLUME_EXTENT constant.
Fawkes library namespace.
void set_world_z(const float new_world_z)
Set world_z value.
void set_extent_y(const float new_extent_y)
Set extent_y value.
size_t maxlenof_pitch() const
Get maximum length of pitch value.
size_t maxlenof_bearing() const
Get maximum length of bearing value.
void set_flags(const uint32_t new_flags)
Set flags value.
uint32_t flags() const
Get flags value.
size_t maxlenof_extent_y() const
Get maximum length of extent_y value.
size_t maxlenof_extent_z() const
Get maximum length of extent_z value.
size_t maxlenof_visibility_history() const
Get maximum length of visibility_history value.
float world_x_velocity() const
Get world_x_velocity value.
static const uint32_t FLAG_IS_FIXED_OBJECT
FLAG_IS_FIXED_OBJECT constant.
float world_z() const
Get world_z value.
size_t maxlenof_world_xyz_velocity_covariance() const
Get maximum length of world_xyz_velocity_covariance value.
float yaw() const
Get yaw value.
void set_distance(const float new_distance)
Set distance value.
void set_roll(const float new_roll)
Set roll value.
size_t maxlenof_dbs_covariance() const
Get maximum length of dbs_covariance value.
void set_relative_y(const float new_relative_y)
Set relative_y value.
float slope() const
Get slope value.
static const uint32_t FLAG_HAS_WORLD
FLAG_HAS_WORLD constant.
Base class for all Fawkes BlackBoard interfaces.
Definition: interface.h:80
float bearing() const
Get bearing value.
virtual const char * enum_tostring(const char *enumtype, int val) const
Convert arbitrary enum value to string.
static const uint32_t FLAG_HAS_Z_AS_ORI
FLAG_HAS_Z_AS_ORI constant.
virtual bool message_valid(const Message *message) const
Check if message is valid and can be enqueued.
size_t maxlenof_yaw() const
Get maximum length of yaw value.
float extent_x() const
Get extent_x value.
static const uint32_t TYPE_SELF
TYPE_SELF constant.
float world_x() const
Get world_x value.
float relative_z_velocity() const
Get relative_z_velocity value.
float world_y_velocity() const
Get world_y_velocity value.
size_t maxlenof_relative_xyz_covariance() const
Get maximum length of relative_xyz_covariance value.
size_t maxlenof_world_y() const
Get maximum length of world_y value.
size_t maxlenof_world_z_velocity() const
Get maximum length of world_z_velocity value.
static const uint32_t FLAG_HAS_RELATIVE_POLAR
FLAG_HAS_RELATIVE_POLAR constant.
size_t maxlenof_slope() const
Get maximum length of slope value.
static const uint32_t FLAG_HAS_CIRCULAR_EXTENT
FLAG_HAS_CIRCULAR_EXTENT constant.
size_t maxlenof_relative_y_velocity() const
Get maximum length of relative_y_velocity value.
void set_object_type(const uint32_t new_object_type)
Set object_type value.
static const uint32_t FLAG_NONE
FLAG_NONE constant.
size_t maxlenof_world_x_velocity() const
Get maximum length of world_x_velocity value.
size_t maxlenof_relative_z_velocity() const
Get maximum length of relative_z_velocity value.
static const uint32_t TYPE_GOAL_BLUE
TYPE_GOAL_BLUE constant.
void set_visibility_history(const int32_t new_visibility_history)
Set visibility_history value.
float relative_z() const
Get relative_z value.
void set_relative_x_velocity(const float new_relative_x_velocity)
Set relative_x_velocity value.
float * dbs_covariance() const
Get dbs_covariance value.
float pitch() const
Get pitch value.
bool is_visible() const
Get visible value.
void set_relative_z_velocity(const float new_relative_z_velocity)
Set relative_z_velocity value.
size_t maxlenof_relative_x() const
Get maximum length of relative_x value.
static const uint32_t FLAG_HAS_EXTENT
FLAG_HAS_EXTENT constant.
void set_pitch(const float new_pitch)
Set pitch value.
void set_extent_z(const float new_extent_z)
Set extent_z value.
void set_dbs_covariance(unsigned int index, const float new_dbs_covariance)
Set dbs_covariance value at given index.
float roll() const
Get roll value.
void set_extent_x(const float new_extent_x)
Set extent_x value.
float world_z_velocity() const
Get world_z_velocity value.
size_t maxlenof_valid() const
Get maximum length of valid value.
float extent_z() const
Get extent_z value.
float distance() const
Get distance value.
void set_world_xyz_velocity_covariance(unsigned int index, const float new_world_xyz_velocity_covariance)
Set world_xyz_velocity_covariance value at given index.
size_t maxlenof_object_type() const
Get maximum length of object_type value.
void set_visible(const bool new_visible)
Set visible value.
void set_bearing(const float new_bearing)
Set bearing value.
float * relative_xyz_covariance() const
Get relative_xyz_covariance value.
static const uint32_t FLAG_HAS_RELATIVE_CARTESIAN
FLAG_HAS_RELATIVE_CARTESIAN constant.
int32_t visibility_history() const
Get visibility_history value.
size_t maxlenof_relative_z() const
Get maximum length of relative_z value.
void set_slope(const float new_slope)
Set slope value.
float extent_y() const
Get extent_y value.
void set_world_x(const float new_world_x)
Set world_x value.
size_t maxlenof_world_x() const
Get maximum length of world_x value.
size_t maxlenof_extent_x() const
Get maximum length of extent_x value.
void set_relative_x(const float new_relative_x)
Set relative_x value.
void set_relative_xyz_velocity_covariance(unsigned int index, const float new_relative_xyz_velocity_covariance)
Set relative_xyz_velocity_covariance value at given index.
size_t maxlenof_relative_x_velocity() const
Get maximum length of relative_x_velocity value.
float * relative_xyz_velocity_covariance() const
Get relative_xyz_velocity_covariance value.
float world_y() const
Get world_y value.
static const uint32_t TYPE_OTHER
TYPE_OTHER constant.
static const uint32_t TYPE_TEAMMEMBER
TYPE_TEAMMEMBER constant.
static const uint32_t TYPE_BALL
TYPE_BALL constant.
bool is_valid() const
Get valid value.
static const uint32_t FLAG_HAS_WORLD_VELOCITY
FLAG_HAS_WORLD_VELOCITY constant.
void set_relative_xyz_covariance(unsigned int index, const float new_relative_xyz_covariance)
Set relative_xyz_covariance value at given index.
size_t maxlenof_roll() const
Get maximum length of roll value.
float * world_xyz_covariance() const
Get world_xyz_covariance value.
size_t maxlenof_visible() const
Get maximum length of visible value.
static const uint32_t TYPE_OPPONENT
TYPE_OPPONENT constant.
size_t maxlenof_world_y_velocity() const
Get maximum length of world_y_velocity value.
void set_world_xyz_covariance(unsigned int index, const float new_world_xyz_covariance)
Set world_xyz_covariance value at given index.
float relative_y_velocity() const
Get relative_y_velocity value.
static const uint32_t TYPE_GOAL_YELLOW
TYPE_GOAL_YELLOW constant.
const char * type() const
Get type of interface.
Definition: interface.cpp:635
size_t maxlenof_flags() const
Get maximum length of flags value.
void set_yaw(const float new_yaw)
Set yaw value.
size_t maxlenof_relative_xyz_velocity_covariance() const
Get maximum length of relative_xyz_velocity_covariance value.
virtual void copy_values(const Interface *other)
Copy values from other interface.
void set_relative_z(const float new_relative_z)
Set relative_z value.
static const uint32_t TYPE_LINE
TYPE_LINE constant.
void set_world_y(const float new_world_y)
Set world_y value.