24 #include <interfaces/LaserLineInterface.h> 26 #include <core/exceptions/software.h> 44 LaserLineInterface::LaserLineInterface() : Interface()
46 data_size =
sizeof(LaserLineInterface_data_t);
47 data_ptr = malloc(data_size);
48 data = (LaserLineInterface_data_t *)data_ptr;
49 data_ts = (interface_data_ts_t *)data_ptr;
50 memset(data_ptr, 0, data_size);
51 add_fieldinfo(IFT_STRING,
"frame_id", 32, data->frame_id);
52 add_fieldinfo(IFT_INT32,
"visibility_history", 1, &data->visibility_history);
53 add_fieldinfo(IFT_FLOAT,
"point_on_line", 3, &data->point_on_line);
54 add_fieldinfo(IFT_FLOAT,
"line_direction", 3, &data->line_direction);
55 add_fieldinfo(IFT_FLOAT,
"bearing", 1, &data->bearing);
56 add_fieldinfo(IFT_FLOAT,
"end_point_1", 3, &data->end_point_1);
57 add_fieldinfo(IFT_FLOAT,
"end_point_2", 3, &data->end_point_2);
58 add_fieldinfo(IFT_FLOAT,
"length", 1, &data->length);
59 unsigned char tmp_hash[] = {0x80, 0xa, 0x8e, 0xab, 0x65, 0xe7, 0x47, 0x3f, 0xc3, 0x8a, 0x44, 0x7b, 0xda, 0xbd, 0xfb, 0x5f};
64 LaserLineInterface::~LaserLineInterface()
76 LaserLineInterface::frame_id()
const 78 return data->frame_id;
86 LaserLineInterface::maxlenof_frame_id()
const 98 LaserLineInterface::set_frame_id(
const char * new_frame_id)
100 strncpy(data->frame_id, new_frame_id,
sizeof(data->frame_id));
115 LaserLineInterface::visibility_history()
const 117 return data->visibility_history;
125 LaserLineInterface::maxlenof_visibility_history()
const 141 LaserLineInterface::set_visibility_history(
const int32_t new_visibility_history)
143 data->visibility_history = new_visibility_history;
154 LaserLineInterface::point_on_line()
const 156 return data->point_on_line;
168 LaserLineInterface::point_on_line(
unsigned int index)
const 171 throw Exception(
"Index value %u out of bounds (0..3)", index);
173 return data->point_on_line[index];
181 LaserLineInterface::maxlenof_point_on_line()
const 193 LaserLineInterface::set_point_on_line(
const float * new_point_on_line)
195 memcpy(data->point_on_line, new_point_on_line,
sizeof(
float) * 3);
207 LaserLineInterface::set_point_on_line(
unsigned int index,
const float new_point_on_line)
210 throw Exception(
"Index value %u out of bounds (0..3)", index);
212 data->point_on_line[index] = new_point_on_line;
222 LaserLineInterface::line_direction()
const 224 return data->line_direction;
236 LaserLineInterface::line_direction(
unsigned int index)
const 239 throw Exception(
"Index value %u out of bounds (0..3)", index);
241 return data->line_direction[index];
249 LaserLineInterface::maxlenof_line_direction()
const 261 LaserLineInterface::set_line_direction(
const float * new_line_direction)
263 memcpy(data->line_direction, new_line_direction,
sizeof(
float) * 3);
275 LaserLineInterface::set_line_direction(
unsigned int index,
const float new_line_direction)
278 throw Exception(
"Index value %u out of bounds (0..3)", index);
280 data->line_direction[index] = new_line_direction;
291 LaserLineInterface::bearing()
const 293 return data->bearing;
301 LaserLineInterface::maxlenof_bearing()
const 314 LaserLineInterface::set_bearing(
const float new_bearing)
316 data->bearing = new_bearing;
328 LaserLineInterface::end_point_1()
const 330 return data->end_point_1;
343 LaserLineInterface::end_point_1(
unsigned int index)
const 346 throw Exception(
"Index value %u out of bounds (0..3)", index);
348 return data->end_point_1[index];
356 LaserLineInterface::maxlenof_end_point_1()
const 369 LaserLineInterface::set_end_point_1(
const float * new_end_point_1)
371 memcpy(data->end_point_1, new_end_point_1,
sizeof(
float) * 3);
384 LaserLineInterface::set_end_point_1(
unsigned int index,
const float new_end_point_1)
387 throw Exception(
"Index value %u out of bounds (0..3)", index);
389 data->end_point_1[index] = new_end_point_1;
400 LaserLineInterface::end_point_2()
const 402 return data->end_point_2;
415 LaserLineInterface::end_point_2(
unsigned int index)
const 418 throw Exception(
"Index value %u out of bounds (0..3)", index);
420 return data->end_point_2[index];
428 LaserLineInterface::maxlenof_end_point_2()
const 441 LaserLineInterface::set_end_point_2(
const float * new_end_point_2)
443 memcpy(data->end_point_2, new_end_point_2,
sizeof(
float) * 3);
456 LaserLineInterface::set_end_point_2(
unsigned int index,
const float new_end_point_2)
459 throw Exception(
"Index value %u out of bounds (0..3)", index);
461 data->end_point_2[index] = new_end_point_2;
469 LaserLineInterface::length()
const 479 LaserLineInterface::maxlenof_length()
const 489 LaserLineInterface::set_length(
const float new_length)
491 data->length = new_length;
497 LaserLineInterface::create_message(
const char *type)
const 500 "message type for this interface type.", type);
513 type(), other->
type());
515 memcpy(data, oi->data,
sizeof(LaserLineInterface_data_t));
519 LaserLineInterface::enum_tostring(
const char *enumtype,
int val)
const 530 LaserLineInterface::message_valid(
const Message *message)
const
Base class for all messages passed through interfaces in Fawkes BlackBoard.
Fawkes library namespace.
LaserLineInterface Fawkes BlackBoard Interface.
Base class for all Fawkes BlackBoard interfaces.
const char * type() const
Get type of interface.
Base class for exceptions in Fawkes.