24 #include <interfaces/KickerInterface.h> 26 #include <core/exceptions/software.h> 47 KickerInterface::KickerInterface() : Interface()
49 data_size =
sizeof(KickerInterface_data_t);
51 data = (KickerInterface_data_t *)
data_ptr;
54 enum_map_GuideBallSideEnum[(int)GUIDE_BALL_LEFT] =
"GUIDE_BALL_LEFT";
55 enum_map_GuideBallSideEnum[(int)GUIDE_BALL_RIGHT] =
"GUIDE_BALL_RIGHT";
59 add_fieldinfo(
IFT_ENUM,
"guide_ball_side", 1, &data->guide_ball_side,
"GuideBallSideEnum", &enum_map_GuideBallSideEnum);
64 unsigned char tmp_hash[] = {0x96, 0x3d, 0x55, 0x60, 0xfd, 0x65, 0xf2, 0xfa, 0xa8, 0xfa, 0xfc, 0xaa, 0xb6, 0xfc, 0xc2, 0x81};
69 KickerInterface::~KickerInterface()
81 case GUIDE_BALL_LEFT:
return "GUIDE_BALL_LEFT";
82 case GUIDE_BALL_RIGHT:
return "GUIDE_BALL_RIGHT";
83 default:
return "UNKNOWN";
96 return data->num_kicks_left;
118 data->num_kicks_left = new_num_kicks_left;
131 return data->num_kicks_center;
153 data->num_kicks_center = new_num_kicks_center;
166 return data->num_kicks_right;
188 data->num_kicks_right = new_num_kicks_right;
221 data->guide_ball_side = new_guide_ball_side;
234 return data->current_intensity;
256 data->current_intensity = new_current_intensity;
264 if ( strncmp(
"KickMessage", type, __INTERFACE_MESSAGE_TYPE_SIZE) == 0 ) {
266 }
else if ( strncmp(
"ResetCounterMessage", type, __INTERFACE_MESSAGE_TYPE_SIZE) == 0 ) {
268 }
else if ( strncmp(
"GuideBallMessage", type, __INTERFACE_MESSAGE_TYPE_SIZE) == 0 ) {
272 "message type for this interface type.", type);
288 memcpy(data, oi->data,
sizeof(KickerInterface_data_t));
294 if (strcmp(enumtype,
"GuideBallSideEnum") == 0) {
319 data = (KickMessage_data_t *)
data_ptr;
321 data->left = ini_left;
322 data->center = ini_center;
323 data->right = ini_right;
324 data->intensity = ini_intensity;
338 data = (KickMessage_data_t *)
data_ptr;
362 data = (KickMessage_data_t *)
data_ptr;
394 data->left = new_left;
424 data->center = new_center;
454 data->right = new_right;
464 return data->intensity;
484 data->intensity = new_intensity;
507 data_size =
sizeof(ResetCounterMessage_data_t);
510 data = (ResetCounterMessage_data_t *)
data_ptr;
530 data = (ResetCounterMessage_data_t *)
data_ptr;
557 data_size =
sizeof(GuideBallMessage_data_t);
560 data = (GuideBallMessage_data_t *)
data_ptr;
562 data->guide_ball_side = ini_guide_ball_side;
565 add_fieldinfo(
IFT_ENUM,
"guide_ball_side", 1, &data->guide_ball_side,
"GuideBallSideEnum", &enum_map_GuideBallSideEnum);
570 data_size =
sizeof(GuideBallMessage_data_t);
573 data = (GuideBallMessage_data_t *)
data_ptr;
577 add_fieldinfo(
IFT_ENUM,
"guide_ball_side", 1, &data->guide_ball_side,
"GuideBallSideEnum", &enum_map_GuideBallSideEnum);
594 data = (GuideBallMessage_data_t *)
data_ptr;
626 data->guide_ball_side = new_guide_ball_side;
const char * tostring_GuideBallSideEnum(GuideBallSideEnum value) const
Convert GuideBallSideEnum constant to string.
void * data_ptr
Pointer to memory that contains local data.
Base class for all messages passed through interfaces in Fawkes BlackBoard.
virtual Message * clone() const
Clone this message.
void set_hash(unsigned char *ihash)
Set hash.
Fawkes library namespace.
void set_num_kicks_left(const int32_t new_num_kicks_left)
Set num_kicks_left value.
Timestamp data, must be present and first entries for each interface data structs! This leans on time...
unsigned int data_size
Minimal data size to hold data storage.
GuideBallMessage()
Constructor.
void set_intensity(const uint32_t new_intensity)
Set intensity value.
Base class for all Fawkes BlackBoard interfaces.
void set_center(const bool new_center)
Set center value.
bool is_left() const
Get left 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.
size_t maxlenof_intensity() const
Get maximum length of intensity value.
GuideBallSideEnum guide_ball_side() const
Get guide_ball_side value.
size_t maxlenof_left() const
Get maximum length of left value.
size_t maxlenof_right() const
Get maximum length of right value.
message_data_ts_t * data_ts
data timestamp aliasing pointer
void add_fieldinfo(interface_fieldtype_t type, const char *name, size_t length, void *value, const char *enumtype=0, const interface_enum_map_t *enum_map=0)
Add an entry to the field info list.
unsigned int data_size
Size of memory needed to hold all data.
void set_current_intensity(const uint32_t new_current_intensity)
Set current_intensity value.
void add_messageinfo(const char *name)
Add an entry to the message info list.
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.
bool data_changed
Indicator if data has changed.
int32_t num_kicks_right() const
Get num_kicks_right value.
const char * type() const
Get type of interface.
void * data_ptr
Pointer to local memory storage.
size_t maxlenof_num_kicks_right() const
Get maximum length of num_kicks_right value.
bool is_right() const
Get right value.
KickMessage Fawkes BlackBoard Interface Message.
size_t maxlenof_guide_ball_side() const
Get maximum length of guide_ball_side value.
size_t maxlenof_num_kicks_center() const
Get maximum length of num_kicks_center value.
void set_left(const bool new_left)
Set left value.
ResetCounterMessage()
Constructor.
virtual const char * enum_tostring(const char *enumtype, int val) const
Convert arbitrary enum value to string.
~GuideBallMessage()
Destructor.
virtual Message * clone() const
Clone this message.
ResetCounterMessage Fawkes BlackBoard Interface Message.
size_t maxlenof_current_intensity() const
Get maximum length of current_intensity value.
uint32_t intensity() const
Get intensity value.
KickMessage()
Constructor.
~ResetCounterMessage()
Destructor.
KickerInterface Fawkes BlackBoard Interface.
Constant defining that the kicker shall activate the ball guidance device in such a way that the left...
size_t maxlenof_guide_ball_side() const
Get maximum length of guide_ball_side value.
GuideBallSideEnum guide_ball_side() const
Get guide_ball_side value.
~KickMessage()
Destructor.
virtual Message * clone() const
Clone this message.
GuideBallSideEnum
Enumeration defining on which side of the robot the ball shall be guided (and thus on which side the ...
bool is_center() const
Get center value.
virtual Message * create_message(const char *type) const
Create message based on type name.
size_t maxlenof_center() const
Get maximum length of center value.
virtual void copy_values(const Interface *other)
Copy values from other interface.
void set_guide_ball_side(const GuideBallSideEnum new_guide_ball_side)
Set guide_ball_side value.
interface_data_ts_t * data_ts
Pointer to data casted to timestamp struct.
Constant defining that the kicker shall activate the ball guidance device in such a way that the righ...
void add_fieldinfo(interface_fieldtype_t type, const char *name, size_t length, void *value, const char *enumtype=0, const interface_enum_map_t *enum_map=0)
Add an entry to the info list.
virtual bool message_valid(const Message *message) const
Check if message is valid and can be enqueued.
size_t maxlenof_num_kicks_left() const
Get maximum length of num_kicks_left value.
uint32_t current_intensity() const
Get current_intensity value.
int32_t num_kicks_left() const
Get num_kicks_left value.
32 bit unsigned integer field
field with interface specific enum type
int32_t num_kicks_center() const
Get num_kicks_center value.