Fawkes API  Fawkes Development Version
TransformInterface.h
00001 
00002 /***************************************************************************
00003  *  TransformInterface.h - Fawkes BlackBoard Interface - TransformInterface
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_TRANSFORMINTERFACE_H_
00025 #define __INTERFACES_TRANSFORMINTERFACE_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 TransformInterface : public Interface
00034 {
00035  /// @cond INTERNALS
00036  INTERFACE_MGMT_FRIENDS(TransformInterface)
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       Parent frame ID. The given transform is relative to the origin
00049       of this coordinate frame.
00050      */
00051     char child_frame[32]; /**< 
00052       The ID of the child frame. The child frame's origin is at the
00053       given point in the parent frame denoted by the transform.
00054      */
00055     double translation[3]; /**< 
00056       This array denotes the translation vector of the transform. The
00057       element indexes are ordered x, y, z, i.e. translation[0] is the
00058       X value of the translation vector.
00059      */
00060     double rotation[4]; /**< 
00061       This array denotes the rotation quaternion of the transform. The
00062       element indexes are ordered x, y, z, w, i.e. translation[0] is
00063       the X value of the rotation quaternion and translation[3] is the
00064       W value.
00065      */
00066   } TransformInterface_data_t;
00067 #pragma pack(pop)
00068 
00069   TransformInterface_data_t *data;
00070 
00071  public:
00072   /* messages */
00073   virtual bool message_valid(const Message *message) const;
00074  private:
00075   TransformInterface();
00076   ~TransformInterface();
00077 
00078  public:
00079   /* Methods */
00080   char * frame() const;
00081   void set_frame(const char * new_frame);
00082   size_t maxlenof_frame() const;
00083   char * child_frame() const;
00084   void set_child_frame(const char * new_child_frame);
00085   size_t maxlenof_child_frame() const;
00086   double * translation() const;
00087   double translation(unsigned int index) const;
00088   void set_translation(unsigned int index, const double new_translation);
00089   void set_translation(const double * new_translation);
00090   size_t maxlenof_translation() const;
00091   double * rotation() const;
00092   double rotation(unsigned int index) const;
00093   void set_rotation(unsigned int index, const double new_rotation);
00094   void set_rotation(const double * new_rotation);
00095   size_t maxlenof_rotation() const;
00096   virtual Message * create_message(const char *type) const;
00097 
00098   virtual void copy_values(const Interface *other);
00099   virtual const char * enum_tostring(const char *enumtype, int val) const;
00100 
00101 };
00102 
00103 } // end namespace fawkes
00104 
00105 #endif