Fawkes API  Fawkes Development Version
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
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