ibeo_core.cpp
Go to the documentation of this file.
1 /*
2  * ibeo_core.cpp - Core parsing and encoding library for Ibeo drivers.
3  * Copyright (C) 2017 AutonomouStuff, Co.
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
18  * USA
19  */
20 
21 #include <vector>
22 #include <ibeo_core/ibeo_core.h>
24 
25 using namespace AS::Network; // NOLINT
26 using namespace AS::Drivers::Ibeo; // NOLINT
27 
28 const int32_t AS::Drivers::Ibeo::ErrorWarning::DATA_TYPE = 0x2030;
29 const int32_t AS::Drivers::Ibeo::ScanData2202::DATA_TYPE = 0x2202;
30 const int32_t AS::Drivers::Ibeo::ScanData2204::DATA_TYPE = 0x2204;
31 const int32_t AS::Drivers::Ibeo::ScanData2205::DATA_TYPE = 0x2205;
32 const int32_t AS::Drivers::Ibeo::ScanData2208::DATA_TYPE = 0x2208;
38 const int32_t AS::Drivers::Ibeo::CameraImage::DATA_TYPE = 0x2403;
42 const int32_t AS::Drivers::Ibeo::DeviceStatus::DATA_TYPE = 0x6301;
43 
44 // Primitive parsing functions
45 void MountingPositionF::parse(const std::vector<uint8_t>& in, const uint16_t& offset)
46 {
47  yaw_angle = read_be<float>(in, offset);
48  pitch_angle = read_be<float>(in, offset + 4);
49  roll_angle = read_be<float>(in, offset + 8);
50  x_position = read_be<float>(in, offset + 12);
51  y_position = read_be<float>(in, offset + 16);
52  z_position = read_be<float>(in, offset + 20);
53 }
54 
55 void ContourPointSigma::parse(
56  const std::vector<uint8_t>& in,
57  const uint16_t& offset,
58  ByteOrder bo)
59 {
60  parse_tuple<int16_t>(in, &x, &y, bo, offset);
61  parse_tuple<uint8_t>(in, &x_sigma, &y_sigma, bo, offset);
62 }
63 
64 void Point2Df::parse(
65  const std::vector<uint8_t>& in,
66  const uint16_t& offset,
67  ByteOrder bo)
68 {
69  parse_tuple<float>(in, &x, &y, bo, offset);
70 }
71 
72 void Point2Di::parse(
73  const std::vector<uint8_t>& in,
74  const uint16_t& offset,
75  ByteOrder bo)
76 {
77  parse_tuple<int16_t>(in, &x, &y, bo, offset);
78 }
79 
80 void Point2Dui::parse(
81  const std::vector<uint8_t>& in,
82  const uint16_t& offset,
83  ByteOrder bo)
84 {
85  parse_tuple<uint16_t>(in, &x, &y, bo, offset);
86 }
87 
88 void Sigma2D::parse(
89  const std::vector<uint8_t>& in,
90  const uint16_t& offset,
91  ByteOrder bo)
92 {
93  parse_tuple<uint16_t>(in, &sigma_x, &sigma_y, bo, offset);
94 }
95 
96 void Size2D::parse(
97  const std::vector<uint8_t>& in,
98  const uint16_t& offset,
99  ByteOrder bo)
100 {
101  parse_tuple<uint16_t>(in, &size_x, &size_y, bo, offset);
102 }
103 
104 void Velocity2D::parse(
105  const std::vector<uint8_t>& in,
106  const uint16_t& offset,
107  ByteOrder bo)
108 {
109  parse_tuple<int16_t>(in, &velocity_x, &velocity_y, bo, offset);
110 }
111 
112 void ResolutionInfo::parse(const std::vector<uint8_t>& in, const uint16_t& offset)
113 {
114  resolution_start_angle = read_be<float>(in, offset);
115  resolution = read_be<float>(in, offset + 4);
116 }
117 
118 void ScannerInfo2204::parse(const std::vector<uint8_t>& in, const uint16_t& offset)
119 {
120  device_id = read_be<uint8_t>(in, offset);
121  scanner_type = read_be<uint8_t>(in, offset + 1);
122  scan_number = read_be<uint16_t>(in, offset + 2);
123  start_angle = read_be<float>(in, offset + 8);
124  end_angle = read_be<float>(in, offset + 12);
125  yaw_angle = read_be<float>(in, offset + 16);
126  pitch_angle = read_be<float>(in, offset + 20);
127  roll_angle = read_be<float>(in, offset + 24);
128  offset_x = read_be<float>(in, offset + 28);
129  offset_y = read_be<float>(in, offset + 32);
130  offset_z = read_be<float>(in, offset + 36);
131 }
132 
133 void ScannerInfo2205::parse(const std::vector<uint8_t>& in, const uint16_t& offset)
134 {
135  device_id = read_be<uint8_t>(in, offset);
136  scanner_type = read_be<uint8_t>(in, offset + 1);
137  scan_number = read_be<uint16_t>(in, offset + 2);
138  start_angle = read_be<float>(in, offset + 8);
139  end_angle = read_be<float>(in, offset + 12);
140  scan_start_time = read_be<NTPTime>(in, offset + 16);
141  scan_end_time = read_be<NTPTime>(in, offset + 24);
142  scan_start_time_from_device = read_be<NTPTime>(in, offset + 32);
143  scan_end_time_from_device = read_be<NTPTime>(in, offset + 40);
144  scan_frequency = read_be<float>(in, offset + 48);
145  beam_tilt = read_be<float>(in, offset + 52);
146  scan_flags = read_be<float>(in, offset + 56);
147  mounting_position.parse(in, offset + 60);
148  resolutions[0].parse(in, offset + 84);
149  resolutions[1].parse(in, offset + 92);
150  resolutions[2].parse(in, offset + 100);
151  resolutions[3].parse(in, offset + 108);
152  resolutions[4].parse(in, offset + 116);
153  resolutions[5].parse(in, offset + 124);
154  resolutions[6].parse(in, offset + 132);
155  resolutions[7].parse(in, offset + 140);
156 }
157 
158 // Object parsing functions
159 void UntrackedProperties::parse(const std::vector<uint8_t>& in, const uint16_t& offset)
160 {
161  relative_time_of_measurement = read_be<uint16_t>(in, offset + 1);
162  position_closest_point.parse(in, offset + 3, ByteOrder::BE);
163  object_box_size.parse(in, offset + 9, ByteOrder::BE);
164  object_box_size_sigma.parse(in, offset + 13, ByteOrder::BE);
165  object_box_orientation = read_be<int16_t>(in, offset + 17);
166  object_box_orientation_sigma = read_be<uint16_t>(in, offset + 19);
167  tracking_point_coordinate.parse(in, offset + 23, ByteOrder::BE);
168  tracking_point_coordinate_sigma.parse(in, offset + 27, ByteOrder::BE);
169  number_of_contour_points = read_be<uint8_t>(in, offset + 34);
170 
171  if (number_of_contour_points == 255)
172  number_of_contour_points = 0;
173 
174  for (uint8_t i = 0; i < number_of_contour_points; i++)
175  {
176  ContourPointSigma new_contour_point;
177  new_contour_point.parse(in, offset + 35 + (i * 8), ByteOrder::BE);
178  contour_point_list.push_back(new_contour_point);
179  }
180 }
181 
182 void TrackedProperties::parse(const std::vector<uint8_t>& in, const uint16_t& offset)
183 {
184  object_age = read_be<uint16_t>(in, offset + 1);
185  hidden_status_age = read_be<uint16_t>(in, offset + 3);
186  uint8_t dynamic_flags = read_be<uint8_t>(in, offset + 5);
187  object_phase = ((dynamic_flags & 0x01) > 0) ? TRACKING : INITIALIZATION;
188  dynamic_property = static_cast<DynamicProperty>((dynamic_flags & 0x70) > 0);
189  relative_time_of_measure = read_be<uint16_t>(in, offset + 6);
190  position_closest_point.parse(in, offset + 8, ByteOrder::BE);
191  relative_velocity.parse(in, offset + 12, ByteOrder::BE);
192  relative_velocity_sigma.parse(in, offset + 16, ByteOrder::BE);
193  classification = static_cast<Classification>(read_be<uint8_t>(in, offset + 20));
194  classification_age = read_be<uint16_t>(in, offset + 22);
195  object_box_size.parse(in, offset + 26, ByteOrder::BE);
196  object_box_size_sigma.parse(in, offset + 30, ByteOrder::BE);
197  object_box_orientation = read_be<int16_t>(in, offset + 34);
198  object_box_orientation_sigma = read_be<uint16_t>(in, offset + 36);
199  tracking_point_location = static_cast<PointLocation>(read_be<uint8_t>(in, offset + 39));
200  tracking_point_coordinate.parse(in, offset + 40, ByteOrder::BE);
201  tracking_point_coordinate_sigma.parse(in, offset + 44, ByteOrder::BE);
202  velocity.parse(in, offset + 51, ByteOrder::BE);
203  velocity_sigma.parse(in, offset + 55, ByteOrder::BE);
204  acceleration.parse(in, offset + 61, ByteOrder::BE);
205  acceleration_sigma.parse(in, offset + 65, ByteOrder::BE);
206  yaw_rate = read_be<int16_t>(in, offset + 71);
207  yaw_rate_sigma = read_be<uint16_t>(in, offset + 73);
208  number_of_contour_points = read_be<uint8_t>(in, offset + 75);
209 
210  if (number_of_contour_points == 255)
211  number_of_contour_points = 0;
212 
213  for (uint8_t i = 0; i < number_of_contour_points; i++)
214  {
215  ContourPointSigma new_contour_point;
216  new_contour_point.parse(in, offset + 76 + (i * 8), ByteOrder::BE);
217  contour_point_list.push_back(new_contour_point);
218  }
219 }
220 
221 void ScanPoint2202::parse(const std::vector<uint8_t>& in, const uint16_t& offset)
222 {
223  uint8_t layer_and_offset = read_le<uint8_t>(in, offset);
224  std::cout << std::hex;
225  layer = (layer_and_offset & 0x0F);
226  echo = ((layer_and_offset & 0xF0) >> 4);
227  uint8_t flags = read_le<uint8_t>(in, offset + 1);
228  transparent_point = ((flags & 0x01) > 0);
229  clutter_atmospheric = ((flags & 0x02) > 0);
230  ground = ((flags & 0x04) > 0);
231  dirt = ((flags & 0x08) > 0);
232  horizontal_angle = read_le<int16_t>(in, offset + 2);
233  radial_distance = read_le<uint16_t>(in, offset + 4);
234  echo_pulse_width = read_le<uint16_t>(in, offset + 6);
235 }
236 
237 void ScanPoint2204::parse(const std::vector<uint8_t>& in, const uint16_t& offset)
238 {
239  x_position = read_be<float>(in, offset + 0);
240  y_position = read_be<float>(in, offset + 4);
241  z_position = read_be<float>(in, offset + 8);
242  echo_width = read_be<float>(in, offset + 12);
243  device_id = read_be<uint8_t>(in, offset + 16);
244  layer = read_be<uint8_t>(in, offset + 17);
245  echo = read_be<uint8_t>(in, offset + 18);
246  time_offset = read_be<uint32_t>(in, offset + 20);
247 
248  uint16_t flags = read_be<uint16_t>(in, offset + 24);
249 
250  ground = ((flags & 0x0001) > 0);
251  dirt = ((flags & 0x0002) > 0);
252  precipitation = ((flags & 0x0004) > 0);
253 }
254 
255 void ScanPoint2205::parse(const std::vector<uint8_t>& in, const uint16_t& offset)
256 {
257  x_position = read_be<float>(in, offset);
258  y_position = read_be<float>(in, offset + 4);
259  z_position = read_be<float>(in, offset + 8);
260  echo_width = read_be<float>(in, offset + 12);
261  device_id = read_be<uint8_t>(in, offset + 16);
262  layer = read_be<uint8_t>(in, offset + 17);
263  echo = read_be<uint8_t>(in, offset + 18);
264  time_offset = read_be<uint8_t>(in, offset + 20);
265  uint16_t flags = read_be<uint8_t>(in, offset + 24);
266  ground = ((flags & 0x0001) > 0);
267  dirt = ((flags & 0x0002) > 0);
268  precipitation = ((flags & 0x0004) > 2);
269  transparent = ((flags & 0x1000) > 12);
270 }
271 
272 void ScanPoint2208::parse(const std::vector<uint8_t>& in, const uint16_t& offset)
273 {
274  echo = (read_be<uint8_t>(in, offset) & 0x0C);
275  layer = read_be<uint8_t>(in, offset + 1); // & 0x03; < should be whole byte, but this gives unexpected results.
276  uint16_t flags = read_be<uint16_t>(in, offset + 2);
277  transparent_point = ((flags & 0x0001) > 0);
278  clutter_atmospheric = ((flags & 0x0002) > 0);
279  ground = ((flags & 0x0004) > 0);
280  dirt = ((flags & 0x0008) > 0);
281  horizontal_angle = read_be<int16_t>(in, offset + 4);
282  radial_distance = read_be<uint16_t>(in, offset + 6);
283  echo_pulse_width = read_be<uint16_t>(in, offset + 8);
284 }
285 
286 void Object2221::parse(const std::vector<uint8_t>& in, const uint16_t& offset)
287 {
288  id = read_le<uint16_t>(in, offset);
289  age = read_le<uint16_t>(in, offset + 2);
290  prediction_age = read_le<uint16_t>(in, offset + 4);
291  relative_timestamp = read_le<uint16_t>(in, offset + 6);
292  reference_point.x = read_le<int16_t>(in, offset + 8);
293  reference_point.y = read_le<int16_t>(in, offset + 10);
294  reference_point_sigma.x = read_le<int16_t>(in, offset + 12);
295  reference_point_sigma.y = read_le<int16_t>(in, offset + 14);
296  closest_point.x = read_le<int16_t>(in, offset + 16);
297  closest_point.y = read_le<int16_t>(in, offset + 18);
298  bounding_box_center.x = read_le<int16_t>(in, offset + 20);
299  bounding_box_center.y = read_le<int16_t>(in, offset + 22);
300  bounding_box_width = read_le<uint16_t>(in, offset + 24);
301  bounding_box_length = read_le<uint16_t>(in, offset + 26);
302  object_box_center.x = read_le<int16_t>(in, offset + 28);
303  object_box_center.y = read_le<int16_t>(in, offset + 30);
304  object_box_size.size_x = read_le<uint16_t>(in, offset + 32);
305  object_box_size.size_y = read_le<uint16_t>(in, offset + 34);
306  object_box_orientation = read_le<int16_t>(in, offset + 36);
307  absolute_velocity.x = read_le<int16_t>(in, offset + 38);
308  absolute_velocity.y = read_le<int16_t>(in, offset + 40);
309  absolute_velocity_sigma.size_x = read_le<uint16_t>(in, offset + 42);
310  absolute_velocity_sigma.size_y = read_le<uint16_t>(in, offset + 44);
311  relative_velocity.x = read_le<int16_t>(in, offset + 46);
312  relative_velocity.y = read_le<int16_t>(in, offset + 48);
313  classification = static_cast<Classification>(read_le<uint8_t>(in, offset + 50));
314  classification_age = read_le<uint16_t>(in, offset + 52);
315  classification_certainty = read_le<uint16_t>(in, offset + 54);
316  number_of_contour_points = read_le<uint16_t>(in, offset + 56);
317 
318  if (number_of_contour_points == 65535)
319  number_of_contour_points = 0;
320 
321  for (uint16_t i = 0; i < number_of_contour_points; i++)
322  {
323  Point2Di contour_point;
324  contour_point.parse(in, offset + 58 + (i * 4), ByteOrder::LE);
325  contour_point_list.push_back(contour_point);
326  }
327 }
328 
329 void Object2225::parse(const std::vector<uint8_t>& in, const uint16_t& offset)
330 {
331  id = read_be<uint16_t>(in, offset);
332  age = read_be<uint32_t>(in, offset + 4);
333  timestamp = read_be<NTPTime>(in, offset + 8);
334  hidden_status_age = read_be<uint16_t>(in, offset + 16);
335  classification = static_cast<Classification>(read_be<uint8_t>(in, offset + 18));
336  classification_certainty = read_be<uint8_t>(in, offset + 19);
337  classification_age = read_be<uint32_t>(in, offset + 20);
338  bounding_box_center.parse(in, offset + 24, ByteOrder::BE);
339  bounding_box_size.parse(in, offset + 32, ByteOrder::BE);
340  object_box_center.parse(in, offset + 40, ByteOrder::BE);
341  object_box_center_sigma.parse(in, offset + 48, ByteOrder::BE);
342  object_box_size.parse(in, offset + 56, ByteOrder::BE);
343  yaw_angle = read_be<float>(in, offset + 72);
344  relative_velocity.parse(in, offset + 80, ByteOrder::BE);
345  relative_velocity_sigma.parse(in, offset + 88, ByteOrder::BE);
346  absolute_velocity.parse(in, offset + 96, ByteOrder::BE);
347  absolute_velocity_sigma.parse(in, offset + 104, ByteOrder::BE);
348  number_of_contour_points = read_be<uint8_t>(in, offset + 130);
349  closest_point_index = read_be<uint8_t>(in, offset + 131);
350 
351  if (number_of_contour_points == 255)
352  number_of_contour_points = 0;
353 
354  for (uint8_t i = 0; i < number_of_contour_points; i++)
355  {
356  Point2Df contour_point;
357  contour_point.parse(in, offset + 132 + (i * 8), ByteOrder::BE);
358  contour_point_list.push_back(contour_point);
359  }
360 }
361 
362 void Object2270::parse(const std::vector<uint8_t>& in, const uint16_t& offset)
363 {
364  id = read_le<uint16_t>(in, offset);
365  age = read_le<uint16_t>(in, offset + 2);
366  prediction_age = read_le<uint16_t>(in, offset + 4);
367  relative_moment_of_measurement = read_le<uint16_t>(in, offset + 6);
368  reference_point_location = static_cast<PointLocation>(read_le<uint8_t>(in, offset + 9));
369  reference_point_position_x = read_le<int16_t>(in, offset + 10);
370  reference_point_position_y = read_le<int16_t>(in, offset + 12);
371  reference_point_position_sigma_x = read_le<uint16_t>(in, offset + 14);
372  reference_point_position_sigma_y = read_le<uint16_t>(in, offset + 16);
373  contour_points_cog_x = read_le<int16_t>(in, offset + 36);
374  contour_points_cog_y = read_le<int16_t>(in, offset + 38);
375  object_box_length = read_le<uint16_t>(in, offset + 40);
376  object_box_width = read_le<uint16_t>(in, offset + 42);
377  object_box_orientation_angle = read_le<int16_t>(in, offset + 44);
378  object_box_orientation_angle_sigma = read_le<int16_t>(in, offset + 50);
379  absolute_velocity_x = read_le<int16_t>(in, offset + 52);
380  absolute_velocity_y = read_le<int16_t>(in, offset + 54);
381  absolute_velocity_sigma_x = read_le<uint16_t>(in, offset + 56);
382  absolute_velocity_sigma_y = read_le<uint16_t>(in, offset + 58);
383  relative_velocity_x = read_le<int16_t>(in, offset + 60);
384  relative_velocity_y = read_le<int16_t>(in, offset + 62);
385  relative_velocity_sigma_x = read_le<uint16_t>(in, offset + 64);
386  relative_velocity_sigma_y = read_le<uint16_t>(in, offset + 66);
387  classification = static_cast<Classification>(read_le<uint8_t>(in, offset + 68));
388  uint8_t flags = read_le<uint8_t>(in, offset + 69);
389  tracking_model = ((flags & 0x01) > 0) ? STATIC : DYNAMIC;
390  mobile_detected = ((flags & 0x02) > 0);
391  track_valid = ((flags & 0x04) > 0);
392  classification_age = read_le<uint16_t>(in, offset + 70);
393  classification_confidence = read_le<uint16_t>(in, offset + 72);
394  number_of_contour_points = read_le<uint16_t>(in, offset + 74);
395 
396  if (number_of_contour_points == 65535)
397  number_of_contour_points = 0;
398 
399  for (uint16_t i = 0; i < number_of_contour_points; i++)
400  {
401  Point2Di contour_point;
402  contour_point.parse(in, offset + 76 + (i * 4), ByteOrder::LE);
403  contour_point_list.push_back(contour_point);
404  }
405 }
406 
407 void Object2271::parse(const std::vector<uint8_t>& in, const uint16_t& offset)
408 {
409  id = read_be<uint32_t>(in, offset);
410  uint8_t properties_available = read_be<uint8_t>(in, offset + 6);
411  untracked_properties_available = ((properties_available & 0x02) > 0);
412  tracked_properties_available = ((properties_available & 0x08) > 0);
413 
414  if (untracked_properties_available)
415  {
416  untracked_properties.parse(in, offset + 7);
417  }
418  else
419  {
420  untracked_properties.number_of_contour_points = 0;
421  }
422 
423  if (tracked_properties_available)
424  {
425  tracked_properties.parse(in, offset + 42 + (untracked_properties.number_of_contour_points * 8));
426  }
427  else
428  {
429  tracked_properties.number_of_contour_points = 0;
430  }
431 }
432 
433 void Object2280::parse(const std::vector<uint8_t>& in, const uint16_t& offset)
434 {
435  id = read_be<uint16_t>(in, offset);
436 
437  uint16_t flags = read_be<uint16_t>(in, offset + 2);
438  tracking_model = ((flags & 0x40) > 0) ? STATIC : DYNAMIC;
439  mobility_of_dyn_object_detected = ((flags & 0x80) > 0);
440  motion_model_validated = ((flags & 0x100) > 0);
441  object_age = read_be<uint32_t>(in, offset + 4);
442  timestamp = read_be<NTPTime>(in, offset + 8);
443  object_prediction_age = read_be<uint16_t>(in, offset + 16);
444  classification = static_cast<Classification>(read_be<uint8_t>(in, offset + 18));
445  classification_certainty = read_be<uint8_t>(in, offset + 19);
446  classification_age = read_be<uint32_t>(in, offset + 20);
447  object_box_center.parse(in, offset + 40, ByteOrder::BE);
448  object_box_center_sigma.parse(in, offset + 48, ByteOrder::BE);
449  object_box_size.parse(in, offset + 56, ByteOrder::BE);
450  object_box_orientation_angle = read_be<float>(in, offset + 72);
451  object_box_orientation_angle_sigma = read_be<float>(in, offset + 76);
452  relative_velocity.parse(in, offset + 80, ByteOrder::BE);
453  relative_velocity_sigma.parse(in, offset + 88, ByteOrder::BE);
454  absolute_velocity.parse(in, offset + 96, ByteOrder::BE);
455  absolute_velocity_sigma.parse(in, offset + 104, ByteOrder::BE);
456  number_of_contour_points = read_be<uint8_t>(in, offset + 130);
457  closest_point_index = read_be<uint8_t>(in, offset + 131);
458  reference_point_location = static_cast<PointLocation>(read_be<uint16_t>(in, offset + 132));
459  reference_point_coordinate.parse(in, offset + 134, ByteOrder::BE);
460  reference_point_coordinate_sigma.parse(in, offset + 142, ByteOrder::BE);
461  reference_point_position_correction_coefficient = read_be<float>(in, offset + 150);
462  object_priority = read_be<uint16_t>(in, offset + 162);
463  object_existence_measurement = read_be<float>(in, offset + 164);
464 
465  if (number_of_contour_points == 255)
466  number_of_contour_points = 0;
467 
468  for (uint8_t i = 0; i < number_of_contour_points; i++)
469  {
470  Point2Df new_contour_point;
471  new_contour_point.parse(in, offset + 168 + (i * 8), ByteOrder::BE);
472  contour_point_list.push_back(new_contour_point);
473  }
474 }
475 
476 // High-level message parsers.
477 void IbeoDataHeader::parse(const std::vector<uint8_t>& in)
478 {
479  previous_message_size = read_be<uint32_t>(in, 4);
480  message_size = read_be<uint32_t>(in, 8);
481  device_id = read_be<uint8_t>(in, 13);
482  data_type_id = read_be<uint16_t>(in, 14);
483  time = read_be<NTPTime>(in, 16);
484 }
485 
486 void IbeoDataHeader::encode()
487 {
488  encoded_data.clear();
489 
490  // Magic Word
491  encoded_data.push_back(0xAF);
492  encoded_data.push_back(0xFE);
493  encoded_data.push_back(0xC0);
494  encoded_data.push_back(0xC2);
495  // size_of_previous_message (unused in live data)
496  encoded_data.push_back(0x00);
497  encoded_data.push_back(0x00);
498  encoded_data.push_back(0x00);
499  encoded_data.push_back(0x00);
500 
501  // message_size
502  std::vector<uint8_t> encoded_message_size = write_be<uint32_t>(&message_size);
503  encoded_data.insert(encoded_data.end(), encoded_message_size.begin(), encoded_message_size.end());
504  // Reserved
505  encoded_data.push_back(0x00);
506  // device_id
507  encoded_data.push_back(0x00);
508  // data_type_id
509  std::vector<uint8_t> encoded_data_type_id = write_be<uint16_t>(&data_type_id);
510  encoded_data.insert(encoded_data.end(), encoded_data_type_id.begin(), encoded_data_type_id.end());
511  // time
512  std::vector<uint8_t> encoded_time = write_be<NTPTime>(&time);
513  encoded_data.insert(encoded_data.end(), encoded_time.begin(), encoded_time.end());
514 }
515 
516 IbeoTxMessage::IbeoTxMessage() :
517  has_scan_points(false),
518  has_contour_points(false),
519  has_objects(false)
520 {}
521 
522 IbeoTxMessage::IbeoTxMessage(bool scan_points, bool contour_points, bool objects) :
523  has_scan_points(scan_points),
524  has_contour_points(contour_points),
525  has_objects(objects)
526 {}
527 
528 std::shared_ptr<IbeoTxMessage> IbeoTxMessage::make_message(const uint16_t& data_type)
529 {
530  switch (data_type)
531  {
533  return std::shared_ptr<IbeoTxMessage>(new ErrorWarning);
534  break;
536  return std::shared_ptr<IbeoTxMessage>(new ScanData2202);
537  break;
539  return std::shared_ptr<IbeoTxMessage>(new ScanData2205);
540  break;
542  return std::shared_ptr<IbeoTxMessage>(new ScanData2208);
543  break;
545  return std::shared_ptr<IbeoTxMessage>(new ObjectData2221);
546  break;
548  return std::shared_ptr<IbeoTxMessage>(new ObjectData2225);
549  break;
551  return std::shared_ptr<IbeoTxMessage>(new ObjectData2270);
552  break;
554  return std::shared_ptr<IbeoTxMessage>(new ObjectData2271);
555  break;
557  return std::shared_ptr<IbeoTxMessage>(new ObjectData2280);
558  break;
560  return std::shared_ptr<IbeoTxMessage>(new CameraImage);
561  break;
563  return std::shared_ptr<IbeoTxMessage>(new HostVehicleState2805);
564  break;
566  return std::shared_ptr<IbeoTxMessage>(new HostVehicleState2806);
567  break;
569  return std::shared_ptr<IbeoTxMessage>(new HostVehicleState2807);
570  break;
572  return std::shared_ptr<IbeoTxMessage>(new DeviceStatus);
573  break;
574  default:
575  return NULL;
576  }
577 }
578 
579 std::vector<Point3DL> IbeoTxMessage::get_scan_points() // <-- virtual
580 {
581  return std::vector<Point3DL>();
582 }
583 
584 std::vector<Point3D> IbeoTxMessage::get_contour_points()
585 {
586  return std::vector<Point3D>();
587 }
588 
589 std::vector<IbeoObject> IbeoTxMessage::get_objects()
590 {
591  return std::vector<IbeoObject>();
592 }
593 
594 void ErrorWarning::parse(const std::vector<uint8_t>& in)
595 {
596  ibeo_header.parse(in);
597 
598  uint16_t hdr = IBEO_HEADER_SIZE;
599 
600  uint16_t err_reg_1 = read_le<uint16_t>(in, hdr);
601  uint16_t err_reg_2 = read_le<uint16_t>(in, hdr + 2);
602  uint16_t wrn_reg_1 = read_le<uint16_t>(in, hdr + 4);
603  uint16_t wrn_reg_2 = read_le<uint16_t>(in, hdr + 6);
604 
605  err_internal_error = ((err_reg_1 & 0x0001) > 0);
606  err_motor_1_fault = ((err_reg_1 & 0x0002) > 0);
607  err_buffer_error_xmt_incomplete = ((err_reg_1 & 0x0004) > 0);
608  err_buffer_error_overflow = ((err_reg_1 & 0x0008) > 0);
609  err_apd_over_temperature = ((err_reg_1 & 0x0100) > 0);
610  err_apd_under_temperature = ((err_reg_1 & 0x0200) > 0);
611  err_apd_temperature_sensor_defect = (err_apd_over_temperature && err_apd_under_temperature);
612  err_motor_2_fault = ((err_reg_1 & 0x0400) > 0);
613  err_motor_3_fault = ((err_reg_1 & 0x0800) > 0);
614  err_motor_4_fault = ((err_reg_1 & 0x1000) > 0);
615  err_motor_5_fault = ((err_reg_1 & 0x2000) > 0);
616 
617  err_int_no_scan_data = ((err_reg_2 & 0x0001) > 0);
618  err_int_communication_error = ((err_reg_2 & 0x0002) > 0);
619  err_int_incorrect_scan_data = ((err_reg_2 & 0x0004) > 0);
620  err_config_fpga_not_configurable = ((err_reg_2 & 0x0008) > 0);
621  err_config_incorrect_config_data = ((err_reg_2 & 0x0010) > 0);
622  err_config_contains_incorrect_params = ((err_reg_2 & 0x0020) > 0);
623  err_timeout_data_processing = ((err_reg_2 & 0x0040) > 0);
624  err_timeout_env_model_computation_reset = ((err_reg_2 & 0x0080) > 0);
625 
626  wrn_int_communication_error = ((wrn_reg_1 & 0x0001) > 0);
627  wrn_low_temperature = ((wrn_reg_1 & 0x0008) > 0);
628  wrn_high_temperature = ((wrn_reg_1 & 0x0010) > 0);
629  wrn_int_motor_1 = ((wrn_reg_1 & 0x0020) > 0);
630  wrn_sync_error = ((wrn_reg_1 & 0x0080) > 0);
631  wrn_laser_1_start_pulse_missing = ((wrn_reg_1 & 0x1000) > 0);
632  wrn_laser_2_start_pulse_missing = ((wrn_reg_1 & 0x2000) > 0);
633 
634  wrn_can_interface_blocked = ((wrn_reg_2 & 0x0001) > 0);
635  wrn_eth_interface_blocked = ((wrn_reg_2 & 0x0002) > 0);
636  wrn_incorrect_can_data_rcvd = ((wrn_reg_2 & 0x0004) > 0);
637  wrn_int_incorrect_scan_data = ((wrn_reg_2 & 0x0008) > 0);
638  wrn_eth_unkwn_incomplete_data = ((wrn_reg_2 & 0x0010) > 0);
639  wrn_incorrect_or_forbidden_cmd_rcvd = ((wrn_reg_2 & 0x0020) > 0);
640  wrn_memory_access_failure = ((wrn_reg_2 & 0x0040) > 0);
641  wrn_int_overflow = ((wrn_reg_2 & 0x0080) > 0);
642  wrn_ego_motion_data_missing = ((wrn_reg_2 & 0x0100) > 0);
643  wrn_incorrect_mounting_params = ((wrn_reg_2 & 0x0200) > 0);
644  wrn_no_obj_comp_due_to_scan_freq = ((wrn_reg_2 & 0x0400) > 0);
645 }
646 
648  IbeoTxMessage(true, false, false)
649 {}
650 
651 void ScanData2202::parse(const std::vector<uint8_t>& in)
652 {
653  ibeo_header.parse(in);
654 
655  uint16_t hdr = IBEO_HEADER_SIZE;
656 
657  scan_number = read_le<uint16_t>(in, hdr);
658  scanner_status = read_le<uint16_t>(in, hdr + 2);
659  sync_phase_offset = read_le<uint16_t>(in, hdr + 4);
660  scan_start_time = read_le<NTPTime>(in, hdr + 6);
661  scan_end_time = read_le<NTPTime>(in, hdr + 14);
662  angle_ticks_per_rotation = read_le<uint16_t>(in, hdr + 22);
663  start_angle_ticks = read_le<int16_t>(in, hdr + 24);
664  end_angle_ticks = read_le<int16_t>(in, hdr + 26);
665  scan_points_count = read_le<uint16_t>(in, hdr + 28);
666  mounting_yaw_angle_ticks = read_le<int16_t>(in, hdr + 30);
667  mounting_pitch_angle_ticks = read_le<int16_t>(in, hdr + 32);
668  mounting_roll_angle_ticks = read_le<int16_t>(in, hdr + 34);
669  mounting_position_x = read_le<int16_t>(in, hdr + 36);
670  mounting_position_y = read_le<int16_t>(in, hdr + 38);
671  mounting_position_z = read_le<int16_t>(in, hdr + 40);
672 
673  uint16_t flags = read_le<uint16_t>(in, hdr + 42);
674  ground_labeled = ((flags & 0x0001) > 0);
675  dirt_labeled = ((flags & 0x0002) > 0);
676  rain_labeled = ((flags & 0x0004) > 0);
677  mirror_side = (((flags & 0x0400) > 0) ? REAR : FRONT);
678 
679  for (uint16_t i = 0; i < scan_points_count; i++)
680  {
681  ScanPoint2202 new_scan_point;
682  new_scan_point.parse(in, hdr + 44 + (i * 10));
683  scan_point_list.push_back(new_scan_point);
684  }
685 }
686 
687 std::vector<Point3DL> ScanData2202::get_scan_points()
688 {
689  std::vector<Point3DL> v;
690  double cm_to_m = 100.0;
691 
692  for (ScanPoint2202 sp : scan_point_list)
693  {
694  if (sp.echo == 0 && sp.layer < 4 && !sp.transparent_point && !sp.clutter_atmospheric && !sp.ground && !sp.dirt)
695  {
696  // Spherical coordinates to cartesian
697  // This uses the following conventions (with right-hand rule applied):
698  // phi = rotation about the Z axis (angle in radians from X = 0)
699  // theta = angle away from Z+ (radians)
700  // rho = radial distance (m)
701  Point3DL p3d;
702  double phi = ticks_to_angle(sp.horizontal_angle, angle_ticks_per_rotation);
703  double theta;
704  double rho = sp.radial_distance / cm_to_m;
705 
706  switch (sp.layer)
707  {
708  case 0:
709  theta = (88.4 * (M_PI / 180.0));
710  break;
711  case 1:
712  theta = (89.2 * (M_PI / 180.0));
713  break;
714  case 2:
715  theta = (90.8 * (M_PI / 180.0));
716  break;
717  case 3:
718  theta = (91.6 * (M_PI / 180.0));
719  break;
720  }
721 
722  p3d.x = rho * sin(theta) * cos(phi);
723  p3d.y = rho * sin(theta) * sin(phi);
724  p3d.z = rho * cos(theta);
725 
726  p3d.label = sp.layer;
727 
728  v.push_back(p3d);
729  }
730  }
731 
732  return v;
733 }
734 
736  IbeoTxMessage(true, false, false)
737 {}
738 
739 void ScanData2204::parse(const std::vector<uint8_t>& in)
740 {
741  ibeo_header.parse(in);
742 
743  uint16_t hdr = IBEO_HEADER_SIZE;
744 
745  scan_start_time = read_be<NTPTime>(in, hdr);
746  scan_end_time_offset = read_be<uint32_t>(in, hdr + 8);
747 
748  uint32_t flags = read_be<uint32_t>(in, hdr + 12);
749  ground_labeled = ((flags & 0x00000001) > 0);
750  dirt_labeled = ((flags & 0x00000002) > 0);
751  rain_labeled = ((flags & 0x00000004) > 0);
752  fused_scan = ((flags & 0x00000100) > 0);
753  mirror_side = ((flags & 0x00000200) > 0) ? REAR : FRONT;
754  coordinate_system = ((flags & 0x00000400) > 0) ? VEHICLE : SCANNER;
755 
756  scan_number = read_be<uint16_t>(in, hdr + 16);
757  scan_points = read_be<uint16_t>(in, hdr + 18);
758  number_of_scanner_infos = read_be<uint8_t>(in, hdr + 20);
759 
760  for (uint8_t i = 0; i < number_of_scanner_infos; i++)
761  {
762  ScannerInfo2204 scanner_info;
763  scanner_info.parse(in, hdr + 24 + (i * 40));
764  scanner_info_list.push_back(scanner_info);
765  }
766 
767  for (uint16_t i = 0; i < scan_points; i++)
768  {
769  ScanPoint2204 scan_point;
770  scan_point.parse(in, hdr + 24 + (number_of_scanner_infos * 40) + (i * 28));
771  scan_point_list.push_back(scan_point);
772  }
773 }
774 
775 std::vector<Point3DL> ScanData2204::get_scan_points()
776 {
777  std::vector<Point3DL> v;
778 
779  for (ScanPoint2204 sp : scan_point_list)
780  {
781  if (sp.echo == 0 && sp.layer < 4 && !sp.ground && !sp.dirt && !sp.precipitation)
782  {
783  Point3DL p3d;
784 
785  p3d.x = sp.x_position;
786  p3d.y = sp.y_position;
787  p3d.z = sp.z_position;
788  p3d.label = sp.layer;
789  v.push_back(p3d);
790  }
791  }
792 
793  return v;
794 }
795 
797  IbeoTxMessage(true, false, false)
798 {}
799 
800 void ScanData2205::parse(const std::vector<uint8_t>& in)
801 {
802  ibeo_header.parse(in);
803 
804  uint16_t hdr = IBEO_HEADER_SIZE;
805 
806  scan_start_time = read_be<NTPTime>(in, hdr);
807  scan_end_time_offset = read_be<uint32_t>(in, hdr + 8);
808 
809  uint32_t flags = read_be<uint32_t>(in, hdr + 12);
810  fused_scan = ((flags & 0x00000100) > 0);
811  mirror_side = ((flags & 0x00000200) > 0) ? REAR : FRONT;
812  coordinate_system = ((flags & 0x00000400) > 0) ? VEHICLE : SCANNER;
813 
814  scan_number = read_be<uint16_t>(in, hdr + 16);
815  scan_points = read_be<uint16_t>(in, hdr + 18);
816  number_of_scanner_infos = read_be<uint8_t>(in, hdr + 20);
817 
818  // printf("%d SCAN POINTS REPORTED\n", scan_points);
819 
820  for (uint8_t i = 0; i < number_of_scanner_infos; i++)
821  {
822  ScannerInfo2205 new_scanner_info;
823  new_scanner_info.parse(in, hdr + 24 + (i * 148));
824  scanner_info_list.push_back(new_scanner_info);
825  }
826 
827  for (uint16_t i = 0; i < scan_points; i++)
828  {
829  ScanPoint2205 new_scan_point;
830  new_scan_point.parse(in, hdr + 24 + (number_of_scanner_infos * 148) + (i * 28));
831  scan_point_list.push_back(new_scan_point);
832  }
833 }
834 
835 std::vector<Point3DL> ScanData2205::get_scan_points()
836 {
837  std::vector<Point3DL> v;
838 
839  for (ScanPoint2205 sp : scan_point_list)
840  {
841  if (sp.echo == 0 && sp.layer < 4 && !sp.transparent && !sp.ground && !sp.dirt && !sp.precipitation)
842  {
843  Point3DL p3d;
844 
845  p3d.x = sp.x_position;
846  p3d.y = sp.y_position;
847  p3d.z = sp.z_position;
848  p3d.label = sp.layer;
849  v.push_back(p3d);
850  }
851  }
852 
853  return v;
854 }
855 
857  IbeoTxMessage(true, false, false)
858 {}
859 
860 void ScanData2208::parse(const std::vector<uint8_t>& in)
861 {
862  ibeo_header.parse(in);
863 
864  uint16_t hdr = IBEO_HEADER_SIZE;
865 
866  scan_number = read_be<uint16_t>(in, hdr);
867  scanner_type = read_be<uint16_t>(in, hdr + 2);
868  uint16_t scanner_status = read_be<uint16_t>(in, hdr + 4);
869  motor_on = ((scanner_status & 0x0001) > 0);
870  laser_on = ((scanner_status & 0x0002) > 0);
871  frequency_locked = ((scanner_status & 0x0004) > 0);
872  motor_rotating_direction = ((scanner_status & 0x0100) > 0) ? COUNTER_CLOCKWISE : CLOCKWISE;
873  angle_ticks_per_rotation = read_be<uint16_t>(in, hdr + 6);
874  scan_flags = read_be<uint32_t>(in, hdr + 8);
875  mounting_yaw_angle_ticks = read_be<int16_t>(in, hdr + 12);
876  mounting_pitch_angle_ticks = read_be<int16_t>(in, hdr + 14);
877  mounting_roll_angle_ticks = read_be<int16_t>(in, hdr + 16);
878  mounting_position_x = read_be<int16_t>(in, hdr + 18);
879  mounting_position_y = read_be<int16_t>(in, hdr + 20);
880  mounting_position_z = read_be<int16_t>(in, hdr + 22);
881  device_id = read_be<uint8_t>(in, hdr + 50);
882  scan_start_time = read_be<NTPTime>(in, hdr + 52);
883  scan_end_time = read_be<NTPTime>(in, hdr + 60);
884  start_angle_ticks = read_be<int16_t>(in, hdr + 68);
885  end_angle_ticks = read_be<int16_t>(in, hdr + 70);
886  subflags = read_be<uint8_t>(in, hdr + 72);
887  mirror_side = ((read_be<uint8_t>(in, hdr + 73) & 0x01) > 0) ? REAR : FRONT;
888  mirror_tilt = read_be<int16_t>(in, hdr + 78);
889  number_of_scan_points = read_be<uint16_t>(in, hdr + 86);
890 
891  for (uint16_t i = 0; i < number_of_scan_points; i++)
892  {
893  ScanPoint2208 new_scan_point;
894  new_scan_point.parse(in, hdr + 88 + (i * 11));
895  scan_point_list.push_back(new_scan_point);
896  }
897 }
898 
899 std::vector<Point3DL> ScanData2208::get_scan_points()
900 {
901  std::vector<Point3DL> v;
902  double cm_to_m = 100.0;
903 
904  for (ScanPoint2208 sp : scan_point_list)
905  {
906  if (sp.echo == 0 && sp.layer < 4 && !sp.transparent_point && !sp.clutter_atmospheric && !sp.ground && !sp.dirt)
907  {
908  // Spherical coordinates to cartesian
909  // This uses the following conventions (with right-hand rule applied):
910  // phi = rotation about the Z axis (angle in radians from X = 0)
911  // theta = angle away from Z+ (radians)
912  // rho = radial distance (m)
913  Point3DL p3d;
914  double phi = ticks_to_angle(sp.horizontal_angle, angle_ticks_per_rotation);
915  double theta;
916  double rho = sp.radial_distance / cm_to_m;
917 
918  switch (sp.layer)
919  {
920  case 0:
921  theta = (88.4 * (M_PI / 180.0));
922  break;
923  case 1:
924  theta = (89.2 * (M_PI / 180.0));
925  break;
926  case 2:
927  theta = (90.8 * (M_PI / 180.0));
928  break;
929  case 3:
930  theta = (91.6 * (M_PI / 180.0));
931  break;
932  }
933 
934  p3d.x = rho * sin(theta) * cos(phi);
935  p3d.y = rho * sin(theta) * sin(phi);
936  p3d.z = rho * cos(theta);
937 
938  p3d.label = sp.layer;
939 
940  p3d.label = sp.layer;
941 
942  v.push_back(p3d);
943  }
944  }
945 
946  return v;
947 }
948 
950  IbeoTxMessage(false, true, true)
951 {}
952 
953 void ObjectData2221::parse(const std::vector<uint8_t>& in)
954 {
955  ibeo_header.parse(in);
956 
957  uint16_t hdr = IBEO_HEADER_SIZE;
958 
959  scan_start_timestamp = read_le<NTPTime>(in, hdr);
960  number_of_objects = read_le<uint16_t>(in, hdr + 8);
961 
962  uint32_t offset = hdr + 10;
963 
964  for (uint16_t i = 0; i < number_of_objects; i++)
965  {
966  Object2221 new_object;
967  new_object.parse(in, offset);
968  object_list.push_back(new_object);
969  offset += 58; // Size of object without contour points.
970  offset += new_object.number_of_contour_points * 4; // Size of object's contour points.
971  }
972 }
973 
975 {
976  std::vector<Point3D> contour_points;
977 
978  for (Object2221 o : object_list)
979  {
980  for (Point2Di p2d : o.contour_point_list)
981  {
982  Point3D p3d;
983  p3d.x = static_cast<double>(p2d.x) / 100.0;
984  p3d.y = static_cast<double>(p2d.y) / 100.0;
985  p3d.z = 0.0;
986  contour_points.push_back(p3d);
987  }
988  }
989 
990  return contour_points;
991 }
992 
993 std::vector<IbeoObject> ObjectData2221::get_objects()
994 {
995  std::vector<IbeoObject> io_list;
996 
997  for (Object2221 o : object_list)
998  {
999  IbeoObject io;
1000 
1001  io.id = o.id;
1002  io.age = o.age;
1003  io.prediction_age = o.prediction_age;
1004  io.relative_timestamp = o.relative_timestamp;
1005  io.reference_point.x = o.reference_point.x / 100.0; // In cm
1006  io.reference_point.y = o.reference_point.y / 100.0; // In cm
1007  io.reference_point_sigma.x = o.reference_point_sigma.x / 100.0; // In cm
1008  io.reference_point_sigma.y = o.reference_point_sigma.y / 100.0; // In cm
1009  io.closest_point.x = o.closest_point.x / 100.0; // In cm
1010  io.closest_point.y = o.closest_point.y / 100.0; // In cm
1011 
1012  io.bounding_box_center.x = o.bounding_box_center.x / 100.0; // In cm
1013  io.bounding_box_center.y = o.bounding_box_center.y / 100.0; // In cm
1014  io.bounding_box_size.size_x = o.bounding_box_width / 100.0; // In cm
1015  io.bounding_box_size.size_y = o.bounding_box_length / 100.0; // In cm
1016 
1017  io.object_box_center.x = o.object_box_center.x / 100.0; // In cm
1018  io.object_box_center.y = o.object_box_center.y / 100.0; // In cm
1019  io.object_box_size.size_x = o.object_box_size.size_x / 100.0; // In cm
1020  io.object_box_size.size_y = o.object_box_size.size_y / 100.0; // In cm
1021  io.object_box_orientation = o.object_box_orientation / 100.0 * (M_PI / 180.0); // In 1/100 degrees.
1022 
1023  io.absolute_velocity.x = o.absolute_velocity.x / 100.0; // In cm/s
1024  io.absolute_velocity.y = o.absolute_velocity.y / 100.0; // In cm/s
1025  io.absolute_velocity_sigma.x = o.absolute_velocity_sigma.size_x / 100.0; // In cm/s
1026  io.absolute_velocity_sigma.y = o.absolute_velocity_sigma.size_y / 100.0; // In cm/s
1027  io.relative_velocity.x = o.relative_velocity.x / 100.0; // In cm/s
1028  io.relative_velocity.y = o.relative_velocity.y / 100.0; // In cm/s
1029 
1030  io.classification = static_cast<uint16_t>(o.classification);
1031  io.classification_age = o.classification_age;
1032  io.classification_certainty = o.classification_certainty;
1033 
1034  io.number_of_contour_points = o.number_of_contour_points;
1035 
1037 
1038  io_list.push_back(io);
1039  }
1040 
1041  return io_list;
1042 }
1043 
1045  IbeoTxMessage(false, true, true)
1046 {}
1047 
1048 void ObjectData2225::parse(const std::vector<uint8_t>& in)
1049 {
1050  ibeo_header.parse(in);
1051 
1052  uint16_t hdr = IBEO_HEADER_SIZE;
1053 
1054  mid_scan_timestamp = read_be<NTPTime>(in, hdr);
1055  number_of_objects = read_be<uint16_t>(in, hdr + 8);
1056 
1057  uint32_t offset = hdr + 10;
1058 
1059  for (uint16_t i = 0; i < number_of_objects; i++)
1060  {
1061  Object2225 new_object;
1062  new_object.parse(in, offset);
1063  object_list.push_back(new_object);
1064  offset += 132; // Add size of single object without contour points.
1065  offset += new_object.number_of_contour_points * 8; // Add size of just-parsed object's contour points.
1066  }
1067 }
1068 
1070 {
1071  std::vector<Point3D> contour_points;
1072 
1073  for (Object2225 o : object_list)
1074  {
1075  for (Point2Df p2d : o.contour_point_list)
1076  {
1077  Point3D p3d;
1078  p3d.x = static_cast<double>(p2d.x) / 100.0;
1079  p3d.y = static_cast<double>(p2d.y) / 100.0;
1080  p3d.z = 0.0;
1081  contour_points.push_back(p3d);
1082  }
1083  }
1084 
1085  return contour_points;
1086 }
1087 
1088 std::vector<IbeoObject> ObjectData2225::get_objects()
1089 {
1090  std::vector<IbeoObject> io_list;
1091 
1092  for (Object2225 o : object_list)
1093  {
1094  IbeoObject io;
1095  io.id = o.id;
1096  io.age = o.age;
1097  io.prediction_age = 0;
1098  io.relative_timestamp = 0;
1100 
1101  io.classification = o.classification;
1102  io.classification_age = o.classification_age;
1103  io.classification_certainty = o.classification_certainty;
1104 
1105  io.bounding_box_center.x = o.bounding_box_center.x;
1106  io.bounding_box_center.y = o.bounding_box_center.y;
1107  io.bounding_box_size.size_x = o.bounding_box_size.x;
1108  io.bounding_box_size.size_y = o.bounding_box_size.y;
1109 
1110  io.object_box_center.x = o.object_box_center.x;
1111  io.object_box_center.y = o.object_box_center.y;
1112  io.object_box_size.size_x = o.bounding_box_size.x;
1113  io.object_box_size.size_y = o.bounding_box_size.y;
1114  io.object_box_orientation = o.yaw_angle;
1115 
1116  io.absolute_velocity.x = o.absolute_velocity.x;
1117  io.absolute_velocity.y = o.absolute_velocity.y;
1118  io.absolute_velocity_sigma.x = o.absolute_velocity_sigma.x;
1119  io.absolute_velocity_sigma.y = o.absolute_velocity_sigma.y;
1120  io.relative_velocity.x = o.relative_velocity.x;
1121  io.relative_velocity.y = o.relative_velocity.y;
1122 
1124 
1125  // In theory, this should still hold.
1126  io.closest_point.x = io.contour_point_list[o.closest_point_index].x;
1127  io.closest_point.y = io.contour_point_list[o.closest_point_index].y;
1128 
1129  io.number_of_contour_points = (uint16_t) io.contour_point_list.size();
1130  io_list.push_back(io);
1131  }
1132 
1133  return io_list;
1134 }
1135 
1137  IbeoTxMessage(false, true, true)
1138 {}
1139 
1140 void ObjectData2270::parse(const std::vector<uint8_t>& in)
1141 {
1142  ibeo_header.parse(in);
1143 
1144  uint16_t hdr = IBEO_HEADER_SIZE;
1145 
1146  start_scan_timestamp = read_le<NTPTime>(in, hdr);
1147  object_list_number = read_le<uint16_t>(in, hdr + 8);
1148  number_of_objects = read_le<uint16_t>(in, hdr + 10);
1149 
1150  uint32_t offset = hdr + 12;
1151 
1152  for (uint16_t i = 0; i < number_of_objects; i++)
1153  {
1154  Object2270 new_object;
1155  new_object.parse(in, offset);
1156  object_list.push_back(new_object);
1157 
1158  offset += 76; // Add size of single object without contour points.
1159  offset += new_object.number_of_contour_points * 4; // Add size of just-parsed object's contour points.
1160  }
1161 }
1162 
1164 {
1165  std::vector<Point3D> contour_points;
1166 
1167  for (Object2270 o : object_list)
1168  {
1169  for (Point2Di p2d : o.contour_point_list)
1170  {
1171  Point3D p3d;
1172  p3d.x = static_cast<double>(p2d.x) / 100.0;
1173  p3d.y = static_cast<double>(p2d.y) / 100.0;
1174  p3d.z = 0.0;
1175  contour_points.push_back(p3d);
1176  }
1177  }
1178 
1179  return contour_points;
1180 }
1181 
1182 std::vector<IbeoObject> ObjectData2270::get_objects()
1183 {
1184  std::vector<IbeoObject> io_list;
1185 
1186  for (Object2270 o : object_list)
1187  {
1188  IbeoObject io;
1189  io.id = o.id;
1190  io.age = o.age;
1191  io.prediction_age = o.prediction_age;
1192  io.relative_timestamp = 0;
1193 
1195 
1196  io.reference_point_location = o.reference_point_location;
1197  io.reference_point.x = o.reference_point_position_x / 100.0; // In cm
1198  io.reference_point.y = o.reference_point_position_y / 100.0; // In cm
1199  io.reference_point_sigma.x = o.reference_point_position_sigma_x / 100.0; // In cm
1200  io.reference_point_sigma.y = o.reference_point_position_sigma_y / 100.0; // In cm
1201 
1202  io.object_box_size.size_x = o.object_box_length / 100.0; // In cm
1203  io.object_box_size.size_y = o.object_box_width / 100.0; // In cm
1204  io.object_box_orientation = o.object_box_orientation_angle / 100.0 * (M_PI / 180.0); // In 1/100 of a degree
1205 
1206  float half_box_x = io.object_box_size.size_x / 2.0;
1207  float half_box_y = io.object_box_size.size_y / 2.0;
1208 
1209  switch (o.reference_point_location)
1210  {
1211  case COG:
1212  io.object_box_center.x = o.contour_points_cog_x / 100.0; // In cm
1213  io.object_box_center.y = o.contour_points_cog_y / 100.0; // In cm
1214  break;
1215  case TOP_FRONT_LEFT_CORNER:
1216  io.object_box_center.x = io.reference_point.x - half_box_x;
1217  io.object_box_center.y = io.reference_point.y - half_box_y;
1218  break;
1220  io.object_box_center.x = io.reference_point.x - half_box_x;
1221  io.object_box_center.y = io.reference_point.y + half_box_y;
1222  break;
1224  io.object_box_center.x = io.reference_point.x + half_box_x;
1225  io.object_box_center.y = io.reference_point.y + half_box_y;
1226  break;
1228  io.object_box_center.x = io.reference_point.x + half_box_x;
1229  io.object_box_center.y = io.reference_point.y - half_box_y;
1230  break;
1232  io.object_box_center.x = io.reference_point.x - half_box_x;
1234  break;
1235  case CENTER_OF_RIGHT_EDGE:
1237  io.object_box_center.y = io.reference_point.y + half_box_y;
1238  break;
1240  io.object_box_center.x = io.reference_point.x + half_box_x;
1242  break;
1243  case CENTER_OF_LEFT_EDGE:
1245  io.object_box_center.y = io.reference_point.y - half_box_y;
1246  break;
1247  case BOX_CENTER:
1248  case INVALID:
1251  break;
1252  }
1253 
1254  io.absolute_velocity.x = o.absolute_velocity_x / 100.0; // In cm/s
1255  io.absolute_velocity.y = o.absolute_velocity_y / 100.0; // In cm/s
1256  io.absolute_velocity_sigma.x = o.absolute_velocity_sigma_x / 100.0; // In cm/s
1257  io.absolute_velocity_sigma.y = o.absolute_velocity_sigma_y / 100.0; // In cm/s
1258  io.relative_velocity.x = o.relative_velocity_x / 100.0; // In cm/s
1259  io.relative_velocity.y = o.relative_velocity_y / 100.0; // In cm/s
1260 
1262  io.number_of_contour_points = (uint16_t) io.contour_point_list.size();
1263 
1264  io_list.push_back(io);
1265  }
1266 
1267  return io_list;
1268 }
1269 
1271  IbeoTxMessage(false, true, true)
1272 {}
1273 
1274 void ObjectData2271::parse(const std::vector<uint8_t>& in)
1275 {
1276  ibeo_header.parse(in);
1277 
1278  uint16_t hdr = IBEO_HEADER_SIZE;
1279 
1280  start_scan_timestamp = read_be<NTPTime>(in, hdr);
1281  scan_number = read_be<uint16_t>(in, hdr + 8);
1282  number_of_objects = read_be<uint16_t>(in, hdr + 18);
1283 
1284  uint32_t offset = hdr + 20;
1285 
1286  for (uint16_t i = 0; i < number_of_objects; i++)
1287  {
1288  Object2271 new_object;
1289  new_object.parse(in, offset);
1290  object_list.push_back(new_object);
1291 
1292  // calculate offset for the next object (i+1)
1293  offset += (118 + 4); // Add size of single object without contour points.
1294  // Add size of just-parsed object's untracked contour points.
1295  offset += new_object.untracked_properties.number_of_contour_points * 8;
1296  // Add size of just-parsed object's tracked contour points.
1297  offset += new_object.tracked_properties.number_of_contour_points * 8;
1298  }
1299 }
1300 
1302 {
1303  std::vector<Point3D> points;
1304 
1305  double m_to_cm = 100.0;
1306  int i = 0;
1307 
1308  for (Object2271 o : object_list)
1309  {
1310  if (o.untracked_properties_available)
1311  {
1312  for (ContourPointSigma cp : o.untracked_properties.contour_point_list)
1313  {
1314  Point3D p;
1315  p.x = cp.x / m_to_cm;
1316  p.y = cp.y / m_to_cm;
1317  points.push_back(p);
1318  }
1319  }
1320 
1321  if (o.tracked_properties_available)
1322  {
1323  for (ContourPointSigma cp : o.tracked_properties.contour_point_list)
1324  {
1325  Point3D p;
1326  p.x = cp.x / m_to_cm;
1327  p.y = cp.y / m_to_cm;
1328  p.z = 0;
1329  points.push_back(p);
1330  }
1331  }
1332 
1333  i++;
1334  }
1335 
1336  return points;
1337 }
1338 
1339 std::vector<IbeoObject> ObjectData2271::get_objects()
1340 {
1341  std::vector<IbeoObject> io_list;
1342 
1343  for (Object2271 o : object_list)
1344  {
1345  IbeoObject io;
1346  io.id = o.id;
1347  io.age = 0;
1348  io.prediction_age = 0;
1349  io.relative_timestamp = 0;
1350  io.bounding_box_size.size_x = 0;
1351  io.bounding_box_size.size_y = 0;
1352  io.object_box_orientation = 0;
1354  io.classification_age = 0;
1355  io.classification_certainty = 0;
1356 
1357  if (o.tracked_properties_available)
1358  {
1359  io.age = o.tracked_properties.object_age;
1360  io.relative_timestamp = o.tracked_properties.relative_time_of_measure;
1361 
1362  io.closest_point.x = o.tracked_properties.position_closest_point.x / 100.0; // In cm
1363  io.closest_point.y = o.tracked_properties.position_closest_point.y / 100.0; // In cm
1364 
1365  io.object_box_size.size_x = o.tracked_properties.object_box_size.x / 100.0; // In cm
1366  io.object_box_size.size_y = o.tracked_properties.object_box_size.y / 100.0; // In cm
1367  io.object_box_orientation = o.tracked_properties.object_box_orientation /
1368  100.0 * (M_PI / 180.0); // In 1/100 of a degree
1369 
1370  float half_box_x = io.object_box_size.size_x / 2.0;
1371  float half_box_y = io.object_box_size.size_y / 2.0;
1372 
1373  switch (o.tracked_properties.tracking_point_location)
1374  {
1375  case TOP_FRONT_LEFT_CORNER:
1376  io.object_box_center.x = io.reference_point.x - half_box_x;
1377  io.object_box_center.y = io.reference_point.y - half_box_y;
1378  break;
1380  io.object_box_center.x = io.reference_point.x - half_box_x;
1381  io.object_box_center.y = io.reference_point.y + half_box_y;
1382  break;
1384  io.object_box_center.x = io.reference_point.x + half_box_x;
1385  io.object_box_center.y = io.reference_point.y + half_box_y;
1386  break;
1388  io.object_box_center.x = io.reference_point.x + half_box_x;
1389  io.object_box_center.y = io.reference_point.y - half_box_y;
1390  break;
1392  io.object_box_center.x = io.reference_point.x - half_box_x;
1394  break;
1395  case CENTER_OF_RIGHT_EDGE:
1397  io.object_box_center.y = io.reference_point.y + half_box_y;
1398  break;
1400  io.object_box_center.x = io.reference_point.x + half_box_x;
1402  break;
1403  case CENTER_OF_LEFT_EDGE:
1405  io.object_box_center.y = io.reference_point.y - half_box_y;
1406  break;
1407  case COG:
1408  case BOX_CENTER:
1409  case INVALID:
1412  break;
1413  }
1414 
1415  io.absolute_velocity.x = o.tracked_properties.velocity.x / 100.0; // In cm/s
1416  io.absolute_velocity.y = o.tracked_properties.velocity.y / 100.0; // In cm/s
1417  io.absolute_velocity_sigma.x = o.tracked_properties.velocity_sigma.x / 100.0; // In cm/s
1418  io.absolute_velocity_sigma.y = o.tracked_properties.velocity_sigma.y / 100.0; // In cm/s
1419  io.relative_velocity.x = o.tracked_properties.relative_velocity.x / 100.0; // In cm/s
1420  io.relative_velocity.y = o.tracked_properties.relative_velocity.y / 100.0; // In cm/s
1421 
1422  io.classification = o.tracked_properties.classification;
1423  io.classification_age = o.tracked_properties.classification_age;
1424  }
1425 
1426  if (o.untracked_properties_available)
1427  {
1428  io.relative_timestamp = o.untracked_properties.relative_time_of_measurement;
1429 
1430  io.closest_point.x = o.untracked_properties.position_closest_point.x / 100.0; // In cm
1431  io.closest_point.y = o.untracked_properties.position_closest_point.y / 100.0; // In cm
1432 
1433  io.object_box_size.size_x = o.untracked_properties.object_box_size.x / 100.0; // In cm
1434  io.object_box_size.size_y = o.untracked_properties.object_box_size.y / 100.0; // In cm
1435  io.object_box_orientation = o.untracked_properties.object_box_orientation /
1436  100.0 * (M_PI / 180.0); // In 1/100 of a degree
1437 
1438  io.object_box_center.x = o.untracked_properties.tracking_point_coordinate.x / 100.0; // In cm
1439  io.object_box_center.y = o.untracked_properties.tracking_point_coordinate.y / 100.0; // In cm
1440 
1441  io.reference_point.x = o.untracked_properties.tracking_point_coordinate.x / 100.0; // In cm
1442  io.reference_point.y = o.untracked_properties.tracking_point_coordinate.y / 100.0; // In cm
1443 
1444  io.reference_point_sigma.x = o.untracked_properties.tracking_point_coordinate_sigma.x / 100.0; // In cm
1445  io.reference_point_sigma.y = o.untracked_properties.tracking_point_coordinate_sigma.y / 100.0; // In cm
1446  }
1447 
1449 
1450  io.number_of_contour_points = (uint16_t) io.contour_point_list.size();
1451  io_list.push_back(io);
1452  }
1453 
1454  return io_list;
1455 }
1456 
1458  IbeoTxMessage(false, true, true)
1459 {}
1460 
1461 void ObjectData2280::parse(const std::vector<uint8_t>& in)
1462 {
1463  ibeo_header.parse(in);
1464 
1465  uint16_t hdr = IBEO_HEADER_SIZE;
1466 
1467  mid_scan_timestamp = read_be<NTPTime>(in, hdr);
1468  number_of_objects = read_be<uint16_t>(in, hdr + 8);
1469 
1470  uint32_t offset = hdr + 10;
1471 
1472  for (uint16_t i = 0; i < number_of_objects; i++)
1473  {
1474  Object2280 new_object;
1475  new_object.parse(in, offset);
1476 
1477  object_list.push_back(new_object);
1478 
1479  offset += 168; // Add size of single object without contour points.
1480  offset += new_object.number_of_contour_points * 8; // Add size of just-parsed object's contour points.
1481  }
1482 }
1483 
1485 {
1486  std::vector<Point3D> contour_points;
1487 
1488  for (Object2280 o : object_list)
1489  {
1490  for (Point2Df p2d : o.contour_point_list)
1491  {
1492  if (!std::isnan(p2d.x) && !std::isnan(p2d.y) && fabs(p2d.x) < 300.0 && fabs(p2d.y) < 300.0)
1493  {
1494  Point3D p3d;
1495  p3d.x = static_cast<double>(p2d.x);
1496  p3d.y = static_cast<double>(p2d.y);
1497  p3d.z = 0.0;
1498  contour_points.push_back(p3d);
1499  }
1500  }
1501  }
1502 
1503  return contour_points;
1504 }
1505 
1506 std::vector<IbeoObject> ObjectData2280::get_objects()
1507 {
1508  std::vector<IbeoObject> io_list;
1509 
1510  for (Object2280 o : object_list)
1511  {
1512  IbeoObject io;
1513  io.id = o.id;
1514  io.age = o.object_age;
1515  io.prediction_age = o.object_prediction_age;
1516  io.classification = o.classification;
1517  io.classification_age = o.classification_age;
1518  io.classification_certainty = o.classification_certainty;
1519 
1520  io.relative_timestamp = 0;
1521  io.bounding_box_center.x = o.object_box_center.x;
1522  io.bounding_box_center.y = o.object_box_center.y;
1523  io.bounding_box_size.size_x = o.object_box_size.x;
1524  io.bounding_box_size.size_y = o.object_box_size.y;
1525 
1526  io.object_box_center.x = o.object_box_center.x;
1527  io.object_box_center.y = o.object_box_center.y;
1528  io.object_box_size.size_x = o.object_box_size.x;
1529  io.object_box_size.size_y = o.object_box_size.y;
1530  io.object_box_orientation = o.object_box_orientation_angle;
1531 
1532  io.absolute_velocity.x = o.absolute_velocity.x;
1533  io.absolute_velocity.y = o.absolute_velocity.y;
1534 
1535  io.absolute_velocity_sigma.x = o.absolute_velocity_sigma.x;
1536  io.absolute_velocity_sigma.y = o.absolute_velocity_sigma.y;
1537 
1538  io.relative_velocity.x = o.relative_velocity.x;
1539  io.relative_velocity.y = o.relative_velocity.y;
1540 
1542  io.number_of_contour_points = o.number_of_contour_points;
1543 
1544  io.closest_point.x = io.contour_point_list[o.closest_point_index].x;
1545  io.closest_point.y = io.contour_point_list[o.closest_point_index].y;
1546 
1547  io_list.push_back(io);
1548  }
1549 
1550  return io_list;
1551 }
1552 
1554  IbeoTxMessage()
1555 {}
1556 
1557 void CameraImage::parse(const std::vector<uint8_t>& in)
1558 {
1559  ibeo_header.parse(in);
1560 
1561  uint16_t hdr = IBEO_HEADER_SIZE;
1562 
1563  image_format = static_cast<ImageFormat>(read_be<uint16_t>(in, hdr));
1564  us_since_power_on = read_be<uint32_t>(in, hdr + 2);
1565  timestamp = read_be<NTPTime>(in, hdr + 6);
1566  device_id = read_be<uint8_t>(in, hdr + 14);
1567  mounting_position.parse(in, hdr + 15);
1568  horizontal_opening_angle = read_be<double>(in, hdr + 39);
1569  vertical_opening_angle = read_be<double>(in, hdr + 47);
1570  image_width = read_be<uint16_t>(in, hdr + 55);
1571  image_height = read_be<uint16_t>(in, hdr + 57);
1572  compressed_size = read_be<uint32_t>(in, hdr + 59);
1573 
1574  for (uint32_t i = 0; i < compressed_size; i++)
1575  {
1576  image_buffer.push_back(in[hdr + 63 + i]);
1577  }
1578 }
1579 
1581  IbeoTxMessage()
1582 {}
1583 
1584 void HostVehicleState2805::parse(const std::vector<uint8_t>& in)
1585 {
1586  ibeo_header.parse(in);
1587 
1588  uint16_t hdr = IBEO_HEADER_SIZE;
1589 
1590  timestamp = read_le<NTPTime>(in, hdr);
1591  scan_number = read_le<uint16_t>(in, hdr + 8);
1592  error_flags = read_le<uint16_t>(in, hdr + 10);
1593  longitudinal_velocity = read_le<int16_t>(in, hdr + 12);
1594  steering_wheel_angle = read_le<int16_t>(in, hdr + 14);
1595  front_wheel_angle = read_le<int16_t>(in, hdr + 16);
1596  x_position = read_le<int32_t>(in, hdr + 20);
1597  y_position = read_le<int32_t>(in, hdr + 24);
1598  course_angle = read_le<int16_t>(in, hdr + 28);
1599  time_difference = read_le<uint16_t>(in, hdr + 30);
1600  x_difference = read_le<int16_t>(in, hdr + 32);
1601  y_difference = read_le<int16_t>(in, hdr + 34);
1602  heading_difference = read_le<int16_t>(in, hdr + 36);
1603  current_yaw_rate = read_le<int16_t>(in, hdr + 40);
1604 }
1605 
1607  IbeoTxMessage()
1608 {}
1609 
1610 void HostVehicleState2806::parse(const std::vector<uint8_t>& in)
1611 {
1612  ibeo_header.parse(in);
1613 
1614  uint16_t hdr = IBEO_HEADER_SIZE;
1615 
1616  timestamp = read_le<NTPTime>(in, hdr + 4);
1617  distance_x = read_le<int32_t>(in, hdr + 12);
1618  distance_y = read_le<int32_t>(in, hdr + 16);
1619  course_angle = read_le<float>(in, hdr + 24);
1620  longitudinal_velocity = read_le<float>(in, hdr + 28);
1621  yaw_rate = read_le<float>(in, hdr + 24);
1622  steering_wheel_angle = read_le<float>(in, hdr + 32);
1623  cross_acceleration = read_le<float>(in, hdr + 36);
1624  front_wheel_angle = read_le<float>(in, hdr + 40);
1625  vehicle_width = read_le<float>(in, hdr + 46);
1626  vehicle_front_to_front_axle = read_le<float>(in, hdr + 54);
1627  rear_axle_to_front_axle = read_le<float>(in, hdr + 58);
1628  rear_axle_to_vehicle_rear = read_le<float>(in, hdr + 62);
1629  steer_ratio_poly_0 = read_le<float>(in, hdr + 70);
1630  steer_ratio_poly_1 = read_le<float>(in, hdr + 74);
1631  steer_ratio_poly_2 = read_le<float>(in, hdr + 78);
1632  steer_ratio_poly_3 = read_le<float>(in, hdr + 82);
1633 }
1634 
1637 {}
1638 
1639 void HostVehicleState2807::parse(const std::vector<uint8_t>& in)
1640 {
1641  ibeo_header.parse(in);
1642 
1643  uint16_t hdr = IBEO_HEADER_SIZE;
1644 
1645  timestamp = read_le<NTPTime>(in, hdr + 4);
1646  distance_x = read_le<int32_t>(in, hdr + 12);
1647  distance_y = read_le<int32_t>(in, hdr + 16);
1648  course_angle = read_le<float>(in, hdr + 24);
1649  longitudinal_velocity = read_le<float>(in, hdr + 28);
1650  yaw_rate = read_le<float>(in, hdr + 24);
1651  steering_wheel_angle = read_le<float>(in, hdr + 32);
1652  cross_acceleration = read_le<float>(in, hdr + 36);
1653  front_wheel_angle = read_le<float>(in, hdr + 40);
1654  vehicle_width = read_le<float>(in, hdr + 46);
1655  vehicle_front_to_front_axle = read_le<float>(in, hdr + 54);
1656  rear_axle_to_front_axle = read_le<float>(in, hdr + 58);
1657  rear_axle_to_vehicle_rear = read_le<float>(in, hdr + 62);
1658  steer_ratio_poly_0 = read_le<float>(in, hdr + 70);
1659  steer_ratio_poly_1 = read_le<float>(in, hdr + 74);
1660  steer_ratio_poly_2 = read_le<float>(in, hdr + 78);
1661  steer_ratio_poly_3 = read_le<float>(in, hdr + 82);
1662 
1663  longitudinal_acceleration = read_le<float>(in, hdr + 86);
1664 }
1665 
1667  IbeoTxMessage()
1668 {}
1669 
1670 void DeviceStatus::parse(const std::vector<uint8_t>& in)
1671 {
1672  ibeo_header.parse(in);
1673 
1674  uint16_t hdr = IBEO_HEADER_SIZE;
1675 
1676  scanner_type = read_le<uint8_t>(in, hdr + 6);
1677  sensor_temperature = read_le<float>(in, hdr + 36);
1678  frequency = read_le<float>(in, hdr + 40);
1679 }
1680 
1682 {
1684  ibeo_header.data_type_id = 0x2010;
1685 
1686  struct timeval tv;
1687  struct tm *tm;
1688  gettimeofday(&tv, NULL);
1689  tm = localtime(&tv.tv_sec); // NOLINT
1690  ibeo_header.time = unix_time_to_ntp(tm, &tv);
1691  ibeo_header.encode();
1692 
1693  encoded_data.insert(encoded_data.end(), ibeo_header.encoded_data.begin(), ibeo_header.encoded_data.end());
1694 
1695  command_identifier = 0x0005;
1696  version = 0x0002;
1697  begin_filter_range = 0x0000;
1698  end_filter_range = 0xFFFF;
1699 
1700  std::vector<uint8_t> encoded_command_identifier = write_be<uint16_t>(&command_identifier);
1701  std::vector<uint8_t> encoded_version = write_be<uint16_t>(&version);
1702  std::vector<uint8_t> encoded_begin_filter_range = write_be<uint16_t>(&begin_filter_range);
1703  std::vector<uint8_t> encoded_end_filter_range = write_be<uint16_t>(&end_filter_range);
1704 
1705  encoded_data.insert(encoded_data.end(), encoded_command_identifier.begin(), encoded_command_identifier.end());
1706  encoded_data.insert(encoded_data.end(), encoded_version.begin(), encoded_version.end());
1707  encoded_data.insert(encoded_data.end(), encoded_begin_filter_range.begin(), encoded_begin_filter_range.end());
1708  encoded_data.insert(encoded_data.end(), encoded_end_filter_range.begin(), encoded_end_filter_range.end());
1709 }
std::vector< IbeoObject > get_objects()
Definition: ibeo_core.cpp:1182
std::vector< Point3DL > get_scan_points()
Definition: ibeo_core.cpp:899
std::vector< Object2221 > object_list
Definition: ibeo_core.h:787
std::vector< uint8_t > encoded_data
Definition: ibeo_core.h:593
double ticks_to_angle(int16_t angle_ticks, uint16_t angle_ticks_per_rotation)
Definition: utils.h:45
std::vector< Point3D > get_contour_points()
Definition: ibeo_core.cpp:1069
CoordinateSystem coordinate_system
Definition: ibeo_core.h:731
std::vector< Point3D > contour_point_list
Definition: ibeo_core.h:431
const uint8_t IBEO_HEADER_SIZE
Definition: ibeo_core.h:30
std::vector< Object2280 > object_list
Definition: ibeo_core.h:853
void parse(const std::vector< uint8_t > &in, const uint16_t &offset, ByteOrder bo)
Definition: ibeo_core.cpp:55
std::vector< ScanPoint2208 > scan_point_list
Definition: ibeo_core.h:772
static std::shared_ptr< IbeoTxMessage > make_message(const uint16_t &data_type)
Definition: ibeo_core.cpp:528
void parse(const std::vector< uint8_t > &in, const uint16_t &offset, ByteOrder bo)
Definition: ibeo_core.cpp:64
void parse(const std::vector< uint8_t > &in)
Definition: ibeo_core.cpp:1610
void parse(const std::vector< uint8_t > &in, const uint16_t &offset, ByteOrder bo)
Definition: ibeo_core.cpp:72
void parse(const std::vector< uint8_t > &in)
Definition: ibeo_core.cpp:953
static const int32_t DATA_TYPE
Definition: ibeo_core.h:815
static const int32_t DATA_TYPE
Definition: ibeo_core.h:700
virtual std::vector< IbeoObject > get_objects()
Definition: ibeo_core.cpp:589
void parse(const std::vector< uint8_t > &in)
Definition: ibeo_core.cpp:651
std::vector< IbeoObject > get_objects()
Definition: ibeo_core.cpp:1506
void parse(const std::vector< uint8_t > &in, const uint16_t &offset)
Definition: ibeo_core.cpp:329
static const int32_t DATA_TYPE
Definition: ibeo_core.h:622
PointLocation reference_point_location
Definition: ibeo_core.h:415
void parse(const std::vector< uint8_t > &in, const uint16_t &offset)
Definition: ibeo_core.cpp:407
void parse(const std::vector< uint8_t > &in)
Definition: ibeo_core.cpp:1557
std::vector< ScanPoint2205 > scan_point_list
Definition: ibeo_core.h:736
void parse(const std::vector< uint8_t > &in, const uint16_t &offset)
Definition: ibeo_core.cpp:433
static const int32_t DATA_TYPE
Definition: ibeo_core.h:725
void parse(const std::vector< uint8_t > &in, const uint16_t &offset)
Definition: ibeo_core.cpp:118
std::vector< Object2271 > object_list
Definition: ibeo_core.h:837
std::vector< Point3DL > get_scan_points()
Definition: ibeo_core.cpp:687
void parse(const std::vector< uint8_t > &in)
Definition: ibeo_core.cpp:1639
TrackedProperties tracked_properties
Definition: ibeo_core.h:540
std::vector< Object2225 > object_list
Definition: ibeo_core.h:803
void parse(const std::vector< uint8_t > &in, const uint16_t &offset)
Definition: ibeo_core.cpp:272
static const int32_t DATA_TYPE
Definition: ibeo_core.h:832
void parse(const std::vector< uint8_t > &in)
Definition: ibeo_core.cpp:594
std::vector< Point3D > get_contour_points()
Definition: ibeo_core.cpp:974
void parse(const std::vector< uint8_t > &in, const uint16_t &offset)
Definition: ibeo_core.cpp:237
void parse(const std::vector< uint8_t > &in, const uint16_t &offset)
Definition: ibeo_core.cpp:286
void parse(const std::vector< uint8_t > &in)
Definition: ibeo_core.cpp:1584
std::vector< Point3DL > get_scan_points()
Definition: ibeo_core.cpp:835
static const int32_t DATA_TYPE
Definition: ibeo_core.h:865
static const int32_t DATA_TYPE
Definition: ibeo_core.h:969
MotorRotatingDirection motor_rotating_direction
Definition: ibeo_core.h:754
void parse(const std::vector< uint8_t > &in)
Definition: ibeo_core.cpp:1461
static const int32_t DATA_TYPE
Definition: ibeo_core.h:783
std::vector< IbeoObject > get_objects()
Definition: ibeo_core.cpp:1088
std::vector< ScannerInfo2204 > scanner_info_list
Definition: ibeo_core.h:713
void parse(const std::vector< uint8_t > &in)
Definition: ibeo_core.cpp:1274
CoordinateSystem object_coordinate_system
Definition: ibeo_core.h:414
MountingPositionF mounting_position
Definition: ibeo_core.h:871
static const int32_t DATA_TYPE
Definition: ibeo_core.h:799
void parse(const std::vector< uint8_t > &in, const uint16_t &offset)
Definition: ibeo_core.cpp:362
std::vector< Point3D > get_contour_points()
Definition: ibeo_core.cpp:1301
static const int32_t DATA_TYPE
Definition: ibeo_core.h:747
std::vector< Object2270 > object_list
Definition: ibeo_core.h:820
std::vector< Point3D > get_contour_points()
Definition: ibeo_core.cpp:1484
void parse(const std::vector< uint8_t > &in)
Definition: ibeo_core.cpp:800
void parse(const std::vector< uint8_t > &in, const uint16_t &offset)
Definition: ibeo_core.cpp:45
std::vector< uint8_t > image_buffer
Definition: ibeo_core.h:877
ByteOrder
std::vector< ScanPoint2204 > scan_point_list
Definition: ibeo_core.h:714
void parse(const std::vector< uint8_t > &in)
Definition: ibeo_core.cpp:1140
void parse(const std::vector< uint8_t > &in, const uint16_t &offset)
Definition: ibeo_core.cpp:221
void parse(const std::vector< uint8_t > &in)
Definition: ibeo_core.cpp:1048
NTPTime unix_time_to_ntp(struct tm *tm, struct timeval *tv)
Definition: utils.h:26
static const int32_t DATA_TYPE
Definition: ibeo_core.h:668
std::vector< ScanPoint2202 > scan_point_list
Definition: ibeo_core.h:689
static const int32_t DATA_TYPE
Definition: ibeo_core.h:849
std::vector< IbeoObject > get_objects()
Definition: ibeo_core.cpp:1339
std::vector< Point3D > get_contour_points()
Definition: ibeo_core.cpp:1163
std::vector< Point3DL > get_scan_points()
Definition: ibeo_core.cpp:775
void parse(const std::vector< uint8_t > &in)
Definition: ibeo_core.cpp:739
std::vector< IbeoObject > get_objects()
Definition: ibeo_core.cpp:993
virtual std::vector< Point3D > get_contour_points()
Definition: ibeo_core.cpp:584
virtual std::vector< Point3DL > get_scan_points()
Definition: ibeo_core.cpp:579
UntrackedProperties untracked_properties
Definition: ibeo_core.h:539
void parse(const std::vector< uint8_t > &in, const uint16_t &offset)
Definition: ibeo_core.cpp:133
std::vector< ScannerInfo2205 > scanner_info_list
Definition: ibeo_core.h:735
void parse(const std::vector< uint8_t > &in)
Definition: ibeo_core.cpp:1670
CoordinateSystem coordinate_system
Definition: ibeo_core.h:709
void parse(const std::vector< uint8_t > &in)
Definition: ibeo_core.cpp:860
void parse(const std::vector< uint8_t > &in)
Definition: ibeo_core.cpp:477
void parse(const std::vector< uint8_t > &in, const uint16_t &offset)
Definition: ibeo_core.cpp:255


ibeo_core
Author(s): Joshua Whitley , Daniel Stanek
autogenerated on Fri Jun 7 2019 21:53:43