Fawkes API
Fawkes Development Version
|
00001 00002 /*************************************************************************** 00003 * ObjectPositionInterface.h - Fawkes BlackBoard Interface - ObjectPositionInterface 00004 * 00005 * Templated created: Thu Oct 12 10:49:19 2006 00006 * Copyright 2007-2008 Tim Niemueller 00007 * 00008 ****************************************************************************/ 00009 00010 /* This program is free software; you can redistribute it and/or modify 00011 * it under the terms of the GNU General Public License as published by 00012 * the Free Software Foundation; either version 2 of the License, or 00013 * (at your option) any later version. A runtime exception applies to 00014 * this software (see LICENSE.GPL_WRE file mentioned below for details). 00015 * 00016 * This program is distributed in the hope that it will be useful, 00017 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00019 * GNU Library General Public License for more details. 00020 * 00021 * Read the full text in the LICENSE.GPL_WRE file in the doc directory. 00022 */ 00023 00024 #ifndef __INTERFACES_OBJECTPOSITIONINTERFACE_H_ 00025 #define __INTERFACES_OBJECTPOSITIONINTERFACE_H_ 00026 00027 #include <interface/interface.h> 00028 #include <interface/message.h> 00029 #include <interface/field_iterator.h> 00030 00031 namespace fawkes { 00032 00033 class ObjectPositionInterface : public Interface 00034 { 00035 /// @cond INTERNALS 00036 INTERFACE_MGMT_FRIENDS(ObjectPositionInterface) 00037 /// @endcond 00038 public: 00039 /* constants */ 00040 static const uint32_t TYPE_OTHER; 00041 static const uint32_t TYPE_BALL; 00042 static const uint32_t TYPE_OPPONENT; 00043 static const uint32_t TYPE_TEAMMEMBER; 00044 static const uint32_t TYPE_LINE; 00045 static const uint32_t TYPE_SELF; 00046 static const uint32_t TYPE_GOAL_BLUE; 00047 static const uint32_t TYPE_GOAL_YELLOW; 00048 static const uint32_t FLAG_NONE; 00049 static const uint32_t FLAG_HAS_WORLD; 00050 static const uint32_t FLAG_HAS_RELATIVE_CARTESIAN; 00051 static const uint32_t FLAG_HAS_RELATIVE_POLAR; 00052 static const uint32_t FLAG_HAS_EULER_ANGLES; 00053 static const uint32_t FLAG_HAS_EXTENT; 00054 static const uint32_t FLAG_HAS_VOLUME_EXTENT; 00055 static const uint32_t FLAG_HAS_CIRCULAR_EXTENT; 00056 static const uint32_t FLAG_HAS_COVARIANCES; 00057 static const uint32_t FLAG_HAS_WORLD_VELOCITY; 00058 static const uint32_t FLAG_HAS_Z_AS_ORI; 00059 static const uint32_t FLAG_IS_FIXED_OBJECT; 00060 00061 private: 00062 #pragma pack(push,4) 00063 /** Internal data storage, do NOT modify! */ 00064 typedef struct { 00065 int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */ 00066 int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */ 00067 uint32_t object_type; /**< 00068 Object type, use constants to define 00069 */ 00070 uint32_t flags; /**< 00071 Bit-wise concatenated fields of FLAG_* constants. Denotes features that the 00072 writer of this interfaces provides. Use a bit-wise OR to concatenate multiple 00073 flags, use a bit-wise AND to check if a flag has been set. 00074 */ 00075 bool visible; /**< True, if object is visible. */ 00076 bool valid; /**< True, if this position is valid. */ 00077 int32_t visibility_history; /**< 00078 The visibilitiy history indicates the number of consecutive positive or negative 00079 sightings. If the history is negative, there have been as many negative sightings 00080 (object not visible) as the absolute value of the history. A positive value denotes 00081 as many positive sightings. 0 shall only be used during the initialisation of the 00082 interface or if the visibility history is not filled. 00083 */ 00084 float roll; /**< 00085 Roll value for the orientation of the object in space. 00086 */ 00087 float pitch; /**< 00088 Pitch value for the orientation of the object in space. 00089 */ 00090 float yaw; /**< 00091 Yaw value for the orientation of the object in space. 00092 */ 00093 float distance; /**< 00094 Distance from the robot to the object on the ground plane. The distance is given 00095 in meters. 00096 */ 00097 float bearing; /**< 00098 Angle between the robot's forward direction and the object on the ground plane. 00099 This angle is in a local 3D coordinate system to the robot and given in radians. 00100 */ 00101 float slope; /**< 00102 Angle between the robot's center position on the ground plane and the middle point 00103 of the object (e.g. this denotes the height of the object combined with the distance. 00104 The angle is given in radians. 00105 */ 00106 float dbs_covariance[9]; /**< 00107 Covariance of Distance/Yaw/Pitch values. This is a 3x3 matrix ordered line by line, 00108 first three values represent row, next tree values second row and last three values 00109 last row from left to right each. 00110 */ 00111 float world_x; /**< 00112 This is the X coordinate in the cartesian right-handed world coordinate system. 00113 This coordinate system has its origin in the center of the field, Y pointing to 00114 the opponent's goal and X pointing to the right. 00115 */ 00116 float world_y; /**< 00117 This is the Y coordinate in the cartesian right-handed world coordinate system. 00118 This coordinate system has its origin in the center of the field, Y pointing to 00119 the opponent's goal and X pointing to the right and Z pointing downwards. 00120 */ 00121 float world_z; /**< 00122 This is the Z coordinate in the cartesian right-handed world coordinate system. 00123 This coordinate system has its origin in the center of the field, Y pointing to 00124 the opponent's goal and X pointing to the right. 00125 */ 00126 float world_xyz_covariance[9]; /**< 00127 Covariance of WorldX/WorldY/WorldZ values. This is a 3x3 matrix ordered line by line, 00128 first three values represent row, next tree values second row and last three values 00129 last row from left to right each. 00130 */ 00131 float relative_x; /**< 00132 This is the X coordinate in the cartesian right-handed robot coordinate system. 00133 */ 00134 float relative_y; /**< 00135 This is the Y coordinate in the cartesian right-handed robot coordinate system. 00136 */ 00137 float relative_z; /**< 00138 This is the Z coordinate in the cartesian right-handed robot coordinate system. 00139 */ 00140 float relative_xyz_covariance[9]; /**< 00141 Covariance of relative x/y/z values. This is a 3x3 matrix ordered line by line, 00142 first three values represent row, next tree values second row and last three values 00143 last row from left to right each. 00144 */ 00145 float extent_x; /**< 00146 Extent of the seen object given in the relative x cartesian coordinate in m. 00147 */ 00148 float extent_y; /**< 00149 Extent of the seen object given in the relative y cartesian coordinate in m. 00150 */ 00151 float extent_z; /**< 00152 Extent of the seen object given in the relative z cartesian coordinate in m. 00153 */ 00154 float world_x_velocity; /**< 00155 Velocity of object in the world coordinate system in X-direction in meter per second. 00156 */ 00157 float world_y_velocity; /**< 00158 Velocity of object in the world coordinate system in Y-direction in meter per second. 00159 */ 00160 float world_z_velocity; /**< 00161 Velocity of object in the world coordinate system in Z-direction in meter per second. 00162 */ 00163 float world_xyz_velocity_covariance[9]; /**< 00164 Covariance of WorldX/WorldY/WorldZ velocity values. This is a 3x3 matrix ordered line 00165 by line, first three values represent row, next tree values second row and last three 00166 values last row from left to right each. 00167 */ 00168 float relative_x_velocity; /**< 00169 Velocity of object in the world coordinate system in X-direction in meter per second. 00170 */ 00171 float relative_y_velocity; /**< 00172 Velocity of object in the world coordinate system in Y-direction in meter per second. 00173 */ 00174 float relative_z_velocity; /**< 00175 Velocity of object in the world coordinate system in Z-direction in meter per second. 00176 */ 00177 float relative_xyz_velocity_covariance[9]; /**< 00178 Covariance of relative x/y/z velocity values. This is a 3x3 matrix ordered line 00179 by line, first three values represent row, next tree values second row and last three 00180 values last row from left to right each. 00181 */ 00182 } ObjectPositionInterface_data_t; 00183 #pragma pack(pop) 00184 00185 ObjectPositionInterface_data_t *data; 00186 00187 public: 00188 /* messages */ 00189 virtual bool message_valid(const Message *message) const; 00190 private: 00191 ObjectPositionInterface(); 00192 ~ObjectPositionInterface(); 00193 00194 public: 00195 /* Methods */ 00196 uint32_t object_type() const; 00197 void set_object_type(const uint32_t new_object_type); 00198 size_t maxlenof_object_type() const; 00199 uint32_t flags() const; 00200 void set_flags(const uint32_t new_flags); 00201 size_t maxlenof_flags() const; 00202 bool is_visible() const; 00203 void set_visible(const bool new_visible); 00204 size_t maxlenof_visible() const; 00205 bool is_valid() const; 00206 void set_valid(const bool new_valid); 00207 size_t maxlenof_valid() const; 00208 int32_t visibility_history() const; 00209 void set_visibility_history(const int32_t new_visibility_history); 00210 size_t maxlenof_visibility_history() const; 00211 float roll() const; 00212 void set_roll(const float new_roll); 00213 size_t maxlenof_roll() const; 00214 float pitch() const; 00215 void set_pitch(const float new_pitch); 00216 size_t maxlenof_pitch() const; 00217 float yaw() const; 00218 void set_yaw(const float new_yaw); 00219 size_t maxlenof_yaw() const; 00220 float distance() const; 00221 void set_distance(const float new_distance); 00222 size_t maxlenof_distance() const; 00223 float bearing() const; 00224 void set_bearing(const float new_bearing); 00225 size_t maxlenof_bearing() const; 00226 float slope() const; 00227 void set_slope(const float new_slope); 00228 size_t maxlenof_slope() const; 00229 float * dbs_covariance() const; 00230 float dbs_covariance(unsigned int index) const; 00231 void set_dbs_covariance(unsigned int index, const float new_dbs_covariance); 00232 void set_dbs_covariance(const float * new_dbs_covariance); 00233 size_t maxlenof_dbs_covariance() const; 00234 float world_x() const; 00235 void set_world_x(const float new_world_x); 00236 size_t maxlenof_world_x() const; 00237 float world_y() const; 00238 void set_world_y(const float new_world_y); 00239 size_t maxlenof_world_y() const; 00240 float world_z() const; 00241 void set_world_z(const float new_world_z); 00242 size_t maxlenof_world_z() const; 00243 float * world_xyz_covariance() const; 00244 float world_xyz_covariance(unsigned int index) const; 00245 void set_world_xyz_covariance(unsigned int index, const float new_world_xyz_covariance); 00246 void set_world_xyz_covariance(const float * new_world_xyz_covariance); 00247 size_t maxlenof_world_xyz_covariance() const; 00248 float relative_x() const; 00249 void set_relative_x(const float new_relative_x); 00250 size_t maxlenof_relative_x() const; 00251 float relative_y() const; 00252 void set_relative_y(const float new_relative_y); 00253 size_t maxlenof_relative_y() const; 00254 float relative_z() const; 00255 void set_relative_z(const float new_relative_z); 00256 size_t maxlenof_relative_z() const; 00257 float * relative_xyz_covariance() const; 00258 float relative_xyz_covariance(unsigned int index) const; 00259 void set_relative_xyz_covariance(unsigned int index, const float new_relative_xyz_covariance); 00260 void set_relative_xyz_covariance(const float * new_relative_xyz_covariance); 00261 size_t maxlenof_relative_xyz_covariance() const; 00262 float extent_x() const; 00263 void set_extent_x(const float new_extent_x); 00264 size_t maxlenof_extent_x() const; 00265 float extent_y() const; 00266 void set_extent_y(const float new_extent_y); 00267 size_t maxlenof_extent_y() const; 00268 float extent_z() const; 00269 void set_extent_z(const float new_extent_z); 00270 size_t maxlenof_extent_z() const; 00271 float world_x_velocity() const; 00272 void set_world_x_velocity(const float new_world_x_velocity); 00273 size_t maxlenof_world_x_velocity() const; 00274 float world_y_velocity() const; 00275 void set_world_y_velocity(const float new_world_y_velocity); 00276 size_t maxlenof_world_y_velocity() const; 00277 float world_z_velocity() const; 00278 void set_world_z_velocity(const float new_world_z_velocity); 00279 size_t maxlenof_world_z_velocity() const; 00280 float * world_xyz_velocity_covariance() const; 00281 float world_xyz_velocity_covariance(unsigned int index) const; 00282 void set_world_xyz_velocity_covariance(unsigned int index, const float new_world_xyz_velocity_covariance); 00283 void set_world_xyz_velocity_covariance(const float * new_world_xyz_velocity_covariance); 00284 size_t maxlenof_world_xyz_velocity_covariance() const; 00285 float relative_x_velocity() const; 00286 void set_relative_x_velocity(const float new_relative_x_velocity); 00287 size_t maxlenof_relative_x_velocity() const; 00288 float relative_y_velocity() const; 00289 void set_relative_y_velocity(const float new_relative_y_velocity); 00290 size_t maxlenof_relative_y_velocity() const; 00291 float relative_z_velocity() const; 00292 void set_relative_z_velocity(const float new_relative_z_velocity); 00293 size_t maxlenof_relative_z_velocity() const; 00294 float * relative_xyz_velocity_covariance() const; 00295 float relative_xyz_velocity_covariance(unsigned int index) const; 00296 void set_relative_xyz_velocity_covariance(unsigned int index, const float new_relative_xyz_velocity_covariance); 00297 void set_relative_xyz_velocity_covariance(const float * new_relative_xyz_velocity_covariance); 00298 size_t maxlenof_relative_xyz_velocity_covariance() const; 00299 virtual Message * create_message(const char *type) const; 00300 00301 virtual void copy_values(const Interface *other); 00302 virtual const char * enum_tostring(const char *enumtype, int val) const; 00303 00304 }; 00305 00306 } // end namespace fawkes 00307 00308 #endif