Fawkes API Fawkes Development Version
KickerInterface.h
1
2/***************************************************************************
3 * KickerInterface.h - Fawkes BlackBoard Interface - KickerInterface
4 *
5 * Templated created: Thu Oct 12 10:49:19 2006
6 * Copyright 2007 Daniel Beck
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_KICKERINTERFACE_H_
25#define _INTERFACES_KICKERINTERFACE_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(KickerInterface)
37 /// @endcond
38 public:
39 /* constants */
40
41 /**
42 Enumeration defining on which side of the robot the ball shall be
43 guided (and thus on which side the arm is to be erected).
44 */
45 typedef enum {
46 GUIDE_BALL_LEFT /**<
47 Constant defining that the kicker shall activate the ball guidance device
48 in such a way that the left arm is erected.
49 */,
51 Constant defining that the kicker shall activate the ball guidance device
52 in such a way that the right arm is erected.
53 */
55 const char * tostring_GuideBallSideEnum(GuideBallSideEnum value) const;
56
57 private:
58 /** Internal data storage, do NOT modify! */
59 typedef struct {
60 int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */
61 int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
62 int32_t num_kicks_left; /**<
63 Number of Left-Kicks
64 */
65 int32_t num_kicks_center; /**<
66 Number of Center-Kicks
67 */
68 int32_t num_kicks_right; /**<
69 Number of Right-Kicks
70 */
71 int32_t guide_ball_side; /**< Side where the ball
72 guidance arm is currently erected. */
73 uint32_t current_intensity; /**<
74 The currently set intensity.
75 */
76 } KickerInterface_data_t;
77
78 KickerInterface_data_t *data;
79
80 interface_enum_map_t enum_map_GuideBallSideEnum;
81 public:
82 /* messages */
83 class KickMessage : public Message
84 {
85 private:
86 /** Internal data storage, do NOT modify! */
87 typedef struct {
88 int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */
89 int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
90 bool left; /**< True to kick with left kicker. */
91 bool center; /**< True to kick with central kicker. */
92 bool right; /**< True to kick with right kicker. */
93 uint32_t intensity; /**< Intensity in the range [0..255]. */
94 } KickMessage_data_t;
95
96 KickMessage_data_t *data;
97
98 interface_enum_map_t enum_map_GuideBallSideEnum;
99 public:
100 KickMessage(const bool ini_left, const bool ini_center, const bool ini_right, const uint32_t ini_intensity);
101 KickMessage();
102 ~KickMessage();
103
104 explicit KickMessage(const KickMessage *m);
105 /* Methods */
106 bool is_left() const;
107 void set_left(const bool new_left);
108 size_t maxlenof_left() const;
109 bool is_center() const;
110 void set_center(const bool new_center);
111 size_t maxlenof_center() const;
112 bool is_right() const;
113 void set_right(const bool new_right);
114 size_t maxlenof_right() const;
115 uint32_t intensity() const;
116 void set_intensity(const uint32_t new_intensity);
117 size_t maxlenof_intensity() const;
118 virtual Message * clone() const;
119 };
120
122 {
123 private:
124 /** Internal data storage, do NOT modify! */
125 typedef struct {
126 int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */
127 int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
128 } ResetCounterMessage_data_t;
129
130 ResetCounterMessage_data_t *data;
131
132 interface_enum_map_t enum_map_GuideBallSideEnum;
133 public:
136
137 explicit ResetCounterMessage(const ResetCounterMessage *m);
138 /* Methods */
139 virtual Message * clone() const;
140 };
141
143 {
144 private:
145 /** Internal data storage, do NOT modify! */
146 typedef struct {
147 int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */
148 int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
149 int32_t guide_ball_side; /**< Side where to guide the ball and erect the arm. */
150 } GuideBallMessage_data_t;
151
152 GuideBallMessage_data_t *data;
153
154 interface_enum_map_t enum_map_GuideBallSideEnum;
155 public:
156 GuideBallMessage(const GuideBallSideEnum ini_guide_ball_side);
159
160 explicit GuideBallMessage(const GuideBallMessage *m);
161 /* Methods */
163 void set_guide_ball_side(const GuideBallSideEnum new_guide_ball_side);
164 size_t maxlenof_guide_ball_side() const;
165 virtual Message * clone() const;
166 };
167
168 virtual bool message_valid(const Message *message) const;
169 private:
172
173 public:
174 /* Methods */
175 int32_t num_kicks_left() const;
176 void set_num_kicks_left(const int32_t new_num_kicks_left);
177 size_t maxlenof_num_kicks_left() const;
178 int32_t num_kicks_center() const;
179 void set_num_kicks_center(const int32_t new_num_kicks_center);
180 size_t maxlenof_num_kicks_center() const;
181 int32_t num_kicks_right() const;
182 void set_num_kicks_right(const int32_t new_num_kicks_right);
183 size_t maxlenof_num_kicks_right() const;
185 void set_guide_ball_side(const GuideBallSideEnum new_guide_ball_side);
186 size_t maxlenof_guide_ball_side() const;
187 uint32_t current_intensity() const;
188 void set_current_intensity(const uint32_t new_current_intensity);
189 size_t maxlenof_current_intensity() const;
190 virtual Message * create_message(const char *type) const;
191
192 virtual void copy_values(const Interface *other);
193 virtual const char * enum_tostring(const char *enumtype, int val) const;
194
195};
196
197} // end namespace fawkes
198
199#endif
Base class for all Fawkes BlackBoard interfaces.
Definition: interface.h:80
const char * type() const
Get type of interface.
Definition: interface.cpp:652
GuideBallMessage Fawkes BlackBoard Interface Message.
size_t maxlenof_guide_ball_side() const
Get maximum length of guide_ball_side value.
virtual Message * clone() const
Clone this message.
GuideBallSideEnum guide_ball_side() const
Get guide_ball_side value.
void set_guide_ball_side(const GuideBallSideEnum new_guide_ball_side)
Set guide_ball_side value.
KickMessage Fawkes BlackBoard Interface Message.
void set_left(const bool new_left)
Set left value.
bool is_left() const
Get left value.
size_t maxlenof_right() const
Get maximum length of right value.
void set_intensity(const uint32_t new_intensity)
Set intensity value.
void set_right(const bool new_right)
Set right value.
bool is_right() const
Get right value.
uint32_t intensity() const
Get intensity value.
void set_center(const bool new_center)
Set center value.
size_t maxlenof_intensity() const
Get maximum length of intensity value.
size_t maxlenof_left() const
Get maximum length of left value.
bool is_center() const
Get center value.
virtual Message * clone() const
Clone this message.
size_t maxlenof_center() const
Get maximum length of center value.
ResetCounterMessage Fawkes BlackBoard Interface Message.
virtual Message * clone() const
Clone this message.
KickerInterface Fawkes BlackBoard Interface.
const char * tostring_GuideBallSideEnum(GuideBallSideEnum value) const
Convert GuideBallSideEnum constant to string.
int32_t num_kicks_center() const
Get num_kicks_center value.
void set_num_kicks_right(const int32_t new_num_kicks_right)
Set num_kicks_right value.
virtual Message * create_message(const char *type) const
Create message based on type name.
int32_t num_kicks_right() const
Get num_kicks_right value.
virtual bool message_valid(const Message *message) const
Check if message is valid and can be enqueued.
void set_current_intensity(const uint32_t new_current_intensity)
Set current_intensity value.
uint32_t current_intensity() const
Get current_intensity value.
size_t maxlenof_guide_ball_side() const
Get maximum length of guide_ball_side value.
size_t maxlenof_current_intensity() const
Get maximum length of current_intensity value.
int32_t num_kicks_left() const
Get num_kicks_left value.
size_t maxlenof_num_kicks_right() const
Get maximum length of num_kicks_right value.
virtual const char * enum_tostring(const char *enumtype, int val) const
Convert arbitrary enum value to string.
GuideBallSideEnum
Enumeration defining on which side of the robot the ball shall be guided (and thus on which side the ...
@ GUIDE_BALL_RIGHT
Constant defining that the kicker shall activate the ball guidance device in such a way that the righ...
@ GUIDE_BALL_LEFT
Constant defining that the kicker shall activate the ball guidance device in such a way that the left...
size_t maxlenof_num_kicks_left() const
Get maximum length of num_kicks_left value.
virtual void copy_values(const Interface *other)
Copy values from other interface.
GuideBallSideEnum guide_ball_side() const
Get guide_ball_side value.
void set_guide_ball_side(const GuideBallSideEnum new_guide_ball_side)
Set guide_ball_side value.
void set_num_kicks_left(const int32_t new_num_kicks_left)
Set num_kicks_left value.
void set_num_kicks_center(const int32_t new_num_kicks_center)
Set num_kicks_center value.
size_t maxlenof_num_kicks_center() const
Get maximum length of num_kicks_center value.
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