Fawkes API  Fawkes Development Version
Position3DInterface.h
00001 
00002 /***************************************************************************
00003  *  Position3DInterface.h - Fawkes BlackBoard Interface - Position3DInterface
00004  *
00005  *  Templated created:   Thu Oct 12 10:49:19 2006
00006  *  Copyright  2011  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_POSITION3DINTERFACE_H_
00025 #define __INTERFACES_POSITION3DINTERFACE_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 Position3DInterface : public Interface
00034 {
00035  /// @cond INTERNALS
00036  INTERFACE_MGMT_FRIENDS(Position3DInterface)
00037  /// @endcond
00038  public:
00039   /* constants */
00040 
00041  private:
00042 #pragma pack(push,4)
00043   /** Internal data storage, do NOT modify! */
00044   typedef struct {
00045     int64_t timestamp_sec;  /**< Interface Unix timestamp, seconds */
00046     int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
00047     char frame[32]; /**< 
00048       Reference coordinate frame for the data.
00049      */
00050     int32_t visibility_history; /**< 
00051       The visibilitiy history indicates the number of consecutive positive or negative
00052       sightings. If the history is negative, there have been as many negative sightings
00053       (object not visible) as the absolute value of the history. A positive value denotes
00054       as many positive sightings. 0 shall only be used during the initialization of the
00055       interface or if the visibility history is not updated.
00056      */
00057     double rotation[4]; /**< 
00058       Rotation quaternion relative to reference frame, ordered as (x, y, z, w).
00059      */
00060     double translation[3]; /**< 
00061       Translation vector from the reference frame's origin, ordered as (x, y, z).
00062      */
00063   } Position3DInterface_data_t;
00064 #pragma pack(pop)
00065 
00066   Position3DInterface_data_t *data;
00067 
00068  public:
00069   /* messages */
00070   virtual bool message_valid(const Message *message) const;
00071  private:
00072   Position3DInterface();
00073   ~Position3DInterface();
00074 
00075  public:
00076   /* Methods */
00077   char * frame() const;
00078   void set_frame(const char * new_frame);
00079   size_t maxlenof_frame() const;
00080   int32_t visibility_history() const;
00081   void set_visibility_history(const int32_t new_visibility_history);
00082   size_t maxlenof_visibility_history() const;
00083   double * rotation() const;
00084   double rotation(unsigned int index) const;
00085   void set_rotation(unsigned int index, const double new_rotation);
00086   void set_rotation(const double * new_rotation);
00087   size_t maxlenof_rotation() const;
00088   double * translation() const;
00089   double translation(unsigned int index) const;
00090   void set_translation(unsigned int index, const double new_translation);
00091   void set_translation(const double * new_translation);
00092   size_t maxlenof_translation() const;
00093   virtual Message * create_message(const char *type) const;
00094 
00095   virtual void copy_values(const Interface *other);
00096   virtual const char * enum_tostring(const char *enumtype, int val) const;
00097 
00098 };
00099 
00100 } // end namespace fawkes
00101 
00102 #endif