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 
33 class Position3DInterface : public Interface
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 {
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
fawkes::Position3DInterface::maxlenof_frame
size_t maxlenof_frame() const
Get maximum length of frame value.
Definition: Position3DInterface.cpp:89
fawkes::Position3DInterface::maxlenof_visibility_history
size_t maxlenof_visibility_history() const
Get maximum length of visibility_history value.
Definition: Position3DInterface.cpp:129
fawkes::Position3DInterface::copy_values
virtual void copy_values(const Interface *other)
Copy values from other interface.
Definition: Position3DInterface.cpp:380
fawkes::Position3DInterface::maxlenof_covariance
size_t maxlenof_covariance() const
Get maximum length of covariance value.
Definition: Position3DInterface.cpp:327
fawkes::Position3DInterface::visibility_history
int32_t visibility_history() const
Get visibility_history value.
Definition: Position3DInterface.cpp:119
fawkes::Position3DInterface::create_message
virtual Message * create_message(const char *type) const
Definition: Position3DInterface.cpp:369
fawkes::Position3DInterface::set_rotation
void set_rotation(unsigned int index, const double new_rotation)
Set rotation value at given index.
Definition: Position3DInterface.cpp:211
fawkes::Message
Definition: message.h:40
fawkes::Position3DInterface::set_frame
void set_frame(const char *new_frame)
Set frame value.
Definition: Position3DInterface.cpp:101
fawkes::Position3DInterface::frame
char * frame() const
Get frame value.
Definition: Position3DInterface.cpp:79
fawkes::Position3DInterface::rotation
double * rotation() const
Get rotation value.
Definition: Position3DInterface.cpp:158
fawkes::Interface::type
const char * type() const
Get type of interface.
Definition: interface.cpp:643
fawkes::Position3DInterface::translation
double * translation() const
Get translation value.
Definition: Position3DInterface.cpp:226
fawkes::Position3DInterface::set_covariance
void set_covariance(unsigned int index, const double new_covariance)
Set covariance value at given index.
Definition: Position3DInterface.cpp:359
fawkes::Position3DInterface::enum_tostring
virtual const char * enum_tostring(const char *enumtype, int val) const
Definition: Position3DInterface.cpp:391
fawkes::Position3DInterface::set_translation
void set_translation(unsigned int index, const double new_translation)
Set translation value at given index.
Definition: Position3DInterface.cpp:279
fawkes
fawkes::Position3DInterface::maxlenof_translation
size_t maxlenof_translation() const
Get maximum length of translation value.
Definition: Position3DInterface.cpp:253
fawkes::Interface
Definition: interface.h:77
fawkes::Position3DInterface::set_visibility_history
void set_visibility_history(const int32_t new_visibility_history)
Set visibility_history value.
Definition: Position3DInterface.cpp:145
fawkes::Position3DInterface
Definition: Position3DInterface.h:37
fawkes::Position3DInterface::covariance
double * covariance() const
Get covariance value.
Definition: Position3DInterface.cpp:297
fawkes::Position3DInterface::message_valid
virtual bool message_valid(const Message *message) const
Check if message is valid and can be enqueued.
Definition: Position3DInterface.cpp:402
fawkes::Position3DInterface::maxlenof_rotation
size_t maxlenof_rotation() const
Get maximum length of rotation value.
Definition: Position3DInterface.cpp:185