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  /** Internal data storage, do NOT modify! */
63  typedef struct __attribute__((packed)) {
64  int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */
65  int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
66  uint32_t object_type; /**<
67  Object type, use constants to define
68  */
69  uint32_t flags; /**<
70  Bit-wise concatenated fields of FLAG_* constants. Denotes features that the
71  writer of this interfaces provides. Use a bit-wise OR to concatenate multiple
72  flags, use a bit-wise AND to check if a flag has been set.
73  */
74  bool visible; /**< True, if object is visible. */
75  bool valid; /**< True, if this position is valid. */
76  int32_t visibility_history; /**<
77  The visibilitiy history indicates the number of consecutive positive or negative
78  sightings. If the history is negative, there have been as many negative sightings
79  (object not visible) as the absolute value of the history. A positive value denotes
80  as many positive sightings. 0 shall only be used during the initialisation of the
81  interface or if the visibility history is not filled.
82  */
83  float roll; /**<
84  Roll value for the orientation of the object in space.
85  */
86  float pitch; /**<
87  Pitch value for the orientation of the object in space.
88  */
89  float yaw; /**<
90  Yaw value for the orientation of the object in space.
91  */
92  float distance; /**<
93  Distance from the robot to the object on the ground plane. The distance is given
94  in meters.
95  */
96  float bearing; /**<
97  Angle between the robot's forward direction and the object on the ground plane.
98  This angle is in a local 3D coordinate system to the robot and given in radians.
99  */
100  float slope; /**<
101  Angle between the robot's center position on the ground plane and the middle point
102  of the object (e.g. this denotes the height of the object combined with the distance.
103  The angle is given in radians.
104  */
105  float dbs_covariance[9]; /**<
106  Covariance of Distance/Yaw/Pitch values. This is a 3x3 matrix ordered line by line,
107  first three values represent row, next tree values second row and last three values
108  last row from left to right each.
109  */
110  float world_x; /**<
111  This is the X coordinate in the cartesian right-handed world coordinate system.
112  This coordinate system has its origin in the center of the field, Y pointing to
113  the opponent's goal and X pointing to the right.
114  */
115  float world_y; /**<
116  This is the Y coordinate in the cartesian right-handed world coordinate system.
117  This coordinate system has its origin in the center of the field, Y pointing to
118  the opponent's goal and X pointing to the right and Z pointing downwards.
119  */
120  float world_z; /**<
121  This is the Z coordinate in the cartesian right-handed world coordinate system.
122  This coordinate system has its origin in the center of the field, Y pointing to
123  the opponent's goal and X pointing to the right.
124  */
125  float world_xyz_covariance[9]; /**<
126  Covariance of WorldX/WorldY/WorldZ values. This is a 3x3 matrix ordered line by line,
127  first three values represent row, next tree values second row and last three values
128  last row from left to right each.
129  */
130  float relative_x; /**<
131  This is the X coordinate in the cartesian right-handed robot coordinate system.
132  */
133  float relative_y; /**<
134  This is the Y coordinate in the cartesian right-handed robot coordinate system.
135  */
136  float relative_z; /**<
137  This is the Z coordinate in the cartesian right-handed robot coordinate system.
138  */
139  float relative_xyz_covariance[9]; /**<
140  Covariance of relative x/y/z values. This is a 3x3 matrix ordered line by line,
141  first three values represent row, next tree values second row and last three values
142  last row from left to right each.
143  */
144  float extent_x; /**<
145  Extent of the seen object given in the relative x cartesian coordinate in m.
146  */
147  float extent_y; /**<
148  Extent of the seen object given in the relative y cartesian coordinate in m.
149  */
150  float extent_z; /**<
151  Extent of the seen object given in the relative z cartesian coordinate in m.
152  */
153  float world_x_velocity; /**<
154  Velocity of object in the world coordinate system in X-direction in meter per second.
155  */
156  float world_y_velocity; /**<
157  Velocity of object in the world coordinate system in Y-direction in meter per second.
158  */
159  float world_z_velocity; /**<
160  Velocity of object in the world coordinate system in Z-direction in meter per second.
161  */
162  float world_xyz_velocity_covariance[9]; /**<
163  Covariance of WorldX/WorldY/WorldZ velocity values. This is a 3x3 matrix ordered line
164  by line, first three values represent row, next tree values second row and last three
165  values last row from left to right each.
166  */
167  float relative_x_velocity; /**<
168  Velocity of object in the world coordinate system in X-direction in meter per second.
169  */
170  float relative_y_velocity; /**<
171  Velocity of object in the world coordinate system in Y-direction in meter per second.
172  */
173  float relative_z_velocity; /**<
174  Velocity of object in the world coordinate system in Z-direction in meter per second.
175  */
176  float relative_xyz_velocity_covariance[9]; /**<
177  Covariance of relative x/y/z velocity values. This is a 3x3 matrix ordered line
178  by line, first three values represent row, next tree values second row and last three
179  values last row from left to right each.
180  */
181  } ObjectPositionInterface_data_t;
182 
183  ObjectPositionInterface_data_t *data;
184 
185  public:
186  /* messages */
187  virtual bool message_valid(const Message *message) const;
188  private:
191 
192  public:
193  /* Methods */
194  uint32_t object_type() const;
195  void set_object_type(const uint32_t new_object_type);
196  size_t maxlenof_object_type() const;
197  uint32_t flags() const;
198  void set_flags(const uint32_t new_flags);
199  size_t maxlenof_flags() const;
200  bool is_visible() const;
201  void set_visible(const bool new_visible);
202  size_t maxlenof_visible() const;
203  bool is_valid() const;
204  void set_valid(const bool new_valid);
205  size_t maxlenof_valid() const;
206  int32_t visibility_history() const;
207  void set_visibility_history(const int32_t new_visibility_history);
208  size_t maxlenof_visibility_history() const;
209  float roll() const;
210  void set_roll(const float new_roll);
211  size_t maxlenof_roll() const;
212  float pitch() const;
213  void set_pitch(const float new_pitch);
214  size_t maxlenof_pitch() const;
215  float yaw() const;
216  void set_yaw(const float new_yaw);
217  size_t maxlenof_yaw() const;
218  float distance() const;
219  void set_distance(const float new_distance);
220  size_t maxlenof_distance() const;
221  float bearing() const;
222  void set_bearing(const float new_bearing);
223  size_t maxlenof_bearing() const;
224  float slope() const;
225  void set_slope(const float new_slope);
226  size_t maxlenof_slope() const;
227  float * dbs_covariance() const;
228  float dbs_covariance(unsigned int index) const;
229  void set_dbs_covariance(unsigned int index, const float new_dbs_covariance);
230  void set_dbs_covariance(const float * new_dbs_covariance);
231  size_t maxlenof_dbs_covariance() const;
232  float world_x() const;
233  void set_world_x(const float new_world_x);
234  size_t maxlenof_world_x() const;
235  float world_y() const;
236  void set_world_y(const float new_world_y);
237  size_t maxlenof_world_y() const;
238  float world_z() const;
239  void set_world_z(const float new_world_z);
240  size_t maxlenof_world_z() const;
241  float * world_xyz_covariance() const;
242  float world_xyz_covariance(unsigned int index) const;
243  void set_world_xyz_covariance(unsigned int index, const float new_world_xyz_covariance);
244  void set_world_xyz_covariance(const float * new_world_xyz_covariance);
245  size_t maxlenof_world_xyz_covariance() const;
246  float relative_x() const;
247  void set_relative_x(const float new_relative_x);
248  size_t maxlenof_relative_x() const;
249  float relative_y() const;
250  void set_relative_y(const float new_relative_y);
251  size_t maxlenof_relative_y() const;
252  float relative_z() const;
253  void set_relative_z(const float new_relative_z);
254  size_t maxlenof_relative_z() const;
255  float * relative_xyz_covariance() const;
256  float relative_xyz_covariance(unsigned int index) const;
257  void set_relative_xyz_covariance(unsigned int index, const float new_relative_xyz_covariance);
258  void set_relative_xyz_covariance(const float * new_relative_xyz_covariance);
259  size_t maxlenof_relative_xyz_covariance() const;
260  float extent_x() const;
261  void set_extent_x(const float new_extent_x);
262  size_t maxlenof_extent_x() const;
263  float extent_y() const;
264  void set_extent_y(const float new_extent_y);
265  size_t maxlenof_extent_y() const;
266  float extent_z() const;
267  void set_extent_z(const float new_extent_z);
268  size_t maxlenof_extent_z() const;
269  float world_x_velocity() const;
270  void set_world_x_velocity(const float new_world_x_velocity);
271  size_t maxlenof_world_x_velocity() const;
272  float world_y_velocity() const;
273  void set_world_y_velocity(const float new_world_y_velocity);
274  size_t maxlenof_world_y_velocity() const;
275  float world_z_velocity() const;
276  void set_world_z_velocity(const float new_world_z_velocity);
277  size_t maxlenof_world_z_velocity() const;
278  float * world_xyz_velocity_covariance() const;
279  float world_xyz_velocity_covariance(unsigned int index) const;
280  void set_world_xyz_velocity_covariance(unsigned int index, const float new_world_xyz_velocity_covariance);
281  void set_world_xyz_velocity_covariance(const float * new_world_xyz_velocity_covariance);
283  float relative_x_velocity() const;
284  void set_relative_x_velocity(const float new_relative_x_velocity);
285  size_t maxlenof_relative_x_velocity() const;
286  float relative_y_velocity() const;
287  void set_relative_y_velocity(const float new_relative_y_velocity);
288  size_t maxlenof_relative_y_velocity() const;
289  float relative_z_velocity() const;
290  void set_relative_z_velocity(const float new_relative_z_velocity);
291  size_t maxlenof_relative_z_velocity() const;
292  float * relative_xyz_velocity_covariance() const;
293  float relative_xyz_velocity_covariance(unsigned int index) const;
294  void set_relative_xyz_velocity_covariance(unsigned int index, const float new_relative_xyz_velocity_covariance);
295  void set_relative_xyz_velocity_covariance(const float * new_relative_xyz_velocity_covariance);
297  virtual Message * create_message(const char *type) const;
298 
299  virtual void copy_values(const Interface *other);
300  virtual const char * enum_tostring(const char *enumtype, int val) const;
301 
302 };
303 
304 } // end namespace fawkes
305 
306 #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.
static const uint32_t FLAG_HAS_COVARIANCES
FLAG_HAS_COVARIANCES constant.
float distance() const
Get distance value.
void set_world_x_velocity(const float new_world_x_velocity)
Set world_x_velocity value.
void set_relative_y_velocity(const float new_relative_y_velocity)
Set relative_y_velocity value.
size_t maxlenof_world_z() const
Get maximum length of world_z value.
Base class for all messages passed through interfaces in Fawkes BlackBoard.
Definition: message.h:44
bool is_valid() const
Get valid value.
size_t maxlenof_relative_x() const
Get maximum length of relative_x value.
size_t maxlenof_world_z_velocity() const
Get maximum length of world_z_velocity value.
size_t maxlenof_valid() const
Get maximum length of valid value.
float extent_x() const
Get extent_x value.
void set_valid(const bool new_valid)
Set valid value.
ObjectPositionInterface Fawkes BlackBoard Interface.
size_t maxlenof_dbs_covariance() const
Get maximum length of dbs_covariance value.
virtual const char * enum_tostring(const char *enumtype, int val) const
Convert arbitrary enum value to string.
static const uint32_t FLAG_HAS_EULER_ANGLES
FLAG_HAS_EULER_ANGLES constant.
static const uint32_t FLAG_HAS_VOLUME_EXTENT
FLAG_HAS_VOLUME_EXTENT constant.
Fawkes library namespace.
float relative_y_velocity() const
Get relative_y_velocity value.
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.
void set_flags(const uint32_t new_flags)
Set flags value.
size_t maxlenof_bearing() const
Get maximum length of bearing value.
size_t maxlenof_world_xyz_velocity_covariance() const
Get maximum length of world_xyz_velocity_covariance value.
static const uint32_t FLAG_IS_FIXED_OBJECT
FLAG_IS_FIXED_OBJECT constant.
void set_distance(const float new_distance)
Set distance value.
void set_roll(const float new_roll)
Set roll value.
void set_relative_y(const float new_relative_y)
Set relative_y value.
static const uint32_t FLAG_HAS_WORLD
FLAG_HAS_WORLD constant.
float * dbs_covariance() const
Get dbs_covariance value.
size_t maxlenof_object_type() const
Get maximum length of object_type value.
Base class for all Fawkes BlackBoard interfaces.
Definition: interface.h:79
size_t maxlenof_extent_y() const
Get maximum length of extent_y value.
size_t maxlenof_distance() const
Get maximum length of distance value.
static const uint32_t FLAG_HAS_Z_AS_ORI
FLAG_HAS_Z_AS_ORI constant.
static const uint32_t TYPE_SELF
TYPE_SELF constant.
float world_y() const
Get world_y value.
float relative_x_velocity() const
Get relative_x_velocity value.
uint32_t object_type() const
Get object_type value.
float world_z_velocity() const
Get world_z_velocity value.
float * relative_xyz_covariance() const
Get relative_xyz_covariance value.
int32_t visibility_history() const
Get visibility_history value.
size_t maxlenof_roll() const
Get maximum length of roll value.
float extent_z() const
Get extent_z value.
bool is_visible() const
Get visible value.
size_t maxlenof_extent_x() const
Get maximum length of extent_x value.
size_t maxlenof_world_y() const
Get maximum length of world_y value.
static const uint32_t FLAG_HAS_RELATIVE_POLAR
FLAG_HAS_RELATIVE_POLAR constant.
static const uint32_t FLAG_HAS_CIRCULAR_EXTENT
FLAG_HAS_CIRCULAR_EXTENT constant.
const char * type() const
Get type of interface.
Definition: interface.cpp:651
void set_object_type(const uint32_t new_object_type)
Set object_type value.
static const uint32_t FLAG_NONE
FLAG_NONE constant.
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.
void set_relative_x_velocity(const float new_relative_x_velocity)
Set relative_x_velocity value.
size_t maxlenof_extent_z() const
Get maximum length of extent_z value.
size_t maxlenof_slope() const
Get maximum length of slope value.
float world_x_velocity() const
Get world_x_velocity value.
size_t maxlenof_relative_y() const
Get maximum length of relative_y value.
float * world_xyz_velocity_covariance() const
Get world_xyz_velocity_covariance value.
void set_relative_z_velocity(const float new_relative_z_velocity)
Set relative_z_velocity 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.
void set_extent_x(const float new_extent_x)
Set extent_x value.
size_t maxlenof_world_x() const
Get maximum length of world_x value.
size_t maxlenof_world_xyz_covariance() const
Get maximum length of world_xyz_covariance value.
size_t maxlenof_relative_x_velocity() const
Get maximum length of relative_x_velocity value.
float extent_y() const
Get extent_y value.
size_t maxlenof_pitch() const
Get maximum length of pitch value.
size_t maxlenof_relative_z() const
Get maximum length of relative_z value.
uint32_t flags() const
Get flags 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.
float world_z() const
Get world_z value.
void set_visible(const bool new_visible)
Set visible value.
float * world_xyz_covariance() const
Get world_xyz_covariance value.
void set_bearing(const float new_bearing)
Set bearing value.
float bearing() const
Get bearing value.
static const uint32_t FLAG_HAS_RELATIVE_CARTESIAN
FLAG_HAS_RELATIVE_CARTESIAN constant.
void set_slope(const float new_slope)
Set slope value.
void set_world_x(const float new_world_x)
Set world_x value.
float world_y_velocity() const
Get world_y_velocity 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_z_velocity() const
Get maximum length of relative_z_velocity value.
static const uint32_t TYPE_OTHER
TYPE_OTHER constant.
static const uint32_t TYPE_TEAMMEMBER
TYPE_TEAMMEMBER constant.
float roll() const
Get roll value.
size_t maxlenof_relative_xyz_velocity_covariance() const
Get maximum length of relative_xyz_velocity_covariance value.
static const uint32_t TYPE_BALL
TYPE_BALL constant.
static const uint32_t FLAG_HAS_WORLD_VELOCITY
FLAG_HAS_WORLD_VELOCITY constant.
size_t maxlenof_world_x_velocity() const
Get maximum length of world_x_velocity value.
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_flags() const
Get maximum length of flags value.
float pitch() const
Get pitch value.
static const uint32_t TYPE_OPPONENT
TYPE_OPPONENT constant.
float world_x() const
Get world_x value.
size_t maxlenof_world_y_velocity() const
Get maximum length of world_y_velocity value.
size_t maxlenof_visibility_history() const
Get maximum length of visibility_history 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_z() const
Get relative_z value.
static const uint32_t TYPE_GOAL_YELLOW
TYPE_GOAL_YELLOW constant.
virtual bool message_valid(const Message *message) const
Check if message is valid and can be enqueued.
float slope() const
Get slope value.
size_t maxlenof_relative_xyz_covariance() const
Get maximum length of relative_xyz_covariance value.
size_t maxlenof_yaw() const
Get maximum length of yaw value.
virtual Message * create_message(const char *type) const
Create message based on type name.
size_t maxlenof_visible() const
Get maximum length of visible value.
float relative_z_velocity() const
Get relative_z_velocity value.
void set_yaw(const float new_yaw)
Set yaw value.
virtual void copy_values(const Interface *other)
Copy values from other interface.
float * relative_xyz_velocity_covariance() const
Get relative_xyz_velocity_covariance value.
void set_relative_z(const float new_relative_z)
Set relative_z value.
size_t maxlenof_relative_y_velocity() const
Get maximum length of relative_y_velocity value.
float relative_y() const
Get relative_y value.
static const uint32_t TYPE_LINE
TYPE_LINE constant.
float relative_x() const
Get relative_x value.
void set_world_y(const float new_world_y)
Set world_y value.