Fawkes API Fawkes Development Version
TransformInterface.h
1
2/***************************************************************************
3 * TransformInterface.h - Fawkes BlackBoard Interface - TransformInterface
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_TRANSFORMINTERFACE_H_
25#define _INTERFACES_TRANSFORMINTERFACE_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(TransformInterface)
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[64]; /**<
47 Parent frame ID. The given transform is relative to the origin
48 of this coordinate frame.
49 */
50 char child_frame[64]; /**<
51 The ID of the child frame. The child frame's origin is at the
52 given point in the parent frame denoted by the transform.
53 */
54 bool static_transform; /**<
55 True if the transform is static, i.e. it will never change
56 during its lifetime, false otherwise.
57 */
58 double translation[3]; /**<
59 This array denotes the translation vector of the transform. The
60 element indexes are ordered x, y, z, i.e. translation[0] is the
61 X value of the translation vector.
62 */
63 double rotation[4]; /**<
64 This array denotes the rotation quaternion of the transform. The
65 element indexes are ordered x, y, z, w, i.e. translation[0] is
66 the X value of the rotation quaternion and translation[3] is the
67 W value.
68 */
69 } TransformInterface_data_t;
70
71 TransformInterface_data_t *data;
72
73 public:
74 /* messages */
75 virtual bool message_valid(const Message *message) const;
76 private:
79
80 public:
81 /* Methods */
82 char * frame() const;
83 void set_frame(const char * new_frame);
84 size_t maxlenof_frame() const;
85 char * child_frame() const;
86 void set_child_frame(const char * new_child_frame);
87 size_t maxlenof_child_frame() const;
88 bool is_static_transform() const;
89 void set_static_transform(const bool new_static_transform);
90 size_t maxlenof_static_transform() const;
91 double * translation() const;
92 double translation(unsigned int index) const;
93 void set_translation(unsigned int index, const double new_translation);
94 void set_translation(const double * new_translation);
95 size_t maxlenof_translation() const;
96 double * rotation() const;
97 double rotation(unsigned int index) const;
98 void set_rotation(unsigned int index, const double new_rotation);
99 void set_rotation(const double * new_rotation);
100 size_t maxlenof_rotation() const;
101 virtual Message * create_message(const char *type) const;
102
103 virtual void copy_values(const Interface *other);
104 virtual const char * enum_tostring(const char *enumtype, int val) const;
105
106};
107
108} // end namespace fawkes
109
110#endif
Base class for all Fawkes BlackBoard interfaces.
Definition: interface.h:80
const char * type() const
Get type of interface.
Definition: interface.cpp:652
Base class for all messages passed through interfaces in Fawkes BlackBoard.
Definition: message.h:44
TransformInterface Fawkes BlackBoard Interface.
char * frame() const
Get frame value.
size_t maxlenof_frame() const
Get maximum length of frame value.
size_t maxlenof_translation() const
Get maximum length of translation value.
virtual bool message_valid(const Message *message) const
Check if message is valid and can be enqueued.
virtual void copy_values(const Interface *other)
Copy values from other interface.
void set_frame(const char *new_frame)
Set frame value.
void set_translation(unsigned int index, const double new_translation)
Set translation value at given index.
size_t maxlenof_rotation() const
Get maximum length of rotation value.
size_t maxlenof_child_frame() const
Get maximum length of child_frame value.
virtual const char * enum_tostring(const char *enumtype, int val) const
Convert arbitrary enum value to string.
void set_rotation(unsigned int index, const double new_rotation)
Set rotation value at given index.
char * child_frame() const
Get child_frame value.
size_t maxlenof_static_transform() const
Get maximum length of static_transform value.
void set_static_transform(const bool new_static_transform)
Set static_transform value.
void set_child_frame(const char *new_child_frame)
Set child_frame value.
virtual Message * create_message(const char *type) const
Create message based on type name.
bool is_static_transform() const
Get static_transform value.
double * rotation() const
Get rotation value.
double * translation() const
Get translation value.
Fawkes library namespace.