imu_advanced_navigation_anpp
Protocol.hpp
Go to the documentation of this file.
1 #ifndef ADVANCED_NAVIGATION_ANPP_HEADER_HPP
2 #define ADVANCED_NAVIGATION_ANPP_HEADER_HPP
3 
4 #include <vector>
5 #include <cstdint>
6 #include <algorithm>
7 #include <stdexcept>
8 #include <cstring>
9 #include <map>
10 #include <type_traits>
11 #include <base/Timeout.hpp>
12 #include <iodrivers_base/Exceptions.hpp>
13 
14 #include <imu_advanced_navigation_anpp/Constants.hpp>
15 #include <imu_advanced_navigation_anpp/DeviceInformation.hpp>
16 #include <imu_advanced_navigation_anpp/Exceptions.hpp>
17 
19 {
31  namespace protocol
32  {
34  template<typename T, typename InputIterator>
35  inline T read16(InputIterator it)
36  {
37  static_assert(sizeof(T) == 2, "return type is not a 2-byte data type");
38  uint16_t b0 = *it;
39  uint16_t b1 = *(++it);
40  uint16_t r = b0 | b1 << 8;
41  return reinterpret_cast<T const&>(r);
42  }
43 
45  template<typename T, typename InputIterator>
46  inline T read32(InputIterator it)
47  {
48  static_assert(sizeof(T) == 4, "return type is not a 4-byte data type");
49  uint32_t b0 = *it;
50  uint32_t b1 = *(++it);
51  uint32_t b2 = *(++it);
52  uint32_t b3 = *(++it);
53  uint32_t r = b0 | b1 << 8 | b2 << 16 | b3 << 24;
54  return reinterpret_cast<T const&>(r);
55  }
56 
58  template<typename T, typename InputIterator>
59  inline T read64(InputIterator it)
60  {
61  static_assert(sizeof(T) == 8, "return type is not a 8-byte data type");
62  uint64_t b0 = *it;
63  uint64_t b1 = *(++it);
64  uint64_t b2 = *(++it);
65  uint64_t b3 = *(++it);
66  uint64_t b4 = *(++it);
67  uint64_t b5 = *(++it);
68  uint64_t b6 = *(++it);
69  uint64_t b7 = *(++it);
70  uint64_t r = b0 | b1 << 8 | b2 << 16 | b3 << 24 | b4 << 32 | b5 << 40 | b6 << 48 | b7 << 56;
71  return reinterpret_cast<T const&>(r);
72  }
73 
75  template<typename T, typename Out>
76  inline void write16(Out out, T sample)
77  {
78  static_assert(sizeof(T) == 2, "sample is not a 2-byte data type");
79  uint16_t value = reinterpret_cast<uint16_t&>(sample);
80  out[0] = value & 0xFF;
81  out[1] = (value >> 8) & 0xFF;
82  }
83 
85  template<typename T, typename Out>
86  inline void write32(Out out, T sample)
87  {
88  static_assert(sizeof(T) == 4, "sample is not a 4-byte data type");
89  uint32_t value = reinterpret_cast<uint32_t&>(sample);
90  out[0] = (value >> 0) & 0xFF;
91  out[1] = (value >> 8) & 0xFF;
92  out[2] = (value >> 16) & 0xFF;
93  out[3] = (value >> 24) & 0xFF;
94  }
95 
97  template<typename T, typename Out>
98  inline void write64(Out out, T sample)
99  {
100  static_assert(sizeof(T) == 8, "sample is not a 8-byte data type");
101  uint64_t value = reinterpret_cast<uint64_t&>(sample);
102  out[1] = (value >> 8) & 0xFF;
103  out[2] = (value >> 16) & 0xFF;
104  out[3] = (value >> 24) & 0xFF;
105  out[4] = (value >> 32) & 0xFF;
106  out[5] = (value >> 40) & 0xFF;
107  out[6] = (value >> 48) & 0xFF;
108  out[7] = (value >> 56) & 0xFF;
109  }
110 
111  static constexpr int PACKET_ID_COUNT = 256;
112 
117  struct Header
118  {
119  static constexpr int SIZE = 5;
128  uint8_t packet_id;
129  uint8_t payload_length;
138 
143  Header();
144 
148  Header(uint8_t packet_id, uint8_t const* begin, uint8_t const* end);
149 
151  size_t getPacketLength() const;
152 
155  bool isValid() const;
156 
159  bool isPacketValid(uint8_t const* begin, uint8_t const* end) const;
160 
163  uint8_t computeHeaderChecksum() const;
164  } __attribute__((packed));
165 
168  static constexpr int MAX_PACKET_SIZE = 256 + sizeof(Header);
169 
172  uint16_t crc(uint8_t const* begin, uint8_t const* end);
173 
175  struct Acknowledge
176  {
177  static constexpr uint8_t ID = 0;
178  static constexpr int SIZE = 4;
183  uint8_t result;
188  bool isMatching(Header const& header) const;
191  bool isSuccess() const;
192 
195  bool isPacketValidationFailure() const;
196 
204  bool isProtocolError() const;
205 
209  bool isSystemError() const;
210 
212  bool isNotReady() const;
213 
216  template<typename RandomInputIterator>
217  static Acknowledge unmarshal(RandomInputIterator begin, RandomInputIterator end)
218  {
219  if (end - begin != sizeof(Acknowledge))
220  throw std::length_error("Acknowledge::unmarshal buffer size not the expected size");
221  return Acknowledge{ begin[0], begin[1], begin[2], begin[3] };
222  }
223  } __attribute__((packed));
224 
230  struct Request
231  {
232  static constexpr uint8_t ID = 1;
233  static constexpr int MIN_SIZE = 0;
234 
235  template<typename OutputIterator, typename InputIterator>
236  OutputIterator marshal(OutputIterator out, InputIterator begin, InputIterator end) const
237  {
238  return std::copy(begin, end, out);
239  }
240 
241  template<typename OutputIterator>
242  OutputIterator marshal(OutputIterator out, uint8_t packet_id) const
243  {
244  return std::copy(&packet_id, &packet_id + 1, out);
245  }
246  } __attribute__((packed));
247 
250  {
253  };
254 
256  struct BootMode
257  {
258  static constexpr uint8_t ID = 2;
259  static constexpr int SIZE = 1;
260 
261  uint8_t boot_mode;
262 
263  template<typename OutputIterator>
264  OutputIterator marshal(OutputIterator out) const
265  {
266  *out = boot_mode;
267  return out + 1;
268  }
269 
270  template<typename RandomInputIterator>
271  static BootMode unmarshal(RandomInputIterator begin, RandomInputIterator end)
272  {
273  if (end - begin != sizeof(BootMode))
274  throw std::length_error("BootMode::unmarshal: buffer size is not expected size");
275  return BootMode{*begin};
276  }
277  } __attribute__((packed));
278 
281  {
282  static constexpr uint8_t ID = 3;
283  static constexpr int SIZE = 24;
284 
285  template<typename RandomInputIterator>
286  static DeviceInformation unmarshal(RandomInputIterator begin, RandomInputIterator end)
287  {
288  if (end - begin != sizeof(DeviceInformation))
289  throw std::length_error("DeviceInformation::unmarshal: buffer size is not expected size");
290 
291  DeviceInformation info;
292  info.software_version = read32<uint32_t>(begin);
293  info.device_id = read32<uint32_t>(begin + 4);
294  info.hardware_revision = read32<uint32_t>(begin + 8);
295  info.serial_number_part0 = read32<uint32_t>(begin + 12);
296  info.serial_number_part1 = read32<uint32_t>(begin + 16);
297  info.serial_number_part2 = read32<uint32_t>(begin + 20);
298  return info;
299  }
300  } __attribute__((packed));
301 
303  {
304  static constexpr uint8_t ID = 4;
305  static constexpr int SIZE = 4;
306 
307  uint8_t verification_sequence[4] = { 0x1C, 0x9E, 0x42, 0x85 };
308 
309  template<typename OutputIterator>
310  OutputIterator marshal(OutputIterator out) const
311  {
312  std::copy(verification_sequence, verification_sequence + 4, out);
313  return out + 4;
314  }
315  } __attribute__((packed));
316 
318  {
319  static constexpr uint8_t ID = 5;
320  static constexpr int SIZE = 4;
321 
322  uint8_t verification_sequence[4] = { 0x7E, 0x7A, 0x05, 0x21 };
323 
324  template<typename OutputIterator>
325  OutputIterator marshal(OutputIterator out) const
326  {
327  std::copy(verification_sequence, verification_sequence + 4, out);
328  return out + 4;
329  }
330  } __attribute__((packed));
331 
333  {
334  static constexpr uint8_t ID = 5;
335  static constexpr int SIZE = 4;
336 
337  uint8_t verification_sequence[4] = { 0xB7, 0x38, 0x5D, 0x9A };
338 
339  template<typename OutputIterator>
340  OutputIterator marshal(OutputIterator out) const
341  {
342  std::copy(verification_sequence, verification_sequence + 4, out);
343  return out + 4;
344  }
345  } __attribute__((packed));
346 
347  struct SystemState
348  {
349  static constexpr uint8_t ID = 20;
350  static constexpr int SIZE = 100;
351 
353  uint16_t system_status;
355  uint16_t filter_status;
358  double lat_lon_z[3];
359  float velocity_ned[3];
361  float g;
362  float rpy[3];
365 
366  template<typename InputIterator>
367  static SystemState unmarshal(InputIterator begin, InputIterator end)
368  {
369  if (end - begin != sizeof(SystemState))
370  throw std::length_error("SystemState::unmarshal buffer size not the expected size");
371 
372  SystemState state;
373  state.system_status = read16<uint16_t>(begin);
374  state.filter_status = read16<uint16_t>(begin + 2);
375  state.unix_time_seconds = read32<uint32_t>(begin + 4);
376  state.unix_time_microseconds = read32<uint32_t>(begin + 8);
377 
378  state.g = read32<float>(begin + 60);
379 
380  for (int i = 0; i < 3; ++i)
381  {
382  state.lat_lon_z[i] = read64<double>(begin + 12 + 8 * i);
383  state.velocity_ned[i] = read32<float>(begin + 36 + 4 * i);
384  state.body_acceleration_xyz[i] = read32<float>(begin + 48 + 4 * i);
385  state.rpy[i] = read32<float>(begin + 64 + 4 * i);
386  state.angular_velocity[i] = read32<float>(begin + 76 + 4 * i);
387  state.lat_lon_z_stddev[i] = read32<float>(begin + 88 + 4 * i);
388  }
389  return state;
390  }
391  } __attribute__((packed));
392 
393  struct UnixTime
394  {
395  static constexpr uint8_t ID = 21;
396  static constexpr int SIZE = 8;
397 
398  uint32_t seconds;
399  uint32_t microseconds;
400 
401  template<typename InputIterator>
402  static UnixTime unmarshal(InputIterator begin, InputIterator end)
403  {
404  if (end - begin != sizeof(UnixTime))
405  throw std::length_error("SystemState::unmarshal buffer size not the expected size");
406  return UnixTime{read32<uint32_t>(begin), read32<uint32_t>(begin + 4)};
407  }
408  } __attribute__((packed));
409 
410  struct Status
411  {
412  static constexpr uint8_t ID = 23;
413  static constexpr int SIZE = 4;
414 
416  uint16_t system_status;
418  uint16_t filter_status;
419 
420  template<typename InputIterator>
421  static Status unmarshal(InputIterator begin, InputIterator end)
422  {
423  if (end - begin != sizeof(Status))
424  throw std::length_error("SystemState::unmarshal buffer size not the expected size");
425  return Status{read16<uint16_t>(begin), read16<uint16_t>(begin + 2)};
426  }
427  } __attribute__((packed));
428 
430  {
431  static constexpr uint8_t ID = 24;
432  static constexpr int SIZE = 12;
433 
435 
436  template<typename InputIterator>
437  static GeodeticPositionStandardDeviation unmarshal(InputIterator begin, InputIterator end)
438  {
439  if (end - begin != sizeof(GeodeticPositionStandardDeviation))
440  throw std::length_error("SystemState::unmarshal buffer size not the expected size");
442  read32<float>(begin + 0),
443  read32<float>(begin + 4),
444  read32<float>(begin + 8)
445  };
446  }
447  } __attribute__((packed));
448 
450  {
451  static constexpr uint8_t ID = 25;
452  static constexpr int SIZE = 12;
453 
454  float ned[3];
455 
456  template<typename InputIterator>
457  static NEDVelocityStandardDeviation unmarshal(InputIterator begin, InputIterator end)
458  {
459  if (end - begin != sizeof(NEDVelocityStandardDeviation))
460  throw std::length_error("NEDVelocityStandardDeviation::unmarshal buffer size not the expected size");
462  read32<float>(begin + 0),
463  read32<float>(begin + 4),
464  read32<float>(begin + 8)
465  };
466  }
467  } __attribute__((packed));
468 
470  {
471  static constexpr uint8_t ID = 26;
472  static constexpr int SIZE = 12;
473 
474  float rpy[3];
475 
476  template<typename InputIterator>
477  static EulerOrientationStandardDeviation unmarshal(InputIterator begin, InputIterator end)
478  {
479  if (end - begin != sizeof(EulerOrientationStandardDeviation))
480  throw std::length_error("EulerOrientationStandardDeviation::unmarshal buffer size not the expected size");
482  read32<float>(begin + 0),
483  read32<float>(begin + 4),
484  read32<float>(begin + 8)
485  };
486  }
487  } __attribute__((packed));
488 
489  struct RawSensors
490  {
491  static constexpr uint8_t ID = 28;
492  static constexpr int SIZE = 48;
493 
495  float gyroscopes_xyz[3];
498  float pressure;
500 
501  template<typename InputIterator>
502  static RawSensors unmarshal(InputIterator begin, InputIterator end)
503  {
504  if (end - begin != sizeof(RawSensors))
505  throw std::length_error("RawSensors::unmarshal buffer size not the expected size");
506 
507  RawSensors out;
508  for (int i = 0; i < 3; ++i)
509  {
510  out.accelerometers_xyz[i] = read32<float>(begin + 0 + 4 * i);
511  out.gyroscopes_xyz[i] = read32<float>(begin + 12 + 4 * i);
512  out.magnetometers_xyz[i] = read32<float>(begin + 24 + 4 * i);
513  }
514 
515  out.imu_temperature_C = read32<float>(begin + 36);
516  out.pressure = read32<float>(begin + 40);
517  out.pressure_temperature_C = read32<float>(begin + 44);
518  return out;
519  }
520  } __attribute__((packed));
521 
522  struct RawGNSS
523  {
524  static constexpr uint8_t ID = 29;
525  static constexpr int SIZE = 74;
526 
529  double lat_lon_z[3];
530  float velocity_ned[3];
532  float pitch;
533  float yaw;
535  float yaw_stddev;
537  uint16_t status;
538 
539  template<typename InputIterator>
540  static RawGNSS unmarshal(InputIterator begin, InputIterator end)
541  {
542  if (end - begin != SIZE)
543  throw std::length_error("RawGNSS::unmarshal buffer size not the expected size");
544 
545  RawGNSS out;
546  out.unix_time_seconds = read32<uint32_t>(begin + 0);
547  out.unix_time_microseconds = read32<uint32_t>(begin + 4);
548  for (int i = 0; i < 3; ++i)
549  {
550  out.lat_lon_z[i] = read64<double>(begin + 8 + 8 * i);
551  out.velocity_ned[i] = read32<float>(begin + 32 + 4 * i);
552  out.lat_lon_z_stddev[i] = read32<float>(begin + 44 + 4 * i);
553  }
554 
555  out.pitch = read32<float>(begin + 56);
556  out.yaw = read32<float>(begin + 60);
557  out.pitch_stddev = read32<float>(begin + 64);
558  out.yaw_stddev = read32<float>(begin + 68);
559  out.status = read16<uint16_t>(begin + 72);
560  return out;
561  }
562  } __attribute__((packed));
563 
565  {
568  RAW_GNSS_2D = 0x01,
569  RAW_GNSS_3D = 0x02,
575 
582  };
583 
584  struct Satellites
585  {
586  static constexpr uint8_t ID = 30;
587  static constexpr int SIZE = 13;
588 
589  float hdop;
590  float vdop;
596 
597  template<typename InputIterator>
598  static Satellites unmarshal(InputIterator begin, InputIterator end)
599  {
600  if (end - begin != SIZE)
601  throw std::length_error("Satellites::unmarshal buffer size not the expected size");
602 
603  return Satellites {
604  read32<float>(begin + 0),
605  read32<float>(begin + 4),
606  begin[8],
607  begin[9],
608  begin[10],
609  begin[11],
610  begin[12]
611  };
612  }
613  } __attribute__((packed));
614 
616  {
626  };
627 
630  {
639  };
640 
643  {
644  static constexpr int SIZE = 7;
645 
647  uint8_t system;
649  uint8_t prn;
654  uint8_t frequencies;
656  uint8_t elevation;
658  uint16_t azimuth;
660  uint8_t snr;
661 
662  template<typename InputIterator>
663  static SatelliteInfo unmarshal(InputIterator begin, InputIterator end)
664  {
665  return SatelliteInfo{
666  begin[0], begin[1], begin[2], begin[3],
667  read16<uint16_t>(begin + 4), begin[6]
668  };
669  }
670  } __attribute__((packed));
671 
673  {
674  static constexpr uint8_t ID = 31;
675  static constexpr int MIN_SIZE = 0;
676 
677  template<typename InputIterator>
678  static void unmarshal(InputIterator begin, InputIterator end, std::vector<SatelliteInfo>& info)
679  {
680  if ((end - begin) % SatelliteInfo::SIZE != 0)
681  throw std::length_error("Satellites::unmarshal buffer is not a multiple of the SatelliteInfo size");
682 
683  for (; begin != end; begin += SatelliteInfo::SIZE)
684  {
685  info.push_back(SatelliteInfo::unmarshal(begin, begin + SatelliteInfo::SIZE));
686  }
687  }
688  } __attribute__((packed));
689 
691  {
692  static constexpr uint8_t ID = 32;
693  static constexpr int SIZE = 24;
694 
695  double lat_lon_z[3];
696 
697  template<typename InputIterator>
698  static GeodeticPosition unmarshal(InputIterator begin, InputIterator end)
699  {
700  if ((end - begin) != GeodeticPosition::SIZE)
701  throw std::length_error("GeodeticPosition::unmarshal unexpected buffer size");
702 
703  GeodeticPosition out;
704  for (int i = 0; i < 3; ++i)
705  out.lat_lon_z[i] = read64<double>(begin + 8 * i);
706  return out;
707  }
708  } __attribute__((packed));
709 
710  struct NEDVelocity
711  {
712  static constexpr uint8_t ID = 35;
713  static constexpr int SIZE = 12;
714 
715  float ned[3];
716 
717  template<typename InputIterator>
718  static NEDVelocity unmarshal(InputIterator begin, InputIterator end)
719  {
720  if ((end - begin) != SIZE)
721  throw std::length_error("NEDVelocity::unmarshal buffer is not of the expected size");
722 
723  return NEDVelocity { {
724  read32<float>(begin),
725  read32<float>(begin + 4),
726  read32<float>(begin + 8) } };
727  }
728  } __attribute__((packed));
729 
731  {
732  static constexpr uint8_t ID = 36;
733  static constexpr int SIZE = 12;
734 
735  float xyz[3];
736 
737  template<typename InputIterator>
738  static BodyVelocity unmarshal(InputIterator begin, InputIterator end)
739  {
740  if ((end - begin) != SIZE)
741  throw std::length_error("BodyVelocity::unmarshal buffer is not of the expected size");
742 
743  return BodyVelocity { {
744  read32<float>(begin),
745  read32<float>(begin + 4),
746  read32<float>(begin + 8) } };
747  }
748  } __attribute__((packed));
749 
752  {
753  static constexpr uint8_t ID = 37;
754  static constexpr int SIZE = 12;
755 
756  float xyz[3];
757 
758  template<typename InputIterator>
759  static Acceleration unmarshal(InputIterator begin, InputIterator end)
760  {
761  if ((end - begin) != SIZE)
762  throw std::length_error("Acceleration::unmarshal buffer is not of the expected size");
763 
764  return Acceleration { {
765  read32<float>(begin),
766  read32<float>(begin + 4),
767  read32<float>(begin + 8) } };
768  }
769  } __attribute__((packed));
770 
772  {
773  static constexpr uint8_t ID = 38;
774  static constexpr int SIZE = 16;
775 
776  float xyz[3];
777  float g;
778 
779  template<typename InputIterator>
780  static BodyAcceleration unmarshal(InputIterator begin, InputIterator end)
781  {
782  if ((end - begin) != SIZE)
783  throw std::length_error("BodyAcceleration::unmarshal buffer is not of the expected size");
784 
785  return BodyAcceleration {
786  {
787  read32<float>(begin),
788  read32<float>(begin + 4),
789  read32<float>(begin + 8)
790  },
791  read32<float>(begin + 12)
792  };
793  }
794  } __attribute__((packed));
795 
797  {
798  static constexpr uint8_t ID = 40;
799  static constexpr int SIZE = 16;
800 
801  float im;
802  float xyz[3];
803 
804  template<typename InputIterator>
805  static QuaternionOrientation unmarshal(InputIterator begin, InputIterator end)
806  {
807  if ((end - begin) != SIZE)
808  throw std::length_error("QuaternionOrientation::unmarshal buffer is not of the expected size");
809 
810  return QuaternionOrientation {
811  read32<float>(begin + 0),
812  {
813  read32<float>(begin + 4),
814  read32<float>(begin + 8),
815  read32<float>(begin + 12)
816  }
817  };
818  }
819  } __attribute__((packed));
820 
822  {
823  static constexpr uint8_t ID = 42;
824  static constexpr int SIZE = 12;
825 
826  float xyz[3];
827 
828  template<typename InputIterator>
829  static AngularVelocity unmarshal(InputIterator begin, InputIterator end)
830  {
831  if ((end - begin) != SIZE)
832  throw std::length_error("AngularVelocity::unmarshal buffer is not of the expected size");
833 
834  return AngularVelocity { {
835  read32<float>(begin),
836  read32<float>(begin + 4),
837  read32<float>(begin + 8) } };
838  }
839  } __attribute__((packed));
840 
842  {
843  static constexpr uint8_t ID = 43;
844  static constexpr int SIZE = 12;
845 
846  float xyz[3];
847 
848  template<typename InputIterator>
849  static AngularAcceleration unmarshal(InputIterator begin, InputIterator end)
850  {
851  if ((end - begin) != SIZE)
852  throw std::length_error("AngularAcceleration::unmarshal buffer is not of the expected size");
853 
854  return AngularAcceleration { {
855  read32<float>(begin),
856  read32<float>(begin + 4),
857  read32<float>(begin + 8) } };
858  }
859  } __attribute__((packed));
860 
862  {
863  static constexpr uint8_t ID = 50;
864  static constexpr int SIZE = 12;
865 
866  float xyz[3];
867 
868  template<typename InputIterator>
869  static LocalMagneticField unmarshal(InputIterator begin, InputIterator end)
870  {
871  if ((end - begin) != SIZE)
872  throw std::length_error("LocalMagneticField::unmarshal buffer is not of the expected size");
873 
874  return LocalMagneticField { {
875  read32<float>(begin),
876  read32<float>(begin + 4),
877  read32<float>(begin + 8) } };
878  }
879  } __attribute__((packed));
880 
882  {
883  static constexpr uint8_t ID = 71;
884  static constexpr int SIZE = 28;
885 
887  uint16_t flags;
888  uint16_t reserved = 0;
889  uint8_t progress[4];
893 
894  template<typename InputIterator>
895  static NorthSeekingInitializationStatus unmarshal(InputIterator begin, InputIterator end)
896  {
897  if (end - begin != SIZE)
898  throw std::length_error("MagneticCalibrationStatus::unmarshal buffer size not the expected size");
899 
901  out.flags = read16<uint16_t>(begin);
902  std::copy_n(begin + 4, 4, out.progress);
903  out.current_rotation_angle = read32<float>(begin + 8);
904  for (int i = 0; i < 3; ++i)
905  out.gyroscope_bias_solution_xyz[i] = read32<float>(begin + 12 + 4 * i);
906  out.gyroscope_bias_solution_error = read32<float>(begin + 24);
907  return out;
908  }
909  } __attribute__((packed));
910 
912  {
913  static constexpr uint8_t ID = 180;
914  static constexpr int SIZE = 4;
915 
916  uint8_t permanent;
918  uint16_t period;
919 
920  template<typename OutputIterator>
921  OutputIterator marshal(OutputIterator out) const
922  {
923  out[0] = permanent;
924  out[1] = utc_synchronization;
925  write16(out + 2, period);
926  return out + SIZE;
927  }
928 
929  template<typename InputIterator>
930  static PacketTimerPeriod unmarshal(InputIterator begin, InputIterator end)
931  {
932  if (end - begin != SIZE)
933  throw std::length_error("PacketTimerPeriod::unmarshal buffer size not the expected size");
934 
935  PacketTimerPeriod out;
936  out.permanent = 0;
937  out.utc_synchronization = *(begin + 1);
938  out.period = read16<uint16_t>(begin + 2);
939  return out;
940  }
941  } __attribute__((packed));
942 
944  {
945  static constexpr uint8_t ID = 181;
946  static constexpr int MIN_SIZE = 2;
947  static constexpr int PERIOD_SIZE = 5;
948 
949  typedef std::map<uint8_t, uint32_t> Periods;
950 
951  uint8_t permanent;
952  uint8_t clear_existing;
953 
954  template<typename OutputIterator>
955  OutputIterator marshal(OutputIterator out) const
956  {
957  out[0] = permanent;
958  out[1] = clear_existing;
959  return out + MIN_SIZE;
960  }
961 
962  template<typename OutputIterator>
963  OutputIterator marshal(OutputIterator out, uint8_t packet_id, uint32_t period) const
964  {
965  out[0] = permanent;
966  out[1] = clear_existing;
967  std::pair<uint8_t, uint32_t> pair(packet_id, period);
968  return marshal(out, &pair, &pair + 1);
969  }
970 
971  template<typename OutputIterator, typename InputIterator>
972  OutputIterator marshal(OutputIterator out, InputIterator begin, InputIterator end) const
973  {
974  out[0] = permanent;
975  out[1] = clear_existing;
976  for (out += 2; begin != end; ++begin, out += PERIOD_SIZE)
977  {
978  out[0] = begin->first;
979  write32(out + 1, begin->second);
980  }
981  return out;
982  }
983 
984  template<typename InputIterator>
985  static std::map<uint8_t, uint32_t> unmarshal(InputIterator begin, InputIterator end)
986  {
987  if ((end - begin) < MIN_SIZE)
988  throw std::length_error("PacketPeriods::unmarshal buffer too small");
989  else if ((end - begin - MIN_SIZE) % PERIOD_SIZE != 0)
990  throw std::length_error("PacketPeriods::unmarshal expected period list to be a multiple of 5");
991  begin += MIN_SIZE;
992  std::map<uint8_t, uint32_t> result;
993  for (; begin != end; begin += PERIOD_SIZE)
994  result[*begin] = read32<uint32_t>(begin + 1);
995  return result;
996  }
997  } __attribute__((packed));
998 
999  struct BaudRates
1000  {
1001  static constexpr uint8_t ID = 182;
1002  static constexpr int SIZE = 17;
1003 
1004  uint8_t permanent;
1005  uint32_t primary_port;
1006  uint32_t gpio;
1008  uint32_t reserved;
1009 
1010  template<typename OutputIterator>
1011  OutputIterator marshal(OutputIterator out) const
1012  {
1013  out[0] = permanent;
1014  write32(out + 1, primary_port);
1015  write32(out + 5, gpio);
1016  write32(out + 9, auxiliary_rs232);
1017  write32(out + 13, static_cast<uint32_t>(0));
1018  return out + 17;
1019  }
1020 
1021  template<typename InputIterator>
1022  static BaudRates unmarshal(InputIterator begin, InputIterator end)
1023  {
1024  if (end - begin != SIZE)
1025  throw std::length_error("BaudRates::unmarshal buffer size not the expected size");
1026 
1027  return BaudRates {
1028  0,
1029  read32<uint32_t>(begin + 1),
1030  read32<uint32_t>(begin + 5),
1031  read32<uint32_t>(begin + 9),
1032  static_cast<uint32_t>(0)
1033  };
1034  }
1035  } __attribute__((packed));
1036 
1037  struct Alignment
1038  {
1039  static constexpr uint8_t ID = 185;
1040  static constexpr int SIZE = 73;
1041 
1042  uint8_t permanent;
1043  float dcm[9];
1047 
1048  template<typename OutputIterator>
1049  OutputIterator marshal(OutputIterator out) const
1050  {
1051  out[0] = permanent;
1052  for (int i = 0; i < 9; ++i)
1053  write32(out + 1 + 4 * i, dcm[i]);
1054  for (int i = 0; i < 3; ++i)
1055  {
1056  write32(out + 37 + 4 * i, gnss_antenna_offset_xyz[i]);
1057  write32(out + 49 + 4 * i, odometer_offset_xyz[i]);
1058  write32(out + 61 + 4 * i, external_data_offset_xyz[i]);
1059  }
1060  return out + SIZE;
1061  }
1062 
1063  template<typename InputIterator>
1064  static Alignment unmarshal(InputIterator begin, InputIterator end)
1065  {
1066  if (end - begin != SIZE)
1067  throw std::length_error("Alignment::unmarshal buffer size not the expected size");
1068 
1069  Alignment out;
1070  out.permanent = 0;
1071  for (int i = 0; i < 9; ++i)
1072  out.dcm[i] = read32<float>(begin + 1 + 4 * i);
1073  for (int i = 0; i < 3; ++i)
1074  {
1075  out.gnss_antenna_offset_xyz[i] = read32<float>(begin + 37 + 4 * i);
1076  out.odometer_offset_xyz[i] = read32<float>(begin + 49 + 4 * i);
1077  out.external_data_offset_xyz[i] = read32<float>(begin + 61 + 4 * i);
1078  }
1079  return out;
1080  }
1081  } __attribute__((packed));
1082 
1084  {
1085  static constexpr uint8_t ID = 186;
1086  static constexpr int SIZE = 17;
1087 
1088  uint8_t permanent;
1093  uint8_t vehicle_type;
1095  uint8_t reserved_0 = 0;
1100  uint8_t reserved_1[9] = { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
1101 
1102  template<typename OutputIterator>
1103  OutputIterator marshal(OutputIterator out) const
1104  {
1105  return std::copy(&permanent, reserved_1 + 9, out);
1106  }
1107 
1108  template<typename InputIterator>
1109  static FilterOptions unmarshal(InputIterator begin, InputIterator end)
1110  {
1111  if (end - begin != SIZE)
1112  throw std::length_error("FilterOptions::unmarshal buffer size not the expected size");
1113 
1114  FilterOptions out;
1115  out.permanent = 0;
1116  std::copy(begin + 1, end, &out.vehicle_type);
1117  return out;
1118  }
1119  } __attribute__ ((packed));
1120 
1122  {
1123  static constexpr uint8_t ID = 189;
1124  static constexpr int SIZE = 49;
1125 
1126  uint8_t permanent;
1129 
1130  template<typename OutputIterator>
1131  OutputIterator marshal(OutputIterator out) const
1132  {
1133  out[0] = permanent;
1134  for (int i = 0; i < 3; ++i)
1135  write32(out + 1 + 4 * i, hard_iron_bias_xyz[i]);
1136  for (int i = 0; i < 9; ++i)
1137  write32(out + 13 + 4 * i, soft_iron_transformation[i]);
1138  return out + SIZE;
1139  }
1140 
1141  template<typename InputIterator>
1142  static MagneticCalibrationValues unmarshal(InputIterator begin, InputIterator end)
1143  {
1144  if (end - begin != SIZE)
1145  throw std::length_error("MagneticCalibrationValues::unmarshal buffer size not the expected size");
1146 
1148  out.permanent = 0;
1149  for (int i = 0; i < 3; ++i)
1150  out.hard_iron_bias_xyz[i] = read32<float>(begin + 1 + 4 * i);
1151  for (int i = 0; i < 9; ++i)
1152  out.soft_iron_transformation[i] = read32<float>(begin + 13 + 4 * i);
1153  return out;
1154  }
1155  } __attribute__((packed));
1156 
1158  {
1159  static constexpr uint8_t ID = 190;
1160  static constexpr int SIZE = 1;
1161 
1163  uint8_t action;
1164 
1165  template<typename OutputIterator>
1166  OutputIterator marshal(OutputIterator out) const
1167  {
1168  out[0] = action;
1169  return out + SIZE;
1170  }
1171  } __attribute__((packed));
1172 
1174  {
1179  };
1180 
1182  {
1183  static constexpr uint8_t ID = 191;
1184  static constexpr int SIZE = 3;
1185 
1187  uint8_t status;
1188  uint8_t progress;
1189  uint8_t error;
1190 
1191  template<typename InputIterator>
1192  static MagneticCalibrationStatus unmarshal(InputIterator begin, InputIterator end)
1193  {
1194  if (end - begin != SIZE)
1195  throw std::length_error("MagneticCalibrationStatus::unmarshal buffer size not the expected size");
1196 
1198  std::copy(begin, end, &out.status);
1199  return out;
1200  }
1201  } __attribute__((packed));
1202 
1203  template<typename Packet, typename Driver>
1204  inline Header writePacket(Driver& driver, Packet const& packet)
1205  {
1206  static_assert(Packet::SIZE + Header::SIZE < 300, "packet and header size are bigger than the expected buffer size");
1207  uint8_t marshalled[300];
1208  uint8_t* marshalled_end = packet.marshal(marshalled + Header::SIZE);
1209  Header const* header =
1210  new(marshalled) Header(Packet::ID, marshalled + Header::SIZE, marshalled_end);
1211  driver.writePacket(marshalled, marshalled_end - marshalled);
1212  return *header;
1213  }
1214 
1215  template<typename Packet, typename Driver>
1216  inline Packet waitForPacket(Driver& driver, base::Time const& _timeout)
1217  {
1218  uint8_t marshalled[MAX_PACKET_SIZE * 10];
1219  driver.resetPollSynchronization();
1220 
1221  base::Timeout timeout(_timeout);
1222  do
1223  {
1224  base::Time left = timeout.timeLeft();
1225  if (left.toMicroseconds() < 0)
1226  left = base::Time();
1227  int packet_size = driver.readPacket(marshalled, sizeof(marshalled), left);
1228 
1229  Header const& header = reinterpret_cast<Header const&>(*marshalled);
1230  if (header.packet_id == Packet::ID)
1231  return Packet::unmarshal(marshalled + Header::SIZE, marshalled + packet_size);
1232  }
1233  while (!timeout.elapsed());
1234  throw iodrivers_base::TimeoutError(
1235  iodrivers_base::TimeoutError::NONE,
1236  "failed to get an expected response from the device");
1237  }
1238 
1239  template<typename Driver>
1240  inline ACK_RESULTS waitForAck(Driver& driver, Header const& header, base::Time const& _timeout)
1241  {
1242  base::Timeout timeout(_timeout);
1243  do
1244  {
1245  base::Time left = timeout.timeLeft();
1246  if (left.toMicroseconds() < 0)
1247  left = base::Time();
1248  Acknowledge ack = waitForPacket<Acknowledge>(driver, left);
1249 
1250  if (ack.isMatching(header))
1251  return static_cast<ACK_RESULTS>(ack.result);
1252  }
1253  while (!timeout.elapsed());
1254  throw iodrivers_base::TimeoutError(
1255  iodrivers_base::TimeoutError::NONE,
1256  "failed to get an ack matching the given packet header");
1257  }
1258 
1259  template<typename Driver>
1260  inline void validateAck(Driver& driver, Header const& header, base::Time const& _timeout)
1261  {
1262  ACK_RESULTS result = waitForAck(driver, header, _timeout);
1263  if (result != ACK_SUCCESS)
1264  throw AcknowledgeFailure(header.packet_id, result);
1265  }
1266 
1267  template<typename Packet, typename Driver>
1268  inline Packet query(Driver& driver)
1269  {
1270  uint8_t marshalled[MAX_PACKET_SIZE];
1271  uint8_t* marshalled_end = Request().marshal(marshalled + Header::SIZE, Packet::ID);
1272  new(marshalled) Header(Request::ID, marshalled + Header::SIZE, marshalled_end);
1273  driver.writePacket(marshalled, marshalled_end - marshalled);
1274 
1275  return waitForPacket<Packet>(driver, driver.getReadTimeout());
1276  }
1277 
1278  template<typename Driver>
1279  inline Header writePacketPeriod(Driver& driver, uint8_t packet_id, int period, bool clear_existing)
1280  {
1281  uint8_t marshalled[MAX_PACKET_SIZE];
1282  PacketPeriods packet;
1283  packet.permanent = 0;
1284  packet.clear_existing = clear_existing ? 1 : 0;
1285  uint8_t* marshalled_end = packet.marshal(marshalled + Header::SIZE, packet_id, period);
1286  Header const* header =
1287  new(marshalled) Header(PacketPeriods::ID, marshalled + Header::SIZE, marshalled_end);
1288  driver.writePacket(marshalled, marshalled_end - marshalled);
1289  return *header;
1290  }
1291  }
1292 }
1293 
1294 #endif
uint32_t serial_number_part2
Definition: DeviceInformation.hpp:15
static BodyAcceleration unmarshal(InputIterator begin, InputIterator end)
Definition: Protocol.hpp:780
float angular_velocity[3]
Definition: Protocol.hpp:187
uint32_t software_version
Definition: DeviceInformation.hpp:10
static void unmarshal(InputIterator begin, InputIterator end, std::vector< SatelliteInfo > &info)
Definition: Protocol.hpp:678
uint8_t payload_checksum_lsb
Definition: Protocol.hpp:133
bool isNotReady() const
Definition: Exceptions.hpp:11
uint32_t auxiliary_rs232
Definition: Protocol.hpp:1007
uint8_t verification_sequence[4]
Definition: Protocol.hpp:176
float gyroscopes_xyz[3]
Definition: Protocol.hpp:495
uint16_t reserved
Definition: Protocol.hpp:178
static BaudRates unmarshal(InputIterator begin, InputIterator end)
Definition: Protocol.hpp:1022
float odometer_offset_xyz[3]
Definition: Protocol.hpp:179
static UnixTime unmarshal(InputIterator begin, InputIterator end)
Definition: Protocol.hpp:402
uint16_t filter_status
Definition: Protocol.hpp:418
static PacketTimerPeriod unmarshal(InputIterator begin, InputIterator end)
Definition: Protocol.hpp:930
OutputIterator marshal(OutputIterator out) const
Definition: Protocol.hpp:264
float pitch
Definition: Protocol.hpp:532
float yaw
Definition: Protocol.hpp:533
OutputIterator marshal(OutputIterator out) const
Definition: Protocol.hpp:1049
SATELLITE_FREQUENCIES
Definition: Protocol.hpp:629
float hard_iron_bias_xyz[3]
Definition: Protocol.hpp:177
uint8_t permanent
Definition: Protocol.hpp:176
uint32_t device_id
Definition: DeviceInformation.hpp:11
static constexpr uint8_t ID
Definition: Protocol.hpp:232
float dcm[9]
Definition: Protocol.hpp:1043
static constexpr int SIZE
Definition: Protocol.hpp:119
T read64(InputIterator it)
Definition: Protocol.hpp:59
uint16_t system_status
Definition: Protocol.hpp:416
uint8_t boot_mode
Definition: Protocol.hpp:176
static SystemState unmarshal(InputIterator begin, InputIterator end)
Definition: Protocol.hpp:367
static Status unmarshal(InputIterator begin, InputIterator end)
Definition: Protocol.hpp:421
size_t getPacketLength() const
Definition: Protocol.cpp:70
uint8_t enabled_velocity_heading
Definition: Protocol.hpp:1097
float pitch_stddev
Definition: Protocol.hpp:534
double lat_lon_z[3]
Definition: Protocol.hpp:182
Definition: Driver.hpp:49
OutputIterator marshal(OutputIterator out) const
Definition: Protocol.hpp:1166
uint8_t sbas_satellite_count
Definition: Protocol.hpp:595
uint8_t frequencies
Definition: Protocol.hpp:654
static MagneticCalibrationValues unmarshal(InputIterator begin, InputIterator end)
Definition: Protocol.hpp:1142
uint8_t payload_checksum_msb
Definition: Protocol.hpp:137
static RawSensors unmarshal(InputIterator begin, InputIterator end)
Definition: Protocol.hpp:502
uint8_t permanent
Definition: Protocol.hpp:1004
float velocity_ned[3]
Definition: Protocol.hpp:530
uint8_t result
Definition: Protocol.hpp:179
static GeodeticPosition unmarshal(InputIterator begin, InputIterator end)
Definition: Protocol.hpp:698
uint16_t system_status
Definition: Protocol.hpp:353
uint32_t unix_time_microseconds
Definition: Protocol.hpp:528
uint32_t serial_number_part1
Definition: DeviceInformation.hpp:14
double lat_lon_z[3]
Definition: Protocol.hpp:358
float hdop
Definition: Protocol.hpp:589
float velocity_ned[3]
Definition: Protocol.hpp:183
uint8_t snr
Definition: Protocol.hpp:660
float odometer_offset_xyz[3]
Definition: Protocol.hpp:1045
OutputIterator marshal(OutputIterator out) const
Definition: Protocol.hpp:1011
uint8_t beidou_satellite_count
Definition: Protocol.hpp:593
float lat_lon_z_stddev[3]
Definition: Protocol.hpp:531
std::map< uint8_t, uint32_t > Periods
Definition: Protocol.hpp:949
static BootMode unmarshal(RandomInputIterator begin, RandomInputIterator end)
Definition: Protocol.hpp:271
uint8_t system
Definition: Protocol.hpp:647
float lat_lon_z_stddev[3]
Definition: Protocol.hpp:364
bool isProtocolError() const
static Satellites unmarshal(InputIterator begin, InputIterator end)
Definition: Protocol.hpp:598
void write64(Out out, T sample)
Definition: Protocol.hpp:98
float accelerometers_xyz[3]
Definition: Protocol.hpp:494
static AngularVelocity unmarshal(InputIterator begin, InputIterator end)
Definition: Protocol.hpp:829
RAW_GNSS_STATUS
Definition: Protocol.hpp:564
float velocity_ned[3]
Definition: Protocol.hpp:359
uint32_t microseconds
Definition: Protocol.hpp:399
uint8_t enabled_atmospheric_altitude
Definition: Protocol.hpp:1096
uint8_t utc_synchronization
Definition: Protocol.hpp:917
uint8_t acked_payload_checksum_lsb
Definition: Protocol.hpp:177
static Acknowledge unmarshal(RandomInputIterator begin, RandomInputIterator end)
Definition: Protocol.hpp:217
uint8_t acked_packet_id
Definition: Protocol.hpp:176
static DeviceInformation unmarshal(RandomInputIterator begin, RandomInputIterator end)
Definition: Protocol.hpp:286
uint16_t status
Definition: Protocol.hpp:537
Definition: DeviceInformation.hpp:8
MAGNETIC_CALIBRATION_ACTIONS
Definition: Protocol.hpp:1173
uint16_t crc(uint8_t const *begin, uint8_t const *end)
Definition: Protocol.cpp:63
uint32_t hardware_revision
Definition: DeviceInformation.hpp:12
float dcm[9]
Definition: Protocol.hpp:177
uint8_t clear_existing
Definition: Protocol.hpp:952
bool isSystemError() const
uint32_t reserved
Definition: Protocol.hpp:1008
uint8_t utc_synchronization
Definition: Protocol.hpp:177
void resetPollSynchronization()
Definition: Driver.cpp:634
static constexpr int SIZE
Definition: Protocol.hpp:693
Packet query(Driver &driver)
Definition: Protocol.hpp:1268
float body_acceleration_xyz[3]
Definition: Protocol.hpp:360
float gnss_antenna_offset_xyz[3]
Definition: Protocol.hpp:1044
ACK_RESULTS
Definition: Exceptions.hpp:9
uint8_t reserved_1[9]
Definition: Protocol.hpp:188
OutputIterator marshal(OutputIterator out, InputIterator begin, InputIterator end) const
Definition: Protocol.hpp:972
uint32_t gpio
Definition: Protocol.hpp:1006
static AngularAcceleration unmarshal(InputIterator begin, InputIterator end)
Definition: Protocol.hpp:849
uint16_t filter_status
Definition: Protocol.hpp:355
static BodyVelocity unmarshal(InputIterator begin, InputIterator end)
Definition: Protocol.hpp:738
uint8_t enabled_reversing_detection
Definition: Protocol.hpp:1098
static constexpr int SIZE
Definition: Protocol.hpp:644
static Alignment unmarshal(InputIterator begin, InputIterator end)
Definition: Protocol.hpp:1064
OutputIterator marshal(OutputIterator out, InputIterator begin, InputIterator end) const
Definition: Protocol.hpp:177
uint32_t primary_port
Definition: Protocol.hpp:1005
float soft_iron_transformation[9]
Definition: Protocol.hpp:178
float angular_velocity[3]
Definition: Protocol.hpp:363
Header writePacket(Driver &driver, Packet const &packet)
Definition: Protocol.hpp:1204
static NEDVelocity unmarshal(InputIterator begin, InputIterator end)
Definition: Protocol.hpp:718
uint8_t packet_id
Definition: Protocol.hpp:128
uint8_t glonass_satellite_count
Definition: Protocol.hpp:592
float pressure_temperature_C
Definition: Protocol.hpp:499
float yaw_stddev
Definition: Protocol.hpp:535
static EulerOrientationStandardDeviation unmarshal(InputIterator begin, InputIterator end)
Definition: Protocol.hpp:477
static MagneticCalibrationStatus unmarshal(InputIterator begin, InputIterator end)
Definition: Protocol.hpp:1192
uint8_t enabled_internal_gnss
Definition: Protocol.hpp:1094
OutputIterator marshal(OutputIterator out) const
Definition: Protocol.hpp:310
uint8_t acked_payload_checksum_msb
Definition: Protocol.hpp:178
uint8_t enabled_motion_analysis
Definition: Protocol.hpp:1099
uint8_t reserved_0
Definition: Protocol.hpp:183
float rpy[3]
Definition: Protocol.hpp:362
static GeodeticPositionStandardDeviation unmarshal(InputIterator begin, InputIterator end)
Definition: Protocol.hpp:437
static LocalMagneticField unmarshal(InputIterator begin, InputIterator end)
Definition: Protocol.hpp:869
static NorthSeekingInitializationStatus unmarshal(InputIterator begin, InputIterator end)
Definition: Protocol.hpp:895
uint16_t period
Definition: Protocol.hpp:178
float vdop
Definition: Protocol.hpp:590
double lat_lon_z[3]
Definition: Protocol.hpp:529
uint8_t progress[4]
Definition: Protocol.hpp:179
OutputIterator marshal(OutputIterator out) const
Definition: Protocol.hpp:340
float accelerometers_xyz[3]
Definition: Protocol.hpp:176
uint8_t permanent
Definition: Protocol.hpp:1042
uint32_t unix_time_microseconds
Definition: Protocol.hpp:357
float xyz[3]
Definition: Protocol.hpp:176
static constexpr uint8_t ID
Definition: Protocol.hpp:945
BOOT_MODES
Definition: Protocol.hpp:249
OutputIterator marshal(OutputIterator out, uint8_t packet_id) const
Definition: Protocol.hpp:242
OutputIterator marshal(OutputIterator out) const
Definition: Protocol.hpp:325
Header writePacketPeriod(Driver &driver, uint8_t packet_id, int period, bool clear_existing)
Definition: Protocol.hpp:1279
uint8_t computeHeaderChecksum() const
Definition: Protocol.cpp:75
uint8_t boot_mode
Definition: Protocol.hpp:261
void validateAck(Driver &driver, Header const &header, base::Time const &_timeout)
Definition: Protocol.hpp:1260
bool isPacketValid(uint8_t const *begin, uint8_t const *end) const
Definition: Protocol.cpp:85
static std::map< uint8_t, uint32_t > unmarshal(InputIterator begin, InputIterator end)
Definition: Protocol.hpp:985
static FilterOptions unmarshal(InputIterator begin, InputIterator end)
Definition: Protocol.hpp:1109
float body_acceleration_xyz[3]
Definition: Protocol.hpp:184
float pressure
Definition: Protocol.hpp:498
ACK_RESULTS waitForAck(Driver &driver, Header const &header, base::Time const &_timeout)
Definition: Protocol.hpp:1240
OutputIterator marshal(OutputIterator out) const
Definition: Protocol.hpp:1131
uint8_t payload_length
Definition: Protocol.hpp:129
bool isMatching(Header const &header) const
void write16(Out out, T sample)
Definition: Protocol.hpp:76
T read32(InputIterator it)
Definition: Protocol.hpp:46
enum imu_advanced_navigation_anpp::protocol::BOOT_MODES __attribute__
bool isPacketValidationFailure() const
float imu_temperature_C
Definition: Protocol.hpp:497
uint32_t unix_time_seconds
Definition: Protocol.hpp:356
uint32_t seconds
Definition: Protocol.hpp:398
uint32_t serial_number_part0
Definition: DeviceInformation.hpp:13
bool isSuccess() const
uint8_t galileo_satellite_count
Definition: Protocol.hpp:594
float gyroscope_bias_solution_xyz[3]
Definition: Protocol.hpp:181
static QuaternionOrientation unmarshal(InputIterator begin, InputIterator end)
Definition: Protocol.hpp:805
static Acceleration unmarshal(InputIterator begin, InputIterator end)
Definition: Protocol.hpp:759
OutputIterator marshal(OutputIterator out) const
Definition: Protocol.hpp:921
uint8_t prn
Definition: Protocol.hpp:649
OutputIterator marshal(OutputIterator out) const
Definition: Protocol.hpp:1103
SATELLITE_SYSTEM
Definition: Protocol.hpp:615
uint8_t gps_satellite_count
Definition: Protocol.hpp:591
uint8_t permanent
Definition: Protocol.hpp:1088
uint8_t permanent
Definition: Protocol.hpp:951
uint8_t vehicle_type
Definition: Protocol.hpp:1093
double lat_lon_z[3]
Definition: Protocol.hpp:695
uint8_t action
Definition: Protocol.hpp:177
float soft_iron_transformation[9]
Definition: Protocol.hpp:1128
static NEDVelocityStandardDeviation unmarshal(InputIterator begin, InputIterator end)
Definition: Protocol.hpp:457
uint8_t header_checksum
Definition: Protocol.hpp:127
uint8_t clear_existing
Definition: Protocol.hpp:180
float gnss_antenna_offset_xyz[3]
Definition: Protocol.hpp:178
static SatelliteInfo unmarshal(InputIterator begin, InputIterator end)
Definition: Protocol.hpp:663
OutputIterator marshal(OutputIterator out, uint8_t packet_id, uint32_t period) const
Definition: Protocol.hpp:963
Definition: Configuration.hpp:8
float external_data_offset_xyz[3]
Definition: Protocol.hpp:180
float gyroscopes_xyz[3]
Definition: Protocol.hpp:177
Packet waitForPacket(Driver &driver, base::Time const &_timeout)
Definition: Protocol.hpp:1216
OutputIterator marshal(OutputIterator out) const
Definition: Protocol.hpp:955
float lat_lon_z_stddev[3]
Definition: Protocol.hpp:188
OutputIterator marshal(OutputIterator out, InputIterator begin, InputIterator end) const
Definition: Protocol.hpp:236
float magnetometers_xyz[3]
Definition: Protocol.hpp:496
bool isValid() const
Definition: Protocol.cpp:80
float external_data_offset_xyz[3]
Definition: Protocol.hpp:1046
uint32_t unix_time_seconds
Definition: Protocol.hpp:527
static RawGNSS unmarshal(InputIterator begin, InputIterator end)
Definition: Protocol.hpp:540
void write32(Out out, T sample)
Definition: Protocol.hpp:86
uint8_t elevation
Definition: Protocol.hpp:656
uint16_t azimuth
Definition: Protocol.hpp:658
float rpy[3]
Definition: Protocol.hpp:186
T read16(InputIterator it)
Definition: Protocol.hpp:35
float magnetometers_xyz[3]
Definition: Protocol.hpp:178
float ned[3]
Definition: Protocol.hpp:176