Fawkes API
Fawkes Development Version
|
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()
83 default:
return "UNKNOWN";
96 return data->num_kicks_left;
130 return data->num_kicks_center;
164 return data->num_kicks_right;
230 return data->current_intensity;
259 if ( strncmp(
"KickMessage",
type, INTERFACE_MESSAGE_TYPE_SIZE_ - 1) == 0 ) {
261 }
else if ( strncmp(
"ResetCounterMessage",
type, INTERFACE_MESSAGE_TYPE_SIZE_ - 1) == 0 ) {
263 }
else if ( strncmp(
"GuideBallMessage",
type, INTERFACE_MESSAGE_TYPE_SIZE_ - 1) == 0 ) {
267 "message type for this interface type.",
type);
283 memcpy(data, oi->data,
sizeof(KickerInterface_data_t));
289 if (strcmp(enumtype,
"GuideBallSideEnum") == 0) {
314 data = (KickMessage_data_t *)
data_ptr;
316 data->left = ini_left;
317 data->center = ini_center;
318 data->right = ini_right;
319 data->intensity = ini_intensity;
333 data = (KickMessage_data_t *)
data_ptr;
357 data = (KickMessage_data_t *)
data_ptr;
459 return data->intensity;
502 data_size =
sizeof(ResetCounterMessage_data_t);
505 data = (ResetCounterMessage_data_t *)
data_ptr;
525 data = (ResetCounterMessage_data_t *)
data_ptr;
552 data_size =
sizeof(GuideBallMessage_data_t);
555 data = (GuideBallMessage_data_t *)
data_ptr;
557 data->guide_ball_side = ini_guide_ball_side;
560 add_fieldinfo(
IFT_ENUM,
"guide_ball_side", 1, &data->guide_ball_side,
"GuideBallSideEnum", &enum_map_GuideBallSideEnum);
565 data_size =
sizeof(GuideBallMessage_data_t);
568 data = (GuideBallMessage_data_t *)
data_ptr;
572 add_fieldinfo(
IFT_ENUM,
"guide_ball_side", 1, &data->guide_ball_side,
"GuideBallSideEnum", &enum_map_GuideBallSideEnum);
589 data = (GuideBallMessage_data_t *)
data_ptr;
621 change_field(data->guide_ball_side, new_guide_ball_side);
void * data_ptr
Pointer to local memory storage.
uint32_t current_intensity() const
Get current_intensity value.
size_t maxlenof_center() const
Get maximum length of center value.
virtual Message * create_message(const char *type) const
Create message based on type name.
GuideBallMessage Fawkes BlackBoard Interface Message.
@ GUIDE_BALL_LEFT
Constant defining that the kicker shall activate the ball guidance device in such a way that the left...
void set_num_kicks_left(const int32_t new_num_kicks_left)
Set num_kicks_left value.
const char * tostring_GuideBallSideEnum(GuideBallSideEnum value) const
Convert GuideBallSideEnum constant to string.
virtual Message * clone() const
Clone this message.
Base class for all messages passed through interfaces in Fawkes BlackBoard.
bool is_left() const
Get left value.
void * data_ptr
Pointer to memory that contains local data.
message_data_ts_t * data_ts
data timestamp aliasing pointer
@ IFT_ENUM
field with interface specific enum type
GuideBallMessage()
Constructor.
@ IFT_UINT32
32 bit unsigned integer field
const char * type() const
Get type of interface.
@ GUIDE_BALL_RIGHT
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 field info list.
void set_center(const bool new_center)
Set center value.
KickerInterface Fawkes BlackBoard Interface.
interface_data_ts_t * data_ts
Pointer to data casted to timestamp struct.
void set_right(const bool new_right)
Set right value.
size_t maxlenof_guide_ball_side() const
Get maximum length of guide_ball_side value.
Timestamp data, must be present and first entries for each interface data structs!...
GuideBallSideEnum guide_ball_side() const
Get guide_ball_side value.
size_t maxlenof_num_kicks_center() const
Get maximum length of num_kicks_center value.
~GuideBallMessage()
Destructor.
virtual Message * clone() const
Clone this message.
bool data_changed
Indicator if data has changed.
~ResetCounterMessage()
Destructor.
bool is_center() const
Get center value.
ResetCounterMessage()
Constructor.
@ IFT_INT32
32 bit integer field
void set_current_intensity(const uint32_t new_current_intensity)
Set current_intensity value.
Fawkes library namespace.
void set_hash(unsigned char *ihash)
Set hash.
int32_t num_kicks_right() const
Get num_kicks_right value.
size_t maxlenof_left() const
Get maximum length of left value.
void set_num_kicks_right(const int32_t new_num_kicks_right)
Set num_kicks_right value.
unsigned int data_size
Size of memory needed to hold all data.
void set_num_kicks_center(const int32_t new_num_kicks_center)
Set num_kicks_center value.
KickMessage Fawkes BlackBoard Interface Message.
virtual Message * clone() const
Clone this message.
GuideBallSideEnum guide_ball_side() const
Get guide_ball_side value.
size_t maxlenof_right() const
Get maximum length of right value.
size_t maxlenof_num_kicks_left() const
Get maximum length of num_kicks_left value.
Base class for all Fawkes BlackBoard interfaces.
GuideBallSideEnum
Enumeration defining on which side of the robot the ball shall be guided (and thus on which side the ...
void set_left(const bool new_left)
Set left value.
void set_intensity(const uint32_t new_intensity)
Set intensity value.
virtual const char * enum_tostring(const char *enumtype, int val) const
Convert arbitrary enum value to string.
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.
virtual void copy_values(const Interface *other)
Copy values from other interface.
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.
unsigned int data_size
Minimal data size to hold data storage.
uint32_t intensity() const
Get intensity value.
size_t maxlenof_num_kicks_right() const
Get maximum length of num_kicks_right value.
size_t maxlenof_intensity() const
Get maximum length of intensity value.
virtual bool message_valid(const Message *message) const
Check if message is valid and can be enqueued.
int32_t num_kicks_left() const
Get num_kicks_left value.
int32_t num_kicks_center() const
Get num_kicks_center value.
void add_messageinfo(const char *name)
Add an entry to the message info list.
KickMessage()
Constructor.
void set_guide_ball_side(const GuideBallSideEnum new_guide_ball_side)
Set guide_ball_side value.
bool is_right() const
Get right value.
bool change_field(FieldT &field, const DataT &value)
Set a field and return whether it changed.
void set_guide_ball_side(const GuideBallSideEnum new_guide_ball_side)
Set guide_ball_side value.
ResetCounterMessage Fawkes BlackBoard Interface Message.
~KickMessage()
Destructor.