Fawkes API
Fawkes Development Version
|
00001 00002 /*************************************************************************** 00003 * KickerInterface.h - Fawkes BlackBoard Interface - KickerInterface 00004 * 00005 * Templated created: Thu Oct 12 10:49:19 2006 00006 * Copyright 2007 Daniel Beck 00007 * 00008 ****************************************************************************/ 00009 00010 /* This program is free software; you can redistribute it and/or modify 00011 * it under the terms of the GNU General Public License as published by 00012 * the Free Software Foundation; either version 2 of the License, or 00013 * (at your option) any later version. A runtime exception applies to 00014 * this software (see LICENSE.GPL_WRE file mentioned below for details). 00015 * 00016 * This program is distributed in the hope that it will be useful, 00017 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00019 * GNU Library General Public License for more details. 00020 * 00021 * Read the full text in the LICENSE.GPL_WRE file in the doc directory. 00022 */ 00023 00024 #ifndef __INTERFACES_KICKERINTERFACE_H_ 00025 #define __INTERFACES_KICKERINTERFACE_H_ 00026 00027 #include <interface/interface.h> 00028 #include <interface/message.h> 00029 #include <interface/field_iterator.h> 00030 00031 namespace fawkes { 00032 00033 class KickerInterface : public Interface 00034 { 00035 /// @cond INTERNALS 00036 INTERFACE_MGMT_FRIENDS(KickerInterface) 00037 /// @endcond 00038 public: 00039 /* constants */ 00040 00041 /** 00042 Enumeration defining on which side of the robot the ball shall be 00043 guided (and thus on which side the arm is to be erected). 00044 */ 00045 typedef enum { 00046 GUIDE_BALL_LEFT /**< 00047 Constant defining that the kicker shall activate the ball guidance device 00048 in such a way that the left arm is erected. 00049 */, 00050 GUIDE_BALL_RIGHT /**< 00051 Constant defining that the kicker shall activate the ball guidance device 00052 in such a way that the right arm is erected. 00053 */ 00054 } GuideBallSideEnum; 00055 const char * tostring_GuideBallSideEnum(GuideBallSideEnum value) const; 00056 00057 private: 00058 #pragma pack(push,4) 00059 /** Internal data storage, do NOT modify! */ 00060 typedef struct { 00061 int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */ 00062 int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */ 00063 int32_t num_kicks_left; /**< 00064 Number of Left-Kicks 00065 */ 00066 int32_t num_kicks_center; /**< 00067 Number of Center-Kicks 00068 */ 00069 int32_t num_kicks_right; /**< 00070 Number of Right-Kicks 00071 */ 00072 GuideBallSideEnum guide_ball_side; /**< Side where the ball 00073 guidance arm is currently erected. */ 00074 uint32_t current_intensity; /**< 00075 The currently set intensity. 00076 */ 00077 } KickerInterface_data_t; 00078 #pragma pack(pop) 00079 00080 KickerInterface_data_t *data; 00081 00082 public: 00083 /* messages */ 00084 class KickMessage : public Message 00085 { 00086 private: 00087 #pragma pack(push,4) 00088 /** Internal data storage, do NOT modify! */ 00089 typedef struct { 00090 int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */ 00091 int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */ 00092 bool left; /**< True to kick with left kicker. */ 00093 bool center; /**< True to kick with central kicker. */ 00094 bool right; /**< True to kick with right kicker. */ 00095 uint32_t intensity; /**< Intensity in the range [0..255]. */ 00096 } KickMessage_data_t; 00097 #pragma pack(pop) 00098 00099 KickMessage_data_t *data; 00100 00101 public: 00102 KickMessage(const bool ini_left, const bool ini_center, const bool ini_right, const uint32_t ini_intensity); 00103 KickMessage(); 00104 ~KickMessage(); 00105 00106 KickMessage(const KickMessage *m); 00107 /* Methods */ 00108 bool is_left() const; 00109 void set_left(const bool new_left); 00110 size_t maxlenof_left() const; 00111 bool is_center() const; 00112 void set_center(const bool new_center); 00113 size_t maxlenof_center() const; 00114 bool is_right() const; 00115 void set_right(const bool new_right); 00116 size_t maxlenof_right() const; 00117 uint32_t intensity() const; 00118 void set_intensity(const uint32_t new_intensity); 00119 size_t maxlenof_intensity() const; 00120 virtual Message * clone() const; 00121 }; 00122 00123 class ResetCounterMessage : public Message 00124 { 00125 private: 00126 #pragma pack(push,4) 00127 /** Internal data storage, do NOT modify! */ 00128 typedef struct { 00129 int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */ 00130 int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */ 00131 } ResetCounterMessage_data_t; 00132 #pragma pack(pop) 00133 00134 ResetCounterMessage_data_t *data; 00135 00136 public: 00137 ResetCounterMessage(); 00138 ~ResetCounterMessage(); 00139 00140 ResetCounterMessage(const ResetCounterMessage *m); 00141 /* Methods */ 00142 virtual Message * clone() const; 00143 }; 00144 00145 class GuideBallMessage : public Message 00146 { 00147 private: 00148 #pragma pack(push,4) 00149 /** Internal data storage, do NOT modify! */ 00150 typedef struct { 00151 int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */ 00152 int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */ 00153 GuideBallSideEnum guide_ball_side; /**< Side where to guide the ball and erect the arm. */ 00154 } GuideBallMessage_data_t; 00155 #pragma pack(pop) 00156 00157 GuideBallMessage_data_t *data; 00158 00159 public: 00160 GuideBallMessage(const GuideBallSideEnum ini_guide_ball_side); 00161 GuideBallMessage(); 00162 ~GuideBallMessage(); 00163 00164 GuideBallMessage(const GuideBallMessage *m); 00165 /* Methods */ 00166 GuideBallSideEnum guide_ball_side() const; 00167 void set_guide_ball_side(const GuideBallSideEnum new_guide_ball_side); 00168 size_t maxlenof_guide_ball_side() const; 00169 virtual Message * clone() const; 00170 }; 00171 00172 virtual bool message_valid(const Message *message) const; 00173 private: 00174 KickerInterface(); 00175 ~KickerInterface(); 00176 00177 public: 00178 /* Methods */ 00179 int32_t num_kicks_left() const; 00180 void set_num_kicks_left(const int32_t new_num_kicks_left); 00181 size_t maxlenof_num_kicks_left() const; 00182 int32_t num_kicks_center() const; 00183 void set_num_kicks_center(const int32_t new_num_kicks_center); 00184 size_t maxlenof_num_kicks_center() const; 00185 int32_t num_kicks_right() const; 00186 void set_num_kicks_right(const int32_t new_num_kicks_right); 00187 size_t maxlenof_num_kicks_right() const; 00188 GuideBallSideEnum guide_ball_side() const; 00189 void set_guide_ball_side(const GuideBallSideEnum new_guide_ball_side); 00190 size_t maxlenof_guide_ball_side() const; 00191 uint32_t current_intensity() const; 00192 void set_current_intensity(const uint32_t new_current_intensity); 00193 size_t maxlenof_current_intensity() const; 00194 virtual Message * create_message(const char *type) const; 00195 00196 virtual void copy_values(const Interface *other); 00197 virtual const char * enum_tostring(const char *enumtype, int val) const; 00198 00199 }; 00200 00201 } // end namespace fawkes 00202 00203 #endif