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 add_fieldinfo(IFT_STRING,
"end_point_frame_1", 32, data->end_point_frame_1);
60 add_fieldinfo(IFT_STRING,
"end_point_frame_2", 32, data->end_point_frame_2);
61 unsigned char tmp_hash[] = {0x5f, 0x66, 0x25, 0x68, 0xe4, 0xe3, 0x5b, 0x51, 0x1f, 0x4, 0x79, 0x7a, 0x1, 0x96, 0xe2, 0xe8};
66 LaserLineInterface::~LaserLineInterface()
78 LaserLineInterface::frame_id()
const 80 return data->frame_id;
88 LaserLineInterface::maxlenof_frame_id()
const 100 LaserLineInterface::set_frame_id(
const char * new_frame_id)
102 strncpy(data->frame_id, new_frame_id,
sizeof(data->frame_id)-1);
103 data->frame_id[
sizeof(data->frame_id)-1] = 0;
118 LaserLineInterface::visibility_history()
const 120 return data->visibility_history;
128 LaserLineInterface::maxlenof_visibility_history()
const 144 LaserLineInterface::set_visibility_history(
const int32_t new_visibility_history)
146 data->visibility_history = new_visibility_history;
157 LaserLineInterface::point_on_line()
const 159 return data->point_on_line;
171 LaserLineInterface::point_on_line(
unsigned int index)
const 174 throw Exception(
"Index value %u out of bounds (0..3)", index);
176 return data->point_on_line[index];
184 LaserLineInterface::maxlenof_point_on_line()
const 196 LaserLineInterface::set_point_on_line(
const float * new_point_on_line)
198 memcpy(data->point_on_line, new_point_on_line,
sizeof(
float) * 3);
210 LaserLineInterface::set_point_on_line(
unsigned int index,
const float new_point_on_line)
213 throw Exception(
"Index value %u out of bounds (0..3)", index);
215 data->point_on_line[index] = new_point_on_line;
225 LaserLineInterface::line_direction()
const 227 return data->line_direction;
239 LaserLineInterface::line_direction(
unsigned int index)
const 242 throw Exception(
"Index value %u out of bounds (0..3)", index);
244 return data->line_direction[index];
252 LaserLineInterface::maxlenof_line_direction()
const 264 LaserLineInterface::set_line_direction(
const float * new_line_direction)
266 memcpy(data->line_direction, new_line_direction,
sizeof(
float) * 3);
278 LaserLineInterface::set_line_direction(
unsigned int index,
const float new_line_direction)
281 throw Exception(
"Index value %u out of bounds (0..3)", index);
283 data->line_direction[index] = new_line_direction;
294 LaserLineInterface::bearing()
const 296 return data->bearing;
304 LaserLineInterface::maxlenof_bearing()
const 317 LaserLineInterface::set_bearing(
const float new_bearing)
319 data->bearing = new_bearing;
331 LaserLineInterface::end_point_1()
const 333 return data->end_point_1;
346 LaserLineInterface::end_point_1(
unsigned int index)
const 349 throw Exception(
"Index value %u out of bounds (0..3)", index);
351 return data->end_point_1[index];
359 LaserLineInterface::maxlenof_end_point_1()
const 372 LaserLineInterface::set_end_point_1(
const float * new_end_point_1)
374 memcpy(data->end_point_1, new_end_point_1,
sizeof(
float) * 3);
387 LaserLineInterface::set_end_point_1(
unsigned int index,
const float new_end_point_1)
390 throw Exception(
"Index value %u out of bounds (0..3)", index);
392 data->end_point_1[index] = new_end_point_1;
403 LaserLineInterface::end_point_2()
const 405 return data->end_point_2;
418 LaserLineInterface::end_point_2(
unsigned int index)
const 421 throw Exception(
"Index value %u out of bounds (0..3)", index);
423 return data->end_point_2[index];
431 LaserLineInterface::maxlenof_end_point_2()
const 444 LaserLineInterface::set_end_point_2(
const float * new_end_point_2)
446 memcpy(data->end_point_2, new_end_point_2,
sizeof(
float) * 3);
459 LaserLineInterface::set_end_point_2(
unsigned int index,
const float new_end_point_2)
462 throw Exception(
"Index value %u out of bounds (0..3)", index);
464 data->end_point_2[index] = new_end_point_2;
472 LaserLineInterface::length()
const 482 LaserLineInterface::maxlenof_length()
const 492 LaserLineInterface::set_length(
const float new_length)
494 data->length = new_length;
505 LaserLineInterface::end_point_frame_1()
const 507 return data->end_point_frame_1;
515 LaserLineInterface::maxlenof_end_point_frame_1()
const 527 LaserLineInterface::set_end_point_frame_1(
const char * new_end_point_frame_1)
529 strncpy(data->end_point_frame_1, new_end_point_frame_1,
sizeof(data->end_point_frame_1)-1);
530 data->end_point_frame_1[
sizeof(data->end_point_frame_1)-1] = 0;
541 LaserLineInterface::end_point_frame_2()
const 543 return data->end_point_frame_2;
551 LaserLineInterface::maxlenof_end_point_frame_2()
const 563 LaserLineInterface::set_end_point_frame_2(
const char * new_end_point_frame_2)
565 strncpy(data->end_point_frame_2, new_end_point_frame_2,
sizeof(data->end_point_frame_2)-1);
566 data->end_point_frame_2[
sizeof(data->end_point_frame_2)-1] = 0;
572 LaserLineInterface::create_message(
const char *type)
const 575 "message type for this interface type.", type);
588 type(), other->
type());
590 memcpy(data, oi->data,
sizeof(LaserLineInterface_data_t));
594 LaserLineInterface::enum_tostring(
const char *enumtype,
int val)
const 605 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.