00001
00002
00003
00004
00005
00006
00007
00008 #include <ibeo_lux/ibeo_lux_ros_msg_handler.h>
00009
00010 #include <string>
00011 #include <vector>
00012
00013 #define NTP_TO_UTC 2208988800
00014
00015 using namespace AS::Drivers::Ibeo;
00016 using namespace AS::Drivers::IbeoLux;
00017
00018 void IbeoLuxRosMsgHandler::fillAndPublish(
00019 const uint8_t& type_id,
00020 const std::string& frame_id,
00021 const ros::Publisher& pub,
00022 IbeoTxMessage * parser_class)
00023 {
00024 if (type_id == ErrorWarning::DATA_TYPE)
00025 {
00026 ibeo_msgs::ErrorWarning new_msg;
00027 fill2030(parser_class, &new_msg, frame_id);
00028 pub.publish(new_msg);
00029 }
00030 else if (type_id == ScanData2202::DATA_TYPE)
00031 {
00032 ibeo_msgs::ScanData2202 new_msg;
00033 fill2202(parser_class, &new_msg, frame_id);
00034 pub.publish(new_msg);
00035 }
00036 else if (type_id == ScanData2204::DATA_TYPE)
00037 {
00038 ibeo_msgs::ScanData2204 new_msg;
00039 fill2204(parser_class, &new_msg, frame_id);
00040 pub.publish(new_msg);
00041 }
00042 else if (type_id == ScanData2205::DATA_TYPE)
00043 {
00044 ibeo_msgs::ScanData2205 new_msg;
00045 fill2205(parser_class, &new_msg, frame_id);
00046 pub.publish(new_msg);
00047 }
00048 else if (type_id == ObjectData2221::DATA_TYPE)
00049 {
00050 ibeo_msgs::ObjectData2221 new_msg;
00051 fill2221(parser_class, &new_msg, frame_id);
00052 pub.publish(new_msg);
00053 }
00054 else if (type_id == ObjectData2225::DATA_TYPE)
00055 {
00056 ibeo_msgs::ObjectData2225 new_msg;
00057 fill2225(parser_class, &new_msg, frame_id);
00058 pub.publish(new_msg);
00059 }
00060 else if (type_id == ObjectData2280::DATA_TYPE)
00061 {
00062 ibeo_msgs::ObjectData2280 new_msg;
00063 fill2280(parser_class, &new_msg, frame_id);
00064 pub.publish(new_msg);
00065 }
00066 else if (type_id == CameraImage::DATA_TYPE)
00067 {
00068 ibeo_msgs::CameraImage new_msg;
00069 fill2403(parser_class, &new_msg, frame_id);
00070 pub.publish(new_msg);
00071 }
00072 else if (type_id == HostVehicleState2805::DATA_TYPE)
00073 {
00074 ibeo_msgs::HostVehicleState2805 new_msg;
00075 fill2805(parser_class, &new_msg, frame_id);
00076 pub.publish(new_msg);
00077 }
00078 else if (type_id == HostVehicleState2806::DATA_TYPE)
00079 {
00080 ibeo_msgs::HostVehicleState2806 new_msg;
00081 fill2806(parser_class, &new_msg, frame_id);
00082 pub.publish(new_msg);
00083 }
00084 else if (type_id == HostVehicleState2807::DATA_TYPE)
00085 {
00086 ibeo_msgs::HostVehicleState2807 new_msg;
00087 fill2807(parser_class, &new_msg, frame_id);
00088 pub.publish(new_msg);
00089 }
00090 }
00091
00092 void IbeoLuxRosMsgHandler::fillPointcloud(
00093 const std::vector<Point3DL>& points,
00094 pcl::PointCloud<pcl::PointXYZL> * new_msg)
00095 {
00096 for (Point3DL p : points)
00097 {
00098 pcl::PointXYZL pclp;
00099 pclp.x = p.x;
00100 pclp.y = p.y;
00101 pclp.z = p.z;
00102 pclp.label = p.label;
00103 new_msg->push_back(pclp);
00104 }
00105 }
00106
00107 void IbeoLuxRosMsgHandler::fillContourPoints(
00108 const std::vector<Point3D>& points,
00109 visualization_msgs::Marker * new_msg,
00110 const std::string& frame_id)
00111 {
00112 new_msg->ns = frame_id;
00113 new_msg->type = visualization_msgs::Marker::POINTS;
00114 new_msg->color.r = 0.0;
00115 new_msg->color.g = 1.0;
00116 new_msg->color.b = 0.0;
00117 new_msg->color.a = 1.0;
00118 new_msg->scale.x = 0.05;
00119 new_msg->scale.y = 0.05;
00120 new_msg->scale.z = 0.05;
00121
00122 for (Point3D p : points)
00123 {
00124 geometry_msgs::Point point;
00125 point.x = p.x;
00126 point.y = p.y;
00127 point.z = p.z;
00128 new_msg->points.push_back(point);
00129 }
00130 }
00131
00132 void IbeoLuxRosMsgHandler::fillMarkerArray(
00133 const std::vector<IbeoObject>& objects,
00134 visualization_msgs::MarkerArray * new_msg,
00135 const std::string& frame_id)
00136 {
00137 for (IbeoObject o : objects)
00138 {
00139 tf::Quaternion quaternion = tf::createQuaternionFromYaw(
00140 o.object_box_orientation);
00141 visualization_msgs::Marker object_marker = createWireframeMarker(
00142 o.object_box_center.x,
00143 o.object_box_center.y,
00144 o.object_box_size.size_x,
00145 o.object_box_size.size_y,
00146 0.75);
00147 object_marker.id = o.id;
00148 object_marker.pose.orientation.x = quaternion.x();
00149 object_marker.pose.orientation.y = quaternion.y();
00150 object_marker.pose.orientation.z = quaternion.z();
00151 object_marker.pose.orientation.w = quaternion.w();
00152 object_marker.lifetime = ros::Duration(0.5);
00153 object_marker.color.a = 0.5;
00154 object_marker.color.r = object_marker.color.g = object_marker.color.b = 1.0;
00155 object_marker.frame_locked = false;
00156
00157 std::string label;
00158 switch (o.classification)
00159 {
00160 case UNCLASSIFIED:
00161 label = "Unclassified";
00162
00163 break;
00164 case UNKNOWN_SMALL:
00165 label = "Unknown Small";
00166
00167 object_marker.color.r = object_marker.color.g = 0;
00168 break;
00169 case UNKNOWN_BIG:
00170 label = "Unknown Big";
00171
00172 object_marker.color.r = object_marker.color.g = 0;
00173 object_marker.color.b = 0.5;
00174 break;
00175 case PEDESTRIAN:
00176 label = "Pedestrian";
00177
00178 object_marker.color.g = object_marker.color.b = 0;
00179 break;
00180 case BIKE:
00181 label = "Bike";
00182
00183 object_marker.color.g = object_marker.color.b = 0;
00184 object_marker.color.r = 0.5;
00185 break;
00186 case CAR:
00187 label = "Car";
00188
00189 object_marker.color.b = object_marker.color.r = 0;
00190 break;
00191 case TRUCK:
00192 label = "Truck";
00193
00194 object_marker.color.b = object_marker.color.r = 0;
00195 object_marker.color.g = 0.5;
00196 break;
00197 default:
00198 label = "Unknown";
00199 object_marker.color.r = object_marker.color.b = object_marker.color.g = 0.0;
00200 break;
00201 }
00202
00203 object_marker.ns = label;
00204 object_marker.scale.x = 0.05;
00205 object_marker.scale.y = 0.05;
00206 object_marker.scale.z = 0.05;
00207 object_marker.type = visualization_msgs::Marker::LINE_LIST;
00208 object_marker.action = visualization_msgs::Marker::MODIFY;
00209 object_marker.header.stamp = ros::Time::now();
00210 object_marker.header.frame_id = frame_id;
00211
00212 visualization_msgs::Marker object_label;
00213 object_label.id = o.id + 1000;
00214 object_label.ns = label;
00215 object_label.type = visualization_msgs::Marker::TEXT_VIEW_FACING;
00216 object_label.action = visualization_msgs::Marker::MODIFY;
00217 object_label.pose.position.x = o.object_box_center.x;
00218 object_label.pose.position.y = o.object_box_center.y;
00219 object_label.pose.position.z = 0.5;
00220 object_label.text = label;
00221 object_label.scale.x = 0.1;
00222 object_label.scale.y = 0.1;
00223 object_label.scale.z = 0.5;
00224 object_label.lifetime = object_marker.lifetime;
00225 object_label.color.r = object_label.color.g = object_label.color.b = 1;
00226 object_label.color.a = 0.5;
00227 object_label.header.stamp = ros::Time::now();
00228 object_label.header.frame_id = frame_id;
00229
00230 new_msg->markers.push_back(object_marker);
00231 new_msg->markers.push_back(object_label);
00232 }
00233 }
00234
00235 ros::Time IbeoLuxRosMsgHandler::ntp_to_ros_time(const NTPTime& time)
00236 {
00237 return ros::Time(((time >> 32) - NTP_TO_UTC), (time & 0x0000FFFF));
00238 }
00239
00240 void IbeoLuxRosMsgHandler::fillIbeoHeader(
00241 const IbeoDataHeader& class_header,
00242 ibeo_msgs::IbeoDataHeader * msg_header)
00243 {
00244 msg_header->previous_message_size = class_header.previous_message_size;
00245 msg_header->message_size = class_header.message_size;
00246 msg_header->device_id = class_header.device_id;
00247 msg_header->data_type_id = class_header.data_type_id;
00248 msg_header->stamp = ntp_to_ros_time(class_header.time);
00249 }
00250
00251 void IbeoLuxRosMsgHandler::fill2030(
00252 IbeoTxMessage * parser_class,
00253 ibeo_msgs::ErrorWarning * new_msg,
00254 const std::string& frame_id)
00255 {
00256 auto dc_parser = dynamic_cast<ErrorWarning*>(parser_class);
00257
00258 fillIbeoHeader(dc_parser->ibeo_header, &(new_msg->ibeo_header));
00259
00260 new_msg->err_internal_error = dc_parser->err_internal_error;
00261 new_msg->err_motor_1_fault = dc_parser->err_motor_1_fault;
00262 new_msg->err_buffer_error_xmt_incomplete = dc_parser->err_buffer_error_xmt_incomplete;
00263 new_msg->err_buffer_error_overflow = dc_parser->err_buffer_error_overflow;
00264 new_msg->err_apd_over_temperature = dc_parser->err_apd_over_temperature;
00265 new_msg->err_apd_under_temperature = dc_parser->err_apd_under_temperature;
00266 new_msg->err_apd_temperature_sensor_defect = dc_parser->err_apd_temperature_sensor_defect;
00267 new_msg->err_motor_2_fault = dc_parser->err_motor_2_fault;
00268 new_msg->err_motor_3_fault = dc_parser->err_motor_3_fault;
00269 new_msg->err_motor_4_fault = dc_parser->err_motor_4_fault;
00270 new_msg->err_motor_5_fault = dc_parser->err_motor_5_fault;
00271 new_msg->err_int_no_scan_data = dc_parser->err_int_no_scan_data;
00272 new_msg->err_int_communication_error = dc_parser->err_int_communication_error;
00273 new_msg->err_int_incorrect_scan_data = dc_parser->err_int_incorrect_scan_data;
00274 new_msg->err_config_fpga_not_configurable = dc_parser->err_config_fpga_not_configurable;
00275 new_msg->err_config_incorrect_config_data = dc_parser->err_config_incorrect_config_data;
00276 new_msg->err_config_contains_incorrect_params = dc_parser->err_config_contains_incorrect_params;
00277 new_msg->err_timeout_data_processing = dc_parser->err_timeout_data_processing;
00278 new_msg->err_timeout_env_model_computation_reset = dc_parser->err_timeout_env_model_computation_reset;
00279 new_msg->wrn_int_communication_error = dc_parser->wrn_int_communication_error;
00280 new_msg->wrn_low_temperature = dc_parser->wrn_low_temperature;
00281 new_msg->wrn_high_temperature = dc_parser->wrn_high_temperature;
00282 new_msg->wrn_int_motor_1 = dc_parser->wrn_int_motor_1;
00283 new_msg->wrn_sync_error = dc_parser->wrn_sync_error;
00284 new_msg->wrn_laser_1_start_pulse_missing = dc_parser->wrn_laser_1_start_pulse_missing;
00285 new_msg->wrn_laser_2_start_pulse_missing = dc_parser->wrn_laser_2_start_pulse_missing;
00286 new_msg->wrn_can_interface_blocked = dc_parser->wrn_can_interface_blocked;
00287 new_msg->wrn_eth_interface_blocked = dc_parser->wrn_eth_interface_blocked;
00288 new_msg->wrn_incorrect_can_data_rcvd = dc_parser->wrn_incorrect_can_data_rcvd;
00289 new_msg->wrn_int_incorrect_scan_data = dc_parser->wrn_int_incorrect_scan_data;
00290 new_msg->wrn_eth_unkwn_incomplete_data = dc_parser->wrn_eth_unkwn_incomplete_data;
00291 new_msg->wrn_incorrect_or_forbidden_cmd_rcvd = dc_parser->wrn_incorrect_or_forbidden_cmd_rcvd;
00292 new_msg->wrn_memory_access_failure = dc_parser->wrn_memory_access_failure;
00293 new_msg->wrn_int_overflow = dc_parser->wrn_int_overflow;
00294 new_msg->wrn_ego_motion_data_missing = dc_parser->wrn_ego_motion_data_missing;
00295 new_msg->wrn_incorrect_mounting_params = dc_parser->wrn_incorrect_mounting_params;
00296 new_msg->wrn_no_obj_comp_due_to_scan_freq = dc_parser->wrn_no_obj_comp_due_to_scan_freq;
00297
00298 new_msg->header.frame_id = frame_id;
00299 new_msg->header.stamp = ros::Time::now();
00300 }
00301
00302 void IbeoLuxRosMsgHandler::fill2202(
00303 IbeoTxMessage * parser_class,
00304 ibeo_msgs::ScanData2202 * new_msg,
00305 const std::string& frame_id)
00306 {
00307 auto dc_parser = dynamic_cast<ScanData2202*>(parser_class);
00308
00309 fillIbeoHeader(dc_parser->ibeo_header, &(new_msg->ibeo_header));
00310
00311 new_msg->scan_number = dc_parser->scan_number;
00312 new_msg->scanner_status = dc_parser->scanner_status;
00313 new_msg->sync_phase_offset = dc_parser->sync_phase_offset;
00314 new_msg->scan_start_time = ntp_to_ros_time(dc_parser->scan_start_time);
00315 new_msg->scan_end_time = ntp_to_ros_time(dc_parser->scan_end_time);
00316 new_msg->angle_ticks_per_rotation = dc_parser->angle_ticks_per_rotation;
00317 new_msg->start_angle_ticks = dc_parser->start_angle_ticks;
00318 new_msg->end_angle_ticks = dc_parser->end_angle_ticks;
00319 new_msg->mounting_yaw_angle_ticks = dc_parser->mounting_yaw_angle_ticks;
00320 new_msg->mounting_pitch_angle_ticks = dc_parser->mounting_pitch_angle_ticks;
00321 new_msg->mounting_roll_angle_ticks = dc_parser->mounting_roll_angle_ticks;
00322 new_msg->mounting_position_x = dc_parser->mounting_position_x;
00323 new_msg->mounting_position_y = dc_parser->mounting_position_y;
00324 new_msg->mounting_position_z = dc_parser->mounting_position_z;
00325 new_msg->ground_labeled = dc_parser->ground_labeled;
00326 new_msg->dirt_labeled = dc_parser->dirt_labeled;
00327 new_msg->rain_labeled = dc_parser->rain_labeled;
00328 new_msg->mirror_side = static_cast<uint8_t>(dc_parser->mirror_side);
00329
00330 for (auto scan_point : dc_parser->scan_point_list)
00331 {
00332 ibeo_msgs::ScanPoint2202 scan_point_msg;
00333
00334 scan_point_msg.layer = scan_point.layer;
00335 scan_point_msg.echo = scan_point.echo;
00336 scan_point_msg.transparent_point = scan_point.transparent_point;
00337 scan_point_msg.clutter_atmospheric = scan_point.clutter_atmospheric;
00338 scan_point_msg.ground = scan_point.ground;
00339 scan_point_msg.dirt = scan_point.dirt;
00340 scan_point_msg.horizontal_angle = scan_point.horizontal_angle;
00341 scan_point_msg.radial_distance = scan_point.radial_distance;
00342 scan_point_msg.echo_pulse_width = scan_point.echo_pulse_width;
00343
00344 new_msg->scan_point_list.push_back(scan_point_msg);
00345 }
00346
00347 new_msg->header.frame_id = frame_id;
00348 new_msg->header.stamp = ros::Time::now();
00349 }
00350
00351 void IbeoLuxRosMsgHandler::fill2204(
00352 IbeoTxMessage * parser_class,
00353 ibeo_msgs::ScanData2204 * new_msg,
00354 const std::string& frame_id)
00355 {
00356 auto dc_parser = dynamic_cast<ScanData2204*>(parser_class);
00357
00358 fillIbeoHeader(dc_parser->ibeo_header, &(new_msg->ibeo_header));
00359
00360 new_msg->scan_start_time = dc_parser->scan_start_time;
00361 new_msg->scan_end_time_offset = dc_parser->scan_end_time_offset;
00362 new_msg->ground_labeled = dc_parser->ground_labeled;
00363 new_msg->dirt_labeled = dc_parser->dirt_labeled;
00364 new_msg->rain_labeled = dc_parser->rain_labeled;
00365 new_msg->mirror_side = static_cast<uint8_t>(dc_parser->mirror_side);
00366 new_msg->coordinate_system = static_cast<uint8_t>(dc_parser->coordinate_system);
00367 new_msg->scan_number = dc_parser->scan_number;
00368 new_msg->scan_points = dc_parser->scan_points;
00369 new_msg->number_of_scanner_infos = dc_parser->number_of_scanner_infos;
00370
00371 ibeo_msgs::ScannerInfo2204 scan_info_msg;
00372 ScannerInfo2204 info_tx;
00373
00374 for (int k = 0; k < new_msg->number_of_scanner_infos; k++)
00375 {
00376 info_tx = dc_parser->scanner_info_list[k];
00377 scan_info_msg.device_id = info_tx.device_id;
00378 scan_info_msg.scanner_type = info_tx.scanner_type;
00379 scan_info_msg.scan_number = info_tx.scan_number;
00380 scan_info_msg.start_angle = info_tx.start_angle;
00381 scan_info_msg.end_angle = info_tx.end_angle;
00382 scan_info_msg.yaw_angle = info_tx.yaw_angle;
00383 scan_info_msg.pitch_angle = info_tx.pitch_angle;
00384 scan_info_msg.roll_angle = info_tx.roll_angle;
00385 scan_info_msg.offset_x = info_tx.offset_x;
00386 scan_info_msg.offset_y = info_tx.offset_y;
00387 scan_info_msg.offset_z = info_tx.offset_z;
00388
00389 new_msg->scanner_info_list.push_back(scan_info_msg);
00390 }
00391
00392 ibeo_msgs::ScanPoint2204 scan_point_msg;
00393 ScanPoint2204 point_tx;
00394
00395 for (int k = 0; k < new_msg->scan_points; k++)
00396 {
00397 point_tx = dc_parser->scan_point_list[k];
00398 scan_point_msg.x_position = point_tx.x_position;
00399 scan_point_msg.y_position = point_tx.y_position;
00400 scan_point_msg.z_position = point_tx.z_position;
00401 scan_point_msg.echo_width = point_tx.echo_width;
00402 scan_point_msg.device_id = point_tx.device_id;
00403 scan_point_msg.layer = point_tx.layer;
00404 scan_point_msg.echo = point_tx.echo;
00405 scan_point_msg.time_offset = point_tx.time_offset;
00406 scan_point_msg.ground = point_tx.ground;
00407 scan_point_msg.dirt = point_tx.dirt;
00408 scan_point_msg.precipitation = point_tx.precipitation;
00409
00410 new_msg->scan_point_list.push_back(scan_point_msg);
00411 }
00412
00413 new_msg->header.frame_id = frame_id;
00414 new_msg->header.stamp = ros::Time::now();
00415 }
00416
00417 void IbeoLuxRosMsgHandler::fill2205(
00418 IbeoTxMessage * parser_class,
00419 ibeo_msgs::ScanData2205 * new_msg,
00420 const std::string& frame_id)
00421 {
00422 auto dc_parser = dynamic_cast<ScanData2205*>(parser_class);
00423
00424 fillIbeoHeader(dc_parser->ibeo_header, &(new_msg->ibeo_header));
00425
00426 new_msg->scan_start_time = ntp_to_ros_time(dc_parser->scan_start_time);
00427 new_msg->scan_end_time_offset = dc_parser->scan_end_time_offset;
00428 new_msg->fused_scan = dc_parser->fused_scan;
00429
00430 if (dc_parser->mirror_side == FRONT)
00431 new_msg->mirror_side = ibeo_msgs::ScanData2205::FRONT;
00432 else
00433 new_msg->mirror_side = ibeo_msgs::ScanData2205::REAR;
00434
00435 if (dc_parser->coordinate_system == SCANNER)
00436 new_msg->coordinate_system = ibeo_msgs::ScanData2205::SCANNER;
00437 else
00438 new_msg->coordinate_system = ibeo_msgs::ScanData2205::VEHICLE;
00439
00440 new_msg->scan_number = dc_parser->scan_number;
00441 new_msg->scan_points = dc_parser->scan_points;
00442 new_msg->number_of_scanner_infos = dc_parser->number_of_scanner_infos;
00443
00444 for (auto scanner_info : dc_parser->scanner_info_list)
00445 {
00446 ibeo_msgs::ScannerInfo2205 scanner_info_msg;
00447
00448 scanner_info_msg.device_id = scanner_info.device_id;
00449 scanner_info_msg.scanner_type = scanner_info.scanner_type;
00450 scanner_info_msg.scan_number = scanner_info.scan_number;
00451 scanner_info_msg.start_angle = scanner_info.start_angle;
00452 scanner_info_msg.end_angle = scanner_info.end_angle;
00453 scanner_info_msg.scan_start_time = ntp_to_ros_time(scanner_info.scan_start_time);
00454 scanner_info_msg.scan_end_time = ntp_to_ros_time(scanner_info.scan_end_time);
00455 scanner_info_msg.scan_start_time_from_device = ntp_to_ros_time(scanner_info.scan_start_time_from_device);
00456 scanner_info_msg.scan_end_time_from_device = ntp_to_ros_time(scanner_info.scan_end_time_from_device);
00457 scanner_info_msg.scan_frequency = scanner_info.scan_frequency;
00458 scanner_info_msg.beam_tilt = scanner_info.beam_tilt;
00459 scanner_info_msg.scan_flags = scanner_info.scan_flags;
00460
00461 scanner_info_msg.mounting_position.yaw_angle = scanner_info.mounting_position.yaw_angle;
00462 scanner_info_msg.mounting_position.pitch_angle = scanner_info.mounting_position.pitch_angle;
00463 scanner_info_msg.mounting_position.roll_angle = scanner_info.mounting_position.roll_angle;
00464 scanner_info_msg.mounting_position.x_position = scanner_info.mounting_position.x_position;
00465 scanner_info_msg.mounting_position.y_position = scanner_info.mounting_position.y_position;
00466 scanner_info_msg.mounting_position.z_position = scanner_info.mounting_position.z_position;
00467 for (int i = 0; i < 8; i++)
00468 {
00469 scanner_info_msg.resolutions[i].resolution_start_angle =
00470 scanner_info.resolutions[i].resolution_start_angle;
00471 scanner_info_msg.resolutions[i].resolution = scanner_info.resolutions[i].resolution;
00472 }
00473
00474 new_msg->scanner_info_list.push_back(scanner_info_msg);
00475 }
00476
00477 for (auto scan_point : dc_parser->scan_point_list)
00478 {
00479 ibeo_msgs::ScanPoint2205 scan_point_msg;
00480
00481 scan_point_msg.x_position = scan_point.x_position;
00482 scan_point_msg.y_position = scan_point.y_position;
00483 scan_point_msg.z_position = scan_point.z_position;
00484 scan_point_msg.echo_width = scan_point.echo_width;
00485 scan_point_msg.device_id = scan_point.device_id;
00486 scan_point_msg.layer = scan_point.layer;
00487 scan_point_msg.echo = scan_point.echo;
00488 scan_point_msg.time_offset = scan_point.time_offset;
00489 scan_point_msg.ground = scan_point.ground;
00490 scan_point_msg.dirt = scan_point.dirt;
00491 scan_point_msg.precipitation = scan_point.precipitation;
00492 scan_point_msg.transparent = scan_point.transparent;
00493
00494 new_msg->scan_point_list.push_back(scan_point_msg);
00495 }
00496
00497 new_msg->header.frame_id = frame_id;
00498 new_msg->header.stamp = ros::Time::now();
00499 }
00500
00501 void IbeoLuxRosMsgHandler::fill2221(
00502 IbeoTxMessage * parser_class,
00503 ibeo_msgs::ObjectData2221 * new_msg,
00504 const std::string& frame_id)
00505 {
00506 auto dc_parser = dynamic_cast<ObjectData2221*>(parser_class);
00507
00508 fillIbeoHeader(dc_parser->ibeo_header, &(new_msg->ibeo_header));
00509
00510 new_msg->scan_start_timestamp = ntp_to_ros_time(dc_parser->scan_start_timestamp);
00511 new_msg->number_of_objects = dc_parser->number_of_objects;
00512
00513 ibeo_msgs::Object2221 object_msg;
00514 Object2221 object_tx;
00515 ibeo_msgs::Point2Di object_point_msg;
00516 Point2Di point_tx;
00517
00518 for (int k = 0; k < dc_parser->number_of_objects; k++)
00519 {
00520 object_tx = dc_parser->object_list[k];
00521 object_msg.id = object_tx.id;
00522 object_msg.age = object_tx.age;
00523 object_msg.prediction_age = object_tx.prediction_age;
00524 object_msg.relative_timestamp = object_tx.relative_timestamp;
00525 object_msg.reference_point.x = object_tx.reference_point.x;
00526 object_msg.reference_point.y = object_tx.reference_point.y;
00527 object_msg.reference_point_sigma.x = object_tx.reference_point_sigma.x;
00528 object_msg.reference_point_sigma.y = object_tx.reference_point_sigma.y;
00529 object_msg.closest_point.x = object_tx.closest_point.x;
00530 object_msg.closest_point.y = object_tx.closest_point.y;
00531 object_msg.bounding_box_center.x = 0.01 * object_tx.bounding_box_center.x;
00532 object_msg.bounding_box_center.y = 0.01 * object_tx.bounding_box_center.y;
00533 object_msg.bounding_box_width = 0.01 * object_tx.bounding_box_width;
00534 object_msg.bounding_box_length = 0.01 * object_tx.bounding_box_length;
00535 object_msg.object_box_center.x = 0.01 * object_tx.object_box_center.x;
00536 object_msg.object_box_center.y = 0.01 * object_tx.object_box_center.y;
00537 object_msg.object_box_size.size_x = 0.01 * object_tx.object_box_size.size_x;
00538 object_msg.object_box_size.size_y = 0.01 * object_tx.object_box_size.size_y;
00539 object_msg.object_box_orientation = static_cast<float>(object_tx.object_box_orientation);
00540 object_msg.absolute_velocity.x = object_tx.absolute_velocity.x;
00541 object_msg.absolute_velocity.y = object_tx.absolute_velocity.y;
00542 object_msg.absolute_velocity_sigma.size_x = object_tx.absolute_velocity_sigma.size_x;
00543 object_msg.absolute_velocity_sigma.size_y = object_tx.absolute_velocity_sigma.size_y;
00544 object_msg.relative_velocity.x = object_tx.relative_velocity.x;
00545 object_msg.relative_velocity.y = object_tx.relative_velocity.y;
00546 object_msg.classification = static_cast<uint8_t>(object_tx.classification);
00547 object_msg.classification_age = object_tx.classification_age;
00548 object_msg.classification_certainty = object_tx.classification_certainty;
00549 object_msg.number_of_contour_points = object_tx.number_of_contour_points;
00550
00551 for (int j = 0; j < object_msg.number_of_contour_points; j++)
00552 {
00553 point_tx.x = object_tx.contour_point_list[k].x;
00554 point_tx.y = object_tx.contour_point_list[k].y;
00555 object_point_msg.x = 0.01 * point_tx.x;
00556 object_point_msg.y = 0.01 * point_tx.y;
00557
00558 object_msg.contour_point_list.push_back(object_point_msg);
00559 }
00560
00561 new_msg->object_list.push_back(object_msg);
00562 }
00563
00564 new_msg->header.frame_id = frame_id;
00565 new_msg->header.stamp = ros::Time::now();
00566 }
00567
00568 void IbeoLuxRosMsgHandler::fill2225(
00569 IbeoTxMessage * parser_class,
00570 ibeo_msgs::ObjectData2225 * new_msg,
00571 const std::string& frame_id)
00572 {
00573 auto dc_parser = dynamic_cast<ObjectData2225*>(parser_class);
00574
00575 fillIbeoHeader(dc_parser->ibeo_header, &(new_msg->ibeo_header));
00576
00577 new_msg->mid_scan_timestamp = ntp_to_ros_time(dc_parser->mid_scan_timestamp);
00578 new_msg->number_of_objects = dc_parser->number_of_objects;
00579
00580 for (auto object : dc_parser->object_list)
00581 {
00582 ibeo_msgs::Object2225 object_msg;
00583
00584 object_msg.id = object.id;
00585 object_msg.age = object.age;
00586 object_msg.timestamp = ntp_to_ros_time(object.timestamp);
00587 object_msg.hidden_status_age = object.hidden_status_age;
00588
00589 switch (object.classification)
00590 {
00591 case UNCLASSIFIED:
00592 object_msg.classification = ibeo_msgs::Object2225::UNCLASSIFIED;
00593 break;
00594 case UNKNOWN_SMALL:
00595 object_msg.classification = ibeo_msgs::Object2225::UNKNOWN_SMALL;
00596 break;
00597 case UNKNOWN_BIG:
00598 object_msg.classification = ibeo_msgs::Object2225::UNKNOWN_BIG;
00599 break;
00600 case PEDESTRIAN:
00601 object_msg.classification = ibeo_msgs::Object2225::PEDESTRIAN;
00602 break;
00603 case BIKE:
00604 object_msg.classification = ibeo_msgs::Object2225::BIKE;
00605 break;
00606 case CAR:
00607 object_msg.classification = ibeo_msgs::Object2225::CAR;
00608 break;
00609 case TRUCK:
00610 object_msg.classification = ibeo_msgs::Object2225::TRUCK;
00611 break;
00612 default:
00613 object_msg.classification = ibeo_msgs::Object2225::UNCLASSIFIED;
00614 break;
00615 }
00616
00617 object_msg.classification_certainty = object.classification_certainty;
00618 object_msg.classification_age = object.classification_age;
00619 object_msg.bounding_box_center.x = object.bounding_box_center.x;
00620 object_msg.bounding_box_center.y = object.bounding_box_center.y;
00621 object_msg.bounding_box_size.x = object.bounding_box_size.x;
00622 object_msg.bounding_box_size.y = object.bounding_box_size.y;
00623 object_msg.object_box_center.x = object.object_box_center.x;
00624 object_msg.object_box_center.y = object.object_box_center.y;
00625 object_msg.object_box_center_sigma.x = object.object_box_center_sigma.x;
00626 object_msg.object_box_center_sigma.y = object.object_box_center_sigma.y;
00627 object_msg.object_box_size.x = object.object_box_size.x;
00628 object_msg.object_box_size.y = object.object_box_size.y;
00629 object_msg.yaw_angle = object.yaw_angle;
00630 object_msg.relative_velocity.x = object.relative_velocity.x;
00631 object_msg.relative_velocity.y = object.relative_velocity.y;
00632 object_msg.relative_velocity_sigma.x = object.relative_velocity_sigma.x;
00633 object_msg.relative_velocity_sigma.y = object.relative_velocity_sigma.y;
00634 object_msg.absolute_velocity.x = object.absolute_velocity.x;
00635 object_msg.absolute_velocity.y = object.absolute_velocity.y;
00636 object_msg.absolute_velocity_sigma.x = object.absolute_velocity_sigma.x;
00637 object_msg.absolute_velocity_sigma.y = object.absolute_velocity_sigma.y;
00638 object_msg.number_of_contour_points = object.number_of_contour_points;
00639 object_msg.closest_point_index = object.closest_point_index;
00640
00641 for (auto contour_point : object.contour_point_list)
00642 {
00643 ibeo_msgs::Point2Df contour_point_msg;
00644
00645 contour_point_msg.x = contour_point.x;
00646 contour_point_msg.y = contour_point.y;
00647
00648 object_msg.contour_point_list.push_back(contour_point_msg);
00649 }
00650
00651 new_msg->object_list.push_back(object_msg);
00652 }
00653
00654 new_msg->header.frame_id = frame_id;
00655 new_msg->header.stamp = ros::Time::now();
00656 }
00657
00658 void IbeoLuxRosMsgHandler::fill2280(
00659 IbeoTxMessage * parser_class,
00660 ibeo_msgs::ObjectData2280 * new_msg,
00661 const std::string& frame_id)
00662 {
00663 auto dc_parser = dynamic_cast<ObjectData2280*>(parser_class);
00664
00665 fillIbeoHeader(dc_parser->ibeo_header, &(new_msg->ibeo_header));
00666
00667 new_msg->mid_scan_timestamp = ntp_to_ros_time(dc_parser->mid_scan_timestamp);
00668 new_msg->number_of_objects = dc_parser->number_of_objects;
00669
00670 for (auto object : dc_parser->object_list)
00671 {
00672 ibeo_msgs::Object2280 object_msg;
00673
00674 object_msg.id = object.id;
00675
00676 if (object.tracking_model == DYNAMIC)
00677 {
00678 object_msg.tracking_model = object_msg.DYNAMIC_MODEL;
00679 }
00680 else
00681 {
00682 object_msg.tracking_model = object_msg.STATIC_MODEL;
00683 }
00684
00685 object_msg.mobility_of_dyn_object_detected = object.mobility_of_dyn_object_detected;
00686 object_msg.motion_model_validated = object.motion_model_validated;
00687 object_msg.object_age = object.object_age;
00688 object_msg.timestamp = ntp_to_ros_time(object.timestamp);
00689 object_msg.object_prediction_age = object.object_prediction_age;
00690
00691 switch (object.classification)
00692 {
00693 case UNCLASSIFIED:
00694 object_msg.classification = object_msg.UNCLASSIFIED;
00695 break;
00696 case UNKNOWN_SMALL:
00697 object_msg.classification = object_msg.UNKNOWN_SMALL;
00698 break;
00699 case UNKNOWN_BIG:
00700 object_msg.classification = object_msg.UNKNOWN_BIG;
00701 break;
00702 case PEDESTRIAN:
00703 object_msg.classification = object_msg.PEDESTRIAN;
00704 break;
00705 case BIKE:
00706 object_msg.classification = object_msg.BIKE;
00707 break;
00708 case CAR:
00709 object_msg.classification = object_msg.CAR;
00710 break;
00711 case TRUCK:
00712 object_msg.classification = object_msg.TRUCK;
00713 break;
00714 }
00715
00716 object_msg.classification_certainty = object.classification_certainty;
00717 object_msg.classification_age = object.classification_age;
00718
00719 object_msg.object_box_center.x = object.object_box_center.x;
00720 object_msg.object_box_center.y = object.object_box_center.y;
00721
00722 object_msg.object_box_center_sigma.x = object.object_box_center_sigma.x;
00723 object_msg.object_box_center_sigma.y = object.object_box_center_sigma.y;
00724
00725 object_msg.object_box_size.x = object.object_box_size.x;
00726 object_msg.object_box_size.y = object.object_box_size.y;
00727
00728 object_msg.object_box_orientation_angle = object.object_box_orientation_angle;
00729 object_msg.object_box_orientation_angle_sigma = object.object_box_orientation_angle_sigma;
00730
00731 object_msg.relative_velocity.x = object.relative_velocity.x;
00732 object_msg.relative_velocity.y = object.relative_velocity.y;
00733
00734 object_msg.relative_velocity_sigma.x = object.relative_velocity_sigma.x;
00735 object_msg.relative_velocity_sigma.y = object.relative_velocity_sigma.y;
00736
00737 object_msg.absolute_velocity.x = object.absolute_velocity.x;
00738 object_msg.absolute_velocity.y = object.absolute_velocity.y;
00739
00740 object_msg.absolute_velocity_sigma.x = object.absolute_velocity_sigma.x;
00741 object_msg.absolute_velocity_sigma.y = object.absolute_velocity_sigma.y;
00742
00743 object_msg.closest_point_index = object.closest_point_index;
00744
00745 object_msg.reference_point_location = (uint16_t) object.reference_point_location;
00746 switch (object.reference_point_location)
00747 {
00748 case COG:
00749 object_msg.reference_point_location = object_msg.CENTER_OF_GRAVITY;
00750 break;
00751 case TOP_FRONT_LEFT_CORNER:
00752 object_msg.reference_point_location = object_msg.FRONT_LEFT;
00753 break;
00754 case TOP_FRONT_RIGHT_CORNER:
00755 object_msg.reference_point_location = object_msg.FRONT_RIGHT;
00756 break;
00757 case BOTTOM_REAR_RIGHT_CORNER:
00758 object_msg.reference_point_location = object_msg.REAR_RIGHT;
00759 break;
00760 case BOTTOM_REAR_LEFT_CORNER:
00761 object_msg.reference_point_location = object_msg.REAR_LEFT;
00762 break;
00763 case CENTER_OF_TOP_FRONT_EDGE:
00764 object_msg.reference_point_location = object_msg.FRONT_CENTER;
00765 break;
00766 case CENTER_OF_RIGHT_EDGE:
00767 object_msg.reference_point_location = object_msg.RIGHT_CENTER;
00768 break;
00769 case CENTER_OF_BOTTOM_REAR_EDGE:
00770 object_msg.reference_point_location = object_msg.REAR_CENTER;
00771 break;
00772 case CENTER_OF_LEFT_EDGE:
00773 object_msg.reference_point_location = object_msg.LEFT_CENTER;
00774 break;
00775 case BOX_CENTER:
00776 object_msg.reference_point_location = object_msg.OBJECT_CENTER;
00777 break;
00778 case INVALID:
00779 object_msg.reference_point_location = object_msg.UNKNOWN;
00780 break;
00781 }
00782
00783 object_msg.reference_point_coordinate.x = object.reference_point_coordinate.x;
00784 object_msg.reference_point_coordinate.y = object.reference_point_coordinate.y;
00785
00786 object_msg.reference_point_coordinate_sigma.x = object.reference_point_coordinate_sigma.x;
00787 object_msg.reference_point_coordinate_sigma.y = object.reference_point_coordinate_sigma.y;
00788
00789 object_msg.object_priority = object.object_priority;
00790 object_msg.reference_point_position_correction_coefficient =
00791 object.reference_point_position_correction_coefficient;
00792 object_msg.object_priority = object.object_priority;
00793 object_msg.object_existence_measurement = object.object_existence_measurement;
00794
00795 object_msg.absolute_velocity.x = object.absolute_velocity.x;
00796 object_msg.absolute_velocity.y = object.absolute_velocity.y;
00797 object_msg.number_of_contour_points = object.number_of_contour_points;
00798 for (auto contour_point : object.contour_point_list)
00799 {
00800 ibeo_msgs::Point2Df msg_cp;
00801 msg_cp.x = contour_point.x;
00802 msg_cp.y = contour_point.y;
00803
00804 object_msg.contour_point_list.push_back(msg_cp);
00805 }
00806
00807 new_msg->objects.push_back(object_msg);
00808 }
00809
00810 new_msg->header.frame_id = frame_id;
00811 new_msg->header.stamp = ros::Time::now();
00812 }
00813
00814 void IbeoLuxRosMsgHandler::fill2403(
00815 IbeoTxMessage * parser_class,
00816 ibeo_msgs::CameraImage * new_msg,
00817 const std::string& frame_id)
00818 {
00819 auto dc_parser = dynamic_cast<CameraImage*>(parser_class);
00820
00821 fillIbeoHeader(dc_parser->ibeo_header, &(new_msg->ibeo_header));
00822
00823 switch (dc_parser->image_format)
00824 {
00825 case JPEG:
00826 new_msg->image_format = new_msg->JPEG;
00827 break;
00828 case MJPEG:
00829 new_msg->image_format = new_msg->MJPEG;
00830 break;
00831 case GRAY8:
00832 new_msg->image_format = new_msg->GRAY8;
00833 break;
00834 case YUV420:
00835 new_msg->image_format = new_msg->YUV420;
00836 break;
00837 case YUV422:
00838 new_msg->image_format = new_msg->YUV422;
00839 break;
00840 }
00841
00842 new_msg->us_since_power_on = dc_parser->us_since_power_on;
00843 new_msg->timestamp = ntp_to_ros_time(dc_parser->timestamp);
00844 new_msg->device_id = dc_parser->device_id;
00845
00846 new_msg->mounting_position.yaw_angle = dc_parser->mounting_position.yaw_angle;
00847 new_msg->mounting_position.pitch_angle = dc_parser->mounting_position.pitch_angle;
00848 new_msg->mounting_position.roll_angle = dc_parser->mounting_position.roll_angle;
00849 new_msg->mounting_position.x_position = dc_parser->mounting_position.x_position;
00850 new_msg->mounting_position.y_position = dc_parser->mounting_position.y_position;
00851 new_msg->mounting_position.z_position = dc_parser->mounting_position.z_position;
00852
00853 new_msg->horizontal_opening_angle = dc_parser->horizontal_opening_angle;
00854 new_msg->vertical_opening_angle = dc_parser->vertical_opening_angle;
00855 new_msg->image_width = dc_parser->image_width;
00856 new_msg->image_height = dc_parser->image_height;
00857 new_msg->compressed_size = dc_parser->compressed_size;
00858
00859 for (int i = 0; i < dc_parser->image_width * dc_parser->image_height; i++)
00860 {
00861 new_msg->image_buffer[i] = dc_parser->image_buffer[i];
00862 }
00863
00864 new_msg->header.frame_id = frame_id;
00865 new_msg->header.stamp = ros::Time::now();
00866 }
00867
00868 void IbeoLuxRosMsgHandler::fill2805(
00869 IbeoTxMessage * parser_class,
00870 ibeo_msgs::HostVehicleState2805 * new_msg,
00871 const std::string& frame_id)
00872 {
00873 auto dc_parser = dynamic_cast<HostVehicleState2805*>(parser_class);
00874
00875 fillIbeoHeader(dc_parser->ibeo_header, &(new_msg->ibeo_header));
00876
00877 new_msg->timestamp = ntp_to_ros_time(dc_parser->timestamp);
00878 new_msg->scan_number = dc_parser->scan_number;
00879 new_msg->error_flags = dc_parser->error_flags;
00880 new_msg->longitudinal_velocity = dc_parser->longitudinal_velocity;
00881 new_msg->steering_wheel_angle = dc_parser->steering_wheel_angle;
00882 new_msg->front_wheel_angle = dc_parser->front_wheel_angle;
00883 new_msg->x_position = dc_parser->x_position;
00884 new_msg->y_position = dc_parser->y_position;
00885 new_msg->course_angle = dc_parser->course_angle;
00886 new_msg->time_difference = dc_parser->time_difference;
00887 new_msg->x_difference = dc_parser->x_difference;
00888 new_msg->y_difference = dc_parser->y_difference;
00889 new_msg->heading_difference = dc_parser->heading_difference;
00890 new_msg->current_yaw_rate = dc_parser->current_yaw_rate;
00891
00892 new_msg->header.frame_id = frame_id;
00893 new_msg->header.stamp = ros::Time::now();
00894 }
00895
00896 void IbeoLuxRosMsgHandler::fill2806(
00897 IbeoTxMessage * parser_class,
00898 ibeo_msgs::HostVehicleState2806 * new_msg,
00899 const std::string& frame_id)
00900 {
00901 auto dc_parser = dynamic_cast<HostVehicleState2806*>(parser_class);
00902
00903 fillIbeoHeader(dc_parser->ibeo_header, &(new_msg->ibeo_header));
00904
00905 new_msg->timestamp = ntp_to_ros_time(dc_parser->timestamp);
00906
00907 new_msg->distance_x = dc_parser->distance_x;
00908 new_msg->distance_y = dc_parser->distance_y;
00909 new_msg->course_angle = dc_parser->course_angle;
00910 new_msg->longitudinal_velocity = dc_parser->longitudinal_velocity;
00911 new_msg->yaw_rate = dc_parser->yaw_rate;
00912 new_msg->steering_wheel_angle = dc_parser->steering_wheel_angle;
00913 new_msg->cross_acceleration = dc_parser->cross_acceleration;
00914 new_msg->front_wheel_angle = dc_parser->front_wheel_angle;
00915 new_msg->vehicle_width = dc_parser->vehicle_width;
00916 new_msg->vehicle_front_to_front_axle = dc_parser->vehicle_front_to_front_axle;
00917 new_msg->rear_axle_to_front_axle = dc_parser->rear_axle_to_front_axle;
00918 new_msg->rear_axle_to_vehicle_rear = dc_parser->rear_axle_to_vehicle_rear;
00919 new_msg->steer_ratio_poly_0 = dc_parser->steer_ratio_poly_0;
00920 new_msg->steer_ratio_poly_1 = dc_parser->steer_ratio_poly_1;
00921 new_msg->steer_ratio_poly_2 = dc_parser->steer_ratio_poly_2;
00922 new_msg->steer_ratio_poly_3 = dc_parser->steer_ratio_poly_3;
00923
00924 new_msg->header.frame_id = frame_id;
00925 new_msg->header.stamp = ros::Time::now();
00926 }
00927
00928 void IbeoLuxRosMsgHandler::fill2807(
00929 IbeoTxMessage * parser_class,
00930 ibeo_msgs::HostVehicleState2807 * new_msg,
00931 const std::string& frame_id)
00932 {
00933 auto dc_parser = dynamic_cast<HostVehicleState2807*>(parser_class);
00934
00935 fillIbeoHeader(dc_parser->ibeo_header, &(new_msg->ibeo_header));
00936
00937 new_msg->timestamp = ntp_to_ros_time(dc_parser->timestamp);
00938
00939 new_msg->distance_x = dc_parser->distance_x;
00940 new_msg->distance_y = dc_parser->distance_y;
00941 new_msg->course_angle = dc_parser->course_angle;
00942 new_msg->longitudinal_velocity = dc_parser->longitudinal_velocity;
00943 new_msg->yaw_rate = dc_parser->yaw_rate;
00944 new_msg->steering_wheel_angle = dc_parser->steering_wheel_angle;
00945 new_msg->cross_acceleration = dc_parser->cross_acceleration;
00946 new_msg->front_wheel_angle = dc_parser->front_wheel_angle;
00947 new_msg->vehicle_width = dc_parser->vehicle_width;
00948 new_msg->vehicle_front_to_front_axle = dc_parser->vehicle_front_to_front_axle;
00949 new_msg->rear_axle_to_front_axle = dc_parser->rear_axle_to_front_axle;
00950 new_msg->rear_axle_to_vehicle_rear = dc_parser->rear_axle_to_vehicle_rear;
00951 new_msg->steer_ratio_poly_0 = dc_parser->steer_ratio_poly_0;
00952 new_msg->steer_ratio_poly_1 = dc_parser->steer_ratio_poly_1;
00953 new_msg->steer_ratio_poly_2 = dc_parser->steer_ratio_poly_2;
00954 new_msg->steer_ratio_poly_3 = dc_parser->steer_ratio_poly_3;
00955 new_msg->longitudinal_acceleration = dc_parser->longitudinal_acceleration;
00956
00957 new_msg->header.frame_id = frame_id;
00958 new_msg->header.stamp = ros::Time::now();
00959 }
00960
00961 visualization_msgs::Marker IbeoLuxRosMsgHandler::createWireframeMarker(
00962 const float& center_x,
00963 const float& center_y,
00964 float size_x,
00965 float size_y,
00966 const float& size_z)
00967 {
00968 visualization_msgs::Marker box;
00969 box.pose.position.x = center_x;
00970 box.pose.position.y = center_y;
00971 geometry_msgs::Point p1, p2, p3, p4, p5, p6, p7, p8;
00972
00973 size_y = (size_y <= 0.1f) ? 0.1f : size_y;
00974 size_x = (size_x <= 0.1f) ? 0.1f : size_x;
00975
00976 float half_x = (0.5) * size_x;
00977 float half_y = (0.5) * size_y;
00978
00979 p1.x = half_x;
00980 p1.y = half_y;
00981 p1.z = size_z;
00982 p2.x = half_x;
00983 p2.y = -half_y;
00984 p2.z = size_z;
00985 p3.x = -half_x;
00986 p3.y = -half_y;
00987 p3.z = size_z;
00988 p4.x = -half_x;
00989 p4.y = half_y;
00990 p4.z = size_z;
00991 p5 = p1;
00992 p5.z = -size_z;
00993 p6 = p2;
00994 p6.z = -size_z;
00995 p7 = p3;
00996 p7.z = -size_z;
00997 p8 = p4;
00998 p8.z = -size_z;
00999
01000 box.points.reserve(24);
01001
01002 box.points.push_back(p1);
01003 box.points.push_back(p2);
01004
01005 box.points.push_back(p2);
01006 box.points.push_back(p3);
01007
01008 box.points.push_back(p3);
01009 box.points.push_back(p4);
01010
01011 box.points.push_back(p4);
01012 box.points.push_back(p1);
01013
01014 box.points.push_back(p1);
01015 box.points.push_back(p5);
01016
01017 box.points.push_back(p2);
01018 box.points.push_back(p6);
01019
01020 box.points.push_back(p3);
01021 box.points.push_back(p7);
01022
01023 box.points.push_back(p4);
01024 box.points.push_back(p8);
01025
01026 box.points.push_back(p5);
01027 box.points.push_back(p6);
01028
01029 box.points.push_back(p6);
01030 box.points.push_back(p7);
01031
01032 box.points.push_back(p7);
01033 box.points.push_back(p8);
01034
01035 box.points.push_back(p8);
01036 box.points.push_back(p5);
01037
01038 return box;
01039 }