Fawkes API  Fawkes Development Version
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
TransformInterface.h
1 
2 /***************************************************************************
3  * TransformInterface.h - Fawkes BlackBoard Interface - TransformInterface
4  *
5  * Templated created: Thu Oct 12 10:49:19 2006
6  * Copyright 2011 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_TRANSFORMINTERFACE_H_
25 #define __INTERFACES_TRANSFORMINTERFACE_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(TransformInterface)
37  /// @endcond
38  public:
39  /* constants */
40 
41  private:
42 #pragma pack(push,4)
43  /** Internal data storage, do NOT modify! */
44  typedef struct {
45  int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */
46  int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
47  char frame[32]; /**<
48  Parent frame ID. The given transform is relative to the origin
49  of this coordinate frame.
50  */
51  char child_frame[32]; /**<
52  The ID of the child frame. The child frame's origin is at the
53  given point in the parent frame denoted by the transform.
54  */
55  double translation[3]; /**<
56  This array denotes the translation vector of the transform. The
57  element indexes are ordered x, y, z, i.e. translation[0] is the
58  X value of the translation vector.
59  */
60  double rotation[4]; /**<
61  This array denotes the rotation quaternion of the transform. The
62  element indexes are ordered x, y, z, w, i.e. translation[0] is
63  the X value of the rotation quaternion and translation[3] is the
64  W value.
65  */
66  } TransformInterface_data_t;
67 #pragma pack(pop)
68 
69  TransformInterface_data_t *data;
70 
71  public:
72  /* messages */
73  virtual bool message_valid(const Message *message) const;
74  private:
77 
78  public:
79  /* Methods */
80  char * frame() const;
81  void set_frame(const char * new_frame);
82  size_t maxlenof_frame() const;
83  char * child_frame() const;
84  void set_child_frame(const char * new_child_frame);
85  size_t maxlenof_child_frame() const;
86  double * translation() const;
87  double translation(unsigned int index) const;
88  void set_translation(unsigned int index, const double new_translation);
89  void set_translation(const double * new_translation);
90  size_t maxlenof_translation() const;
91  double * rotation() const;
92  double rotation(unsigned int index) const;
93  void set_rotation(unsigned int index, const double new_rotation);
94  void set_rotation(const double * new_rotation);
95  size_t maxlenof_rotation() const;
96  virtual Message * create_message(const char *type) const;
97 
98  virtual void copy_values(const Interface *other);
99  virtual const char * enum_tostring(const char *enumtype, int val) const;
100 
101 };
102 
103 } // end namespace fawkes
104 
105 #endif