13 #define NTP_TO_UTC 2208988800 18 void IbeoLuxRosMsgHandler::fillAndPublish(
19 const uint8_t& type_id,
20 const std::string& frame_id,
26 ibeo_msgs::ErrorWarning new_msg;
27 fill2030(parser_class, &new_msg, frame_id);
32 ibeo_msgs::ScanData2202 new_msg;
33 fill2202(parser_class, &new_msg, frame_id);
38 ibeo_msgs::ScanData2204 new_msg;
39 fill2204(parser_class, &new_msg, frame_id);
44 ibeo_msgs::ScanData2205 new_msg;
45 fill2205(parser_class, &new_msg, frame_id);
50 ibeo_msgs::ObjectData2221 new_msg;
51 fill2221(parser_class, &new_msg, frame_id);
56 ibeo_msgs::ObjectData2225 new_msg;
57 fill2225(parser_class, &new_msg, frame_id);
62 ibeo_msgs::ObjectData2280 new_msg;
63 fill2280(parser_class, &new_msg, frame_id);
68 ibeo_msgs::CameraImage new_msg;
69 fill2403(parser_class, &new_msg, frame_id);
74 ibeo_msgs::HostVehicleState2805 new_msg;
75 fill2805(parser_class, &new_msg, frame_id);
80 ibeo_msgs::HostVehicleState2806 new_msg;
81 fill2806(parser_class, &new_msg, frame_id);
86 ibeo_msgs::HostVehicleState2807 new_msg;
87 fill2807(parser_class, &new_msg, frame_id);
92 void IbeoLuxRosMsgHandler::fillPointcloud(
93 const std::vector<Point3DL>& points,
94 pcl::PointCloud<pcl::PointXYZL> * new_msg)
102 pclp.label = p.label;
103 new_msg->push_back(pclp);
107 void IbeoLuxRosMsgHandler::fillContourPoints(
108 const std::vector<Point3D>& points,
109 visualization_msgs::Marker * new_msg,
110 const std::string& frame_id)
112 new_msg->ns = frame_id;
113 new_msg->type = visualization_msgs::Marker::POINTS;
114 new_msg->color.r = 0.0;
115 new_msg->color.g = 1.0;
116 new_msg->color.b = 0.0;
117 new_msg->color.a = 1.0;
118 new_msg->scale.x = 0.05;
119 new_msg->scale.y = 0.05;
120 new_msg->scale.z = 0.05;
124 geometry_msgs::Point point;
128 new_msg->points.push_back(point);
132 void IbeoLuxRosMsgHandler::fillMarkerArray(
133 const std::vector<IbeoObject>& objects,
134 visualization_msgs::MarkerArray * new_msg,
135 const std::string& frame_id)
140 o.object_box_orientation);
141 visualization_msgs::Marker object_marker = createWireframeMarker(
142 o.object_box_center.x,
143 o.object_box_center.y,
144 o.object_box_size.size_x,
145 o.object_box_size.size_y,
147 object_marker.id = o.id;
148 object_marker.pose.orientation.x = quaternion.x();
149 object_marker.pose.orientation.y = quaternion.y();
150 object_marker.pose.orientation.z = quaternion.z();
151 object_marker.pose.orientation.w = quaternion.w();
153 object_marker.color.a = 0.5;
154 object_marker.color.r = object_marker.color.g = object_marker.color.b = 1.0;
155 object_marker.frame_locked =
false;
158 switch (o.classification)
161 label =
"Unclassified";
165 label =
"Unknown Small";
167 object_marker.color.r = object_marker.color.g = 0;
170 label =
"Unknown Big";
172 object_marker.color.r = object_marker.color.g = 0;
173 object_marker.color.b = 0.5;
176 label =
"Pedestrian";
178 object_marker.color.g = object_marker.color.b = 0;
183 object_marker.color.g = object_marker.color.b = 0;
184 object_marker.color.r = 0.5;
189 object_marker.color.b = object_marker.color.r = 0;
194 object_marker.color.b = object_marker.color.r = 0;
195 object_marker.color.g = 0.5;
199 object_marker.color.r = object_marker.color.b = object_marker.color.g = 0.0;
203 object_marker.ns = label;
204 object_marker.scale.x = 0.05;
205 object_marker.scale.y = 0.05;
206 object_marker.scale.z = 0.05;
207 object_marker.type = visualization_msgs::Marker::LINE_LIST;
208 object_marker.action = visualization_msgs::Marker::MODIFY;
210 object_marker.header.frame_id = frame_id;
212 visualization_msgs::Marker object_label;
213 object_label.id = o.id + 1000;
214 object_label.ns = label;
215 object_label.type = visualization_msgs::Marker::TEXT_VIEW_FACING;
216 object_label.action = visualization_msgs::Marker::MODIFY;
217 object_label.pose.position.x = o.object_box_center.x;
218 object_label.pose.position.y = o.object_box_center.y;
219 object_label.pose.position.z = 0.5;
220 object_label.text = label;
221 object_label.scale.x = 0.1;
222 object_label.scale.y = 0.1;
223 object_label.scale.z = 0.5;
224 object_label.lifetime = object_marker.lifetime;
225 object_label.color.r = object_label.color.g = object_label.color.b = 1;
226 object_label.color.a = 0.5;
228 object_label.header.frame_id = frame_id;
230 new_msg->markers.push_back(object_marker);
231 new_msg->markers.push_back(object_label);
240 void IbeoLuxRosMsgHandler::fillIbeoHeader(
242 ibeo_msgs::IbeoDataHeader * msg_header)
246 msg_header->device_id = class_header.
device_id;
248 msg_header->stamp = ntp_to_ros_time(class_header.
time);
251 void IbeoLuxRosMsgHandler::fill2030(
253 ibeo_msgs::ErrorWarning * new_msg,
254 const std::string& frame_id)
256 auto dc_parser =
dynamic_cast<ErrorWarning*
>(parser_class);
258 fillIbeoHeader(dc_parser->ibeo_header, &(new_msg->ibeo_header));
260 new_msg->err_internal_error = dc_parser->err_internal_error;
261 new_msg->err_motor_1_fault = dc_parser->err_motor_1_fault;
262 new_msg->err_buffer_error_xmt_incomplete = dc_parser->err_buffer_error_xmt_incomplete;
263 new_msg->err_buffer_error_overflow = dc_parser->err_buffer_error_overflow;
264 new_msg->err_apd_over_temperature = dc_parser->err_apd_over_temperature;
265 new_msg->err_apd_under_temperature = dc_parser->err_apd_under_temperature;
266 new_msg->err_apd_temperature_sensor_defect = dc_parser->err_apd_temperature_sensor_defect;
267 new_msg->err_motor_2_fault = dc_parser->err_motor_2_fault;
268 new_msg->err_motor_3_fault = dc_parser->err_motor_3_fault;
269 new_msg->err_motor_4_fault = dc_parser->err_motor_4_fault;
270 new_msg->err_motor_5_fault = dc_parser->err_motor_5_fault;
271 new_msg->err_int_no_scan_data = dc_parser->err_int_no_scan_data;
272 new_msg->err_int_communication_error = dc_parser->err_int_communication_error;
273 new_msg->err_int_incorrect_scan_data = dc_parser->err_int_incorrect_scan_data;
274 new_msg->err_config_fpga_not_configurable = dc_parser->err_config_fpga_not_configurable;
275 new_msg->err_config_incorrect_config_data = dc_parser->err_config_incorrect_config_data;
276 new_msg->err_config_contains_incorrect_params = dc_parser->err_config_contains_incorrect_params;
277 new_msg->err_timeout_data_processing = dc_parser->err_timeout_data_processing;
278 new_msg->err_timeout_env_model_computation_reset = dc_parser->err_timeout_env_model_computation_reset;
279 new_msg->wrn_int_communication_error = dc_parser->wrn_int_communication_error;
280 new_msg->wrn_low_temperature = dc_parser->wrn_low_temperature;
281 new_msg->wrn_high_temperature = dc_parser->wrn_high_temperature;
282 new_msg->wrn_int_motor_1 = dc_parser->wrn_int_motor_1;
283 new_msg->wrn_sync_error = dc_parser->wrn_sync_error;
284 new_msg->wrn_laser_1_start_pulse_missing = dc_parser->wrn_laser_1_start_pulse_missing;
285 new_msg->wrn_laser_2_start_pulse_missing = dc_parser->wrn_laser_2_start_pulse_missing;
286 new_msg->wrn_can_interface_blocked = dc_parser->wrn_can_interface_blocked;
287 new_msg->wrn_eth_interface_blocked = dc_parser->wrn_eth_interface_blocked;
288 new_msg->wrn_incorrect_can_data_rcvd = dc_parser->wrn_incorrect_can_data_rcvd;
289 new_msg->wrn_int_incorrect_scan_data = dc_parser->wrn_int_incorrect_scan_data;
290 new_msg->wrn_eth_unkwn_incomplete_data = dc_parser->wrn_eth_unkwn_incomplete_data;
291 new_msg->wrn_incorrect_or_forbidden_cmd_rcvd = dc_parser->wrn_incorrect_or_forbidden_cmd_rcvd;
292 new_msg->wrn_memory_access_failure = dc_parser->wrn_memory_access_failure;
293 new_msg->wrn_int_overflow = dc_parser->wrn_int_overflow;
294 new_msg->wrn_ego_motion_data_missing = dc_parser->wrn_ego_motion_data_missing;
295 new_msg->wrn_incorrect_mounting_params = dc_parser->wrn_incorrect_mounting_params;
296 new_msg->wrn_no_obj_comp_due_to_scan_freq = dc_parser->wrn_no_obj_comp_due_to_scan_freq;
298 new_msg->header.frame_id = frame_id;
302 void IbeoLuxRosMsgHandler::fill2202(
304 ibeo_msgs::ScanData2202 * new_msg,
305 const std::string& frame_id)
307 auto dc_parser =
dynamic_cast<ScanData2202*
>(parser_class);
309 fillIbeoHeader(dc_parser->ibeo_header, &(new_msg->ibeo_header));
311 new_msg->scan_number = dc_parser->scan_number;
312 new_msg->scanner_status = dc_parser->scanner_status;
313 new_msg->sync_phase_offset = dc_parser->sync_phase_offset;
314 new_msg->scan_start_time = ntp_to_ros_time(dc_parser->scan_start_time);
315 new_msg->scan_end_time = ntp_to_ros_time(dc_parser->scan_end_time);
316 new_msg->angle_ticks_per_rotation = dc_parser->angle_ticks_per_rotation;
317 new_msg->start_angle_ticks = dc_parser->start_angle_ticks;
318 new_msg->end_angle_ticks = dc_parser->end_angle_ticks;
319 new_msg->mounting_yaw_angle_ticks = dc_parser->mounting_yaw_angle_ticks;
320 new_msg->mounting_pitch_angle_ticks = dc_parser->mounting_pitch_angle_ticks;
321 new_msg->mounting_roll_angle_ticks = dc_parser->mounting_roll_angle_ticks;
322 new_msg->mounting_position_x = dc_parser->mounting_position_x;
323 new_msg->mounting_position_y = dc_parser->mounting_position_y;
324 new_msg->mounting_position_z = dc_parser->mounting_position_z;
325 new_msg->ground_labeled = dc_parser->ground_labeled;
326 new_msg->dirt_labeled = dc_parser->dirt_labeled;
327 new_msg->rain_labeled = dc_parser->rain_labeled;
328 new_msg->mirror_side =
static_cast<uint8_t
>(dc_parser->mirror_side);
330 for (
auto scan_point : dc_parser->scan_point_list)
332 ibeo_msgs::ScanPoint2202 scan_point_msg;
334 scan_point_msg.layer = scan_point.layer;
335 scan_point_msg.echo = scan_point.echo;
336 scan_point_msg.transparent_point = scan_point.transparent_point;
337 scan_point_msg.clutter_atmospheric = scan_point.clutter_atmospheric;
338 scan_point_msg.ground = scan_point.ground;
339 scan_point_msg.dirt = scan_point.dirt;
340 scan_point_msg.horizontal_angle = scan_point.horizontal_angle;
341 scan_point_msg.radial_distance = scan_point.radial_distance;
342 scan_point_msg.echo_pulse_width = scan_point.echo_pulse_width;
344 new_msg->scan_point_list.push_back(scan_point_msg);
347 new_msg->header.frame_id = frame_id;
351 void IbeoLuxRosMsgHandler::fill2204(
353 ibeo_msgs::ScanData2204 * new_msg,
354 const std::string& frame_id)
356 auto dc_parser =
dynamic_cast<ScanData2204*
>(parser_class);
358 fillIbeoHeader(dc_parser->ibeo_header, &(new_msg->ibeo_header));
360 new_msg->scan_start_time = dc_parser->scan_start_time;
361 new_msg->scan_end_time_offset = dc_parser->scan_end_time_offset;
362 new_msg->ground_labeled = dc_parser->ground_labeled;
363 new_msg->dirt_labeled = dc_parser->dirt_labeled;
364 new_msg->rain_labeled = dc_parser->rain_labeled;
365 new_msg->mirror_side =
static_cast<uint8_t
>(dc_parser->mirror_side);
366 new_msg->coordinate_system =
static_cast<uint8_t
>(dc_parser->coordinate_system);
367 new_msg->scan_number = dc_parser->scan_number;
368 new_msg->scan_points = dc_parser->scan_points;
369 new_msg->number_of_scanner_infos = dc_parser->number_of_scanner_infos;
371 ibeo_msgs::ScannerInfo2204 scan_info_msg;
374 for (
int k = 0; k < new_msg->number_of_scanner_infos; k++)
376 info_tx = dc_parser->scanner_info_list[k];
381 scan_info_msg.end_angle = info_tx.
end_angle;
382 scan_info_msg.yaw_angle = info_tx.
yaw_angle;
384 scan_info_msg.roll_angle = info_tx.
roll_angle;
385 scan_info_msg.offset_x = info_tx.
offset_x;
386 scan_info_msg.offset_y = info_tx.
offset_y;
387 scan_info_msg.offset_z = info_tx.
offset_z;
389 new_msg->scanner_info_list.push_back(scan_info_msg);
392 ibeo_msgs::ScanPoint2204 scan_point_msg;
395 for (
int k = 0; k < new_msg->scan_points; k++)
397 point_tx = dc_parser->scan_point_list[k];
399 scan_point_msg.y_position = point_tx.
y_position;
400 scan_point_msg.z_position = point_tx.
z_position;
401 scan_point_msg.echo_width = point_tx.
echo_width;
402 scan_point_msg.device_id = point_tx.
device_id;
403 scan_point_msg.layer = point_tx.
layer;
404 scan_point_msg.echo = point_tx.
echo;
406 scan_point_msg.ground = point_tx.
ground;
407 scan_point_msg.dirt = point_tx.
dirt;
410 new_msg->scan_point_list.push_back(scan_point_msg);
413 new_msg->header.frame_id = frame_id;
417 void IbeoLuxRosMsgHandler::fill2205(
419 ibeo_msgs::ScanData2205 * new_msg,
420 const std::string& frame_id)
422 auto dc_parser =
dynamic_cast<ScanData2205*
>(parser_class);
424 fillIbeoHeader(dc_parser->ibeo_header, &(new_msg->ibeo_header));
426 new_msg->scan_start_time = ntp_to_ros_time(dc_parser->scan_start_time);
427 new_msg->scan_end_time_offset = dc_parser->scan_end_time_offset;
428 new_msg->fused_scan = dc_parser->fused_scan;
430 if (dc_parser->mirror_side ==
FRONT)
431 new_msg->mirror_side = ibeo_msgs::ScanData2205::FRONT;
433 new_msg->mirror_side = ibeo_msgs::ScanData2205::REAR;
435 if (dc_parser->coordinate_system ==
SCANNER)
436 new_msg->coordinate_system = ibeo_msgs::ScanData2205::SCANNER;
438 new_msg->coordinate_system = ibeo_msgs::ScanData2205::VEHICLE;
440 new_msg->scan_number = dc_parser->scan_number;
441 new_msg->scan_points = dc_parser->scan_points;
442 new_msg->number_of_scanner_infos = dc_parser->number_of_scanner_infos;
444 for (
auto scanner_info : dc_parser->scanner_info_list)
446 ibeo_msgs::ScannerInfo2205 scanner_info_msg;
448 scanner_info_msg.device_id = scanner_info.device_id;
449 scanner_info_msg.scanner_type = scanner_info.scanner_type;
450 scanner_info_msg.scan_number = scanner_info.scan_number;
451 scanner_info_msg.start_angle = scanner_info.start_angle;
452 scanner_info_msg.end_angle = scanner_info.end_angle;
453 scanner_info_msg.scan_start_time = ntp_to_ros_time(scanner_info.scan_start_time);
454 scanner_info_msg.scan_end_time = ntp_to_ros_time(scanner_info.scan_end_time);
455 scanner_info_msg.scan_start_time_from_device = ntp_to_ros_time(scanner_info.scan_start_time_from_device);
456 scanner_info_msg.scan_end_time_from_device = ntp_to_ros_time(scanner_info.scan_end_time_from_device);
457 scanner_info_msg.scan_frequency = scanner_info.scan_frequency;
458 scanner_info_msg.beam_tilt = scanner_info.beam_tilt;
459 scanner_info_msg.scan_flags = scanner_info.scan_flags;
461 scanner_info_msg.mounting_position.yaw_angle = scanner_info.mounting_position.yaw_angle;
462 scanner_info_msg.mounting_position.pitch_angle = scanner_info.mounting_position.pitch_angle;
463 scanner_info_msg.mounting_position.roll_angle = scanner_info.mounting_position.roll_angle;
464 scanner_info_msg.mounting_position.x_position = scanner_info.mounting_position.x_position;
465 scanner_info_msg.mounting_position.y_position = scanner_info.mounting_position.y_position;
466 scanner_info_msg.mounting_position.z_position = scanner_info.mounting_position.z_position;
467 for (
int i = 0; i < 8; i++)
469 scanner_info_msg.resolutions[i].resolution_start_angle =
470 scanner_info.resolutions[i].resolution_start_angle;
471 scanner_info_msg.resolutions[i].resolution = scanner_info.resolutions[i].resolution;
474 new_msg->scanner_info_list.push_back(scanner_info_msg);
477 for (
auto scan_point : dc_parser->scan_point_list)
479 ibeo_msgs::ScanPoint2205 scan_point_msg;
481 scan_point_msg.x_position = scan_point.x_position;
482 scan_point_msg.y_position = scan_point.y_position;
483 scan_point_msg.z_position = scan_point.z_position;
484 scan_point_msg.echo_width = scan_point.echo_width;
485 scan_point_msg.device_id = scan_point.device_id;
486 scan_point_msg.layer = scan_point.layer;
487 scan_point_msg.echo = scan_point.echo;
488 scan_point_msg.time_offset = scan_point.time_offset;
489 scan_point_msg.ground = scan_point.ground;
490 scan_point_msg.dirt = scan_point.dirt;
491 scan_point_msg.precipitation = scan_point.precipitation;
492 scan_point_msg.transparent = scan_point.transparent;
494 new_msg->scan_point_list.push_back(scan_point_msg);
497 new_msg->header.frame_id = frame_id;
501 void IbeoLuxRosMsgHandler::fill2221(
503 ibeo_msgs::ObjectData2221 * new_msg,
504 const std::string& frame_id)
508 fillIbeoHeader(dc_parser->ibeo_header, &(new_msg->ibeo_header));
510 new_msg->scan_start_timestamp = ntp_to_ros_time(dc_parser->scan_start_timestamp);
511 new_msg->number_of_objects = dc_parser->number_of_objects;
513 ibeo_msgs::Object2221 object_msg;
515 ibeo_msgs::Point2Di object_point_msg;
518 for (
int k = 0; k < dc_parser->number_of_objects; k++)
520 object_tx = dc_parser->object_list[k];
521 object_msg.
id = object_tx.
id;
522 object_msg.age = object_tx.
age;
546 object_msg.classification =
static_cast<uint8_t
>(object_tx.
classification);
551 for (
int j = 0; j < object_msg.number_of_contour_points; j++)
555 object_point_msg.x = 0.01 * point_tx.
x;
556 object_point_msg.y = 0.01 * point_tx.
y;
558 object_msg.contour_point_list.push_back(object_point_msg);
561 new_msg->object_list.push_back(object_msg);
564 new_msg->header.frame_id = frame_id;
568 void IbeoLuxRosMsgHandler::fill2225(
570 ibeo_msgs::ObjectData2225 * new_msg,
571 const std::string& frame_id)
575 fillIbeoHeader(dc_parser->ibeo_header, &(new_msg->ibeo_header));
577 new_msg->mid_scan_timestamp = ntp_to_ros_time(dc_parser->mid_scan_timestamp);
578 new_msg->number_of_objects = dc_parser->number_of_objects;
580 for (
auto object : dc_parser->object_list)
582 ibeo_msgs::Object2225 object_msg;
584 object_msg.id =
object.id;
585 object_msg.age =
object.age;
586 object_msg.timestamp = ntp_to_ros_time(
object.timestamp);
587 object_msg.hidden_status_age =
object.hidden_status_age;
589 switch (
object.classification)
592 object_msg.classification = ibeo_msgs::Object2225::UNCLASSIFIED;
595 object_msg.classification = ibeo_msgs::Object2225::UNKNOWN_SMALL;
598 object_msg.classification = ibeo_msgs::Object2225::UNKNOWN_BIG;
601 object_msg.classification = ibeo_msgs::Object2225::PEDESTRIAN;
604 object_msg.classification = ibeo_msgs::Object2225::BIKE;
607 object_msg.classification = ibeo_msgs::Object2225::CAR;
610 object_msg.classification = ibeo_msgs::Object2225::TRUCK;
613 object_msg.classification = ibeo_msgs::Object2225::UNCLASSIFIED;
617 object_msg.classification_certainty =
object.classification_certainty;
618 object_msg.classification_age =
object.classification_age;
619 object_msg.bounding_box_center.x =
object.bounding_box_center.x;
620 object_msg.bounding_box_center.y =
object.bounding_box_center.y;
621 object_msg.bounding_box_size.x =
object.bounding_box_size.x;
622 object_msg.bounding_box_size.y =
object.bounding_box_size.y;
623 object_msg.object_box_center.x =
object.object_box_center.x;
624 object_msg.object_box_center.y =
object.object_box_center.y;
625 object_msg.object_box_center_sigma.x =
object.object_box_center_sigma.x;
626 object_msg.object_box_center_sigma.y =
object.object_box_center_sigma.y;
627 object_msg.object_box_size.x =
object.object_box_size.x;
628 object_msg.object_box_size.y =
object.object_box_size.y;
629 object_msg.yaw_angle =
object.yaw_angle;
630 object_msg.relative_velocity.x =
object.relative_velocity.x;
631 object_msg.relative_velocity.y =
object.relative_velocity.y;
632 object_msg.relative_velocity_sigma.x =
object.relative_velocity_sigma.x;
633 object_msg.relative_velocity_sigma.y =
object.relative_velocity_sigma.y;
634 object_msg.absolute_velocity.x =
object.absolute_velocity.x;
635 object_msg.absolute_velocity.y =
object.absolute_velocity.y;
636 object_msg.absolute_velocity_sigma.x =
object.absolute_velocity_sigma.x;
637 object_msg.absolute_velocity_sigma.y =
object.absolute_velocity_sigma.y;
638 object_msg.number_of_contour_points =
object.number_of_contour_points;
639 object_msg.closest_point_index =
object.closest_point_index;
641 for (
auto contour_point :
object.contour_point_list)
643 ibeo_msgs::Point2Df contour_point_msg;
645 contour_point_msg.x = contour_point.x;
646 contour_point_msg.y = contour_point.y;
648 object_msg.contour_point_list.push_back(contour_point_msg);
651 new_msg->object_list.push_back(object_msg);
654 new_msg->header.frame_id = frame_id;
658 void IbeoLuxRosMsgHandler::fill2280(
660 ibeo_msgs::ObjectData2280 * new_msg,
661 const std::string& frame_id)
665 fillIbeoHeader(dc_parser->ibeo_header, &(new_msg->ibeo_header));
667 new_msg->mid_scan_timestamp = ntp_to_ros_time(dc_parser->mid_scan_timestamp);
668 new_msg->number_of_objects = dc_parser->number_of_objects;
670 for (
auto object : dc_parser->object_list)
672 ibeo_msgs::Object2280 object_msg;
674 object_msg.id =
object.id;
676 if (
object.tracking_model ==
DYNAMIC)
678 object_msg.tracking_model = object_msg.DYNAMIC_MODEL;
682 object_msg.tracking_model = object_msg.STATIC_MODEL;
685 object_msg.mobility_of_dyn_object_detected =
object.mobility_of_dyn_object_detected;
686 object_msg.motion_model_validated =
object.motion_model_validated;
687 object_msg.object_age =
object.object_age;
688 object_msg.timestamp = ntp_to_ros_time(
object.timestamp);
689 object_msg.object_prediction_age =
object.object_prediction_age;
691 switch (
object.classification)
694 object_msg.classification = object_msg.UNCLASSIFIED;
697 object_msg.classification = object_msg.UNKNOWN_SMALL;
700 object_msg.classification = object_msg.UNKNOWN_BIG;
703 object_msg.classification = object_msg.PEDESTRIAN;
706 object_msg.classification = object_msg.BIKE;
709 object_msg.classification = object_msg.CAR;
712 object_msg.classification = object_msg.TRUCK;
716 object_msg.classification_certainty =
object.classification_certainty;
717 object_msg.classification_age =
object.classification_age;
719 object_msg.object_box_center.x =
object.object_box_center.x;
720 object_msg.object_box_center.y =
object.object_box_center.y;
722 object_msg.object_box_center_sigma.x =
object.object_box_center_sigma.x;
723 object_msg.object_box_center_sigma.y =
object.object_box_center_sigma.y;
725 object_msg.object_box_size.x =
object.object_box_size.x;
726 object_msg.object_box_size.y =
object.object_box_size.y;
728 object_msg.object_box_orientation_angle =
object.object_box_orientation_angle;
729 object_msg.object_box_orientation_angle_sigma =
object.object_box_orientation_angle_sigma;
731 object_msg.relative_velocity.x =
object.relative_velocity.x;
732 object_msg.relative_velocity.y =
object.relative_velocity.y;
734 object_msg.relative_velocity_sigma.x =
object.relative_velocity_sigma.x;
735 object_msg.relative_velocity_sigma.y =
object.relative_velocity_sigma.y;
737 object_msg.absolute_velocity.x =
object.absolute_velocity.x;
738 object_msg.absolute_velocity.y =
object.absolute_velocity.y;
740 object_msg.absolute_velocity_sigma.x =
object.absolute_velocity_sigma.x;
741 object_msg.absolute_velocity_sigma.y =
object.absolute_velocity_sigma.y;
743 object_msg.closest_point_index =
object.closest_point_index;
745 object_msg.reference_point_location = (uint16_t)
object.reference_point_location;
746 switch (
object.reference_point_location)
749 object_msg.reference_point_location = object_msg.CENTER_OF_GRAVITY;
752 object_msg.reference_point_location = object_msg.FRONT_LEFT;
755 object_msg.reference_point_location = object_msg.FRONT_RIGHT;
758 object_msg.reference_point_location = object_msg.REAR_RIGHT;
761 object_msg.reference_point_location = object_msg.REAR_LEFT;
764 object_msg.reference_point_location = object_msg.FRONT_CENTER;
767 object_msg.reference_point_location = object_msg.RIGHT_CENTER;
770 object_msg.reference_point_location = object_msg.REAR_CENTER;
773 object_msg.reference_point_location = object_msg.LEFT_CENTER;
776 object_msg.reference_point_location = object_msg.OBJECT_CENTER;
779 object_msg.reference_point_location = object_msg.UNKNOWN;
783 object_msg.reference_point_coordinate.x =
object.reference_point_coordinate.x;
784 object_msg.reference_point_coordinate.y =
object.reference_point_coordinate.y;
786 object_msg.reference_point_coordinate_sigma.x =
object.reference_point_coordinate_sigma.x;
787 object_msg.reference_point_coordinate_sigma.y =
object.reference_point_coordinate_sigma.y;
789 object_msg.object_priority =
object.object_priority;
790 object_msg.reference_point_position_correction_coefficient =
791 object.reference_point_position_correction_coefficient;
792 object_msg.object_priority =
object.object_priority;
793 object_msg.object_existence_measurement =
object.object_existence_measurement;
795 object_msg.absolute_velocity.x =
object.absolute_velocity.x;
796 object_msg.absolute_velocity.y =
object.absolute_velocity.y;
797 object_msg.number_of_contour_points =
object.number_of_contour_points;
798 for (
auto contour_point :
object.contour_point_list)
800 ibeo_msgs::Point2Df msg_cp;
801 msg_cp.x = contour_point.x;
802 msg_cp.y = contour_point.y;
804 object_msg.contour_point_list.push_back(msg_cp);
807 new_msg->objects.push_back(object_msg);
810 new_msg->header.frame_id = frame_id;
814 void IbeoLuxRosMsgHandler::fill2403(
816 ibeo_msgs::CameraImage * new_msg,
817 const std::string& frame_id)
819 auto dc_parser =
dynamic_cast<CameraImage*
>(parser_class);
821 fillIbeoHeader(dc_parser->ibeo_header, &(new_msg->ibeo_header));
823 switch (dc_parser->image_format)
826 new_msg->image_format = new_msg->JPEG;
829 new_msg->image_format = new_msg->MJPEG;
832 new_msg->image_format = new_msg->GRAY8;
835 new_msg->image_format = new_msg->YUV420;
838 new_msg->image_format = new_msg->YUV422;
842 new_msg->us_since_power_on = dc_parser->us_since_power_on;
843 new_msg->timestamp = ntp_to_ros_time(dc_parser->timestamp);
844 new_msg->device_id = dc_parser->device_id;
846 new_msg->mounting_position.yaw_angle = dc_parser->mounting_position.yaw_angle;
847 new_msg->mounting_position.pitch_angle = dc_parser->mounting_position.pitch_angle;
848 new_msg->mounting_position.roll_angle = dc_parser->mounting_position.roll_angle;
849 new_msg->mounting_position.x_position = dc_parser->mounting_position.x_position;
850 new_msg->mounting_position.y_position = dc_parser->mounting_position.y_position;
851 new_msg->mounting_position.z_position = dc_parser->mounting_position.z_position;
853 new_msg->horizontal_opening_angle = dc_parser->horizontal_opening_angle;
854 new_msg->vertical_opening_angle = dc_parser->vertical_opening_angle;
855 new_msg->image_width = dc_parser->image_width;
856 new_msg->image_height = dc_parser->image_height;
857 new_msg->compressed_size = dc_parser->compressed_size;
859 for (
int i = 0; i < dc_parser->image_width * dc_parser->image_height; i++)
861 new_msg->image_buffer[i] = dc_parser->image_buffer[i];
864 new_msg->header.frame_id = frame_id;
868 void IbeoLuxRosMsgHandler::fill2805(
870 ibeo_msgs::HostVehicleState2805 * new_msg,
871 const std::string& frame_id)
875 fillIbeoHeader(dc_parser->ibeo_header, &(new_msg->ibeo_header));
877 new_msg->timestamp = ntp_to_ros_time(dc_parser->timestamp);
878 new_msg->scan_number = dc_parser->scan_number;
879 new_msg->error_flags = dc_parser->error_flags;
880 new_msg->longitudinal_velocity = dc_parser->longitudinal_velocity;
881 new_msg->steering_wheel_angle = dc_parser->steering_wheel_angle;
882 new_msg->front_wheel_angle = dc_parser->front_wheel_angle;
883 new_msg->x_position = dc_parser->x_position;
884 new_msg->y_position = dc_parser->y_position;
885 new_msg->course_angle = dc_parser->course_angle;
886 new_msg->time_difference = dc_parser->time_difference;
887 new_msg->x_difference = dc_parser->x_difference;
888 new_msg->y_difference = dc_parser->y_difference;
889 new_msg->heading_difference = dc_parser->heading_difference;
890 new_msg->current_yaw_rate = dc_parser->current_yaw_rate;
892 new_msg->header.frame_id = frame_id;
896 void IbeoLuxRosMsgHandler::fill2806(
898 ibeo_msgs::HostVehicleState2806 * new_msg,
899 const std::string& frame_id)
903 fillIbeoHeader(dc_parser->ibeo_header, &(new_msg->ibeo_header));
905 new_msg->timestamp = ntp_to_ros_time(dc_parser->timestamp);
907 new_msg->distance_x = dc_parser->distance_x;
908 new_msg->distance_y = dc_parser->distance_y;
909 new_msg->course_angle = dc_parser->course_angle;
910 new_msg->longitudinal_velocity = dc_parser->longitudinal_velocity;
911 new_msg->yaw_rate = dc_parser->yaw_rate;
912 new_msg->steering_wheel_angle = dc_parser->steering_wheel_angle;
913 new_msg->cross_acceleration = dc_parser->cross_acceleration;
914 new_msg->front_wheel_angle = dc_parser->front_wheel_angle;
915 new_msg->vehicle_width = dc_parser->vehicle_width;
916 new_msg->vehicle_front_to_front_axle = dc_parser->vehicle_front_to_front_axle;
917 new_msg->rear_axle_to_front_axle = dc_parser->rear_axle_to_front_axle;
918 new_msg->rear_axle_to_vehicle_rear = dc_parser->rear_axle_to_vehicle_rear;
919 new_msg->steer_ratio_poly_0 = dc_parser->steer_ratio_poly_0;
920 new_msg->steer_ratio_poly_1 = dc_parser->steer_ratio_poly_1;
921 new_msg->steer_ratio_poly_2 = dc_parser->steer_ratio_poly_2;
922 new_msg->steer_ratio_poly_3 = dc_parser->steer_ratio_poly_3;
924 new_msg->header.frame_id = frame_id;
928 void IbeoLuxRosMsgHandler::fill2807(
930 ibeo_msgs::HostVehicleState2807 * new_msg,
931 const std::string& frame_id)
935 fillIbeoHeader(dc_parser->ibeo_header, &(new_msg->ibeo_header));
937 new_msg->timestamp = ntp_to_ros_time(dc_parser->timestamp);
939 new_msg->distance_x = dc_parser->distance_x;
940 new_msg->distance_y = dc_parser->distance_y;
941 new_msg->course_angle = dc_parser->course_angle;
942 new_msg->longitudinal_velocity = dc_parser->longitudinal_velocity;
943 new_msg->yaw_rate = dc_parser->yaw_rate;
944 new_msg->steering_wheel_angle = dc_parser->steering_wheel_angle;
945 new_msg->cross_acceleration = dc_parser->cross_acceleration;
946 new_msg->front_wheel_angle = dc_parser->front_wheel_angle;
947 new_msg->vehicle_width = dc_parser->vehicle_width;
948 new_msg->vehicle_front_to_front_axle = dc_parser->vehicle_front_to_front_axle;
949 new_msg->rear_axle_to_front_axle = dc_parser->rear_axle_to_front_axle;
950 new_msg->rear_axle_to_vehicle_rear = dc_parser->rear_axle_to_vehicle_rear;
951 new_msg->steer_ratio_poly_0 = dc_parser->steer_ratio_poly_0;
952 new_msg->steer_ratio_poly_1 = dc_parser->steer_ratio_poly_1;
953 new_msg->steer_ratio_poly_2 = dc_parser->steer_ratio_poly_2;
954 new_msg->steer_ratio_poly_3 = dc_parser->steer_ratio_poly_3;
955 new_msg->longitudinal_acceleration = dc_parser->longitudinal_acceleration;
957 new_msg->header.frame_id = frame_id;
961 visualization_msgs::Marker IbeoLuxRosMsgHandler::createWireframeMarker(
962 const float& center_x,
963 const float& center_y,
968 visualization_msgs::Marker box;
969 box.pose.position.x = center_x;
970 box.pose.position.y = center_y;
971 geometry_msgs::Point p1, p2, p3, p4, p5, p6, p7, p8;
973 size_y = (size_y <= 0.1f) ? 0.1
f : size_y;
974 size_x = (size_x <= 0.1f) ? 0.1
f : size_x;
976 float half_x = (0.5) * size_x;
977 float half_y = (0.5) * size_y;
1000 box.points.reserve(24);
1002 box.points.push_back(p1);
1003 box.points.push_back(p2);
1005 box.points.push_back(p2);
1006 box.points.push_back(p3);
1008 box.points.push_back(p3);
1009 box.points.push_back(p4);
1011 box.points.push_back(p4);
1012 box.points.push_back(p1);
1014 box.points.push_back(p1);
1015 box.points.push_back(p5);
1017 box.points.push_back(p2);
1018 box.points.push_back(p6);
1020 box.points.push_back(p3);
1021 box.points.push_back(p7);
1023 box.points.push_back(p4);
1024 box.points.push_back(p8);
1026 box.points.push_back(p5);
1027 box.points.push_back(p6);
1029 box.points.push_back(p6);
1030 box.points.push_back(p7);
1032 box.points.push_back(p7);
1033 box.points.push_back(p8);
1035 box.points.push_back(p8);
1036 box.points.push_back(p5);
CENTER_OF_BOTTOM_REAR_EDGE
void publish(const boost::shared_ptr< M > &message) const
Point2Di relative_velocity
static const int32_t DATA_TYPE
uint16_t bounding_box_width
uint16_t classification_certainty
static const int32_t DATA_TYPE
static const int32_t DATA_TYPE
Point2Di bounding_box_center
static const int32_t DATA_TYPE
Classification classification
Point2Di absolute_velocity
uint16_t classification_age
uint16_t number_of_contour_points
static const int32_t DATA_TYPE
static const int32_t DATA_TYPE
static Quaternion createQuaternionFromYaw(double yaw)
Size2D absolute_velocity_sigma
static const int32_t DATA_TYPE
Point2Di reference_point_sigma
static const int32_t DATA_TYPE
static const int32_t DATA_TYPE
Point2Di object_box_center
uint16_t relative_timestamp
static const int32_t DATA_TYPE
static const int32_t DATA_TYPE
std::vector< Point2Di > contour_point_list
int16_t object_box_orientation
uint16_t bounding_box_length