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