Fawkes API  Fawkes Development Version
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  /** Internal data storage, do NOT modify! */
43  typedef struct __attribute__((packed)) {
44  int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */
45  int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
46  char frame[32]; /**<
47  Reference coordinate frame for the data.
48  */
49  int32_t visibility_history; /**<
50  The visibilitiy history indicates the number of consecutive positive or negative
51  sightings. If the history is negative, there have been as many negative sightings
52  (object not visible) as the absolute value of the history. A positive value denotes
53  as many positive sightings. 0 shall only be used during the initialization of the
54  interface or if the visibility history is not updated.
55  */
56  double rotation[4]; /**<
57  Rotation quaternion relative to reference frame, ordered as (x, y, z, w).
58  */
59  double translation[3]; /**<
60  Translation vector from the reference frame's origin, ordered as (x, y, z).
61  */
62  double covariance[36]; /**<
63  Row-major representation of the 6x6 covariance matrix.
64  The orientation parameters use a fixed-axis representation.
65  In order, the parameters are:
66  (x, y, z, rotation about X axis, rotation about Y axis, rotation about Z axis)
67  */
68  } Position3DInterface_data_t;
69 
70  Position3DInterface_data_t *data;
71 
72  public:
73  /* messages */
74  virtual bool message_valid(const Message *message) const;
75  private:
78 
79  public:
80  /* Methods */
81  char * frame() const;
82  void set_frame(const char * new_frame);
83  size_t maxlenof_frame() const;
84  int32_t visibility_history() const;
85  void set_visibility_history(const int32_t new_visibility_history);
86  size_t maxlenof_visibility_history() const;
87  double * rotation() const;
88  double rotation(unsigned int index) const;
89  void set_rotation(unsigned int index, const double new_rotation);
90  void set_rotation(const double * new_rotation);
91  size_t maxlenof_rotation() const;
92  double * translation() const;
93  double translation(unsigned int index) const;
94  void set_translation(unsigned int index, const double new_translation);
95  void set_translation(const double * new_translation);
96  size_t maxlenof_translation() const;
97  double * covariance() const;
98  double covariance(unsigned int index) const;
99  void set_covariance(unsigned int index, const double new_covariance);
100  void set_covariance(const double * new_covariance);
101  size_t maxlenof_covariance() const;
102  virtual Message * create_message(const char *type) const;
103 
104  virtual void copy_values(const Interface *other);
105  virtual const char * enum_tostring(const char *enumtype, int val) const;
106 
107 };
108 
109 } // end namespace fawkes
110 
111 #endif
void set_frame(const char *new_frame)
Set frame value.
double * rotation() const
Get rotation value.
char * frame() const
Get frame value.
Base class for all messages passed through interfaces in Fawkes BlackBoard.
Definition: message.h:44
Fawkes library namespace.
size_t maxlenof_frame() const
Get maximum length of frame value.
virtual Message * create_message(const char *type) const
Create message based on type name.
void set_translation(unsigned int index, const double new_translation)
Set translation value at given index.
Base class for all Fawkes BlackBoard interfaces.
Definition: interface.h:79
void set_rotation(unsigned int index, const double new_rotation)
Set rotation value at given index.
const char * type() const
Get type of interface.
Definition: interface.cpp:651
Position3DInterface Fawkes BlackBoard Interface.
void set_visibility_history(const int32_t new_visibility_history)
Set visibility_history value.
void set_covariance(unsigned int index, const double new_covariance)
Set covariance value at given index.
double * translation() const
Get translation value.
virtual bool message_valid(const Message *message) const
Check if message is valid and can be enqueued.
size_t maxlenof_translation() const
Get maximum length of translation value.
virtual const char * enum_tostring(const char *enumtype, int val) const
Convert arbitrary enum value to string.
size_t maxlenof_visibility_history() const
Get maximum length of visibility_history value.
size_t maxlenof_rotation() const
Get maximum length of rotation value.
int32_t visibility_history() const
Get visibility_history value.
virtual void copy_values(const Interface *other)
Copy values from other interface.
size_t maxlenof_covariance() const
Get maximum length of covariance value.
double * covariance() const
Get covariance value.