Fawkes API  Fawkes Development Version
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Position3DInterface.h
1 
2 /***************************************************************************
3  * Position3DInterface.h - Fawkes BlackBoard Interface - Position3DInterface
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_POSITION3DINTERFACE_H_
25 #define __INTERFACES_POSITION3DINTERFACE_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(Position3DInterface)
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  Reference coordinate frame for the data.
49  */
50  int32_t visibility_history; /**<
51  The visibilitiy history indicates the number of consecutive positive or negative
52  sightings. If the history is negative, there have been as many negative sightings
53  (object not visible) as the absolute value of the history. A positive value denotes
54  as many positive sightings. 0 shall only be used during the initialization of the
55  interface or if the visibility history is not updated.
56  */
57  double rotation[4]; /**<
58  Rotation quaternion relative to reference frame, ordered as (x, y, z, w).
59  */
60  double translation[3]; /**<
61  Translation vector from the reference frame's origin, ordered as (x, y, z).
62  */
63  } Position3DInterface_data_t;
64 #pragma pack(pop)
65 
66  Position3DInterface_data_t *data;
67 
68  public:
69  /* messages */
70  virtual bool message_valid(const Message *message) const;
71  private:
74 
75  public:
76  /* Methods */
77  char * frame() const;
78  void set_frame(const char * new_frame);
79  size_t maxlenof_frame() const;
80  int32_t visibility_history() const;
81  void set_visibility_history(const int32_t new_visibility_history);
82  size_t maxlenof_visibility_history() const;
83  double * rotation() const;
84  double rotation(unsigned int index) const;
85  void set_rotation(unsigned int index, const double new_rotation);
86  void set_rotation(const double * new_rotation);
87  size_t maxlenof_rotation() const;
88  double * translation() const;
89  double translation(unsigned int index) const;
90  void set_translation(unsigned int index, const double new_translation);
91  void set_translation(const double * new_translation);
92  size_t maxlenof_translation() const;
93  virtual Message * create_message(const char *type) const;
94 
95  virtual void copy_values(const Interface *other);
96  virtual const char * enum_tostring(const char *enumtype, int val) const;
97 
98 };
99 
100 } // end namespace fawkes
101 
102 #endif