configuration.h
Go to the documentation of this file.
1 /**************************************************************************/ /**
2  * @brief Device configuration settings control messages.
3  * @file
4  ******************************************************************************/
5 
6 #pragma once
7 
8 // If we are compiling under MSVC, disable warning C4200:
9 // nonstandard extension used: zero-sized array in struct/union
10 // Zero-sized arrays are supported by MSVC, GCC, and Clang, and we use them as
11 // convenience placeholders for variable sized message payloads.
12 #ifdef _MSC_VER
13 # pragma warning(push)
14 # pragma warning(disable : 4200)
15 #endif
16 
17 #include <ostream>
18 
20 
21 namespace point_one {
22 namespace fusion_engine {
23 namespace messages {
24 
25 // Enforce 4-byte alignment and packing of all data structures and values.
26 // Floating point values are aligned on platforms that require it. This is done
27 // with a combination of setting struct attributes, and manual alignment
28 // within the definitions. See the "Message Packing" section of the README.
29 #pragma pack(push, 1)
30 
31 /**
32  * @brief An identifier for the contents of a parameter configuration message.
33  * @ingroup config_and_ctrl_messages
34  *
35  * See also @ref SetConfigMessage.
36  */
37 enum class ConfigType : uint16_t {
38  INVALID = 0,
39 
40  /**
41  * The location of the device IMU with respect to the vehicle body frame (in
42  * meters).
43  *
44  * Payload format: @ref Point3f
45  */
46  DEVICE_LEVER_ARM = 16,
47 
48  /**
49  * The orientation of the device IMU with respect to the vehicle body axes.
50  *
51  * Payload format: @ref CoarseOrientation
52  */
54 
55  /**
56  * The location of the GNSS antenna with respect to the vehicle body frame (in
57  * meters).
58  *
59  * Payload format: @ref Point3f
60  */
61  GNSS_LEVER_ARM = 18,
62 
63  /**
64  * The offset of the desired output location with respect to the vehicle
65  * body frame (in meters).
66  *
67  * Payload format: @ref Point3f
68  */
69  OUTPUT_LEVER_ARM = 19,
70 
71  /**
72  * Information about the vehicle including model and dimensions.
73  *
74  * Payload format: @ref VehicleDetails
75  */
76  VEHICLE_DETAILS = 20,
77 
78  /**
79  * Information pertaining to wheel speed/rotation measurements.
80  *
81  * Payload format: @ref WheelConfig
82  */
83  WHEEL_CONFIG = 21,
84 
85  /**
86  * Indicates the mode and direction used when capturing vehicle wheel tick
87  * data from a voltage pulse on an I/O pin.
88  *
89  * Payload format: @ref HardwareTickConfig
90  */
92 
93  /**
94  * Configure the UART1 serial baud rate (in bits/second).
95  *
96  * Payload format: `uint32_t`
97  */
98  UART1_BAUD = 256,
99 
100  /**
101  * Configure the UART2 serial baud rate (in bits/second).
102  *
103  * Payload format: `uint32_t`
104  */
105  UART2_BAUD = 257,
106 
107  /**
108  * Force output the diagnostic message set on UART1.
109  *
110  * Payload format: `bool`
111  */
113 
114  /**
115  * Force output the diagnostic message set on UART2.
116  *
117  * Payload format: `bool`
118  */
120 
121  /**
122  * Enable watchdog timer to restart device after fatal errors.
123  *
124  * Payload format: `bool`
125  */
126  ENABLE_WATCHDOG_TIMER = 300,
127 };
128 
129 /**
130  * @brief Get a human-friendly string name for the specified @ref ConfigType.
131  * @ingroup config_and_ctrl_messages
132  *
133  * @param type The desired configuration parameter type.
134  *
135  * @return The corresponding string name.
136  */
137 inline const char* to_string(ConfigType type) {
138  switch (type) {
139  case ConfigType::INVALID:
140  return "Invalid";
141 
143  return "Device Lever Arm";
144 
146  return "Device Coarse Orientation";
147 
149  return "GNSS Lever Arm";
150 
152  return "Output Lever Arm";
153 
155  return "Vehicle Details";
156 
158  return "Wheel Config";
159 
161  return "Hardware Tick Config";
162 
164  return "UART1 Baud Rate";
165 
167  return "UART2 Baud Rate";
168 
170  return "UART1 Diagnostic Messages Enabled";
171 
173  return "UART2 Diagnostic Messages Enabled";
174 
176  return "Watchdog Timer Enabled";
177 
178  default:
179  return "Unrecognized Configuration";
180  }
181 }
182 
183 /**
184  * @brief @ref ConfigType stream operator.
185  * @ingroup config_and_ctrl_messages
186  */
187 inline std::ostream& operator<<(std::ostream& stream, ConfigType type) {
188  stream << to_string(type) << " (" << (int)type << ")";
189  return stream;
190 }
191 
192 /**
193  * @brief The type of a device's configuration settings.
194  * @ingroup config_and_ctrl_messages
195  */
196 enum class ConfigurationSource : uint8_t {
197  ACTIVE = 0, ///< Active configuration currently in use by the device.
198  SAVED = 1, ///< Settings currently saved to persistent storage.
199 };
200 
201 /**
202  * @brief Get a human-friendly string name for the specified @ref
203  * ConfigurationSource.
204  * @ingroup config_and_ctrl_messages
205  *
206  * @param source The desired configuration source.
207  *
208  * @return The corresponding string name.
209  */
210 inline const char* to_string(ConfigurationSource source) {
211  switch (source) {
213  return "Active";
214 
216  return "Saved";
217 
218  default:
219  return "Unrecognized Source";
220  }
221 }
222 
223 /**
224  * @brief @ref ConfigurationSource stream operator.
225  * @ingroup config_and_ctrl_messages
226  */
227 inline std::ostream& operator<<(std::ostream& stream,
228  ConfigurationSource source) {
229  stream << to_string(source) << " (" << (int)source << ")";
230  return stream;
231 }
232 
233 /**
234  * @brief The type configuration save operation to be performed.
235  * @ingroup config_and_ctrl_messages
236  */
237 enum class SaveAction : uint8_t {
238  /** Save all active parameters to persistent storage. */
239  SAVE = 0,
240  /** Revert the active configuration to previously saved values. */
241  REVERT_TO_SAVED = 1,
242  /** Reset the active _and_ saved configuration to default values. */
243  REVERT_TO_DEFAULT = 2,
244 };
245 
246 /**
247  * @brief Get a human-friendly string name for the specified @ref SaveAction.
248  * @ingroup config_and_ctrl_messages
249  *
250  * @param action The desired save operation.
251  *
252  * @return The corresponding string name.
253  */
254 inline const char* to_string(SaveAction action) {
255  switch (action) {
256  case SaveAction::SAVE:
257  return "Save";
258 
260  return "Revert To Saved";
261 
263  return "Revert To Default";
264 
265  default:
266  return "Unknown";
267  }
268 }
269 
270 /**
271  * @brief @ref SaveAction stream operator.
272  * @ingroup config_and_ctrl_messages
273  */
274 inline std::ostream& operator<<(std::ostream& stream, SaveAction action) {
275  stream << to_string(action) << " (" << (int)action << ")";
276  return stream;
277 }
278 
279 /**
280  * @brief Set a user configuration parameter (@ref MessageType::SET_CONFIG,
281  * version 1.0).
282  * @ingroup config_and_ctrl_messages
283  *
284  * The format of the parameter value, @ref config_change_data, is defined by the
285  * the specified @ref config_type (@ref ConfigType). For example, an antenna
286  * lever arm definition may require three 32-bit `float` values, one for each
287  * axis, while a serial port baud rate may be specified as single 32-bit
288  * unsigned integer (`uint32_t`).
289  *
290  * The device will respond with a @ref CommandResponseMessage indicating whether
291  * or not the request was accepted. Not all parameters defined in @ref
292  * ConfigType are supported on all devices.
293  *
294  * Parameter changes are applied to the device's active configuration
295  * immediately, but are not saved to persistent storage and will be restored to
296  * their previous values on reset. To save configuration settings to persistent
297  * storage, see @ref SaveConfigMessage.
298  */
299 struct alignas(4) SetConfigMessage : public MessagePayload {
301  static constexpr uint8_t MESSAGE_VERSION = 0;
302 
303  /** Flag to immediately save the config after applying this setting. */
304  static constexpr uint8_t FLAG_APPLY_AND_SAVE = 0x01;
305 
306  /** The type of parameter to be configured. */
308 
309  /** Bitmask of additional flags to modify the command. */
310  uint8_t flags = 0;
311 
312  uint8_t reserved[1] = {0};
313 
314  /** The size of the parameter value, @ref config_change_data (in bytes). */
315  uint32_t config_length_bytes = 0;
316 
317  /**
318  * A pointer to the beginning of the configuration parameter value.
319  *
320  * The size and format of the contents is specified by the @ref config_type.
321  * See @ref ConfigType.
322  */
323  uint8_t config_change_data[0];
324 };
325 
326 /**
327  * @brief Query the value of a user configuration parameter (@ref
328  * MessageType::GET_CONFIG, version 1.0).
329  * @ingroup config_and_ctrl_messages
330  *
331  * The device will respond with a @ref ConfigResponseMessage containing the
332  * requested parameter value, or a @ref CommandResponseMessage on failure.
333  */
334 struct alignas(4) GetConfigMessage : public MessagePayload {
336  static constexpr uint8_t MESSAGE_VERSION = 0;
337 
338  /** The desired parameter. */
340 
341  /** The config source to request data from (active, saved, etc.). */
343 
344  uint8_t reserved[1] = {0};
345 };
346 
347 /**
348  * @brief Save or reload configuration settings (@ref MessageType::SAVE_CONFIG,
349  * version 1.0).
350  * @ingroup config_and_ctrl_messages
351  *
352  * The device will respond with a @ref CommandResponseMessage indicating whether
353  * or not the request was accepted.
354  */
355 struct alignas(4) SaveConfigMessage : public MessagePayload {
357  static constexpr uint8_t MESSAGE_VERSION = 0;
358 
359  /** The action to performed. */
361 
362  uint8_t reserved[3] = {0};
363 };
364 
365 /**
366  * @brief Response to a @ref GetConfigMessage request (@ref
367  * MessageType::CONFIG_RESPONSE, version 1.0).
368  * @ingroup config_and_ctrl_messages
369  *
370  * This message is followed by `N` bytes, where `N` is equal to @ref
371  * config_length_bytes that make up the data associated with @ref config_type.
372  * For example if the @ref config_type is @ref ConfigType::UART1_BAUD, the
373  * payload will include a single 32-bit unsigned integer:
374  *
375  * ```
376  * {MessageHeader, ConfigResponseMessage, uint32_t}
377  * ```
378  *
379  * In response to a @ref GetConfigMessage with an invalid or unsupported @ref
380  * ConfigType, @ref config_type in the resulting @ref ConfigResponseMessage will
381  * be set to @ref ConfigType::INVALID, and @ref response will indicate the
382  * reason. Note that all @ref GetConfigMessage requests, including invalid and
383  * rejected requests, will receive a @ref ConfigResponseMessage, not a
384  * @ref CommandResponseMessage.
385  */
386 struct alignas(4) ConfigResponseMessage : public MessagePayload {
388  static constexpr uint8_t MESSAGE_VERSION = 0;
389 
390  /** The source of the parameter value (active, saved, etc.). */
392 
393  /**
394  * Set to `true` if the active configuration differs from the saved
395  * configuration for this parameter.
396  */
398 
399  /** The type of configuration parameter contained in this message. */
401 
402  /** The response status (success, error, etc.). */
404 
405  uint8_t reserved[3] = {0};
406 
407  /** The size of the parameter value, @ref config_change_data (in bytes). */
408  uint32_t config_length_bytes = 0;
409 
410  /**
411  * A pointer to the beginning of the configuration parameter value.
412  *
413  * The size and format of the contents is specified by the @ref config_type.
414  * See @ref ConfigType.
415  */
416  uint8_t config_change_data[0];
417 };
418 
419 /**************************************************************************/ /**
420  * @name Configuration Settings Type Definitions
421  * @{
422  ******************************************************************************/
423 
424 /**
425  * @brief A 3-dimensional vector (used for lever arms, etc.).
426  */
427 struct alignas(4) Point3f {
428  float x = NAN;
429  float y = NAN;
430  float z = NAN;
431 };
432 
433 /**
434  * @brief The orientation of a device with respect to the vehicle body axes.
435  *
436  * A device's orientation is defined by specifying how the +x and +z axes of its
437  * IMU are aligned with the vehicle body axes. For example, in a car:
438  * - `forward,up`: device +x = vehicle +x, device +z = vehicle +z (i.e.,
439  * IMU pointed towards the front of the vehicle).
440  * - `left,up`: device +x = vehicle +y, device +z = vehicle +z (i.e., IMU
441  * pointed towards the left side of the vehicle)
442  * - `up,backward`: device +x = vehicle +z, device +z = vehicle -x (i.e.,
443  * IMU pointed vertically upward, with the top of the IMU pointed towards the
444  * trunk)
445  */
446 struct alignas(4) CoarseOrientation {
447  enum class Direction : uint8_t {
448  FORWARD = 0, ///< Aligned with vehicle +x axis.
449  BACKWARD = 1, ///< Aligned with vehicle -x axis.
450  LEFT = 2, ///< Aligned with vehicle +y axis.
451  RIGHT = 3, ///< Aligned with vehicle -y axis.
452  UP = 4, ///< Aligned with vehicle +z axis.
453  DOWN = 5, ///< Aligned with vehicle -z axis.
454  INVALID = 255
455  };
456 
457  /** The direction of the device +x axis relative to the vehicle body axes. */
459 
460  /** The direction of the device +z axis relative to the vehicle body axes. */
462 
463  uint8_t reserved[2] = {0};
464 };
465 
466 /**
467  * @brief The make and model of the vehicle.
468  * @ingroup config_and_ctrl_messages
469  */
470 enum class VehicleModel : uint16_t {
471  UNKNOWN_VEHICLE = 0,
472  DATASPEED_CD4 = 1,
473  // In general, all J1939 vehicles support a subset of the J1939 standard and
474  // may be set to vehicle model `J1939`. Their 29-bit CAN IDs may differ
475  // based on how the platform assigns message priorities and source
476  // addresses, but the underlying program group number (PGN) and message
477  // contents will be consistent.
478  //
479  // For most vehicles, it is not necessary to specify and particular make and
480  // model.
481  J1939 = 2,
482 
483  LEXUS_CT200H = 20,
484 
485  KIA_SORENTO = 40,
486  KIA_SPORTAGE = 41,
487 
488  AUDI_Q7 = 60,
489  AUDI_A8L = 61,
490 
491  TESLA_MODEL_X = 80,
492  TESLA_MODEL_3 = 81,
493 
494  HYUNDAI_ELANTRA = 100,
495 
496  PEUGEOT_206 = 120,
497 
498  MAN_TGX = 140,
499 
500  FACTION = 160,
501 
502  LINCOLN_MKZ = 180,
503 
504  BMW_7 = 200,
505 };
506 
507 /**
508  * @brief Get a human-friendly string name for the specified @ref VehicleModel.
509  * @ingroup config_and_ctrl_messages
510  *
511  * @param vehicle_model The desired vehicle model.
512  *
513  * @return The corresponding string name.
514  */
515 inline const char* to_string(VehicleModel vehicle_model) {
516  switch (vehicle_model) {
518  return "UNKNOWN";
520  return "DATASPEED_CD4";
521  case VehicleModel::J1939:
522  return "J1939";
524  return "LEXUS_CT200H";
526  return "KIA_SORENTO";
528  return "KIA_SPORTAGE";
530  return "AUDI_Q7";
532  return "AUDI_A8L";
534  return "TESLA_MODEL_X";
536  return "TESLA_MODEL_3";
538  return "HYUNDAI_ELANTRA";
540  return "PEUGEOT_206";
542  return "MAN_TGX";
544  return "FACTION";
546  return "LINCOLN_MKZ";
547  case VehicleModel::BMW_7:
548  return "BMW_7";
549  default:
550  return "UNRECOGNIZED";
551  }
552 }
553 
554 /**
555  * @brief @ref VehicleModel stream operator.
556  * @ingroup config_and_ctrl_messages
557  */
558 inline std::ostream& operator<<(std::ostream& stream,
559  VehicleModel vehicle_model) {
560  stream << to_string(vehicle_model) << " (" << (int)vehicle_model << ")";
561  return stream;
562 }
563 
564 /**
565  * @brief Information about the vehicle including model and dimensions.
566  * @ingroup config_and_ctrl_messages
567  */
568 struct alignas(4) VehicleDetails {
570  uint8_t reserved[10] = {0};
571 
572  /** The distance between the front axle and rear axle (in meters). */
573  float wheelbase_m = NAN;
574 
575  /** The distance between the two front wheels (in meters). */
576  float front_track_width_m = NAN;
577 
578  /** The distance between the two rear wheels (in meters). */
579  float rear_track_width_m = NAN;
580 };
581 
582 /**
583  * @brief The type of vehicle/wheel speed measurements produced by the vehicle.
584  * @ingroup config_and_ctrl_messages
585  */
586 enum class WheelSensorType : uint8_t {
587  /** Wheel/vehicle speed data not available. */
588  NONE = 0,
589  /**
590  * Individual wheel rotation rates, reported as an encoder tick rate (in
591  * ticks/second). Will be scaled to meters/second using the specified scale
592  * factor.
593  */
594  TICK_RATE = 1,
595  /**
596  * Individual wheel rotational angles, reported as accumulated encoder
597  * ticks.
598  * */
599  TICKS = 2,
600  /** Individual wheel speeds, reported in meters/second. */
601  WHEEL_SPEED = 3,
602  /** A single value indicating the vehicle speed (in meters/second). */
603  VEHICLE_SPEED = 4,
604  /** A single wheel rotational angle, reported as accumulated encoder ticks. */
605  VEHICLE_TICKS = 5,
606 };
607 
608 /**
609  * @brief Get a human-friendly string name for the specified @ref
610  * WheelSensorType.
611  * @ingroup config_and_ctrl_messages
612  *
613  * @param wheel_sensor_type The desired wheel sensor type.
614  *
615  * @return The corresponding string name.
616  */
617 inline const char* to_string(WheelSensorType wheel_sensor_type) {
618  switch (wheel_sensor_type) {
619  case WheelSensorType::NONE: {
620  return "None";
621  }
623  return "Tick Rate";
624  }
625  case WheelSensorType::TICKS: {
626  return "Ticks";
627  }
629  return "Wheel Speed";
630  }
632  return "Vehicle Speed";
633  }
635  return "Vehicle Ticks";
636  }
637  default: {
638  return "None";
639  }
640  }
641 }
642 
643 /**
644  * @brief @ref WheelSensorType stream operator.
645  * @ingroup config_and_ctrl_messages
646  */
647 inline std::ostream& operator<<(std::ostream& stream,
648  WheelSensorType wheel_sensor_type) {
649  stream << to_string(wheel_sensor_type) << " (" << (int)wheel_sensor_type
650  << ")";
651  return stream;
652 }
653 
654 /**
655  * @brief The type of vehicle/wheel speed measurements to be applied.
656  * @ingroup config_and_ctrl_messages
657  */
658 enum class AppliedSpeedType : uint8_t {
659  /** Speed data not applied to the system. */
660  NONE = 0,
661  /** Rear wheel speed data to be applied to the system (recommended). */
662  REAR_WHEELS = 1,
663  /** Front wheel speed data to be applied to the system. */
664  FRONT_WHEELS = 2,
665  /** Front and rear wheel speed data to be applied to the system. */
667  /** Individual vehicle speed to be applied to the system. */
668  VEHICLE_BODY = 4,
669 };
670 
671 /**
672  * @brief Get a human-friendly string name for the specified @ref
673  * AppliedSpeedType.
674  * @ingroup config_and_ctrl_messages
675  *
676  * @param applied_speed_type The desired applied speed type.
677  *
678  * @return The corresponding string name.
679  */
680 inline const char* to_string(AppliedSpeedType applied_speed_type) {
681  switch (applied_speed_type) {
682  case AppliedSpeedType::NONE: {
683  return "None";
684  }
686  return "Rear Wheels";
687  }
689  return "Front Wheels";
690  }
692  return "Front and Rear Wheels";
693  }
695  return "Vehicle Body";
696  }
697  default: {
698  return "Unrecognized";
699  }
700  }
701 }
702 
703 /**
704  * @brief @ref AppliedSpeedType stream operator.
705  * @ingroup config_and_ctrl_messages
706  */
707 inline std::ostream& operator<<(std::ostream& stream,
708  AppliedSpeedType applied_speed_type) {
709  stream << to_string(applied_speed_type) << " (" << (int)applied_speed_type
710  << ")";
711  return stream;
712 }
713 
714 /**
715  * @brief Indication of which of the vehicle's wheels are steered.
716  * @ingroup config_and_ctrl_messages
717  */
718 enum class SteeringType : uint8_t {
719  /** Steered wheels unknown. */
720  UNKNOWN = 0,
721  /** Front wheels are steered. */
722  FRONT = 1,
723  /** Front and rear wheels are steered. */
724  FRONT_AND_REAR = 2,
725 };
726 
727 /**
728  * @brief Get a human-friendly string name for the specified @ref SteeringType.
729  * @ingroup config_and_ctrl_messages
730  *
731  * @param steering_type The desired steering type.
732  *
733  * @return The corresponding string name.
734  */
735 inline const char* to_string(SteeringType steering_type) {
736  switch (steering_type) {
737  case SteeringType::UNKNOWN: {
738  return "Unknown Steering";
739  }
740  case SteeringType::FRONT: {
741  return "Front Steering";
742  }
744  return "Front and Rear Steering";
745  }
746  default: {
747  return "Unrecognized";
748  }
749  }
750 }
751 
752 /**
753  * @brief @ref SteeringType stream operator.
754  * @ingroup config_and_ctrl_messages
755  */
756 inline std::ostream& operator<<(std::ostream& stream,
757  SteeringType steering_type) {
758  stream << to_string(steering_type) << " (" << (int)steering_type << ")";
759  return stream;
760 }
761 
762 /**
763  * @brief Vehicle/wheel speed measurement configuration settings.
764  * @ingroup config_and_ctrl_messages
765  *
766  * See:
767  * - @ref WheelSpeedMeasurement
768  * - @ref VehicleSpeedMeasurement
769  * - @ref WheelTickMeasurement
770  * - @ref VehicleTickMeasurement
771  */
772 struct alignas(4) WheelConfig {
773  /**
774  * The type of vehicle/wheel speed measurements produced by the vehicle.
775  */
777 
778  /**
779  * The type of vehicle/wheel speed measurements to be applied to the
780  * navigation solution.
781  */
783 
784  /** Indication of which of the vehicle's wheels are steered. */
786 
787  uint8_t reserved1[1] = {0};
788 
789  /**
790  * The nominal rate at which wheel speed measurements will be provided (in
791  * seconds).
792  */
794 
795  /**
796  * The nominal rate at which wheel tick measurements will be provided (in
797  * seconds).
798  */
800 
801  /**
802  * Ratio between angle of the steering wheel and the angle of the wheels on
803  * the ground.
804  */
805  float steering_ratio = NAN;
806 
807  /**
808  * The scale factor to convert from wheel encoder ticks to distance (in
809  * meters/tick). Used for @ref WheelSensorType::TICKS and
810  * @ref WheelSensorType::TICK_RATE.
811  */
812  float wheel_ticks_to_m = NAN;
813 
814  /**
815  * The maximum value (inclusive) before the wheel tick measurement will roll
816  * over.
817  *
818  * The rollover behavior depends on the value of @ref wheel_ticks_signed. For
819  * example, a maximum value of 10 will work as follows:
820  * - `wheel_ticks_signed == true`: [-11, 10]
821  * - `wheel_ticks_signed == false`: [0, 10]
822  *
823  * Signed values are assumed to be asymmetric, consistent with a typical 2's
824  * complement rollover.
825  */
826  uint32_t wheel_tick_max_value = 0;
827 
828  /**
829  * `true` if the reported wheel tick measurements should be interpreted as
830  * signed integers, or `false` if they should be interpreted as unsigned
831  * integers.
832  *
833  * See @ref wheel_tick_max_value for details.
834  */
835  bool wheel_ticks_signed = false;
836 
837  /**
838  * `true` if the wheel tick measurements increase by a positive amount when
839  * driving forward or backward. `false` if wheel tick measurements decrease
840  * when driving backward.
841  */
843 
844  uint8_t reserved2[2] = {0};
845 };
846 
847 /**
848  * @brief The signal edge to use when capturing a wheel tick voltage signal.
849  * @ingroup config_and_ctrl_messages
850  */
851 enum class TickMode : uint8_t {
852  /** Wheel tick capture disabled. */
853  OFF = 0,
854  /** Capture a wheel tick on the rising edge of the incoming pulse. */
855  RISING_EDGE = 1,
856  /** Capture a wheel tick on the falling edge of the incoming pulse. */
857  FALLING_EDGE = 2,
858 };
859 
860 inline const char* to_string(TickMode tick_mode) {
861  switch (tick_mode) {
862  case TickMode::OFF:
863  return "OFF";
865  return "RISING_EDGE";
867  return "FALLING_EDGE";
868  default:
869  return "UNRECOGNIZED";
870  }
871 }
872 
873 /**
874  * @brief @ref TickMode stream operator.
875  * @ingroup config_and_ctrl_messages
876  */
877 inline std::ostream& operator<<(std::ostream& stream, TickMode tick_mode) {
878  stream << to_string(tick_mode) << " (" << (int)tick_mode << ")";
879  return stream;
880 }
881 
882 /**
883  * @brief The way to interpret an incoming voltage signal, used to indicate
884  * direction of a hardware wheel tick pulse, if available.
885  * @ingroup config_and_ctrl_messages
886  */
887 enum class TickDirection : uint8_t {
888  /** Wheel tick direction not provided. */
889  OFF = 0,
890  /**
891  * Assume vehicle is moving forward when direction signal voltage is high, and
892  * backward when direction signal is low.
893  */
895  /**
896  * Assume vehicle is moving forward when direction signal voltage is low, and
897  * backward when direction signal is high.
898  */
899  FORWARD_ACTIVE_LOW = 2,
900 };
901 
902 inline const char* to_string(TickDirection tick_direction) {
903  switch (tick_direction) {
904  case TickDirection::OFF:
905  return "OFF";
907  return "FORWARD_ACTIVE_HIGH";
909  return "FORWARD_ACTIVE_LOW";
910  default:
911  return "UNRECOGNIZED";
912  }
913 }
914 
915 /**
916  * @brief @ref TickDirection stream operator.
917  * @ingroup config_and_ctrl_messages
918  */
919 inline std::ostream& operator<<(std::ostream& stream,
920  TickDirection tick_direction) {
921  stream << to_string(tick_direction) << " (" << (int)tick_direction << ")";
922  return stream;
923 }
924 
925 /**
926  * @brief Hardware wheel encoder configuration settings.
927  * @ingroup config_and_ctrl_messages
928  *
929  * See @ref VehicleTickMeasurement.
930  */
931 struct alignas(4) HardwareTickConfig {
932  /**
933  * If enabled -- tick mode is not @ref TickMode::OFF -- the device will
934  * accumulate ticks received on the I/O pin, and use them as an indication of
935  * vehicle speed. If enabled, you must also specify @ref wheel_ticks_to_m to
936  * indicate the mapping of wheel tick encoder angle to tire circumference. All
937  * other wheel tick-related parameters such as tick capture rate, rollover
938  * value, etc. will be set internally.
939  *
940  * @warning
941  * Do not enable this feature if a wheel tick voltage signal is not present.
942  */
944 
945  /**
946  * When direction is @ref TickDirection::OFF, the incoming ticks will be
947  * treated as unsigned, meaning the tick count will continue to increase in
948  * either direction of travel. If direction is not @ref TickDirection::OFF,
949  * a second direction I/O pin will be used to indicate the direction of
950  * travel and the accumulated tick count will increase/decrease accordingly.
951  */
953 
954  uint8_t reserved1[2] = {0};
955 
956  /**
957  * The scale factor to convert from wheel encoder ticks to distance (in
958  * meters/tick). Used for @ref WheelSensorType::TICKS and
959  * @ref WheelSensorType::TICK_RATE.
960  */
961  float wheel_ticks_to_m = NAN;
962 };
963 
964 /** @} */
965 
966 /**************************************************************************/ /**
967  * @name Input/Output Stream Control
968  * @{
969  ******************************************************************************/
970 
971 /**
972  * @brief The framing protocol of a message.
973  */
974 enum class ProtocolType : uint8_t {
975  INVALID = 0,
976  FUSION_ENGINE = 1,
977  NMEA = 2,
978  RTCM = 3,
979 };
980 
981 /**
982  * @brief Get a human-friendly string name for the specified @ref
983  * ProtocolType.
984  * @ingroup config_and_ctrl_messages
985  *
986  * @param val The enum to get the string name for.
987  *
988  * @return The corresponding string name.
989  */
990 inline const char* to_string(ProtocolType val) {
991  switch (val) {
993  return "Invalid";
995  return "FusionEngine";
996  case ProtocolType::NMEA:
997  return "NMEA";
998  case ProtocolType::RTCM:
999  return "RTCM";
1000  default:
1001  return "Unrecognized";
1002  }
1003 }
1004 
1005 /**
1006  * @brief @ref ProtocolType stream operator.
1007  * @ingroup config_and_ctrl_messages
1008  */
1009 inline std::ostream& operator<<(std::ostream& stream, ProtocolType val) {
1010  stream << to_string(val) << " (" << (int)val << ")";
1011  return stream;
1012 }
1013 
1014 /**
1015  * @brief Type of IO interface transport.
1016  */
1017 enum class TransportType : uint8_t {
1018  INVALID = 0,
1019  SERIAL = 1,
1020  FILE = 2,
1021  TCP_CLIENT = 3,
1022  TCP_SERVER = 4,
1023  UDP_CLIENT = 5,
1024  UDP_SERVER = 6,
1025  /** This is used for requesting the configuration for all interfaces. */
1026  ALL = 255,
1027 };
1028 
1029 /**
1030  * @brief Get a human-friendly string name for the specified @ref
1031  * TransportType.
1032  * @ingroup config_and_ctrl_messages
1033  *
1034  * @param val The enum to get the string name for.
1035  *
1036  * @return The corresponding string name.
1037  */
1038 inline const char* to_string(TransportType val) {
1039  switch (val) {
1041  return "Invalid";
1042  case TransportType::SERIAL:
1043  return "Serial";
1044  case TransportType::FILE:
1045  return "File";
1047  return "TCP Client";
1049  return "TCP Server";
1051  return "UDP Client";
1053  return "UDP Server";
1054  case TransportType::ALL:
1055  return "All";
1056  default:
1057  return "Unrecognized";
1058  }
1059 }
1060 
1061 /**
1062  * @brief @ref TransportType stream operator.
1063  * @ingroup config_and_ctrl_messages
1064  */
1065 inline std::ostream& operator<<(std::ostream& stream, TransportType val) {
1066  stream << to_string(val) << " (" << (int)val << ")";
1067  return stream;
1068 }
1069 
1070 /**
1071  * @brief Identifies an IO interface.
1072  *
1073  * (e.g., serial port 0 or TCP server 2)
1074  */
1075 struct alignas(4) InterfaceID {
1076  /** The interface's transport type. **/
1078  /** An identifier for the instance of this transport. */
1079  uint8_t index = 0;
1080  uint8_t reserved[2] = {0};
1081 
1082  bool operator==(const InterfaceID& other) const {
1083  return type == other.type && index == other.index;
1084  }
1085 
1086  bool inline operator!=(const InterfaceID& other) const {
1087  return !(*this == other);
1088  }
1089 };
1090 
1091 /**
1092  * @brief @ref InterfaceID stream operator.
1093  * @ingroup config_and_ctrl_messages
1094  */
1095 inline std::ostream& operator<<(std::ostream& stream, InterfaceID val) {
1096  stream << "[type=" << to_string(val.type) << ", index=" << (int)val.index
1097  << "]";
1098  return stream;
1099 }
1100 
1101 /**
1102  * @brief The ways that this configuration message can be applied to the
1103  * previous list of values for that configuration type.
1104  */
1105 enum class UpdateAction : uint8_t {
1106  /**
1107  * Replace the previous list of values with the set provided in
1108  * this configuration.
1109  */
1110  REPLACE = 0
1111 };
1112 
1113 /**
1114  * @brief Get a human-friendly string name for the specified @ref
1115  * UpdateAction.
1116  * @ingroup config_and_ctrl_messages
1117  *
1118  * @param val The enum to get the string name for.
1119  *
1120  * @return The corresponding string name.
1121  */
1122 inline const char* to_string(UpdateAction val) {
1123  switch (val) {
1124  case UpdateAction::REPLACE:
1125  return "Replace";
1126  default:
1127  return "Unrecognized";
1128  }
1129 }
1130 
1131 /**
1132  * @brief @ref UpdateAction stream operator.
1133  * @ingroup config_and_ctrl_messages
1134  */
1135 inline std::ostream& operator<<(std::ostream& stream, UpdateAction val) {
1136  stream << to_string(val) << " (" << (int)val << ")";
1137  return stream;
1138 }
1139 
1140 /**
1141  * @brief Configuration for the streams associated with a single output
1142  * interface.
1143  *
1144  * This object is used in the payload of the @ref
1145  * SetOutputInterfaceConfigMessage and @ref
1146  * OutputInterfaceConfigResponseMessage messages. The declared contents are
1147  * followed by `N` `uint8_t` stream indices, where `N` is equal to @ref
1148  * num_streams. For example:
1149  *
1150  * ```
1151  * {MessageHeader, SetOutputInterfaceConfigMessage,
1152  * OutputInterfaceConfigEntry, uint8_t, uint8_t, ...}
1153  * ```
1154  */
1155 struct alignas(4) OutputInterfaceConfigEntry {
1156  /** The output interface to configure. */
1158  /** The number of `stream_indices` entries this message contains. */
1159  uint8_t num_streams = 0;
1160  uint8_t reserved[3] = {0};
1161  /**
1162  * Placeholder pointer for variable length set of indices.
1163  *
1164  * In the future these streams will be user defined, but for now they are:
1165  * - `0`: All FusionEngine messages.
1166  * - `1`: All NMEA messages.
1167  * - `2`: All RTCM messages.
1168  */
1169  uint8_t stream_indices[0];
1170 };
1171 
1172 /**
1173  * @brief Configure the set of output streams enabled for a given output
1174  * interface (@ref MessageType::SET_OUTPUT_INTERFACE_CONFIG, version
1175  * 1.0).
1176  * @ingroup config_and_ctrl_messages
1177 
1178  * The device will respond with a @ref CommandResponseMessage indicating whether
1179  * or not the request was accepted. Not all interfaces defined in @ref
1180  * InterfaceID are supported on all devices.
1181  *
1182  * Parameter changes are applied to the device's active configuration
1183  * immediately, but are not saved to persistent storage and will be restored to
1184  * their previous values on reset. To save configuration settings to persistent
1185  * storage, see @ref SaveConfigMessage.
1186  */
1188  static constexpr MessageType MESSAGE_TYPE =
1190  static constexpr uint8_t MESSAGE_VERSION = 0;
1191  /**
1192  * The type of action this configuration message applies to the
1193  * previous list of streams.
1194  */
1196  uint8_t reserved[3] = {0};
1197 
1198  /**
1199  * The new output interface configuration to be applied.
1200  */
1202 };
1203 
1204 /**
1205  * @brief Query the set of message streams configured to be output by the device
1206  * on a specified interface. (@ref
1207  * MessageType::GET_OUTPUT_INTERFACE_CONFIG, version 1.0).
1208  * @ingroup config_and_ctrl_messages
1209  *
1210  * The device will respond with a @ref OutputInterfaceConfigResponseMessage
1211  * containing the values.
1212  */
1214  static constexpr MessageType MESSAGE_TYPE =
1216  static constexpr uint8_t MESSAGE_VERSION = 0;
1217 
1218  /** The config source to request data from (active, saved, etc.). */
1220 
1221  uint8_t reserved[3] = {0};
1222 
1223  /**
1224  * The output interface to get the config for. If the `type` is @ref
1225  * TransportType::ALL then request the configuration for all interfaces.
1226  */
1228 };
1229 
1230 /**
1231  * @brief Response to a @ref GetOutputInterfaceConfigMessage request (@ref
1232  * MessageType::OUTPUT_INTERFACE_CONFIG_RESPONSE, version 1.0).
1233  * @ingroup config_and_ctrl_messages
1234  *
1235  * This message is followed by `N` @ref OutputInterfaceConfigEntry objects,
1236  * where `N` is equal to @ref number_of_interfaces. Each of these interfaces is
1237  * variable size, and the sum of the objects should add up to the message size
1238  * from the header.
1239  *
1240  * For example if the @ref number_of_interfaces is 2 and both interfaces have
1241  * two streams the payload will look as follows:
1242  *
1243  * ```
1244  * {MessageHeader, OutputInterfaceConfigResponseMessage,
1245  * OutputInterfaceConfigEntry, uint8_t, uint8_t,
1246  * OutputInterfaceConfigEntry, uint8_t, uint8_t}
1247  * ```
1248  */
1250  static constexpr MessageType MESSAGE_TYPE =
1252  static constexpr uint8_t MESSAGE_VERSION = 0;
1253 
1254  /** The source of the parameter value (active, saved, etc.). */
1256 
1257  /** The response status (success, error, etc.). */
1259 
1260  /**
1261  * Set to `true` if the active configuration differs from the saved
1262  * configuration for this parameter.
1263  */
1265 
1266  /** The number of output interfaces to follow. */
1268 
1269  /**
1270  * A pointer to the beginning of the interface data.
1271  */
1272  // Note: This causes a compiler error on MSVC so it is not included:
1273  // https://docs.microsoft.com/en-us/cpp/error-messages/compiler-errors-1/compiler-error-c2233
1274  // OutputInterfaceConfigEntry output_interface_data[0];
1275 };
1276 
1277 /**
1278  * @brief Integer ID for NMEA messages.
1279  */
1280 enum class NmeaMessageType : uint16_t {
1281  INVALID = 0,
1282 
1283  /**
1284  * @name Standard NMEA Messages
1285  * @{
1286  */
1287  GGA = 1,
1288  GLL = 2,
1289  GSA = 3,
1290  GSV = 4,
1291  RMC = 5,
1292  VTG = 6,
1293  /** @} */
1294 
1295  /**
1296  * @name Point One Proprietary Messages
1297  * @{
1298  */
1299  P1CALSTATUS = 1000,
1300  P1MSG = 1001,
1301  /** @} */
1302 
1303  /**
1304  * @name Quectel Proprietary Messages
1305  * @{
1306  */
1307  PQTMVERNO = 1200,
1308  PQTMVER = 1201,
1309  PQTMGNSS = 1202,
1310  /** @} */
1311 };
1312 
1313 /**
1314  * @brief Get a human-friendly string name for the specified @ref
1315  * NmeaMessageType.
1316  * @ingroup config_and_ctrl_messages
1317  *
1318  * @param value The enum to get the string name for.
1319  *
1320  * @return The corresponding string name.
1321  */
1322 inline const char* to_string(NmeaMessageType value) {
1323  switch (value) {
1325  return "INVALID";
1326  break;
1327  case NmeaMessageType::GGA:
1328  return "GGA";
1329  break;
1330  case NmeaMessageType::GLL:
1331  return "GLL";
1332  break;
1333  case NmeaMessageType::GSA:
1334  return "GSA";
1335  break;
1336  case NmeaMessageType::GSV:
1337  return "GSV";
1338  break;
1339  case NmeaMessageType::RMC:
1340  return "RMC";
1341  break;
1342  case NmeaMessageType::VTG:
1343  return "VTG";
1344  break;
1346  return "P1CALSTATUS";
1347  break;
1349  return "P1MSG";
1350  break;
1352  return "PQTMVERNO";
1353  break;
1355  return "PQTMVER";
1356  break;
1358  return "PQTMGNSS";
1359  break;
1360  default:
1361  return "Unrecognized";
1362  }
1363 }
1364 
1365 /**
1366  * @brief @ref NmeaMessageType stream operator.
1367  * @ingroup config_and_ctrl_messages
1368  */
1369 inline std::ostream& operator<<(std::ostream& stream, NmeaMessageType val) {
1370  stream << to_string(val) << " (" << (int)val << ")";
1371  return stream;
1372 }
1373 
1374 /**
1375  * @brief The output rate for a message type on an interface.
1376  */
1377 enum class MessageRate : uint8_t {
1378  /**
1379  * Disable output of this message.
1380  */
1381  OFF = 0,
1382  /**
1383  * Output this message each time a new value is available.
1384  */
1385  ON_CHANGE = 1,
1386  /**
1387  * Output this message at this interval. Not supported for all messages or
1388  * platforms.
1389  */
1390  INTERVAL_10_MS = 2,
1391  /**
1392  * Output this message at this interval. Not supported for all messages or
1393  * platforms.
1394  */
1395  INTERVAL_20_MS = 3,
1396  /**
1397  * Output this message at this interval. Not supported for all messages or
1398  * platforms.
1399  */
1400  INTERVAL_40_MS = 4,
1401  /**
1402  * Output this message at this interval. Not supported for all messages or
1403  * platforms.
1404  */
1405  INTERVAL_50_MS = 5,
1406  /**
1407  * Output this message at this interval. Not supported for all messages or
1408  * platforms.
1409  */
1410  INTERVAL_100_MS = 6,
1411  /**
1412  * Output this message at this interval. Not supported for all messages or
1413  * platforms.
1414  */
1415  INTERVAL_200_MS = 7,
1416  /**
1417  * Output this message at this interval. Not supported for all messages or
1418  * platforms.
1419  */
1420  INTERVAL_500_MS = 8,
1421  /**
1422  * Output this message at this interval. Not supported for all messages or
1423  * platforms.
1424  */
1425  INTERVAL_1_S = 9,
1426  /**
1427  * Output this message at this interval. Not supported for all messages or
1428  * platforms.
1429  */
1430  INTERVAL_2_S = 10,
1431  /**
1432  * Output this message at this interval. Not supported for all messages or
1433  * platforms.
1434  */
1435  INTERVAL_5_S = 11,
1436  /**
1437  * Output this message at this interval. Not supported for all messages or
1438  * platforms.
1439  */
1440  INTERVAL_10_S = 12
1441 };
1442 
1443 /**
1444  * @brief Get a human-friendly string name for the specified @ref
1445  * MessageRate.
1446  * @ingroup config_and_ctrl_messages
1447  *
1448  * @param value The enum to get the string name for.
1449  *
1450  * @return The corresponding string name.
1451  */
1452 inline const char* to_string(MessageRate value) {
1453  switch (value) {
1454  case MessageRate::OFF:
1455  return "OFF";
1456  break;
1458  return "ON_CHANGE";
1459  break;
1461  return "INTERVAL_10_MS";
1462  break;
1464  return "INTERVAL_20_MS";
1465  break;
1467  return "INTERVAL_40_MS";
1468  break;
1470  return "INTERVAL_50_MS";
1471  break;
1473  return "INTERVAL_100_MS";
1474  break;
1476  return "INTERVAL_200_MS";
1477  break;
1479  return "INTERVAL_500_MS";
1480  break;
1482  return "INTERVAL_1_S";
1483  break;
1485  return "INTERVAL_2_S";
1486  break;
1488  return "INTERVAL_5_S";
1489  break;
1491  return "INTERVAL_10_S";
1492  break;
1493  default:
1494  return "Unrecognized";
1495  }
1496 }
1497 
1498 /**
1499  * @brief @ref MessageRate stream operator.
1500  * @ingroup config_and_ctrl_messages
1501  */
1502 inline std::ostream& operator<<(std::ostream& stream, MessageRate val) {
1503  stream << to_string(val) << " (" << (int)val << ")";
1504  return stream;
1505 }
1506 
1507 /**
1508  * @brief Set the output rate for the requested message type on the specified
1509  * interface.
1510  * @ingroup config_and_ctrl_messages
1511  */
1512 struct alignas(4) SetMessageOutputRate : public MessagePayload {
1513  static constexpr MessageType MESSAGE_TYPE =
1515  static constexpr uint8_t MESSAGE_VERSION = 0;
1518  uint8_t reserved1[1] = {0};
1519  uint16_t message_id = 0;
1521  uint8_t reserved2[3] = {0};
1522 };
1523 
1524 /**
1525  * @brief Get the configured output rate for the he requested message type on
1526  * the specified interface
1527  * @ingroup config_and_ctrl_messages
1528  *
1529  * The device will respond with a @ref MessageOutputRateResponse
1530  * containing the values.
1531  */
1532 struct alignas(4) GetMessageOutputRate : public MessagePayload {
1533  static constexpr MessageType MESSAGE_TYPE =
1535  static constexpr uint8_t MESSAGE_VERSION = 0;
1538  /** The source of the parameter value (active, saved, etc.). */
1540  uint16_t message_id = 0;
1541 };
1542 
1543 /**
1544  * @brief The requested output rate.
1545  * @ingroup config_and_ctrl_messages
1546  */
1547 struct alignas(4) MessageOutputRateResponse : public MessagePayload {
1548  static constexpr MessageType MESSAGE_TYPE =
1550  static constexpr uint8_t MESSAGE_VERSION = 0;
1551  /** The source of the parameter value (active, saved, etc.). */
1553  /**
1554  * Set to `true` if the active configuration differs from the saved
1555  * configuration for this parameter.
1556  */
1558  /** The response status (success, error, etc.). */
1560 
1561  uint8_t reserved1[1] = {0};
1564  uint8_t reserved2[1] = {0};
1565  uint16_t message_id = 0;
1567  uint8_t reserved3[3] = {0};
1568 };
1569 
1570 /** @} */
1571 
1572 #pragma pack(pop)
1573 
1574 } // namespace messages
1575 } // namespace fusion_engine
1576 } // namespace point_one
1577 
1578 #ifdef _MSC_VER
1579 # pragma warning(pop)
1580 #endif
@ INTERVAL_10_S
Output this message at this interval.
@ INTERVAL_10_MS
Output this message at this interval.
ConfigType
An identifier for the contents of a parameter configuration message.
Definition: configuration.h:37
float wheel_ticks_to_m
The scale factor to convert from wheel encoder ticks to distance (in meters/tick).
@ VEHICLE_TICKS
A single wheel rotational angle, reported as accumulated encoder ticks.
@ BACKWARD
Aligned with vehicle -x axis.
static constexpr MessageType MESSAGE_TYPE
@ ALL
This is used for requesting the configuration for all interfaces.
A 3-dimensional vector (used for lever arms, etc.).
bool wheel_ticks_signed
true if the reported wheel tick measurements should be interpreted as signed integers,...
@ INTERVAL_5_S
Output this message at this interval.
@ RTCM
Identifies an IO interface.
def value
@ PQTMGNSS
TransportType type
The interface's transport type.
@ RMC
MessageType
Identifiers for the defined output message types.
Definition: defs.h:32
ProtocolType protocol
ProtocolType protocol
Response to a GetConfigMessage request (MessageType::CONFIG_RESPONSE, version 1.0).
@ SAVE
Save all active parameters to persistent storage.
@ OK
static constexpr MessageType MESSAGE_TYPE
The orientation of a device with respect to the vehicle body axes.
@ LEXUS_CT200H
@ INVALID
Hardware wheel encoder configuration settings.
@ NONE
Wheel/vehicle speed data not available.
@ TESLA_MODEL_X
@ DEVICE_LEVER_ARM
The location of the device IMU with respect to the vehicle body frame (in meters).
TickMode
The signal edge to use when capturing a wheel tick voltage signal.
@ DATASPEED_CD4
ConfigType config_type
The type of configuration parameter contained in this message.
OutputInterfaceConfigEntry output_interface_data
The new output interface configuration to be applied.
static constexpr MessageType MESSAGE_TYPE
@ FORWARD_ACTIVE_LOW
Assume vehicle is moving forward when direction signal voltage is low, and backward when direction si...
@ REVERT_TO_SAVED
Revert the active configuration to previously saved values.
@ BMW_7
@ DOWN
Aligned with vehicle -z axis.
bool active_differs_from_saved
Set to true if the active configuration differs from the saved configuration for this parameter.
static constexpr uint8_t MESSAGE_VERSION
static constexpr MessageType MESSAGE_TYPE
@ FILE
@ UART1_BAUD
Configure the UART1 serial baud rate (in bits/second).
ConfigurationSource config_source
The source of the parameter value (active, saved, etc.).
uint16_t message_id
@ GET_OUTPUT_INTERFACE_CONFIG
GetOutputInterfaceConfigMessage
@ VEHICLE_BODY
Individual vehicle speed to be applied to the system.
@ PQTMVERNO
@ UART1_OUTPUT_DIAGNOSTICS_MESSAGES
Force output the diagnostic message set on UART1.
@ TESLA_MODEL_3
InterfaceID output_interface
@ KIA_SPORTAGE
SteeringType
Indication of which of the vehicle's wheels are steered.
uint8_t flags
Bitmask of additional flags to modify the command.
@ HARDWARE_TICK_CONFIG
Indicates the mode and direction used when capturing vehicle wheel tick data from a voltage pulse on ...
InterfaceID output_interface
The output interface to get the config for.
uint8_t num_streams
The number of stream_indices entries this message contains.
@ UNKNOWN_VEHICLE
@ INTERVAL_500_MS
Output this message at this interval.
@ SET_OUTPUT_MESSAGE_RATE
SetMessageOutputRate
@ GLL
uint8_t config_change_data[0]
A pointer to the beginning of the configuration parameter value.
float wheel_update_interval_sec
The nominal rate at which wheel speed measurements will be provided (in seconds).
@ AUDI_Q7
SaveAction
The type configuration save operation to be performed.
uint8_t number_of_interfaces
The number of output interfaces to follow.
MessageRate rate
static constexpr uint8_t MESSAGE_VERSION
Information about the vehicle including model and dimensions.
The requested output rate.
ConfigurationSource config_source
The source of the parameter value (active, saved, etc.).
@ REVERT_TO_DEFAULT
Reset the active and saved configuration to default values.
UpdateAction
The ways that this configuration message can be applied to the previous list of values for that confi...
uint32_t wheel_tick_max_value
The maximum value (inclusive) before the wheel tick measurement will roll over.
@ SAVE_CONFIG
SaveConfigMessage
MessageRate
The output rate for a message type on an interface.
uint8_t config_change_data[0]
A pointer to the beginning of the configuration parameter value.
uint16_t message_id
TickDirection tick_direction
When direction is TickDirection::OFF, the incoming ticks will be treated as unsigned,...
float z
InterfaceID output_interface
static constexpr MessageType MESSAGE_TYPE
@ ACTIVE
Active configuration currently in use by the device.
@ FRONT
Front wheels are steered.
uint32_t config_length_bytes
The size of the parameter value, config_change_data (in bytes).
@ PEUGEOT_206
WheelSensorType wheel_sensor_type
The type of vehicle/wheel speed measurements produced by the vehicle.
SaveAction action
The action to performed.
@ TICK_RATE
Individual wheel rotation rates, reported as an encoder tick rate (in ticks/second).
TransportType
Type of IO interface transport.
The base class for all message payloads.
Definition: defs.h:497
static constexpr MessageType MESSAGE_TYPE
@ INTERVAL_1_S
Output this message at this interval.
Query the value of a user configuration parameter (MessageType::GET_CONFIG, version 1....
Response response
The response status (success, error, etc.).
Response response
The response status (success, error, etc.).
@ ON_CHANGE
Output this message each time a new value is available.
float y
@ INTERVAL_50_MS
Output this message at this interval.
@ PQTMVER
@ INVALID
@ INTERVAL_2_S
Output this message at this interval.
@ INTERVAL_100_MS
Output this message at this interval.
@ SERIAL
static constexpr uint8_t FLAG_APPLY_AND_SAVE
Flag to immediately save the config after applying this setting.
bool operator==(const InterfaceID &other) const
@ INVALID
@ OFF
Wheel tick capture disabled.
static constexpr MessageType MESSAGE_TYPE
@ TCP_SERVER
ConfigType config_type
The desired parameter.
UpdateAction update_action
The type of action this configuration message applies to the previous list of streams.
Definition: logging.h:36
Response to a GetOutputInterfaceConfigMessage request (MessageType::OUTPUT_INTERFACE_CONFIG_RESPONSE,...
@ FRONT_WHEELS
Front wheel speed data to be applied to the system.
@ INVALID
uint8_t index
An identifier for the instance of this transport.
@ UP
Aligned with vehicle +z axis.
@ FRONT_AND_REAR_WHEELS
Front and rear wheel speed data to be applied to the system.
Configuration for the streams associated with a single output interface.
bool operator!=(const InterfaceID &other) const
VehicleModel vehicle_model
@ P1MSG
TickMode tick_mode
If enabled – tick mode is not TickMode::OFF – the device will accumulate ticks received on the I/O pi...
float rear_track_width_m
The distance between the two rear wheels (in meters).
@ UART2_BAUD
Configure the UART2 serial baud rate (in bits/second).
@ GSV
AppliedSpeedType applied_speed_type
The type of vehicle/wheel speed measurements to be applied to the navigation solution.
@ TICKS
Individual wheel rotational angles, reported as accumulated encoder ticks.
@ AUDI_A8L
Direction
float steering_ratio
Ratio between angle of the steering wheel and the angle of the wheels on the ground.
@ REPLACE
Replace the previous list of values with the set provided in this configuration.
@ INTERVAL_200_MS
Output this message at this interval.
VehicleModel
The make and model of the vehicle.
@ DEVICE_COARSE_ORIENTATION
The orientation of the device IMU with respect to the vehicle body axes.
@ NMEA
@ INTERVAL_40_MS
Output this message at this interval.
float wheelbase_m
The distance between the front axle and rear axle (in meters).
@ OUTPUT_INTERFACE_CONFIG_RESPONSE
OutputInterfaceConfigResponseMessage
static constexpr uint8_t MESSAGE_VERSION
@ LEFT
Aligned with vehicle +y axis.
static constexpr uint8_t MESSAGE_VERSION
ConfigType config_type
The type of parameter to be configured.
Response
Command response status indicators.
Definition: defs.h:262
@ LINCOLN_MKZ
float wheel_tick_output_interval_sec
The nominal rate at which wheel tick measurements will be provided (in seconds).
TickDirection
The way to interpret an incoming voltage signal, used to indicate direction of a hardware wheel tick ...
ConfigurationSource request_source
The config source to request data from (active, saved, etc.).
@ OFF
Disable output of this message.
ConfigurationSource config_source
The source of the parameter value (active, saved, etc.).
InterfaceID output_interface
The output interface to configure.
static constexpr MessageType MESSAGE_TYPE
@ VEHICLE_SPEED
A single value indicating the vehicle speed (in meters/second).
@ GSA
uint8_t stream_indices[0]
Placeholder pointer for variable length set of indices.
@ UDP_SERVER
@ P1CALSTATUS
@ MAN_TGX
Direction z_direction
The direction of the device +z axis relative to the vehicle body axes.
MessageRate rate
static constexpr MessageType MESSAGE_TYPE
ConfigurationSource request_source
The config source to request data from (active, saved, etc.).
ProtocolType protocol
static constexpr uint8_t MESSAGE_VERSION
@ GET_OUTPUT_MESSAGE_RATE
GetMessageOutputRate
Response response
The response status (success, error, etc.).
NmeaMessageType
Integer ID for NMEA messages.
Save or reload configuration settings (MessageType::SAVE_CONFIG, version 1.0).
InterfaceID output_interface
@ HYUNDAI_ELANTRA
ProtocolType
The framing protocol of a message.
Set a user configuration parameter (MessageType::SET_CONFIG, version 1.0).
@ ENABLE_WATCHDOG_TIMER
Enable watchdog timer to restart device after fatal errors.
static constexpr uint8_t MESSAGE_VERSION
@ VTG
@ OUTPUT_MESSAGE_RATE_RESPONSE
MessageOutputRateResponse
WheelSensorType
The type of vehicle/wheel speed measurements produced by the vehicle.
SteeringType steering_type
Indication of which of the vehicle's wheels are steered.
float wheel_ticks_to_m
The scale factor to convert from wheel encoder ticks to distance (in meters/tick).
bool wheel_ticks_always_increase
true if the wheel tick measurements increase by a positive amount when driving forward or backward.
@ GET_CONFIG
GetConfigMessage
@ FRONT_AND_REAR
Front and rear wheels are steered.
Set the output rate for the requested message type on the specified interface.
@ OUTPUT_LEVER_ARM
The offset of the desired output location with respect to the vehicle body frame (in meters).
static constexpr uint8_t MESSAGE_VERSION
ConfigurationSource request_source
The source of the parameter value (active, saved, etc.).
@ SAVED
Settings currently saved to persistent storage.
@ SET_CONFIG
SetConfigMessage
@ VEHICLE_DETAILS
Information about the vehicle including model and dimensions.
@ NONE
Speed data not applied to the system.
std::ostream & operator<<(std::ostream &stream, ConfigType type)
ConfigType stream operator.
bool active_differs_from_saved
Set to true if the active configuration differs from the saved configuration for this parameter.
@ WHEEL_CONFIG
Information pertaining to wheel speed/rotation measurements.
Configure the set of output streams enabled for a given output interface (MessageType::SET_OUTPUT_INT...
Point One FusionEngine output message common definitions.
Vehicle/wheel speed measurement configuration settings.
bool active_differs_from_saved
Set to true if the active configuration differs from the saved configuration for this parameter.
@ WHEEL_SPEED
Individual wheel speeds, reported in meters/second.
@ SET_OUTPUT_INTERFACE_CONFIG
SetOutputInterfaceConfigMessage
@ FALLING_EDGE
Capture a wheel tick on the falling edge of the incoming pulse.
@ FORWARD_ACTIVE_HIGH
Assume vehicle is moving forward when direction signal voltage is high, and backward when direction s...
static constexpr MessageType MESSAGE_TYPE
uint32_t config_length_bytes
The size of the parameter value, config_change_data (in bytes).
@ GGA
@ FACTION
ConfigurationSource
The type of a device's configuration settings.
@ TCP_CLIENT
float x
const char * to_string(ConfigType type)
Get a human-friendly string name for the specified ConfigType.
@ INTERVAL_20_MS
Output this message at this interval.
@ REAR_WHEELS
Rear wheel speed data to be applied to the system (recommended).
static constexpr uint8_t MESSAGE_VERSION
@ GNSS_LEVER_ARM
The location of the GNSS antenna with respect to the vehicle body frame (in meters).
float front_track_width_m
The distance between the two front wheels (in meters).
@ RIGHT
Aligned with vehicle -y axis.
@ KIA_SORENTO
@ FUSION_ENGINE
static constexpr uint8_t MESSAGE_VERSION
Query the set of message streams configured to be output by the device on a specified interface.
uint16_t message_id
@ OFF
Wheel tick direction not provided.
Get the configured output rate for the he requested message type on the specified interface.
static constexpr uint8_t MESSAGE_VERSION
@ RISING_EDGE
Capture a wheel tick on the rising edge of the incoming pulse.
Direction x_direction
The direction of the device +x axis relative to the vehicle body axes.
@ UART2_OUTPUT_DIAGNOSTICS_MESSAGES
Force output the diagnostic message set on UART2.
@ UDP_CLIENT
AppliedSpeedType
The type of vehicle/wheel speed measurements to be applied.
@ J1939
@ UNKNOWN
Steered wheels unknown.
@ INVALID
@ FORWARD
Aligned with vehicle +x axis.
@ CONFIG_RESPONSE
ConfigResponseMessage