Fawkes API Fawkes Development Version
JointInterface.h
1
2/***************************************************************************
3 * JointInterface.h - Fawkes BlackBoard Interface - JointInterface
4 *
5 * Templated created: Thu Oct 12 10:49:19 2006
6 * Copyright 2013 Till Hofmann
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_JOINTINTERFACE_H_
25#define _INTERFACES_JOINTINTERFACE_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(JointInterface)
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 float position; /**<
47 The joint's position in rad.
48 */
49 float velocity; /**<
50 The joint's velocity in rad/s.
51 */
52 } JointInterface_data_t;
53
54 JointInterface_data_t *data;
55
56 public:
57 /* messages */
58 virtual bool message_valid(const Message *message) const;
59 private:
62
63 public:
64 /* Methods */
65 float position() const;
66 void set_position(const float new_position);
67 size_t maxlenof_position() const;
68 float velocity() const;
69 void set_velocity(const float new_velocity);
70 size_t maxlenof_velocity() const;
71 virtual Message * create_message(const char *type) const;
72
73 virtual void copy_values(const Interface *other);
74 virtual const char * enum_tostring(const char *enumtype, int val) const;
75
76};
77
78} // end namespace fawkes
79
80#endif
Base class for all Fawkes BlackBoard interfaces.
Definition: interface.h:80
const char * type() const
Get type of interface.
Definition: interface.cpp:652
JointInterface Fawkes BlackBoard Interface.
float position() const
Get position value.
virtual Message * create_message(const char *type) const
Create message based on type name.
float velocity() const
Get velocity value.
size_t maxlenof_velocity() const
Get maximum length of velocity value.
virtual const char * enum_tostring(const char *enumtype, int val) const
Convert arbitrary enum value to string.
void set_position(const float new_position)
Set position value.
void set_velocity(const float new_velocity)
Set velocity value.
size_t maxlenof_position() const
Get maximum length of position value.
virtual void copy_values(const Interface *other)
Copy values from other interface.
virtual bool message_valid(const Message *message) const
Check if message is valid and can be enqueued.
Base class for all messages passed through interfaces in Fawkes BlackBoard.
Definition: message.h:44
Fawkes library namespace.