Fawkes API Fawkes Development Version
GripperInterface.h
1
2/***************************************************************************
3 * GripperInterface.h - Fawkes BlackBoard Interface - GripperInterface
4 *
5 * Templated created: Thu Oct 12 10:49:19 2006
6 * Copyright 2013 Sebastian Reuter
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_GRIPPERINTERFACE_H_
25#define _INTERFACES_GRIPPERINTERFACE_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(GripperInterface)
37 /// @endcond
38 public:
39 /* constants */
40
41 /** Indicator of current or desired gripper state. */
42 typedef enum {
43 OPEN /**< Gripper is open */,
44 CLOSED /**< Gripper is closed */
46 const char * tostring_GripperState(GripperState value) const;
47
48 private:
49 /** Internal data storage, do NOT modify! */
50 typedef struct {
51 int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */
52 int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
53 int32_t gripper_state; /**<
54 The current state of the gripper.
55 */
56 } GripperInterface_data_t;
57
58 GripperInterface_data_t *data;
59
60 interface_enum_map_t enum_map_GripperState;
61 public:
62 /* messages */
64 {
65 private:
66 /** Internal data storage, do NOT modify! */
67 typedef struct {
68 int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */
69 int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
70 } OpenGripperMessage_data_t;
71
72 OpenGripperMessage_data_t *data;
73
74 interface_enum_map_t enum_map_GripperState;
75 public:
78
79 explicit OpenGripperMessage(const OpenGripperMessage *m);
80 /* Methods */
81 virtual Message * clone() const;
82 };
83
85 {
86 private:
87 /** Internal data storage, do NOT modify! */
88 typedef struct {
89 int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */
90 int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
91 } CloseGripperMessage_data_t;
92
93 CloseGripperMessage_data_t *data;
94
95 interface_enum_map_t enum_map_GripperState;
96 public:
99
100 explicit CloseGripperMessage(const CloseGripperMessage *m);
101 /* Methods */
102 virtual Message * clone() const;
103 };
104
105 virtual bool message_valid(const Message *message) const;
106 private:
109
110 public:
111 /* Methods */
113 void set_gripper_state(const GripperState new_gripper_state);
114 size_t maxlenof_gripper_state() const;
115 virtual Message * create_message(const char *type) const;
116
117 virtual void copy_values(const Interface *other);
118 virtual const char * enum_tostring(const char *enumtype, int val) const;
119
120};
121
122} // end namespace fawkes
123
124#endif
CloseGripperMessage Fawkes BlackBoard Interface Message.
virtual Message * clone() const
Clone this message.
OpenGripperMessage Fawkes BlackBoard Interface Message.
virtual Message * clone() const
Clone this message.
GripperInterface Fawkes BlackBoard Interface.
GripperState gripper_state() const
Get gripper_state value.
void set_gripper_state(const GripperState new_gripper_state)
Set gripper_state value.
virtual bool message_valid(const Message *message) const
Check if message is valid and can be enqueued.
const char * tostring_GripperState(GripperState value) const
Convert GripperState constant to string.
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.
size_t maxlenof_gripper_state() const
Get maximum length of gripper_state value.
GripperState
Indicator of current or desired gripper state.
@ OPEN
Gripper is open.
@ CLOSED
Gripper is closed.
virtual void copy_values(const Interface *other)
Copy values from other interface.
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
Fawkes library namespace.
std::map< int, std::string > interface_enum_map_t
Map of enum integer to string values.
Definition: types.h:54