24 #include <interfaces/Position3DInterface.h>
26 #include <core/exceptions/software.h>
46 Position3DInterface::Position3DInterface() : Interface()
48 data_size =
sizeof(Position3DInterface_data_t);
49 data_ptr = malloc(data_size);
50 data = (Position3DInterface_data_t *)data_ptr;
51 data_ts = (interface_data_ts_t *)data_ptr;
52 memset(data_ptr, 0, data_size);
53 add_fieldinfo(IFT_STRING,
"frame", 32, data->frame);
54 add_fieldinfo(IFT_INT32,
"visibility_history", 1, &data->visibility_history);
55 add_fieldinfo(IFT_DOUBLE,
"rotation", 4, &data->rotation);
56 add_fieldinfo(IFT_DOUBLE,
"translation", 3, &data->translation);
57 add_fieldinfo(IFT_DOUBLE,
"covariance", 36, &data->covariance);
58 unsigned char tmp_hash[] = {0xd6, 0x19, 0x3f, 0x58, 0x62, 0xbc, 0x72, 0xd6, 0x22, 0x36, 0xd3, 0x7, 0x55, 0xb5, 0x3a, 0x48};
63 Position3DInterface::~Position3DInterface()
75 Position3DInterface::frame()
const
85 Position3DInterface::maxlenof_frame()
const
97 Position3DInterface::set_frame(
const char * new_frame)
113 Position3DInterface::visibility_history()
const
115 return data->visibility_history;
123 Position3DInterface::maxlenof_visibility_history()
const
139 Position3DInterface::set_visibility_history(
const int32_t new_visibility_history)
141 data_changed |=
change_field(data->visibility_history, new_visibility_history);
151 Position3DInterface::rotation()
const
153 return data->rotation;
165 Position3DInterface::rotation(
unsigned int index)
const
168 throw Exception(
"Index value %u out of bounds (0..3)", index);
170 return data->rotation[index];
178 Position3DInterface::maxlenof_rotation()
const
190 Position3DInterface::set_rotation(
const double * new_rotation)
192 data_changed |=
change_field(data->rotation, new_rotation);
203 Position3DInterface::set_rotation(
unsigned int index,
const double new_rotation)
205 data_changed |=
change_field(data->rotation, index, new_rotation);
214 Position3DInterface::translation()
const
216 return data->translation;
228 Position3DInterface::translation(
unsigned int index)
const
231 throw Exception(
"Index value %u out of bounds (0..2)", index);
233 return data->translation[index];
241 Position3DInterface::maxlenof_translation()
const
253 Position3DInterface::set_translation(
const double * new_translation)
255 data_changed |=
change_field(data->translation, new_translation);
266 Position3DInterface::set_translation(
unsigned int index,
const double new_translation)
268 data_changed |=
change_field(data->translation, index, new_translation);
280 Position3DInterface::covariance()
const
282 return data->covariance;
297 Position3DInterface::covariance(
unsigned int index)
const
300 throw Exception(
"Index value %u out of bounds (0..35)", index);
302 return data->covariance[index];
310 Position3DInterface::maxlenof_covariance()
const
325 Position3DInterface::set_covariance(
const double * new_covariance)
327 data_changed |=
change_field(data->covariance, new_covariance);
341 Position3DInterface::set_covariance(
unsigned int index,
const double new_covariance)
343 data_changed |=
change_field(data->covariance, index, new_covariance);
347 Position3DInterface::create_message(
const char *type)
const
350 "message type for this interface type.", type);
358 Position3DInterface::copy_values(
const Interface *other)
363 type(), other->
type());
365 memcpy(data, oi->data,
sizeof(Position3DInterface_data_t));
369 Position3DInterface::enum_tostring(
const char *enumtype,
int val)
const
380 Position3DInterface::message_valid(
const Message *message)
const
Base class for exceptions in Fawkes.
Base class for all Fawkes BlackBoard interfaces.
const char * type() const
Get type of interface.
Base class for all messages passed through interfaces in Fawkes BlackBoard.
Position3DInterface Fawkes BlackBoard Interface.
Fawkes library namespace.
bool change_field(FieldT &field, const DataT &value)
Set a field and return whether it changed.