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 data_changed |=
change_field(data->frame_id, new_frame_id);
116 LaserLineInterface::visibility_history()
const
118 return data->visibility_history;
126 LaserLineInterface::maxlenof_visibility_history()
const
142 LaserLineInterface::set_visibility_history(
const int32_t new_visibility_history)
144 data_changed |=
change_field(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..2)", 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 data_changed |=
change_field(data->point_on_line, new_point_on_line);
206 LaserLineInterface::set_point_on_line(
unsigned int index,
const float new_point_on_line)
208 data_changed |=
change_field(data->point_on_line, index, new_point_on_line);
217 LaserLineInterface::line_direction()
const
219 return data->line_direction;
231 LaserLineInterface::line_direction(
unsigned int index)
const
234 throw Exception(
"Index value %u out of bounds (0..2)", index);
236 return data->line_direction[index];
244 LaserLineInterface::maxlenof_line_direction()
const
256 LaserLineInterface::set_line_direction(
const float * new_line_direction)
258 data_changed |=
change_field(data->line_direction, new_line_direction);
269 LaserLineInterface::set_line_direction(
unsigned int index,
const float new_line_direction)
271 data_changed |=
change_field(data->line_direction, index, new_line_direction);
281 LaserLineInterface::bearing()
const
283 return data->bearing;
291 LaserLineInterface::maxlenof_bearing()
const
304 LaserLineInterface::set_bearing(
const float new_bearing)
306 data_changed |=
change_field(data->bearing, new_bearing);
317 LaserLineInterface::end_point_1()
const
319 return data->end_point_1;
332 LaserLineInterface::end_point_1(
unsigned int index)
const
335 throw Exception(
"Index value %u out of bounds (0..2)", index);
337 return data->end_point_1[index];
345 LaserLineInterface::maxlenof_end_point_1()
const
358 LaserLineInterface::set_end_point_1(
const float * new_end_point_1)
360 data_changed |=
change_field(data->end_point_1, new_end_point_1);
372 LaserLineInterface::set_end_point_1(
unsigned int index,
const float new_end_point_1)
374 data_changed |=
change_field(data->end_point_1, index, new_end_point_1);
384 LaserLineInterface::end_point_2()
const
386 return data->end_point_2;
399 LaserLineInterface::end_point_2(
unsigned int index)
const
402 throw Exception(
"Index value %u out of bounds (0..2)", index);
404 return data->end_point_2[index];
412 LaserLineInterface::maxlenof_end_point_2()
const
425 LaserLineInterface::set_end_point_2(
const float * new_end_point_2)
427 data_changed |=
change_field(data->end_point_2, new_end_point_2);
439 LaserLineInterface::set_end_point_2(
unsigned int index,
const float new_end_point_2)
441 data_changed |=
change_field(data->end_point_2, index, new_end_point_2);
448 LaserLineInterface::length()
const
458 LaserLineInterface::maxlenof_length()
const
468 LaserLineInterface::set_length(
const float new_length)
480 LaserLineInterface::end_point_frame_1()
const
482 return data->end_point_frame_1;
490 LaserLineInterface::maxlenof_end_point_frame_1()
const
502 LaserLineInterface::set_end_point_frame_1(
const char * new_end_point_frame_1)
504 data_changed |=
change_field(data->end_point_frame_1, new_end_point_frame_1);
514 LaserLineInterface::end_point_frame_2()
const
516 return data->end_point_frame_2;
524 LaserLineInterface::maxlenof_end_point_frame_2()
const
536 LaserLineInterface::set_end_point_frame_2(
const char * new_end_point_frame_2)
538 data_changed |=
change_field(data->end_point_frame_2, new_end_point_frame_2);
543 LaserLineInterface::create_message(
const char *type)
const
546 "message type for this interface type.", type);
559 type(), other->
type());
561 memcpy(data, oi->data,
sizeof(LaserLineInterface_data_t));
565 LaserLineInterface::enum_tostring(
const char *enumtype,
int val)
const
576 LaserLineInterface::message_valid(
const Message *message)
const