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
31namespace 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 {
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 {
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
Base class for all Fawkes BlackBoard interfaces.
Definition: interface.h:80
const char * type() const
Get type of interface.
Definition: interface.cpp:652
SetInitialPoseMessage Fawkes BlackBoard Interface Message.
void set_translation(unsigned int index, const double new_translation)
Set translation value at given index.
virtual Message * clone() const
Clone this message.
size_t maxlenof_translation() const
Get maximum length of translation value.
size_t maxlenof_covariance() const
Get maximum length of covariance value.
void set_rotation(unsigned int index, const double new_rotation)
Set rotation value at given index.
size_t maxlenof_frame() const
Get maximum length of frame value.
size_t maxlenof_rotation() const
Get maximum length of rotation value.
void set_frame(const char *new_frame)
Set frame value.
void set_covariance(unsigned int index, const double new_covariance)
Set covariance value at given index.
LocalizationInterface Fawkes BlackBoard Interface.
size_t maxlenof_map() const
Get maximum length of map value.
virtual const char * enum_tostring(const char *enumtype, int val) const
Convert arbitrary enum value to string.
virtual Message * create_message(const char *type) const
Create message based on type name.
void set_map(const char *new_map)
Set map value.
virtual bool message_valid(const Message *message) const
Check if message is valid and can be enqueued.
char * map() const
Get map value.
virtual void copy_values(const Interface *other)
Copy values from other interface.
Base class for all messages passed through interfaces in Fawkes BlackBoard.
Definition: message.h:44
Fawkes library namespace.