24 #include <interfaces/IMUInterface.h> 26 #include <core/exceptions/software.h> 65 IMUInterface::IMUInterface() : Interface()
69 data = (IMUInterface_data_t *)
data_ptr;
79 unsigned char tmp_hash[] = {0x9d, 0xf6, 0xde, 0x9d, 0x32, 0xe3, 0xf, 0x11, 0xac, 0xdc, 0x5d, 0x92, 0x27, 0x89, 0x27, 0x7e};
84 IMUInterface::~IMUInterface()
120 strncpy(data->frame, new_frame,
sizeof(data->frame));
133 return data->orientation;
148 throw Exception(
"Index value %u out of bounds (0..4)", index);
150 return data->orientation[index];
172 memcpy(data->orientation, new_orientation,
sizeof(
float) * 4);
187 throw Exception(
"Index value %u out of bounds (0..4)", index);
189 data->orientation[index] = new_orientation;
201 return data->orientation_covariance;
216 throw Exception(
"Index value %u out of bounds (0..9)", index);
218 return data->orientation_covariance[index];
240 memcpy(data->orientation_covariance, new_orientation_covariance,
sizeof(
double) * 9);
255 throw Exception(
"Index value %u out of bounds (0..9)", index);
257 data->orientation_covariance[index] = new_orientation_covariance;
269 return data->angular_velocity;
284 throw Exception(
"Index value %u out of bounds (0..3)", index);
286 return data->angular_velocity[index];
308 memcpy(data->angular_velocity, new_angular_velocity,
sizeof(
float) * 3);
323 throw Exception(
"Index value %u out of bounds (0..3)", index);
325 data->angular_velocity[index] = new_angular_velocity;
337 return data->angular_velocity_covariance;
352 throw Exception(
"Index value %u out of bounds (0..9)", index);
354 return data->angular_velocity_covariance[index];
376 memcpy(data->angular_velocity_covariance, new_angular_velocity_covariance,
sizeof(
double) * 9);
391 throw Exception(
"Index value %u out of bounds (0..9)", index);
393 data->angular_velocity_covariance[index] = new_angular_velocity_covariance;
405 return data->linear_acceleration;
420 throw Exception(
"Index value %u out of bounds (0..3)", index);
422 return data->linear_acceleration[index];
444 memcpy(data->linear_acceleration, new_linear_acceleration,
sizeof(
float) * 3);
459 throw Exception(
"Index value %u out of bounds (0..3)", index);
461 data->linear_acceleration[index] = new_linear_acceleration;
473 return data->linear_acceleration_covariance;
488 throw Exception(
"Index value %u out of bounds (0..9)", index);
490 return data->linear_acceleration_covariance[index];
512 memcpy(data->linear_acceleration_covariance, new_linear_acceleration_covariance,
sizeof(
double) * 9);
527 throw Exception(
"Index value %u out of bounds (0..9)", index);
529 data->linear_acceleration_covariance[index] = new_linear_acceleration_covariance;
537 "message type for this interface type.", type);
552 memcpy(data, oi->data,
sizeof(IMUInterface_data_t));
virtual Message * create_message(const char *type) const
Create message based on type name.
double * angular_velocity_covariance() const
Get angular_velocity_covariance value.
Base class for all messages passed through interfaces in Fawkes BlackBoard.
size_t maxlenof_angular_velocity_covariance() const
Get maximum length of angular_velocity_covariance value.
void set_hash(unsigned char *ihash)
Set hash.
void set_orientation(unsigned int index, const float new_orientation)
Set orientation value at given index.
Fawkes library namespace.
size_t maxlenof_frame() const
Get maximum length of frame value.
unsigned int data_size
Minimal data size to hold data storage.
size_t maxlenof_linear_acceleration() const
Get maximum length of linear_acceleration value.
size_t maxlenof_orientation_covariance() const
Get maximum length of orientation_covariance value.
Base class for all Fawkes BlackBoard interfaces.
void set_linear_acceleration_covariance(unsigned int index, const double new_linear_acceleration_covariance)
Set linear_acceleration_covariance value at given index.
void set_angular_velocity(unsigned int index, const float new_angular_velocity)
Set angular_velocity value at given index.
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.
bool data_changed
Indicator if data has changed.
void set_frame(const char *new_frame)
Set frame value.
const char * type() const
Get type of interface.
void * data_ptr
Pointer to local memory storage.
void set_orientation_covariance(unsigned int index, const double new_orientation_covariance)
Set orientation_covariance value at given index.
Base class for exceptions in Fawkes.
virtual bool message_valid(const Message *message) const
Check if message is valid and can be enqueued.
void set_angular_velocity_covariance(unsigned int index, const double new_angular_velocity_covariance)
Set angular_velocity_covariance value at given index.
float * angular_velocity() const
Get angular_velocity value.
size_t maxlenof_angular_velocity() const
Get maximum length of angular_velocity value.
size_t maxlenof_linear_acceleration_covariance() const
Get maximum length of linear_acceleration_covariance value.
double * linear_acceleration_covariance() const
Get linear_acceleration_covariance value.
IMUInterface Fawkes BlackBoard Interface.
virtual void copy_values(const Interface *other)
Copy values from other interface.
char * frame() const
Get frame value.
double * orientation_covariance() const
Get orientation_covariance value.
size_t maxlenof_orientation() const
Get maximum length of orientation value.
interface_data_ts_t * data_ts
Pointer to data casted to timestamp struct.
float * linear_acceleration() const
Get linear_acceleration value.
void set_linear_acceleration(unsigned int index, const float new_linear_acceleration)
Set linear_acceleration value at given index.
float * orientation() const
Get orientation value.
virtual const char * enum_tostring(const char *enumtype, int val) const
Convert arbitrary enum value to string.