Fawkes API  Fawkes Development Version
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
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 
31 namespace fawkes {
32 
33 class KickerInterface : public Interface
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 {
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 #pragma pack(push,4)
59  /** Internal data storage, do NOT modify! */
60  typedef struct {
61  int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */
62  int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
63  int32_t num_kicks_left; /**<
64  Number of Left-Kicks
65  */
66  int32_t num_kicks_center; /**<
67  Number of Center-Kicks
68  */
69  int32_t num_kicks_right; /**<
70  Number of Right-Kicks
71  */
72  int32_t guide_ball_side; /**< Side where the ball
73  guidance arm is currently erected. */
74  uint32_t current_intensity; /**<
75  The currently set intensity.
76  */
77  } KickerInterface_data_t;
78 #pragma pack(pop)
79 
80  KickerInterface_data_t *data;
81 
82  public:
83  /* messages */
84  class KickMessage : public Message
85  {
86  private:
87 #pragma pack(push,4)
88  /** Internal data storage, do NOT modify! */
89  typedef struct {
90  int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */
91  int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
92  bool left; /**< True to kick with left kicker. */
93  bool center; /**< True to kick with central kicker. */
94  bool right; /**< True to kick with right kicker. */
95  uint32_t intensity; /**< Intensity in the range [0..255]. */
96  } KickMessage_data_t;
97 #pragma pack(pop)
98 
99  KickMessage_data_t *data;
100 
101  public:
102  KickMessage(const bool ini_left, const bool ini_center, const bool ini_right, const uint32_t ini_intensity);
103  KickMessage();
104  ~KickMessage();
105 
106  KickMessage(const KickMessage *m);
107  /* Methods */
108  bool is_left() const;
109  void set_left(const bool new_left);
110  size_t maxlenof_left() const;
111  bool is_center() const;
112  void set_center(const bool new_center);
113  size_t maxlenof_center() const;
114  bool is_right() const;
115  void set_right(const bool new_right);
116  size_t maxlenof_right() const;
117  uint32_t intensity() const;
118  void set_intensity(const uint32_t new_intensity);
119  size_t maxlenof_intensity() const;
120  virtual Message * clone() const;
121  };
122 
124  {
125  private:
126 #pragma pack(push,4)
127  /** Internal data storage, do NOT modify! */
128  typedef struct {
129  int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */
130  int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
131  } ResetCounterMessage_data_t;
132 #pragma pack(pop)
133 
134  ResetCounterMessage_data_t *data;
135 
136  public:
139 
141  /* Methods */
142  virtual Message * clone() const;
143  };
144 
145  class GuideBallMessage : public Message
146  {
147  private:
148 #pragma pack(push,4)
149  /** Internal data storage, do NOT modify! */
150  typedef struct {
151  int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */
152  int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
153  int32_t guide_ball_side; /**< Side where to guide the ball and erect the arm. */
154  } GuideBallMessage_data_t;
155 #pragma pack(pop)
156 
157  GuideBallMessage_data_t *data;
158 
159  public:
160  GuideBallMessage(const GuideBallSideEnum ini_guide_ball_side);
163 
165  /* Methods */
167  void set_guide_ball_side(const GuideBallSideEnum new_guide_ball_side);
168  size_t maxlenof_guide_ball_side() const;
169  virtual Message * clone() const;
170  };
171 
172  virtual bool message_valid(const Message *message) const;
173  private:
174  KickerInterface();
175  ~KickerInterface();
176 
177  public:
178  /* Methods */
179  int32_t num_kicks_left() const;
180  void set_num_kicks_left(const int32_t new_num_kicks_left);
181  size_t maxlenof_num_kicks_left() const;
182  int32_t num_kicks_center() const;
183  void set_num_kicks_center(const int32_t new_num_kicks_center);
184  size_t maxlenof_num_kicks_center() const;
185  int32_t num_kicks_right() const;
186  void set_num_kicks_right(const int32_t new_num_kicks_right);
187  size_t maxlenof_num_kicks_right() const;
189  void set_guide_ball_side(const GuideBallSideEnum new_guide_ball_side);
190  size_t maxlenof_guide_ball_side() const;
191  uint32_t current_intensity() const;
192  void set_current_intensity(const uint32_t new_current_intensity);
193  size_t maxlenof_current_intensity() const;
194  virtual Message * create_message(const char *type) const;
195 
196  virtual void copy_values(const Interface *other);
197  virtual const char * enum_tostring(const char *enumtype, int val) const;
198 
199 };
200 
201 } // end namespace fawkes
202 
203 #endif
size_t maxlenof_center() const
Get maximum length of center value.
virtual Message * clone() const
Clone this message.
bool is_center() const
Get center value.
Base class for all messages passed through interfaces in Fawkes BlackBoard.
Definition: message.h:43
size_t maxlenof_num_kicks_center() const
Get maximum length of num_kicks_center value.
GuideBallSideEnum guide_ball_side() const
Get guide_ball_side value.
size_t maxlenof_guide_ball_side() const
Get maximum length of guide_ball_side value.
virtual Message * clone() const
Clone this message.
void set_num_kicks_left(const int32_t new_num_kicks_left)
Set num_kicks_left value.
size_t maxlenof_guide_ball_side() const
Get maximum length of guide_ball_side value.
bool is_left() const
Get left value.
void set_intensity(const uint32_t new_intensity)
Set intensity value.
Base class for all Fawkes BlackBoard interfaces.
Definition: interface.h:80
void set_center(const bool new_center)
Set center value.
void set_guide_ball_side(const GuideBallSideEnum new_guide_ball_side)
Set guide_ball_side value.
GuideBallMessage Fawkes BlackBoard Interface Message.
void set_right(const bool new_right)
Set right value.
virtual Message * create_message(const char *type) const
Create message based on type name.
void set_current_intensity(const uint32_t new_current_intensity)
Set current_intensity value.
virtual Message * clone() const
Clone this message.
void set_num_kicks_right(const int32_t new_num_kicks_right)
Set num_kicks_right value.
void set_num_kicks_center(const int32_t new_num_kicks_center)
Set num_kicks_center value.
size_t maxlenof_current_intensity() const
Get maximum length of current_intensity value.
KickMessage Fawkes BlackBoard Interface Message.
virtual bool message_valid(const Message *message) const
Check if message is valid and can be enqueued.
int32_t num_kicks_center() const
Get num_kicks_center value.
int32_t num_kicks_left() const
Get num_kicks_left value.
size_t maxlenof_num_kicks_left() const
Get maximum length of num_kicks_left value.
void set_left(const bool new_left)
Set left value.
size_t maxlenof_intensity() const
Get maximum length of intensity value.
ResetCounterMessage Fawkes BlackBoard Interface Message.
uint32_t intensity() const
Get intensity value.
bool is_right() const
Get right value.
GuideBallSideEnum guide_ball_side() const
Get guide_ball_side value.
KickerInterface Fawkes BlackBoard Interface.
Constant defining that the kicker shall activate the ball guidance device in such a way that the left...
uint32_t current_intensity() const
Get current_intensity value.
GuideBallSideEnum
Enumeration defining on which side of the robot the ball shall be guided (and thus on which side the ...
const char * tostring_GuideBallSideEnum(GuideBallSideEnum value) const
Convert GuideBallSideEnum constant to string.
virtual void copy_values(const Interface *other)
Copy values from other interface.
int32_t num_kicks_right() const
Get num_kicks_right value.
void set_guide_ball_side(const GuideBallSideEnum new_guide_ball_side)
Set guide_ball_side value.
size_t maxlenof_left() const
Get maximum length of left value.
Constant defining that the kicker shall activate the ball guidance device in such a way that the righ...
virtual const char * enum_tostring(const char *enumtype, int val) const
Convert arbitrary enum value to string.
const char * type() const
Get type of interface.
Definition: interface.cpp:635
size_t maxlenof_num_kicks_right() const
Get maximum length of num_kicks_right value.
size_t maxlenof_right() const
Get maximum length of right value.