Fawkes API  Fawkes Development Version
LocalizationInterface.h
1 
2 /***************************************************************************
3  * LocalizationInterface.h - Fawkes BlackBoard Interface - LocalizationInterface
4  *
5  * Templated created: Thu Oct 12 10:49:19 2006
6  * Copyright 2015 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_LOCALIZATIONINTERFACE_H_
25 #define __INTERFACES_LOCALIZATIONINTERFACE_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(LocalizationInterface)
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 map[64]; /**< The currently used map. */
47  } LocalizationInterface_data_t;
48 
49  LocalizationInterface_data_t *data;
50 
51  public:
52  /* messages */
54  {
55  private:
56  /** Internal data storage, do NOT modify! */
57  typedef struct __attribute__((packed)) {
58  int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */
59  int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
60  char frame[32]; /**<
61  Reference coordinate frame for the data.
62  */
63  double rotation[4]; /**<
64  Rotation quaternion relative to reference frame, ordered as (x, y, z, w).
65  */
66  double translation[3]; /**<
67  Translation vector from the reference frame's origin, ordered as (x, y, z).
68  */
69  double covariance[36]; /**<
70  Row-major representation of the 6x6 covariance matrix. The
71  orientation parameters use a fixed-axis representation. In
72  order, the parameters are: (x, y, z, rotation about X axis,
73  rotation about Y axis, rotation about Z axis).
74  */
75  } SetInitialPoseMessage_data_t;
76 
77  SetInitialPoseMessage_data_t *data;
78 
79  public:
80  SetInitialPoseMessage(const char * ini_frame, const double * ini_rotation, const double * ini_translation, const double * ini_covariance);
83 
85  /* Methods */
86  char * frame() const;
87  void set_frame(const char * new_frame);
88  size_t maxlenof_frame() const;
89  double * rotation() const;
90  double rotation(unsigned int index) const;
91  void set_rotation(unsigned int index, const double new_rotation);
92  void set_rotation(const double * new_rotation);
93  size_t maxlenof_rotation() const;
94  double * translation() const;
95  double translation(unsigned int index) const;
96  void set_translation(unsigned int index, const double new_translation);
97  void set_translation(const double * new_translation);
98  size_t maxlenof_translation() const;
99  double * covariance() const;
100  double covariance(unsigned int index) const;
101  void set_covariance(unsigned int index, const double new_covariance);
102  void set_covariance(const double * new_covariance);
103  size_t maxlenof_covariance() const;
104  virtual Message * clone() const;
105  };
106 
107  virtual bool message_valid(const Message *message) const;
108  private:
111 
112  public:
113  /* Methods */
114  char * map() const;
115  void set_map(const char * new_map);
116  size_t maxlenof_map() const;
117  virtual Message * create_message(const char *type) const;
118 
119  virtual void copy_values(const Interface *other);
120  virtual const char * enum_tostring(const char *enumtype, int val) const;
121 
122 };
123 
124 } // end namespace fawkes
125 
126 #endif
LocalizationInterface Fawkes BlackBoard Interface.
Base class for all messages passed through interfaces in Fawkes BlackBoard.
Definition: message.h:44
virtual const char * enum_tostring(const char *enumtype, int val) const
Convert arbitrary enum value to string.
Fawkes library namespace.
void set_map(const char *new_map)
Set map value.
size_t maxlenof_map() const
Get maximum length of map value.
Base class for all Fawkes BlackBoard interfaces.
Definition: interface.h:79
virtual Message * create_message(const char *type) const
Create message based on type name.
const char * type() const
Get type of interface.
Definition: interface.cpp:651
SetInitialPoseMessage Fawkes BlackBoard Interface Message.
virtual void copy_values(const Interface *other)
Copy values from other interface.
char * map() const
Get map value.
virtual bool message_valid(const Message *message) const
Check if message is valid and can be enqueued.