24 #include <interfaces/GripperInterface.h> 26 #include <core/exceptions/software.h> 47 GripperInterface::GripperInterface() : Interface()
49 data_size =
sizeof(GripperInterface_data_t);
50 data_ptr = malloc(data_size);
51 data = (GripperInterface_data_t *)data_ptr;
52 data_ts = (interface_data_ts_t *)data_ptr;
53 memset(data_ptr, 0, data_size);
54 enum_map_GripperState[(int)OPEN] =
"OPEN";
55 enum_map_GripperState[(int)CLOSED] =
"CLOSED";
56 add_fieldinfo(IFT_ENUM,
"gripper_state", 1, &data->gripper_state,
"GripperState", &enum_map_GripperState);
57 add_messageinfo(
"OpenGripperMessage");
58 add_messageinfo(
"CloseGripperMessage");
59 unsigned char tmp_hash[] = {0xf8, 0xd6, 0x88, 0xb4, 0xfc, 0xfa, 0x1f, 0x1b, 0x20, 0x9f, 0xc, 0xd, 0x81, 0x3c, 0xba, 0xdf};
64 GripperInterface::~GripperInterface()
76 case OPEN:
return "OPEN";
77 case CLOSED:
return "CLOSED";
78 default:
return "UNKNOWN";
89 GripperInterface::gripper_state()
const 99 GripperInterface::maxlenof_gripper_state()
const 111 GripperInterface::set_gripper_state(
const GripperState new_gripper_state)
113 data->gripper_state = new_gripper_state;
119 GripperInterface::create_message(
const char *type)
const 121 if ( strncmp(
"OpenGripperMessage", type, __INTERFACE_MESSAGE_TYPE_SIZE) == 0 ) {
123 }
else if ( strncmp(
"CloseGripperMessage", type, __INTERFACE_MESSAGE_TYPE_SIZE) == 0 ) {
127 "message type for this interface type.", type);
141 type(), other->
type());
143 memcpy(data, oi->data,
sizeof(GripperInterface_data_t));
147 GripperInterface::enum_tostring(
const char *enumtype,
int val)
const 149 if (strcmp(enumtype,
"GripperState") == 0) {
164 GripperInterface::OpenGripperMessage::OpenGripperMessage() :
Message(
"OpenGripperMessage")
166 data_size =
sizeof(OpenGripperMessage_data_t);
169 data = (OpenGripperMessage_data_t *)
data_ptr;
171 enum_map_GripperState[(int)
OPEN] =
"OPEN";
172 enum_map_GripperState[(int)
CLOSED] =
"CLOSED";
189 data = (OpenGripperMessage_data_t *)
data_ptr;
214 data_size =
sizeof(CloseGripperMessage_data_t);
217 data = (CloseGripperMessage_data_t *)
data_ptr;
219 enum_map_GripperState[(int)
OPEN] =
"OPEN";
220 enum_map_GripperState[(int)
CLOSED] =
"CLOSED";
237 data = (CloseGripperMessage_data_t *)
data_ptr;
void * data_ptr
Pointer to memory that contains local data.
Base class for all messages passed through interfaces in Fawkes BlackBoard.
CloseGripperMessage Fawkes BlackBoard Interface Message.
~CloseGripperMessage()
Destructor.
Fawkes library namespace.
virtual bool message_valid(const Message *message) const
Check if message is valid and can be enqueued.
Timestamp data, must be present and first entries for each interface data structs! This leans on time...
OpenGripperMessage()
Constructor.
Base class for all Fawkes BlackBoard interfaces.
message_data_ts_t * data_ts
data timestamp aliasing pointer
unsigned int data_size
Size of memory needed to hold all data.
const char * type() const
Get type of interface.
~OpenGripperMessage()
Destructor.
virtual Message * clone() const
Clone this message.
CloseGripperMessage()
Constructor.
virtual Message * clone() const
Clone this message.
GripperState
Indicator of current or desired gripper state.
OpenGripperMessage Fawkes BlackBoard Interface Message.
GripperInterface Fawkes BlackBoard Interface.