ObjectPositionInterface.h

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 unsigned int TYPE_OTHER;
00041   static const unsigned int TYPE_BALL;
00042   static const unsigned int TYPE_OPPONENT;
00043   static const unsigned int TYPE_TEAMMEMBER;
00044   static const unsigned int TYPE_LINE;
00045   static const unsigned int TYPE_SELF;
00046   static const unsigned int TYPE_GOAL_BLUE;
00047   static const unsigned int TYPE_GOAL_YELLOW;
00048   static const unsigned int FLAG_NONE;
00049   static const unsigned int FLAG_HAS_WORLD;
00050   static const unsigned int FLAG_HAS_RELATIVE_CARTESIAN;
00051   static const unsigned int FLAG_HAS_RELATIVE_POLAR;
00052   static const unsigned int FLAG_HAS_EULER_ANGLES;
00053   static const unsigned int FLAG_HAS_EXTENT;
00054   static const unsigned int FLAG_HAS_VOLUME_EXTENT;
00055   static const unsigned int FLAG_HAS_CIRCULAR_EXTENT;
00056   static const unsigned int FLAG_HAS_COVARIANCES;
00057   static const unsigned int FLAG_HAS_WORLD_VELOCITY;
00058   static const unsigned int FLAG_HAS_Z_AS_ORI;
00059   static const unsigned int FLAG_IS_FIXED_OBJECT;
00060
00061  private:
00062   /** Internal data storage, do NOT modify! */
00063   typedef struct {
00064     unsigned int object_type; /**< 
00065       Object type, use constants to define
00066      */
00067     unsigned int flags; /**< 
00068       Bit-wise concatenated fields of FLAG_* constants. Denotes features that the
00069       writer of this interfaces provides. Use a bit-wise OR to concatenate multiple
00070       flags, use a bit-wise AND to check if a flag has been set.
00071      */
00072     int visibility_history; /**< 
00073       The visibilitiy history indicates the number of consecutive positive or negative
00074       sightings. If the history is negative, there have been as many negative sightings
00075       (object not visible) as the absolute value of the history. A positive value denotes
00076       as many positive sightings. 0 shall only be used during the initialisation of the
00077       interface or if the visibility history is not filled.
00078      */
00079     float roll; /**< 
00080       Roll value for the orientation of the object in space.
00081      */
00082     float pitch; /**< 
00083       Pitch value for the orientation of the object in space.
00084      */
00085     float yaw; /**< 
00086       Yaw value for the orientation of the object in space.
00087      */
00088     float distance; /**< 
00089       Distance from the robot to the object on the ground plane. The distance is given
00090       in meters.
00091      */
00092     float bearing; /**< 
00093       Angle between the robot's forward direction and the object on the ground plane.
00094       This angle is in a local 3D coordinate system to the robot and given in radians.
00095      */
00096     float slope; /**< 
00097       Angle between the robot's center position on the ground plane and the middle point
00098       of the object (e.g. this denotes the height of the object combined with the distance.
00099       The angle is given in radians.
00100      */
00101     float dbs_covariance[9]; /**< 
00102       Covariance of Distance/Yaw/Pitch values. This is a 3x3 matrix ordered line by line,
00103       first three values represent row, next tree values second row and last three values
00104       last row from left to right each.
00105      */
00106     float world_x; /**< 
00107       This is the X coordinate in the cartesian right-handed world coordinate system.
00108       This coordinate system has its origin in the center of the field, Y pointing to
00109       the opponent's goal and X pointing to the right.
00110      */
00111     float world_y; /**< 
00112       This is the Y 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 and Z pointing downwards.
00115      */
00116     float world_z; /**< 
00117       This is the Z 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.
00120      */
00121     float world_xyz_covariance[9]; /**< 
00122       Covariance of WorldX/WorldY/WorldZ values. This is a 3x3 matrix ordered line by line,
00123       first three values represent row, next tree values second row and last three values
00124       last row from left to right each.
00125      */
00126     float relative_x; /**< 
00127       This is the X coordinate in the cartesian right-handed robot coordinate system.
00128      */
00129     float relative_y; /**< 
00130       This is the Y coordinate in the cartesian right-handed robot coordinate system.
00131      */
00132     float relative_z; /**< 
00133       This is the Z coordinate in the cartesian right-handed robot coordinate system.
00134      */
00135     float relative_xyz_covariance[9]; /**< 
00136       Covariance of relative x/y/z values. This is a 3x3 matrix ordered line by line,
00137       first three values represent row, next tree values second row and last three values
00138       last row from left to right each.
00139      */
00140     float extent_x; /**< 
00141       Extent of the seen object given in the relative x cartesian coordinate in m.
00142      */
00143     float extent_y; /**< 
00144       Extent of the seen object given in the relative y cartesian coordinate in m.
00145      */
00146     float extent_z; /**< 
00147       Extent of the seen object given in the relative z cartesian coordinate in m.
00148      */
00149     float world_x_velocity; /**< 
00150       Velocity of object in the world coordinate system in X-direction in meter per second.
00151      */
00152     float world_y_velocity; /**< 
00153       Velocity of object in the world coordinate system in Y-direction in meter per second.
00154      */
00155     float world_z_velocity; /**< 
00156       Velocity of object in the world coordinate system in Z-direction in meter per second.
00157      */
00158     float world_xyz_velocity_covariance[9]; /**< 
00159       Covariance of WorldX/WorldY/WorldZ velocity values. This is a 3x3 matrix ordered line
00160       by line, first three values represent row, next tree values second row and last three
00161       values last row from left to right each.
00162      */
00163     float relative_x_velocity; /**< 
00164       Velocity of object in the world coordinate system in X-direction in meter per second.
00165      */
00166     float relative_y_velocity; /**< 
00167       Velocity of object in the world coordinate system in Y-direction in meter per second.
00168      */
00169     float relative_z_velocity; /**< 
00170       Velocity of object in the world coordinate system in Z-direction in meter per second.
00171      */
00172     float relative_xyz_velocity_covariance[9]; /**< 
00173       Covariance of relative x/y/z velocity values. This is a 3x3 matrix ordered line
00174       by line, first three values represent row, next tree values second row and last three
00175       values last row from left to right each.
00176      */
00177     bool visible; /**< True, if object is visible. */
00178     bool valid; /**< True, if this position is valid. */
00179   } ObjectPositionInterface_data_t;
00180
00181   ObjectPositionInterface_data_t *data;
00182
00183  public:
00184   /* messages */
00185   virtual bool message_valid(const Message *message) const;
00186  private:
00187   ObjectPositionInterface();
00188   ~ObjectPositionInterface();
00189
00190  public:
00191   /* Methods */
00192   unsigned int object_type() const;
00193   void set_object_type(const unsigned int new_object_type);
00194   size_t maxlenof_object_type() const;
00195   unsigned int flags() const;
00196   void set_flags(const unsigned int new_flags);
00197   size_t maxlenof_flags() const;
00198   bool is_visible() const;
00199   void set_visible(const bool new_visible);
00200   size_t maxlenof_visible() const;
00201   bool is_valid() const;
00202   void set_valid(const bool new_valid);
00203   size_t maxlenof_valid() const;
00204   int visibility_history() const;
00205   void set_visibility_history(const int new_visibility_history);
00206   size_t maxlenof_visibility_history() const;
00207   float roll() const;
00208   void set_roll(const float new_roll);
00209   size_t maxlenof_roll() const;
00210   float pitch() const;
00211   void set_pitch(const float new_pitch);
00212   size_t maxlenof_pitch() const;
00213   float yaw() const;
00214   void set_yaw(const float new_yaw);
00215   size_t maxlenof_yaw() const;
00216   float distance() const;
00217   void set_distance(const float new_distance);
00218   size_t maxlenof_distance() const;
00219   float bearing() const;
00220   void set_bearing(const float new_bearing);
00221   size_t maxlenof_bearing() const;
00222   float slope() const;
00223   void set_slope(const float new_slope);
00224   size_t maxlenof_slope() const;
00225   float * dbs_covariance() const;
00226   float dbs_covariance(unsigned int index) const;
00227   void set_dbs_covariance(unsigned int index, const float new_dbs_covariance);
00228   void set_dbs_covariance(const float * new_dbs_covariance);
00229   size_t maxlenof_dbs_covariance() const;
00230   float world_x() const;
00231   void set_world_x(const float new_world_x);
00232   size_t maxlenof_world_x() const;
00233   float world_y() const;
00234   void set_world_y(const float new_world_y);
00235   size_t maxlenof_world_y() const;
00236   float world_z() const;
00237   void set_world_z(const float new_world_z);
00238   size_t maxlenof_world_z() const;
00239   float * world_xyz_covariance() const;
00240   float world_xyz_covariance(unsigned int index) const;
00241   void set_world_xyz_covariance(unsigned int index, const float new_world_xyz_covariance);
00242   void set_world_xyz_covariance(const float * new_world_xyz_covariance);
00243   size_t maxlenof_world_xyz_covariance() const;
00244   float relative_x() const;
00245   void set_relative_x(const float new_relative_x);
00246   size_t maxlenof_relative_x() const;
00247   float relative_y() const;
00248   void set_relative_y(const float new_relative_y);
00249   size_t maxlenof_relative_y() const;
00250   float relative_z() const;
00251   void set_relative_z(const float new_relative_z);
00252   size_t maxlenof_relative_z() const;
00253   float * relative_xyz_covariance() const;
00254   float relative_xyz_covariance(unsigned int index) const;
00255   void set_relative_xyz_covariance(unsigned int index, const float new_relative_xyz_covariance);
00256   void set_relative_xyz_covariance(const float * new_relative_xyz_covariance);
00257   size_t maxlenof_relative_xyz_covariance() const;
00258   float extent_x() const;
00259   void set_extent_x(const float new_extent_x);
00260   size_t maxlenof_extent_x() const;
00261   float extent_y() const;
00262   void set_extent_y(const float new_extent_y);
00263   size_t maxlenof_extent_y() const;
00264   float extent_z() const;
00265   void set_extent_z(const float new_extent_z);
00266   size_t maxlenof_extent_z() const;
00267   float world_x_velocity() const;
00268   void set_world_x_velocity(const float new_world_x_velocity);
00269   size_t maxlenof_world_x_velocity() const;
00270   float world_y_velocity() const;
00271   void set_world_y_velocity(const float new_world_y_velocity);
00272   size_t maxlenof_world_y_velocity() const;
00273   float world_z_velocity() const;
00274   void set_world_z_velocity(const float new_world_z_velocity);
00275   size_t maxlenof_world_z_velocity() const;
00276   float * world_xyz_velocity_covariance() const;
00277   float world_xyz_velocity_covariance(unsigned int index) const;
00278   void set_world_xyz_velocity_covariance(unsigned int index, const float new_world_xyz_velocity_covariance);
00279   void set_world_xyz_velocity_covariance(const float * new_world_xyz_velocity_covariance);
00280   size_t maxlenof_world_xyz_velocity_covariance() const;
00281   float relative_x_velocity() const;
00282   void set_relative_x_velocity(const float new_relative_x_velocity);
00283   size_t maxlenof_relative_x_velocity() const;
00284   float relative_y_velocity() const;
00285   void set_relative_y_velocity(const float new_relative_y_velocity);
00286   size_t maxlenof_relative_y_velocity() const;
00287   float relative_z_velocity() const;
00288   void set_relative_z_velocity(const float new_relative_z_velocity);
00289   size_t maxlenof_relative_z_velocity() const;
00290   float * relative_xyz_velocity_covariance() const;
00291   float relative_xyz_velocity_covariance(unsigned int index) const;
00292   void set_relative_xyz_velocity_covariance(unsigned int index, const float new_relative_xyz_velocity_covariance);
00293   void set_relative_xyz_velocity_covariance(const float * new_relative_xyz_velocity_covariance);
00294   size_t maxlenof_relative_xyz_velocity_covariance() const;
00295   virtual Message * create_message(const char *type) const;
00296
00297   virtual void copy_values(const Interface *other);
00298
00299 };
00300
00301 } // end namespace fawkes
00302
00303 #endif