24 #include <interfaces/LocalizationInterface.h>
26 #include <core/exceptions/software.h>
48 LocalizationInterface::LocalizationInterface() : Interface()
50 data_size =
sizeof(LocalizationInterface_data_t);
51 data_ptr = malloc(data_size);
52 data = (LocalizationInterface_data_t *)data_ptr;
53 data_ts = (interface_data_ts_t *)data_ptr;
54 memset(data_ptr, 0, data_size);
55 add_fieldinfo(IFT_STRING,
"map", 64, data->map);
56 add_messageinfo(
"SetInitialPoseMessage");
57 unsigned char tmp_hash[] = {0x7f, 0x9, 0xec, 0xd1, 00, 0x3f, 0x3, 0xb7, 0x95, 0xce, 0xe, 0x1d, 0x6f, 0x48, 0x6c, 0xad};
62 LocalizationInterface::~LocalizationInterface()
72 LocalizationInterface::map()
const
82 LocalizationInterface::maxlenof_map()
const
92 LocalizationInterface::set_map(
const char * new_map)
99 LocalizationInterface::create_message(
const char *type)
const
101 if ( strncmp(
"SetInitialPoseMessage", type, INTERFACE_MESSAGE_TYPE_SIZE_ - 1) == 0 ) {
105 "message type for this interface type.", type);
114 LocalizationInterface::copy_values(
const Interface *other)
119 type(), other->
type());
121 memcpy(data, oi->data,
sizeof(LocalizationInterface_data_t));
125 LocalizationInterface::enum_tostring(
const char *enumtype,
int val)
const
144 LocalizationInterface::SetInitialPoseMessage::SetInitialPoseMessage(
const char * ini_frame,
const double * ini_rotation,
const double * ini_translation,
const double * ini_covariance) :
Message(
"SetInitialPoseMessage")
146 data_size =
sizeof(SetInitialPoseMessage_data_t);
149 data = (SetInitialPoseMessage_data_t *)
data_ptr;
151 strncpy(data->frame, ini_frame, 32-1);
152 data->frame[32-1] = 0;
153 memcpy(data->rotation, ini_rotation,
sizeof(
double) * 4);
154 memcpy(data->translation, ini_translation,
sizeof(
double) * 3);
155 memcpy(data->covariance, ini_covariance,
sizeof(
double) * 36);
164 data_size =
sizeof(SetInitialPoseMessage_data_t);
167 data = (SetInitialPoseMessage_data_t *)
data_ptr;
189 data = (SetInitialPoseMessage_data_t *)
data_ptr;
237 return data->rotation;
252 throw Exception(
"Index value %u out of bounds (0..3)", index);
254 return data->rotation[index];
300 return data->translation;
315 throw Exception(
"Index value %u out of bounds (0..2)", index);
317 return data->translation[index];
352 change_field(data->translation, index, new_translation);
366 return data->covariance;
384 throw Exception(
"Index value %u out of bounds (0..35)", index);
386 return data->covariance[index];
Base class for exceptions in Fawkes.
Base class for all Fawkes BlackBoard interfaces.
const char * type() const
Get type of interface.
void * data_ptr
Pointer to local memory storage.
SetInitialPoseMessage Fawkes BlackBoard Interface Message.
void set_translation(unsigned int index, const double new_translation)
Set translation value at given index.
SetInitialPoseMessage()
Constructor.
virtual Message * clone() const
Clone this message.
size_t maxlenof_translation() const
Get maximum length of translation value.
double * rotation() const
Get rotation value.
double * covariance() const
Get covariance value.
size_t maxlenof_covariance() const
Get maximum length of covariance value.
void set_rotation(unsigned int index, const double new_rotation)
Set rotation value at given index.
~SetInitialPoseMessage()
Destructor.
char * frame() const
Get frame value.
double * translation() const
Get translation value.
size_t maxlenof_frame() const
Get maximum length of frame value.
size_t maxlenof_rotation() const
Get maximum length of rotation value.
void set_frame(const char *new_frame)
Set frame value.
void set_covariance(unsigned int index, const double new_covariance)
Set covariance value at given index.
LocalizationInterface Fawkes BlackBoard Interface.
virtual bool message_valid(const Message *message) const
Check if message is valid and can be enqueued.
Base class for all messages passed through interfaces in Fawkes BlackBoard.
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.
void * data_ptr
Pointer to memory that contains local data.
message_data_ts_t * data_ts
data timestamp aliasing pointer
unsigned int data_size
Size of memory needed to hold all data.
Fawkes library namespace.
bool change_field(FieldT &field, const DataT &value)
Set a field and return whether it changed.
Timestamp data, must be present and first entries for each interface data structs!...