24 #include <interfaces/LaserClusterInterface.h> 26 #include <core/exceptions/software.h> 44 LaserClusterInterface::LaserClusterInterface() : Interface()
46 data_size =
sizeof(LaserClusterInterface_data_t);
47 data_ptr = malloc(data_size);
48 data = (LaserClusterInterface_data_t *)data_ptr;
49 data_ts = (interface_data_ts_t *)data_ptr;
50 memset(data_ptr, 0, data_size);
51 enum_map_SelectionMode[(int)SELMODE_MIN_ANGLE] =
"SELMODE_MIN_ANGLE";
52 enum_map_SelectionMode[(int)SELMODE_MIN_DIST] =
"SELMODE_MIN_DIST";
53 add_fieldinfo(IFT_FLOAT,
"max_x", 1, &data->max_x);
54 add_fieldinfo(IFT_ENUM,
"selection_mode", 1, &data->selection_mode,
"SelectionMode", &enum_map_SelectionMode);
55 add_messageinfo(
"SetMaxXMessage");
56 add_messageinfo(
"SetSelectionModeMessage");
57 unsigned char tmp_hash[] = {0xad, 0xf8, 0x6e, 0xe7, 0x17, 0x56, 0x8a, 0xfb, 0xf9, 0xad, 0x3e, 0xba, 0xd, 0x15, 0xce, 0xde};
62 LaserClusterInterface::~LaserClusterInterface()
71 LaserClusterInterface::tostring_SelectionMode(
SelectionMode value)
const 74 case SELMODE_MIN_ANGLE:
return "SELMODE_MIN_ANGLE";
75 case SELMODE_MIN_DIST:
return "SELMODE_MIN_DIST";
76 default:
return "UNKNOWN";
86 LaserClusterInterface::max_x()
const 96 LaserClusterInterface::maxlenof_max_x()
const 107 LaserClusterInterface::set_max_x(
const float new_max_x)
109 data->max_x = new_max_x;
120 LaserClusterInterface::selection_mode()
const 130 LaserClusterInterface::maxlenof_selection_mode()
const 142 LaserClusterInterface::set_selection_mode(
const SelectionMode new_selection_mode)
144 data->selection_mode = new_selection_mode;
150 LaserClusterInterface::create_message(
const char *type)
const 152 if ( strncmp(
"SetMaxXMessage", type, __INTERFACE_MESSAGE_TYPE_SIZE) == 0 ) {
154 }
else if ( strncmp(
"SetSelectionModeMessage", type, __INTERFACE_MESSAGE_TYPE_SIZE) == 0 ) {
158 "message type for this interface type.", type);
167 LaserClusterInterface::copy_values(
const Interface *other)
172 type(), other->
type());
174 memcpy(data, oi->data,
sizeof(LaserClusterInterface_data_t));
178 LaserClusterInterface::enum_tostring(
const char *enumtype,
int val)
const 180 if (strcmp(enumtype,
"SelectionMode") == 0) {
197 LaserClusterInterface::SetMaxXMessage::SetMaxXMessage(
const float ini_max_x) :
Message(
"SetMaxXMessage")
199 data_size =
sizeof(SetMaxXMessage_data_t);
202 data = (SetMaxXMessage_data_t *)
data_ptr;
204 data->max_x = ini_max_x;
212 data_size =
sizeof(SetMaxXMessage_data_t);
215 data = (SetMaxXMessage_data_t *)
data_ptr;
236 data = (SetMaxXMessage_data_t *)
data_ptr;
270 data->max_x = new_max_x;
295 data_size =
sizeof(SetSelectionModeMessage_data_t);
298 data = (SetSelectionModeMessage_data_t *)
data_ptr;
300 data->selection_mode = ini_selection_mode;
303 add_fieldinfo(
IFT_ENUM,
"selection_mode", 1, &data->selection_mode,
"SelectionMode", &enum_map_SelectionMode);
308 data_size =
sizeof(SetSelectionModeMessage_data_t);
311 data = (SetSelectionModeMessage_data_t *)
data_ptr;
315 add_fieldinfo(
IFT_ENUM,
"selection_mode", 1, &data->selection_mode,
"SelectionMode", &enum_map_SelectionMode);
332 data = (SetSelectionModeMessage_data_t *)
data_ptr;
368 data->selection_mode = new_selection_mode;
void set_selection_mode(const SelectionMode new_selection_mode)
Set selection_mode value.
virtual Message * clone() const
Clone this message.
void * data_ptr
Pointer to memory that contains local data.
Base class for all messages passed through interfaces in Fawkes BlackBoard.
~SetSelectionModeMessage()
Destructor.
Choose the cluster with the minimum angle difference from 0 degrees.
LaserClusterInterface Fawkes BlackBoard Interface.
Fawkes library namespace.
SetSelectionModeMessage Fawkes BlackBoard Interface Message.
Timestamp data, must be present and first entries for each interface data structs! This leans on time...
SetMaxXMessage Fawkes BlackBoard Interface Message.
virtual bool message_valid(const Message *message) const
Check if message is valid and can be enqueued.
Base class for all Fawkes BlackBoard interfaces.
SetMaxXMessage()
Constructor.
Choose the cluster with the minimum distance in X direction of the reference frame (typically forward...
message_data_ts_t * data_ts
data timestamp aliasing pointer
unsigned int data_size
Size of memory needed to hold all data.
~SetMaxXMessage()
Destructor.
const char * type() const
Get type of interface.
SelectionMode selection_mode() const
Get selection_mode value.
virtual Message * clone() const
Clone this message.
size_t maxlenof_max_x() const
Get maximum length of max_x value.
void set_max_x(const float new_max_x)
Set max_x value.
SetSelectionModeMessage()
Constructor.
size_t maxlenof_selection_mode() const
Get maximum length of selection_mode value.
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.
float max_x() const
Get max_x value.
field with interface specific enum type
SelectionMode
Enumeration defining the possible cluster selection modes.