MIP SDK  0.0.1
MicroStrain Communications Library for embedded systems
data_sensor.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include "descriptors.h"
4 #include "../mip_result.h"
5 
6 #include <stdint.h>
7 #include <stddef.h>
8 #include <stdbool.h>
9 
10 namespace mip {
11 class Serializer;
12 
13 namespace C {
14 struct mip_interface;
15 } // namespace C
16 
17 namespace data_sensor {
18 
25 
27 // Descriptors
29 
30 enum
31 {
33 
35  DATA_GYRO_RAW = 0x02,
36  DATA_MAG_RAW = 0x03,
49  DATA_STAB_MAG = 0x10,
57  DATA_ODOMETER = 0x40,
58 
61 };
62 
64 // Shared Type Definitions
66 
67 
69 // Mip Fields
71 
78 
79 struct RawAccel
80 {
83 
84  static const bool HAS_FUNCTION_SELECTOR = false;
85 
86  float raw_accel[3] = {0};
87 
88 };
89 void insert(Serializer& serializer, const RawAccel& self);
90 void extract(Serializer& serializer, RawAccel& self);
91 
100 
101 struct RawGyro
102 {
105 
106  static const bool HAS_FUNCTION_SELECTOR = false;
107 
108  float raw_gyro[3] = {0};
109 
110 };
111 void insert(Serializer& serializer, const RawGyro& self);
112 void extract(Serializer& serializer, RawGyro& self);
113 
122 
123 struct RawMag
124 {
127 
128  static const bool HAS_FUNCTION_SELECTOR = false;
129 
130  float raw_mag[3] = {0};
131 
132 };
133 void insert(Serializer& serializer, const RawMag& self);
134 void extract(Serializer& serializer, RawMag& self);
135 
144 
146 {
149 
150  static const bool HAS_FUNCTION_SELECTOR = false;
151 
152  float raw_pressure = 0;
153 
154 };
155 void insert(Serializer& serializer, const RawPressure& self);
156 void extract(Serializer& serializer, RawPressure& self);
157 
166 
168 {
171 
172  static const bool HAS_FUNCTION_SELECTOR = false;
173 
174  float scaled_accel[3] = {0};
175 
176 };
177 void insert(Serializer& serializer, const ScaledAccel& self);
178 void extract(Serializer& serializer, ScaledAccel& self);
179 
188 
190 {
193 
194  static const bool HAS_FUNCTION_SELECTOR = false;
195 
196  float scaled_gyro[3] = {0};
197 
198 };
199 void insert(Serializer& serializer, const ScaledGyro& self);
200 void extract(Serializer& serializer, ScaledGyro& self);
201 
210 
211 struct ScaledMag
212 {
215 
216  static const bool HAS_FUNCTION_SELECTOR = false;
217 
218  float scaled_mag[3] = {0};
219 
220 };
221 void insert(Serializer& serializer, const ScaledMag& self);
222 void extract(Serializer& serializer, ScaledMag& self);
223 
231 
233 {
236 
237  static const bool HAS_FUNCTION_SELECTOR = false;
238 
239  float scaled_pressure = 0;
240 
241 };
242 void insert(Serializer& serializer, const ScaledPressure& self);
243 void extract(Serializer& serializer, ScaledPressure& self);
244 
253 
255 {
258 
259  static const bool HAS_FUNCTION_SELECTOR = false;
260 
261  float delta_theta[3] = {0};
262 
263 };
264 void insert(Serializer& serializer, const DeltaTheta& self);
265 void extract(Serializer& serializer, DeltaTheta& self);
266 
275 
277 {
280 
281  static const bool HAS_FUNCTION_SELECTOR = false;
282 
283  float delta_velocity[3] = {0};
284 
285 };
286 void insert(Serializer& serializer, const DeltaVelocity& self);
287 void extract(Serializer& serializer, DeltaVelocity& self);
288 
306 
308 {
311 
312  static const bool HAS_FUNCTION_SELECTOR = false;
313 
314  float m[9] = {0};
315 
316 };
317 void insert(Serializer& serializer, const CompOrientationMatrix& self);
318 void extract(Serializer& serializer, CompOrientationMatrix& self);
319 
335 
337 {
340 
341  static const bool HAS_FUNCTION_SELECTOR = false;
342 
343  float q[4] = {0};
344 
345 };
346 void insert(Serializer& serializer, const CompQuaternion& self);
347 void extract(Serializer& serializer, CompQuaternion& self);
348 
357 
359 {
362 
363  static const bool HAS_FUNCTION_SELECTOR = false;
364 
365  float roll = 0;
366  float pitch = 0;
367  float yaw = 0;
368 
369 };
370 void insert(Serializer& serializer, const CompEulerAngles& self);
371 void extract(Serializer& serializer, CompEulerAngles& self);
372 
380 
382 {
385 
386  static const bool HAS_FUNCTION_SELECTOR = false;
387 
388  float m[9] = {0};
389 
390 };
391 void insert(Serializer& serializer, const CompOrientationUpdateMatrix& self);
392 void extract(Serializer& serializer, CompOrientationUpdateMatrix& self);
393 
401 
403 {
406 
407  static const bool HAS_FUNCTION_SELECTOR = false;
408 
409  uint16_t raw_temp[4] = {0};
410 
411 };
412 void insert(Serializer& serializer, const OrientationRawTemp& self);
413 void extract(Serializer& serializer, OrientationRawTemp& self);
414 
422 
424 {
427 
428  static const bool HAS_FUNCTION_SELECTOR = false;
429 
430  uint32_t counts = 0;
431 
432 };
433 void insert(Serializer& serializer, const InternalTimestamp& self);
434 void extract(Serializer& serializer, InternalTimestamp& self);
435 
443 
445 {
448 
449  static const bool HAS_FUNCTION_SELECTOR = false;
450 
451  uint32_t seconds = 0;
452  uint32_t useconds = 0;
453 
454 };
455 void insert(Serializer& serializer, const PpsTimestamp& self);
456 void extract(Serializer& serializer, PpsTimestamp& self);
457 
471 
473 {
476 
477  static const bool HAS_FUNCTION_SELECTOR = false;
478 
479  struct ValidFlags : Bitfield<ValidFlags>
480  {
481  enum _enumType : uint16_t
482  {
483  NONE = 0x0000,
484  PPS_VALID = 0x0001,
485  TIME_REFRESH = 0x0002,
486  TIME_INITIALIZED = 0x0004,
487  TOW_VALID = 0x0008,
488  WEEK_NUMBER_VALID = 0x0010,
489  };
490  uint16_t value = NONE;
491 
493  ValidFlags(int val) : value((uint16_t)val) {}
494  operator uint16_t() const { return value; }
495  ValidFlags& operator=(uint16_t val) { value = val; return *this; }
496  ValidFlags& operator=(int val) { value = val; return *this; }
497  ValidFlags& operator|=(uint16_t val) { return *this = value | val; }
498  ValidFlags& operator&=(uint16_t val) { return *this = value & val; }
499  };
500 
501  double tow = 0;
502  uint16_t week_number = 0;
504 
505 };
506 void insert(Serializer& serializer, const GpsTimestamp& self);
507 void extract(Serializer& serializer, GpsTimestamp& self);
508 
520 
522 {
525 
526  static const bool HAS_FUNCTION_SELECTOR = false;
527 
528  float min_temp = 0;
529  float max_temp = 0;
530  float mean_temp = 0;
531 
532 };
533 void insert(Serializer& serializer, const TemperatureAbs& self);
534 void extract(Serializer& serializer, TemperatureAbs& self);
535 
549 
550 struct UpVector
551 {
554 
555  static const bool HAS_FUNCTION_SELECTOR = false;
556 
557  float up[3] = {0};
558 
559 };
560 void insert(Serializer& serializer, const UpVector& self);
561 void extract(Serializer& serializer, UpVector& self);
562 
573 
575 {
578 
579  static const bool HAS_FUNCTION_SELECTOR = false;
580 
581  float north[3] = {0};
582 
583 };
584 void insert(Serializer& serializer, const NorthVector& self);
585 void extract(Serializer& serializer, NorthVector& self);
586 
593 
595 {
598 
599  static const bool HAS_FUNCTION_SELECTOR = false;
600 
601  struct Status : Bitfield<Status>
602  {
603  enum _enumType : uint16_t
604  {
605  NONE = 0x0000,
606  ACCEL_X = 0x0001,
607  ACCEL_Y = 0x0002,
608  ACCEL_Z = 0x0004,
609  GYRO_X = 0x0010,
610  GYRO_Y = 0x0020,
611  GYRO_Z = 0x0040,
612  MAG_X = 0x0100,
613  MAG_Y = 0x0200,
614  MAG_Z = 0x0400,
615  PRESS = 0x1000,
616  };
617  uint16_t value = NONE;
618 
619  Status() : value(NONE) {}
620  Status(int val) : value((uint16_t)val) {}
621  operator uint16_t() const { return value; }
622  Status& operator=(uint16_t val) { value = val; return *this; }
623  Status& operator=(int val) { value = val; return *this; }
624  Status& operator|=(uint16_t val) { return *this = value | val; }
625  Status& operator&=(uint16_t val) { return *this = value & val; }
626  };
627 
629 
630 };
631 void insert(Serializer& serializer, const OverrangeStatus& self);
632 void extract(Serializer& serializer, OverrangeStatus& self);
633 
640 
642 {
645 
646  static const bool HAS_FUNCTION_SELECTOR = false;
647 
648  float speed = 0;
649  float uncertainty = 0;
650  uint16_t valid_flags = 0;
651 
652 };
653 void insert(Serializer& serializer, const OdometerData& self);
654 void extract(Serializer& serializer, OdometerData& self);
655 
658 
663 } // namespace data_sensor
664 } // namespace mip
665 
Serialization class.
Definition: serialization.h:145
void extract(Serializer &serializer, RawAccel &self)
Definition: data_sensor.cpp:38
void insert(Serializer &serializer, const RawAccel &self)
Definition: data_sensor.cpp:32
struct mip::C::mip_interface mip_interface
State of the interface for communicating with a MIP device.
@ DATA_COMP_ORIENTATION_MATRIX
Definition: data_sensor.hpp:42
@ DATA_GYRO_RAW
Definition: data_sensor.hpp:35
@ DATA_MAG_RAW
Definition: data_sensor.hpp:36
@ DATA_TIME_STAMP_GPS
Definition: data_sensor.hpp:51
@ DATA_ODOMETER
Definition: data_sensor.hpp:57
@ DATA_ACCEL_SCALED
Definition: data_sensor.hpp:37
@ DATA_RAW_CLIP_DATA
Definition: data_sensor.hpp:53
@ DATA_COMP_ORIENTATION_UPDATE_MATRIX
Definition: data_sensor.hpp:44
@ DATA_MAG_SCALED
Definition: data_sensor.hpp:39
@ DATA_TEMPERATURE_RAW
Definition: data_sensor.hpp:46
@ DATA_COMP_EULER_ANGLES
Definition: data_sensor.hpp:45
@ DATA_COMP_QUATERNION
Definition: data_sensor.hpp:43
@ DATA_STAB_MAG
Definition: data_sensor.hpp:49
@ DATA_PRESSURE_RAW
Definition: data_sensor.hpp:54
@ MIP_DATA_DESC_ASPP
Definition: data_sensor.hpp:59
@ DATA_OVERRANGE_STATUS
Definition: data_sensor.hpp:56
@ MIP_DATA_DESC_GXSB
Definition: data_sensor.hpp:60
@ DATA_DELTA_VELOCITY
Definition: data_sensor.hpp:41
@ DATA_STAB_ACCEL
Definition: data_sensor.hpp:50
@ DESCRIPTOR_SET
Definition: data_sensor.hpp:32
@ DATA_TIME_STAMP_INTERNAL
Definition: data_sensor.hpp:47
@ DATA_ACCEL_RAW
Definition: data_sensor.hpp:34
@ DATA_TIME_STAMP_PPS
Definition: data_sensor.hpp:48
@ DATA_GYRO_SCALED
Definition: data_sensor.hpp:38
@ DATA_TEMPERATURE_ABS
Definition: data_sensor.hpp:52
@ DATA_DELTA_THETA
Definition: data_sensor.hpp:40
@ DATA_PRESSURE_SCALED
Definition: data_sensor.hpp:55
A collection of C++ classes and functions covering the full mip api.
Definition: commands_3dm.c:11
A dummy struct which is used to mark bitfield objects.
Definition: descriptors.h:95
Definition: data_sensor.hpp:359
float yaw
[radians]
Definition: data_sensor.hpp:367
static const bool HAS_FUNCTION_SELECTOR
Definition: data_sensor.hpp:363
float roll
[radians]
Definition: data_sensor.hpp:365
static const uint8_t FIELD_DESCRIPTOR
Definition: data_sensor.hpp:361
static const uint8_t DESCRIPTOR_SET
Definition: data_sensor.hpp:360
float pitch
[radians]
Definition: data_sensor.hpp:366
Definition: data_sensor.hpp:308
static const bool HAS_FUNCTION_SELECTOR
Definition: data_sensor.hpp:312
static const uint8_t FIELD_DESCRIPTOR
Definition: data_sensor.hpp:310
static const uint8_t DESCRIPTOR_SET
Definition: data_sensor.hpp:309
float m[9]
Matrix elements in row-major order.
Definition: data_sensor.hpp:314
Definition: data_sensor.hpp:382
static const uint8_t FIELD_DESCRIPTOR
Definition: data_sensor.hpp:384
float m[9]
Definition: data_sensor.hpp:388
static const bool HAS_FUNCTION_SELECTOR
Definition: data_sensor.hpp:386
static const uint8_t DESCRIPTOR_SET
Definition: data_sensor.hpp:383
Definition: data_sensor.hpp:337
float q[4]
Quaternion elements EQSTART q = (q_w, q_x, q_y, q_z) EQEND.
Definition: data_sensor.hpp:343
static const uint8_t FIELD_DESCRIPTOR
Definition: data_sensor.hpp:339
static const bool HAS_FUNCTION_SELECTOR
Definition: data_sensor.hpp:341
static const uint8_t DESCRIPTOR_SET
Definition: data_sensor.hpp:338
Definition: data_sensor.hpp:255
static const uint8_t DESCRIPTOR_SET
Definition: data_sensor.hpp:256
static const bool HAS_FUNCTION_SELECTOR
Definition: data_sensor.hpp:259
float delta_theta[3]
(x, y, z) [radians]
Definition: data_sensor.hpp:261
static const uint8_t FIELD_DESCRIPTOR
Definition: data_sensor.hpp:257
Definition: data_sensor.hpp:277
static const uint8_t FIELD_DESCRIPTOR
Definition: data_sensor.hpp:279
static const uint8_t DESCRIPTOR_SET
Definition: data_sensor.hpp:278
float delta_velocity[3]
(x, y, z) [g*sec]
Definition: data_sensor.hpp:283
static const bool HAS_FUNCTION_SELECTOR
Definition: data_sensor.hpp:281
Definition: data_sensor.hpp:480
uint16_t value
Definition: data_sensor.hpp:490
ValidFlags & operator=(uint16_t val)
Definition: data_sensor.hpp:495
_enumType
Definition: data_sensor.hpp:482
@ TIME_REFRESH
Toggles each time the time is updated via internal GPS or the GPS Time Update command (0x01,...
Definition: data_sensor.hpp:485
@ TIME_INITIALIZED
True if the time has ever been set.
Definition: data_sensor.hpp:486
@ TOW_VALID
True if the time of week is valid.
Definition: data_sensor.hpp:487
@ WEEK_NUMBER_VALID
True if the week number is valid.
Definition: data_sensor.hpp:488
@ NONE
Definition: data_sensor.hpp:483
@ PPS_VALID
True when the PPS signal is present.
Definition: data_sensor.hpp:484
ValidFlags(int val)
Definition: data_sensor.hpp:493
ValidFlags()
Definition: data_sensor.hpp:492
ValidFlags & operator&=(uint16_t val)
Definition: data_sensor.hpp:498
ValidFlags & operator|=(uint16_t val)
Definition: data_sensor.hpp:497
ValidFlags & operator=(int val)
Definition: data_sensor.hpp:496
Definition: data_sensor.hpp:473
double tow
GPS Time of Week [seconds].
Definition: data_sensor.hpp:501
static const bool HAS_FUNCTION_SELECTOR
Definition: data_sensor.hpp:477
static const uint8_t DESCRIPTOR_SET
Definition: data_sensor.hpp:474
uint16_t week_number
GPS Week Number since 1980 [weeks].
Definition: data_sensor.hpp:502
ValidFlags valid_flags
Definition: data_sensor.hpp:503
static const uint8_t FIELD_DESCRIPTOR
Definition: data_sensor.hpp:475
Definition: data_sensor.hpp:424
uint32_t counts
Definition: data_sensor.hpp:430
static const uint8_t DESCRIPTOR_SET
Definition: data_sensor.hpp:425
static const bool HAS_FUNCTION_SELECTOR
Definition: data_sensor.hpp:428
static const uint8_t FIELD_DESCRIPTOR
Definition: data_sensor.hpp:426
Definition: data_sensor.hpp:575
static const bool HAS_FUNCTION_SELECTOR
Definition: data_sensor.hpp:579
float north[3]
[Gauss]
Definition: data_sensor.hpp:581
static const uint8_t DESCRIPTOR_SET
Definition: data_sensor.hpp:576
static const uint8_t FIELD_DESCRIPTOR
Definition: data_sensor.hpp:577
Definition: data_sensor.hpp:642
float uncertainty
Uncertainty of velocity [m/s].
Definition: data_sensor.hpp:649
float speed
Average speed over the time interval [m/s]. Can be negative for quadrature encoders.
Definition: data_sensor.hpp:648
static const bool HAS_FUNCTION_SELECTOR
Definition: data_sensor.hpp:646
uint16_t valid_flags
If odometer is configured, bit 0 will be set to 1.
Definition: data_sensor.hpp:650
static const uint8_t FIELD_DESCRIPTOR
Definition: data_sensor.hpp:644
static const uint8_t DESCRIPTOR_SET
Definition: data_sensor.hpp:643
Definition: data_sensor.hpp:403
static const uint8_t FIELD_DESCRIPTOR
Definition: data_sensor.hpp:405
static const bool HAS_FUNCTION_SELECTOR
Definition: data_sensor.hpp:407
static const uint8_t DESCRIPTOR_SET
Definition: data_sensor.hpp:404
uint16_t raw_temp[4]
Definition: data_sensor.hpp:409
Definition: data_sensor.hpp:602
Status & operator|=(uint16_t val)
Definition: data_sensor.hpp:624
Status & operator=(uint16_t val)
Definition: data_sensor.hpp:622
_enumType
Definition: data_sensor.hpp:604
@ GYRO_X
Definition: data_sensor.hpp:609
@ GYRO_Y
Definition: data_sensor.hpp:610
@ MAG_Z
Definition: data_sensor.hpp:614
@ ACCEL_X
Definition: data_sensor.hpp:606
@ GYRO_Z
Definition: data_sensor.hpp:611
@ ACCEL_Z
Definition: data_sensor.hpp:608
@ MAG_X
Definition: data_sensor.hpp:612
@ MAG_Y
Definition: data_sensor.hpp:613
@ PRESS
Definition: data_sensor.hpp:615
@ NONE
Definition: data_sensor.hpp:605
@ ACCEL_Y
Definition: data_sensor.hpp:607
Status()
Definition: data_sensor.hpp:619
Status(int val)
Definition: data_sensor.hpp:620
uint16_t value
Definition: data_sensor.hpp:617
Status & operator=(int val)
Definition: data_sensor.hpp:623
Status & operator&=(uint16_t val)
Definition: data_sensor.hpp:625
Definition: data_sensor.hpp:595
static const uint8_t FIELD_DESCRIPTOR
Definition: data_sensor.hpp:597
Status status
Definition: data_sensor.hpp:628
static const bool HAS_FUNCTION_SELECTOR
Definition: data_sensor.hpp:599
static const uint8_t DESCRIPTOR_SET
Definition: data_sensor.hpp:596
Definition: data_sensor.hpp:445
static const uint8_t DESCRIPTOR_SET
Definition: data_sensor.hpp:446
static const uint8_t FIELD_DESCRIPTOR
Definition: data_sensor.hpp:447
static const bool HAS_FUNCTION_SELECTOR
Definition: data_sensor.hpp:449
uint32_t useconds
Definition: data_sensor.hpp:452
uint32_t seconds
Definition: data_sensor.hpp:451
Definition: data_sensor.hpp:80
float raw_accel[3]
Native sensor counts.
Definition: data_sensor.hpp:86
static const uint8_t FIELD_DESCRIPTOR
Definition: data_sensor.hpp:82
static const uint8_t DESCRIPTOR_SET
Definition: data_sensor.hpp:81
static const bool HAS_FUNCTION_SELECTOR
Definition: data_sensor.hpp:84
Definition: data_sensor.hpp:102
static const bool HAS_FUNCTION_SELECTOR
Definition: data_sensor.hpp:106
static const uint8_t FIELD_DESCRIPTOR
Definition: data_sensor.hpp:104
static const uint8_t DESCRIPTOR_SET
Definition: data_sensor.hpp:103
float raw_gyro[3]
Native sensor counts.
Definition: data_sensor.hpp:108
Definition: data_sensor.hpp:124
static const bool HAS_FUNCTION_SELECTOR
Definition: data_sensor.hpp:128
float raw_mag[3]
Native sensor counts.
Definition: data_sensor.hpp:130
static const uint8_t FIELD_DESCRIPTOR
Definition: data_sensor.hpp:126
static const uint8_t DESCRIPTOR_SET
Definition: data_sensor.hpp:125
Definition: data_sensor.hpp:146
static const uint8_t FIELD_DESCRIPTOR
Definition: data_sensor.hpp:148
float raw_pressure
Native sensor counts.
Definition: data_sensor.hpp:152
static const uint8_t DESCRIPTOR_SET
Definition: data_sensor.hpp:147
static const bool HAS_FUNCTION_SELECTOR
Definition: data_sensor.hpp:150
Definition: data_sensor.hpp:168
static const uint8_t FIELD_DESCRIPTOR
Definition: data_sensor.hpp:170
static const uint8_t DESCRIPTOR_SET
Definition: data_sensor.hpp:169
static const bool HAS_FUNCTION_SELECTOR
Definition: data_sensor.hpp:172
float scaled_accel[3]
(x, y, z)[g]
Definition: data_sensor.hpp:174
Definition: data_sensor.hpp:190
static const uint8_t DESCRIPTOR_SET
Definition: data_sensor.hpp:191
static const uint8_t FIELD_DESCRIPTOR
Definition: data_sensor.hpp:192
float scaled_gyro[3]
(x, y, z) [radians/second]
Definition: data_sensor.hpp:196
static const bool HAS_FUNCTION_SELECTOR
Definition: data_sensor.hpp:194
Definition: data_sensor.hpp:212
static const bool HAS_FUNCTION_SELECTOR
Definition: data_sensor.hpp:216
static const uint8_t DESCRIPTOR_SET
Definition: data_sensor.hpp:213
float scaled_mag[3]
(x, y, z) [Gauss]
Definition: data_sensor.hpp:218
static const uint8_t FIELD_DESCRIPTOR
Definition: data_sensor.hpp:214
Definition: data_sensor.hpp:233
static const bool HAS_FUNCTION_SELECTOR
Definition: data_sensor.hpp:237
float scaled_pressure
[mBar]
Definition: data_sensor.hpp:239
static const uint8_t DESCRIPTOR_SET
Definition: data_sensor.hpp:234
static const uint8_t FIELD_DESCRIPTOR
Definition: data_sensor.hpp:235
Definition: data_sensor.hpp:522
static const uint8_t DESCRIPTOR_SET
Definition: data_sensor.hpp:523
float min_temp
[degC]
Definition: data_sensor.hpp:528
static const bool HAS_FUNCTION_SELECTOR
Definition: data_sensor.hpp:526
float max_temp
[degC]
Definition: data_sensor.hpp:529
float mean_temp
[degC]
Definition: data_sensor.hpp:530
static const uint8_t FIELD_DESCRIPTOR
Definition: data_sensor.hpp:524
Definition: data_sensor.hpp:551
float up[3]
[Gs]
Definition: data_sensor.hpp:557
static const uint8_t DESCRIPTOR_SET
Definition: data_sensor.hpp:552
static const uint8_t FIELD_DESCRIPTOR
Definition: data_sensor.hpp:553
static const bool HAS_FUNCTION_SELECTOR
Definition: data_sensor.hpp:555