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 
22 
23 namespace point_one {
24 namespace fusion_engine {
25 namespace messages {
26 
27 // Enforce 4-byte alignment and packing of all data structures and values.
28 // Floating point values are aligned on platforms that require it. This is done
29 // with a combination of setting struct attributes, and manual alignment
30 // within the definitions. See the "Message Packing" section of the README.
31 #pragma pack(push, 1)
32 
33 /**
34  * @brief An identifier for the contents of a parameter configuration message.
35  * @ingroup config_and_ctrl_messages
36  *
37  * See also @ref SetConfigMessage.
38  */
39 enum class ConfigType : uint16_t {
40  INVALID = 0,
41 
42  /**
43  * The location of the device IMU with respect to the vehicle body frame (in
44  * meters).
45  *
46  * Payload format: @ref Point3f
47  */
48  DEVICE_LEVER_ARM = 16,
49 
50  /**
51  * The orientation of the device IMU with respect to the vehicle body axes.
52  *
53  * Payload format: @ref CoarseOrientation
54  */
56 
57  /**
58  * The location of the GNSS antenna with respect to the vehicle body frame (in
59  * meters).
60  *
61  * Payload format: @ref Point3f
62  */
63  GNSS_LEVER_ARM = 18,
64 
65  /**
66  * The offset of the desired output location with respect to the vehicle
67  * body frame (in meters).
68  *
69  * Payload format: @ref Point3f
70  */
71  OUTPUT_LEVER_ARM = 19,
72 
73  /**
74  * Information about the vehicle including model and dimensions.
75  *
76  * Payload format: @ref VehicleDetails
77  */
78  VEHICLE_DETAILS = 20,
79 
80  /**
81  * Information pertaining to wheel speed/rotation measurements when wheel data
82  * is transmitted via software.
83  *
84  * @note
85  * For hardware wheel tick voltage capture, use @ref
86  * ConfigType::HARDWARE_TICK_CONFIG instead.
87  *
88  * Payload format: @ref WheelConfig
89  */
90  WHEEL_CONFIG = 21,
91 
92  /**
93  * Indicates the mode and direction used when capturing vehicle wheel tick
94  * data from a voltage pulse on an I/O pin.
95  *
96  * @note
97  * For software wheel tick capture (wheel ticks sent as FusionEngine messages
98  * or on a CAN bus), use @ref ConfigType::WHEEL_CONFIG instead.
99  *
100  * Payload format: @ref HardwareTickConfig
101  */
103 
104  /**
105  * A bitmask indicating which GNSS constellations are enabled.
106  *
107  * Payload format: `uint32_t` (see @ref sat_type_masks)
108  */
110 
111  /**
112  * A bitmask indicating which GNSS frequency bands are enabled.
113  *
114  * Payload format: `uint32_t` (see @ref freq_band_masks)
115  */
117 
118  /**
119  * Specify a UTC leap second count override value to use for all UTC time
120  * conversions. Setting this value will disable all internal leap second
121  * sources, including data received from the GNSS almanac decoded from
122  * available signals.
123  *
124  * Set to -1 to disable leap second override and re-enable internal leap
125  * second handling.
126  *
127  * Payload format: `int32_t`
128  */
129  LEAP_SECOND = 52,
130 
131  /**
132  * Specify a GPS legacy week rollover count override to use when converting
133  * all legacy 10-bit GPS week numbers. Setting this value will disable all
134  * internal week rollover sources, including data received from modern GPS
135  * navigation messages (CNAV, CNAV2) or non-GPS constellations.
136  *
137  * Set to -1 to disable week rollover override and re-enable internal
138  * handling.
139  *
140  * Payload format: `int32_t`
141  */
142  GPS_WEEK_ROLLOVER = 53,
143 
144  /**
145  * Change a configuration setting for a specified output interface.
146  *
147  * Payload format: `InterfaceConfigSubmessage`
148  */
149  INTERFACE_CONFIG = 200,
150 
151  /**
152  * Configure the UART1 serial baud rate (in bits/second).
153  *
154  * @deprecated
155  * The @ref ConfigType::INTERFACE_CONFIG type combined with @ref
156  * InterfaceConfigType::BAUD_RATE in the @ref InterfaceConfigSubmessage should
157  * be used to configure this value going forward.
158  *
159  * Payload format: `uint32_t`
160  */
161  UART1_BAUD = 256,
162 
163  /**
164  * Configure the UART2 serial baud rate (in bits/second).
165  *
166  * @deprecated
167  * The @ref ConfigType::INTERFACE_CONFIG type combined with @ref
168  * InterfaceConfigType::BAUD_RATE in the @ref InterfaceConfigSubmessage should
169  * be used to configure this value going forward.
170  *
171  * Payload format: `uint32_t`
172  */
173  UART2_BAUD = 257,
174 
175  /**
176  * Enable/disable output of diagnostic data on UART1.
177  *
178  * @deprecated
179  * The @ref ConfigType::INTERFACE_CONFIG type combined with @ref
180  * InterfaceConfigType::OUTPUT_DIAGNOSTICS_MESSAGES in the @ref
181  * InterfaceConfigSubmessage should be used to configure this value going
182  * forward.
183  *
184  * @note
185  * Enabling this setting will override the message rate/off settings for some
186  * FusionEngine messages.
187  *
188  * Payload format: `bool`
189  */
191 
192  /**
193  * Enable/disable output of diagnostic data on UART2.
194  *
195  * @deprecated
196  * The @ref ConfigType::INTERFACE_CONFIG type combined with @ref
197  * InterfaceConfigType::OUTPUT_DIAGNOSTICS_MESSAGES in the @ref
198  * InterfaceConfigSubmessage should be used to configure this value going
199  * forward.
200  *
201  * @note
202  * Enabling this setting will override the message rate/off settings for some
203  * FusionEngine messages.
204  *
205  * Payload format: `bool`
206  */
208 
209  /**
210  * Enable watchdog timer to restart device after fatal errors.
211  *
212  * Payload format: `bool`
213  */
214  ENABLE_WATCHDOG_TIMER = 300,
215 };
216 
217 /**
218  * @brief Get a human-friendly string name for the specified @ref ConfigType.
219  * @ingroup config_and_ctrl_messages
220  *
221  * @param type The desired configuration parameter type.
222  *
223  * @return The corresponding string name.
224  */
226  switch (type) {
227  case ConfigType::INVALID:
228  return "Invalid";
229 
231  return "Device Lever Arm";
232 
234  return "Device Coarse Orientation";
235 
237  return "GNSS Lever Arm";
238 
240  return "Output Lever Arm";
241 
243  return "Vehicle Details";
244 
246  return "Wheel Config";
247 
249  return "Hardware Tick Config";
250 
252  return "UART1 Baud Rate";
253 
255  return "UART2 Baud Rate";
256 
258  return "UART1 Diagnostic Messages Enabled";
259 
261  return "UART2 Diagnostic Messages Enabled";
262 
264  return "Watchdog Timer Enabled";
265 
267  return "Interface Submessage";
268 
269  default:
270  return "Unrecognized Configuration";
271  }
272 }
273 
274 /**
275  * @brief @ref ConfigType stream operator.
276  * @ingroup config_and_ctrl_messages
277  */
278 inline std::ostream& operator<<(std::ostream& stream, ConfigType type) {
279  stream << to_string(type) << " (" << (int)type << ")";
280  return stream;
281 }
282 
283 /**
284  * @brief An identifier for the contents of a output interface configuration
285  * submessage.
286  * @ingroup config_and_ctrl_messages
287  *
288  * See also @ref InterfaceConfigSubmessage.
289  */
290 enum class InterfaceConfigType : uint8_t {
291  INVALID = 0,
292 
293  /**
294  * Enable/disable output of diagnostic data on this interface.
295  *
296  * Valid for:
297  * - All @ref TransportType
298  *
299  * @note
300  * Enabling this setting will override the message rate/off settings for some
301  * FusionEngine messages.
302  *
303  * Payload format: `bool`
304  */
306 
307  /**
308  * Configure the serial baud rate (in bits/second).
309  *
310  * Valid for:
311  * - @ref TransportType::SERIAL
312  *
313  * Payload format: `uint32_t`
314  */
315  BAUD_RATE = 2,
316 
317  /**
318  * Configure the network address for a client to connect to.
319  *
320  * Valid for:
321  * - @ref TransportType::TCP_CLIENT
322  * - @ref TransportType::UDP_CLIENT
323  *
324  * Payload format: `char[64]` containing a NULL terminated string.
325  */
326  REMOTE_ADDRESS = 3,
327 
328  /**
329  * Configure the network port.
330  *
331  * Valid for:
332  * - @ref TransportType::TCP_CLIENT
333  * - @ref TransportType::TCP_SERVER
334  * - @ref TransportType::UDP_CLIENT
335  * - @ref TransportType::UDP_SERVER
336  *
337  * Payload format: `uint16_t`
338  */
339  PORT = 4,
340 };
341 
342 /**
343  * @brief Get a human-friendly string name for the specified @ref ConfigType.
344  * @ingroup config_and_ctrl_messages
345  *
346  * @param type The desired configuration parameter type.
347  *
348  * @return The corresponding string name.
349  */
351  switch (type) {
353  return "Invalid";
354 
356  return "Diagnostic Messages Enabled";
357 
359  return "Serial Baud Rate";
360 
362  return "Remote Network Address";
363 
365  return "Network Port";
366 
367  default:
368  return "Unrecognized Configuration";
369  }
370 }
371 
372 /**
373  * @brief @ref InterfaceConfigType stream operator.
374  * @ingroup config_and_ctrl_messages
375  */
376 inline std::ostream& operator<<(std::ostream& stream,
377  InterfaceConfigType type) {
378  stream << to_string(type) << " (" << (int)type << ")";
379  return stream;
380 }
381 
382 /**
383  * @brief The type of a device's configuration settings.
384  * @ingroup config_and_ctrl_messages
385  */
386 enum class ConfigurationSource : uint8_t {
387  ACTIVE = 0, ///< Active configuration currently in use by the device.
388  SAVED = 1, ///< Settings currently saved to persistent storage.
389 };
390 
391 /**
392  * @brief Get a human-friendly string name for the specified @ref
393  * ConfigurationSource.
394  * @ingroup config_and_ctrl_messages
395  *
396  * @param source The desired configuration source.
397  *
398  * @return The corresponding string name.
399  */
401  switch (source) {
403  return "Active";
404 
406  return "Saved";
407 
408  default:
409  return "Unrecognized Source";
410  }
411 }
412 
413 /**
414  * @brief @ref ConfigurationSource stream operator.
415  * @ingroup config_and_ctrl_messages
416  */
417 inline std::ostream& operator<<(std::ostream& stream,
418  ConfigurationSource source) {
419  stream << to_string(source) << " (" << (int)source << ")";
420  return stream;
421 }
422 
423 /**
424  * @brief The type configuration save operation to be performed.
425  * @ingroup config_and_ctrl_messages
426  */
427 enum class SaveAction : uint8_t {
428  /** Save all active parameters to persistent storage. */
429  SAVE = 0,
430  /** Revert the active configuration to previously saved values. */
431  REVERT_TO_SAVED = 1,
432  /** Reset the active _and_ saved configuration to default values. */
433  REVERT_TO_DEFAULT = 2,
434 };
435 
436 /**
437  * @brief Get a human-friendly string name for the specified @ref SaveAction.
438  * @ingroup config_and_ctrl_messages
439  *
440  * @param action The desired save operation.
441  *
442  * @return The corresponding string name.
443  */
445  switch (action) {
446  case SaveAction::SAVE:
447  return "Save";
448 
450  return "Revert To Saved";
451 
453  return "Revert To Default";
454 
455  default:
456  return "Unknown";
457  }
458 }
459 
460 /**
461  * @brief @ref SaveAction stream operator.
462  * @ingroup config_and_ctrl_messages
463  */
464 inline std::ostream& operator<<(std::ostream& stream, SaveAction action) {
465  stream << to_string(action) << " (" << (int)action << ")";
466  return stream;
467 }
468 
469 /**
470  * @brief Set a user configuration parameter (@ref MessageType::SET_CONFIG,
471  * version 1.0).
472  * @ingroup config_and_ctrl_messages
473  *
474  * The format of the parameter value, @ref config_change_data, is defined by the
475  * the specified @ref config_type (@ref ConfigType). For example, an antenna
476  * lever arm definition may require three 32-bit `float` values, one for each
477  * axis, while a serial port baud rate may be specified as single 32-bit
478  * unsigned integer (`uint32_t`).
479  *
480  * Not all parameters defined in @ref ConfigType are supported on all devices.
481  *
482  * Parameter changes are applied to the device's active configuration
483  * immediately, but are not saved to persistent storage and will be restored to
484  * their previous values on reset. To save configuration settings to persistent
485  * storage, see @ref SaveConfigMessage.
486  *
487  * # Expected Response
488  * The device will respond with a @ref CommandResponseMessage indicating whether
489  * or not the request succeeded.
490  */
491 struct alignas(4) SetConfigMessage : public MessagePayload {
493  static constexpr uint8_t MESSAGE_VERSION = 0;
494 
495  /** Flag to immediately save the config after applying this setting. */
496  static constexpr uint8_t FLAG_APPLY_AND_SAVE = 0x01;
497  /**
498  * Flag to restore the config_type back to its default value.
499  *
500  * When set, the @ref config_length_bytes should be 0 and no data should be
501  * included unless the config_type is @ref ConfigType::INTERFACE_CONFIG. In
502  * that case the @ref config_length_bytes should be
503  * `sizeof(InterfaceConfigSubmessage)` with a an @ref
504  * InterfaceConfigSubmessage as the @ref config_change_data without any
505  * further payload.
506  */
507  static constexpr uint8_t FLAG_REVERT_TO_DEFAULT = 0x02;
508 
509  /** The type of parameter to be configured. */
511 
512  /** Bitmask of additional flags to modify the command. */
513  uint8_t flags = 0;
514 
515  uint8_t reserved[1] = {0};
516 
517  /** The size of the parameter value, @ref config_change_data (in bytes). */
518  uint32_t config_length_bytes = 0;
519 
520  /**
521  * A pointer to the beginning of the configuration parameter value.
522  *
523  * The size and format of the contents is specified by the @ref config_type.
524  * See @ref ConfigType.
525  */
526  uint8_t config_change_data[0];
527 };
528 
529 /**
530  * @brief Query the value of a user configuration parameter (@ref
531  * MessageType::GET_CONFIG, version 1.0).
532  * @ingroup config_and_ctrl_messages
533  *
534  * # Expected Response
535  * The device will respond with a @ref ConfigResponseMessage containing the
536  * requested parameter value, or a @ref CommandResponseMessage on failure.
537  */
538 struct alignas(4) GetConfigMessage : public MessagePayload {
540  static constexpr uint8_t MESSAGE_VERSION = 1;
541 
542  /** The desired parameter. */
544 
545  /** The config source to request data from (active, saved, etc.). */
547 
548  uint8_t reserved[1] = {0};
549 
550  /**
551  * When @ref config_type is @ref ConfigType::INTERFACE_CONFIG, a @ref
552  * InterfaceConfigSubmessage must be added to the end of this message with
553  * empty @ref InterfaceConfigSubmessage::config_data.
554  */
556 };
557 
558 /**
559  * @brief Save or reload configuration settings (@ref MessageType::SAVE_CONFIG,
560  * version 1.0).
561  * @ingroup config_and_ctrl_messages
562  *
563  * # Expected Response
564  * The device will respond with a @ref CommandResponseMessage indicating whether
565  * or not the request succeeded.
566  */
567 struct alignas(4) SaveConfigMessage : public MessagePayload {
569  static constexpr uint8_t MESSAGE_VERSION = 0;
570 
571  /** The action to performed. */
573 
574  uint8_t reserved[3] = {0};
575 };
576 
577 /**
578  * @brief Response to a @ref GetConfigMessage request (@ref
579  * MessageType::CONFIG_RESPONSE, version 1.0).
580  * @ingroup config_and_ctrl_messages
581  *
582  * This message is followed by `N` bytes, where `N` is equal to @ref
583  * config_length_bytes that make up the data associated with @ref config_type.
584  * For example if the @ref config_type is @ref ConfigType::UART1_BAUD, the
585  * payload will include a single 32-bit unsigned integer:
586  *
587  * ```
588  * {MessageHeader, ConfigResponseMessage, uint32_t}
589  * ```
590  *
591  * In response to a @ref GetConfigMessage with an invalid or unsupported @ref
592  * ConfigType, @ref config_type in the resulting @ref ConfigResponseMessage will
593  * be set to @ref ConfigType::INVALID, and @ref response will indicate the
594  * reason. Note that all @ref GetConfigMessage requests, including invalid and
595  * rejected requests, will receive a @ref ConfigResponseMessage, not a
596  * @ref CommandResponseMessage.
597  */
598 struct alignas(4) ConfigResponseMessage : public MessagePayload {
600  static constexpr uint8_t MESSAGE_VERSION = 0;
601 
602  /**
603  * Flag to indicate the active value for this configuration differs from the
604  * value saved to persistent memory.
605  */
606  static constexpr uint8_t FLAG_ACTIVE_DIFFERS_FROM_SAVED = 0x1;
607 
608  /** The source of the parameter value (active, saved, etc.). */
610 
611  /** Flags that describe the configuration parameter. */
612  uint8_t flags = 0;
613 
614  /** The type of configuration parameter contained in this message. */
616 
617  /** The response status (success, error, etc.). */
619 
620  uint8_t reserved[3] = {0};
621 
622  /** The size of the parameter value, @ref config_change_data (in bytes). */
623  uint32_t config_length_bytes = 0;
624 
625  /**
626  * A pointer to the beginning of the configuration parameter value.
627  *
628  * The size and format of the contents is specified by the @ref config_type.
629  * See @ref ConfigType.
630  */
631  uint8_t config_change_data[0];
632 };
633 
634 /**************************************************************************/ /**
635  * @defgroup config_types Configuration Settings Type Definitions
636  * @{
637  ******************************************************************************/
638 
639 /**
640  * @brief A 3-dimensional vector (used for lever arms, etc.).
641  */
642 struct alignas(4) Point3f {
643  float x = NAN;
644  float y = NAN;
645  float z = NAN;
646 };
647 
648 /**
649  * @brief The orientation of a device with respect to the vehicle body axes.
650  *
651  * A device's orientation is defined by specifying how the +x and +z axes of its
652  * IMU are aligned with the vehicle body axes. For example, in a car:
653  * - `forward,up`: device +x = vehicle +x, device +z = vehicle +z (i.e.,
654  * IMU pointed towards the front of the vehicle).
655  * - `left,up`: device +x = vehicle +y, device +z = vehicle +z (i.e., IMU
656  * pointed towards the left side of the vehicle)
657  * - `up,backward`: device +x = vehicle +z, device +z = vehicle -x (i.e.,
658  * IMU pointed vertically upward, with the top of the IMU pointed towards the
659  * trunk)
660  */
661 struct alignas(4) CoarseOrientation {
662  enum class Direction : uint8_t {
663  FORWARD = 0, ///< Aligned with vehicle +x axis.
664  BACKWARD = 1, ///< Aligned with vehicle -x axis.
665  LEFT = 2, ///< Aligned with vehicle +y axis.
666  RIGHT = 3, ///< Aligned with vehicle -y axis.
667  UP = 4, ///< Aligned with vehicle +z axis.
668  DOWN = 5, ///< Aligned with vehicle -z axis.
669  INVALID = 255
670  };
671 
672  /** The direction of the device +x axis relative to the vehicle body axes. */
674 
675  /** The direction of the device +z axis relative to the vehicle body axes. */
677 
678  uint8_t reserved[2] = {0};
679 };
680 
681 /**
682  * @brief The make and model of the vehicle.
683  * @ingroup config_and_ctrl_messages
684  */
685 enum class VehicleModel : uint16_t {
686  UNKNOWN_VEHICLE = 0,
687  DATASPEED_CD4 = 1,
688  // In general, all J1939 vehicles support a subset of the J1939 standard and
689  // may be set to vehicle model `J1939`. Their 29-bit CAN IDs may differ
690  // based on how the platform assigns message priorities and source
691  // addresses, but the underlying program group number (PGN) and message
692  // contents will be consistent.
693  //
694  // For most vehicles, it is not necessary to specify and particular make and
695  // model.
696  J1939 = 2,
697 
698  LEXUS_CT200H = 20,
699 
700  KIA_SORENTO = 40,
701  KIA_SPORTAGE = 41,
702 
703  AUDI_Q7 = 60,
704  AUDI_A8L = 61,
705 
706  TESLA_MODEL_X = 80,
707  TESLA_MODEL_3 = 81,
708 
709  HYUNDAI_ELANTRA = 100,
710 
711  PEUGEOT_206 = 120,
712 
713  MAN_TGX = 140,
714 
715  FACTION = 160,
716 
717  LINCOLN_MKZ = 180,
718 
719  BMW_7 = 200,
720 };
721 
722 /**
723  * @brief Get a human-friendly string name for the specified @ref VehicleModel.
724  * @ingroup config_and_ctrl_messages
725  *
726  * @param vehicle_model The desired vehicle model.
727  *
728  * @return The corresponding string name.
729  */
730 P1_CONSTEXPR_FUNC const char* to_string(VehicleModel vehicle_model) {
731  switch (vehicle_model) {
733  return "UNKNOWN";
735  return "DATASPEED_CD4";
736  case VehicleModel::J1939:
737  return "J1939";
739  return "LEXUS_CT200H";
741  return "KIA_SORENTO";
743  return "KIA_SPORTAGE";
745  return "AUDI_Q7";
747  return "AUDI_A8L";
749  return "TESLA_MODEL_X";
751  return "TESLA_MODEL_3";
753  return "HYUNDAI_ELANTRA";
755  return "PEUGEOT_206";
757  return "MAN_TGX";
759  return "FACTION";
761  return "LINCOLN_MKZ";
762  case VehicleModel::BMW_7:
763  return "BMW_7";
764  default:
765  return "UNRECOGNIZED";
766  }
767 }
768 
769 /**
770  * @brief @ref VehicleModel stream operator.
771  * @ingroup config_and_ctrl_messages
772  */
773 inline std::ostream& operator<<(std::ostream& stream,
774  VehicleModel vehicle_model) {
775  stream << to_string(vehicle_model) << " (" << (int)vehicle_model << ")";
776  return stream;
777 }
778 
779 /**
780  * @brief Information about the vehicle including model and dimensions.
781  * @ingroup config_and_ctrl_messages
782  */
783 struct alignas(4) VehicleDetails {
785  uint8_t reserved[10] = {0};
786 
787  /** The distance between the front axle and rear axle (in meters). */
788  float wheelbase_m = NAN;
789 
790  /** The distance between the two front wheels (in meters). */
791  float front_track_width_m = NAN;
792 
793  /** The distance between the two rear wheels (in meters). */
794  float rear_track_width_m = NAN;
795 };
796 
797 /**
798  * @brief The type of vehicle/wheel speed measurements produced by the vehicle.
799  * @ingroup config_and_ctrl_messages
800  */
801 enum class WheelSensorType : uint8_t {
802  /** Wheel/vehicle speed data not available. */
803  NONE = 0,
804  /**
805  * Individual wheel rotation rates, reported as an encoder tick rate (in
806  * ticks/second). Will be scaled to meters/second using the specified scale
807  * factor.
808  */
809  TICK_RATE = 1,
810  /**
811  * Individual wheel rotational angles, reported as accumulated encoder
812  * ticks.
813  * */
814  TICKS = 2,
815  /** Individual wheel speeds, reported in meters/second. */
816  WHEEL_SPEED = 3,
817  /** A single value indicating the vehicle speed (in meters/second). */
818  VEHICLE_SPEED = 4,
819  /** A single wheel rotational angle, reported as accumulated encoder ticks. */
820  VEHICLE_TICKS = 5,
821 };
822 
823 /**
824  * @brief Get a human-friendly string name for the specified @ref
825  * WheelSensorType.
826  * @ingroup config_and_ctrl_messages
827  *
828  * @param wheel_sensor_type The desired wheel sensor type.
829  *
830  * @return The corresponding string name.
831  */
832 P1_CONSTEXPR_FUNC const char* to_string(WheelSensorType wheel_sensor_type) {
833  switch (wheel_sensor_type) {
834  case WheelSensorType::NONE: {
835  return "None";
836  }
838  return "Tick Rate";
839  }
840  case WheelSensorType::TICKS: {
841  return "Ticks";
842  }
844  return "Wheel Speed";
845  }
847  return "Vehicle Speed";
848  }
850  return "Vehicle Ticks";
851  }
852  default: {
853  return "None";
854  }
855  }
856 }
857 
858 /**
859  * @brief @ref WheelSensorType stream operator.
860  * @ingroup config_and_ctrl_messages
861  */
862 inline std::ostream& operator<<(std::ostream& stream,
863  WheelSensorType wheel_sensor_type) {
864  stream << to_string(wheel_sensor_type) << " (" << (int)wheel_sensor_type
865  << ")";
866  return stream;
867 }
868 
869 /**
870  * @brief The type of vehicle/wheel speed measurements to be applied.
871  * @ingroup config_and_ctrl_messages
872  */
873 enum class AppliedSpeedType : uint8_t {
874  /** Speed data not applied to the system. */
875  NONE = 0,
876  /** Rear wheel speed data to be applied to the system (recommended). */
877  REAR_WHEELS = 1,
878  /** Front wheel speed data to be applied to the system. */
879  FRONT_WHEELS = 2,
880  /** Front and rear wheel speed data to be applied to the system. */
882  /** Individual vehicle speed to be applied to the system. */
883  VEHICLE_BODY = 4,
884 };
885 
886 /**
887  * @brief Get a human-friendly string name for the specified @ref
888  * AppliedSpeedType.
889  * @ingroup config_and_ctrl_messages
890  *
891  * @param applied_speed_type The desired applied speed type.
892  *
893  * @return The corresponding string name.
894  */
895 P1_CONSTEXPR_FUNC const char* to_string(AppliedSpeedType applied_speed_type) {
896  switch (applied_speed_type) {
897  case AppliedSpeedType::NONE: {
898  return "None";
899  }
901  return "Rear Wheels";
902  }
904  return "Front Wheels";
905  }
907  return "Front and Rear Wheels";
908  }
910  return "Vehicle Body";
911  }
912  default: {
913  return "Unrecognized";
914  }
915  }
916 }
917 
918 /**
919  * @brief @ref AppliedSpeedType stream operator.
920  * @ingroup config_and_ctrl_messages
921  */
922 inline std::ostream& operator<<(std::ostream& stream,
923  AppliedSpeedType applied_speed_type) {
924  stream << to_string(applied_speed_type) << " (" << (int)applied_speed_type
925  << ")";
926  return stream;
927 }
928 
929 /**
930  * @brief Indication of which of the vehicle's wheels are steered.
931  * @ingroup config_and_ctrl_messages
932  */
933 enum class SteeringType : uint8_t {
934  /** Steered wheels unknown. */
935  UNKNOWN = 0,
936  /** Front wheels are steered. */
937  FRONT = 1,
938  /** Front and rear wheels are steered. */
939  FRONT_AND_REAR = 2,
940 };
941 
942 /**
943  * @brief Get a human-friendly string name for the specified @ref SteeringType.
944  * @ingroup config_and_ctrl_messages
945  *
946  * @param steering_type The desired steering type.
947  *
948  * @return The corresponding string name.
949  */
950 P1_CONSTEXPR_FUNC const char* to_string(SteeringType steering_type) {
951  switch (steering_type) {
952  case SteeringType::UNKNOWN: {
953  return "Unknown Steering";
954  }
955  case SteeringType::FRONT: {
956  return "Front Steering";
957  }
959  return "Front and Rear Steering";
960  }
961  default: {
962  return "Unrecognized";
963  }
964  }
965 }
966 
967 /**
968  * @brief @ref SteeringType stream operator.
969  * @ingroup config_and_ctrl_messages
970  */
971 inline std::ostream& operator<<(std::ostream& stream,
972  SteeringType steering_type) {
973  stream << to_string(steering_type) << " (" << (int)steering_type << ")";
974  return stream;
975 }
976 
977 /**
978  * @brief Software vehicle/wheel speed measurement configuration settings.
979  * @ingroup config_and_ctrl_messages
980  *
981  * @warning
982  * The @ref WheelConfig payload is intended for use on vehicles where wheel
983  * speed or angle (tick) data is received via software, either using
984  * FusionEngine measurement messages, or from another software data source such
985  * as a vehicle CAN bus. For vehicles using a hardware wheel tick voltage
986  * signal, use @ref HardwareTickConfig instead.
987  *
988  * Wheel data may be differential (measurements from each individual wheel), or
989  * scalar (a single speed measurement for the vehicle body).
990  *
991  * When using software wheel data, you must also specify @ref VehicleDetails,
992  * which is used to describe the vehicle dimensions and make/model.
993  *
994  * See also:
995  * - @ref WheelSpeedMeasurement
996  * - @ref VehicleSpeedMeasurement
997  * - @ref WheelTickMeasurement
998  * - @ref VehicleTickMeasurement
999  */
1000 struct alignas(4) WheelConfig {
1001  /**
1002  * The type of vehicle/wheel speed measurements produced by the vehicle.
1003  */
1005 
1006  /**
1007  * The type of vehicle/wheel speed measurements to be applied to the
1008  * navigation solution.
1009  */
1011 
1012  /** Indication of which of the vehicle's wheels are steered. */
1014 
1015  uint8_t reserved1[1] = {0};
1016 
1017  /**
1018  * The nominal rate at which wheel speed measurements will be provided (in
1019  * seconds).
1020  */
1022 
1023  /**
1024  * The nominal rate at which wheel tick measurements will be provided (in
1025  * seconds).
1026  */
1028 
1029  /**
1030  * Ratio between angle of the steering wheel and the angle of the wheels on
1031  * the ground.
1032  */
1033  float steering_ratio = NAN;
1034 
1035  /**
1036  * The scale factor to convert from wheel encoder ticks to distance (in
1037  * meters/tick). Used for @ref WheelSensorType::TICKS and
1038  * @ref WheelSensorType::TICK_RATE.
1039  */
1040  float wheel_ticks_to_m = NAN;
1041 
1042  /**
1043  * The maximum value (inclusive) before the wheel tick measurement will roll
1044  * over.
1045  *
1046  * The rollover behavior depends on the value of @ref wheel_ticks_signed. For
1047  * example, a maximum value of 10 will work as follows:
1048  * - `wheel_ticks_signed == true`: [-11, 10]
1049  * - `wheel_ticks_signed == false`: [0, 10]
1050  *
1051  * Signed values are assumed to be asymmetric, consistent with a typical 2's
1052  * complement rollover.
1053  */
1054  uint32_t wheel_tick_max_value = 0;
1055 
1056  /**
1057  * `true` if the reported wheel tick measurements should be interpreted as
1058  * signed integers, or `false` if they should be interpreted as unsigned
1059  * integers.
1060  *
1061  * See @ref wheel_tick_max_value for details.
1062  */
1063  bool wheel_ticks_signed = false;
1064 
1065  /**
1066  * `true` if the wheel tick measurements increase by a positive amount when
1067  * driving forward or backward. `false` if wheel tick measurements decrease
1068  * when driving backward.
1069  */
1071 
1072  uint8_t reserved2[2] = {0};
1073 };
1074 
1075 /**
1076  * @brief The signal edge to use when capturing a wheel tick voltage signal.
1077  * @ingroup config_and_ctrl_messages
1078  */
1079 enum class TickMode : uint8_t {
1080  /** Wheel tick capture disabled. */
1081  OFF = 0,
1082  /** Capture a wheel tick on the rising edge of the incoming pulse. */
1083  RISING_EDGE = 1,
1084  /** Capture a wheel tick on the falling edge of the incoming pulse. */
1085  FALLING_EDGE = 2,
1086 };
1087 
1088 P1_CONSTEXPR_FUNC const char* to_string(TickMode tick_mode) {
1089  switch (tick_mode) {
1090  case TickMode::OFF:
1091  return "OFF";
1092  case TickMode::RISING_EDGE:
1093  return "RISING_EDGE";
1095  return "FALLING_EDGE";
1096  default:
1097  return "UNRECOGNIZED";
1098  }
1099 }
1100 
1101 /**
1102  * @brief @ref TickMode stream operator.
1103  * @ingroup config_and_ctrl_messages
1104  */
1105 inline std::ostream& operator<<(std::ostream& stream, TickMode tick_mode) {
1106  stream << to_string(tick_mode) << " (" << (int)tick_mode << ")";
1107  return stream;
1108 }
1109 
1110 /**
1111  * @brief The way to interpret an incoming voltage signal, used to indicate
1112  * direction of a hardware wheel tick pulse, if available.
1113  * @ingroup config_and_ctrl_messages
1114  */
1115 enum class TickDirection : uint8_t {
1116  /** Wheel tick direction not provided. */
1117  OFF = 0,
1118  /**
1119  * Assume vehicle is moving forward when direction signal voltage is high, and
1120  * backward when direction signal is low.
1121  */
1122  FORWARD_ACTIVE_HIGH = 1,
1123  /**
1124  * Assume vehicle is moving forward when direction signal voltage is low, and
1125  * backward when direction signal is high.
1126  */
1127  FORWARD_ACTIVE_LOW = 2,
1128 };
1129 
1130 P1_CONSTEXPR_FUNC const char* to_string(TickDirection tick_direction) {
1131  switch (tick_direction) {
1132  case TickDirection::OFF:
1133  return "OFF";
1135  return "FORWARD_ACTIVE_HIGH";
1137  return "FORWARD_ACTIVE_LOW";
1138  default:
1139  return "UNRECOGNIZED";
1140  }
1141 }
1142 
1143 /**
1144  * @brief @ref TickDirection stream operator.
1145  * @ingroup config_and_ctrl_messages
1146  */
1147 inline std::ostream& operator<<(std::ostream& stream,
1148  TickDirection tick_direction) {
1149  stream << to_string(tick_direction) << " (" << (int)tick_direction << ")";
1150  return stream;
1151 }
1152 
1153 /**
1154  * @brief Hardware wheel tick encoder configuration settings.
1155  * @ingroup config_and_ctrl_messages
1156  *
1157  * @warning
1158  * The @ref HardwareTickConfig payload is intended for use on vehicles with a
1159  * physical voltage signal, generated by a wheel encoder, that produces a series
1160  * of voltage pulses (encoder ticks) as the vehicle’s wheel rotates. These ticks
1161  * will be captured by the device on an input pin and used to indicate vehicle
1162  * speed. For vehicles using software wheel speed/tick information, including
1163  * data send using FusionEngine messages or a vehicle CAN bus, use @ref
1164  * WheelConfig instead.
1165  *
1166  * @note
1167  * In addition to the wheel tick signal, an optional voltage signal may be
1168  * provided to indicate vehicle direction. If this signal is not connected, the
1169  * @ref tick_direction setting MUST be set to `OFF` otherwise there will be
1170  * substantial errors in dead reckoning.
1171  *
1172  * See also @ref VehicleTickMeasurement.
1173  */
1174 struct alignas(4) HardwareTickConfig {
1175  /**
1176  * If enabled -- tick mode is not @ref TickMode::OFF -- the device will
1177  * accumulate ticks received on the I/O pin, and use them as an indication of
1178  * vehicle speed. If enabled, you must also specify @ref wheel_ticks_to_m to
1179  * indicate the mapping of wheel tick encoder angle to tire circumference. All
1180  * other wheel tick-related parameters such as tick capture rate, rollover
1181  * value, etc. will be set internally.
1182  *
1183  * @warning
1184  * Do not enable this feature if a wheel tick voltage signal is not present.
1185  */
1187 
1188  /**
1189  * When direction is @ref TickDirection::OFF, the incoming ticks will be
1190  * treated as unsigned, meaning the tick count will continue to increase in
1191  * either direction of travel. If direction is not @ref TickDirection::OFF,
1192  * a second direction I/O pin will be used to indicate the direction of
1193  * travel and the accumulated tick count will increase/decrease accordingly.
1194  */
1196 
1197  uint8_t reserved1[2] = {0};
1198 
1199  /**
1200  * The scale factor to convert from wheel encoder ticks to distance (in
1201  * meters/tick). Used for @ref WheelSensorType::TICKS and
1202  * @ref WheelSensorType::TICK_RATE.
1203  */
1204  float wheel_ticks_to_m = NAN;
1205 };
1206 
1207 /** @} */
1208 
1209 /**************************************************************************/ /**
1210  * @name Input/Output Stream Control
1211  * @{
1212  ******************************************************************************/
1213 
1214 /**
1215  * @brief The framing protocol of a message.
1216  */
1217 enum class ProtocolType : uint8_t {
1218  INVALID = 0,
1219  FUSION_ENGINE = 1,
1220  NMEA = 2,
1221  RTCM = 3,
1222  /** This is used for requesting the configuration for all protocols. */
1223  ALL = 0xFF,
1224 };
1225 
1226 /** Setting message_id to this value acts as a wild card. */
1227 constexpr uint16_t ALL_MESSAGES_ID = 0xFFFF;
1228 
1229 /**
1230  * @brief Get a human-friendly string name for the specified @ref
1231  * ProtocolType.
1232  * @ingroup config_and_ctrl_messages
1233  *
1234  * @param val The enum to get the string name for.
1235  *
1236  * @return The corresponding string name.
1237  */
1239  switch (val) {
1240  case ProtocolType::INVALID:
1241  return "Invalid";
1243  return "FusionEngine";
1244  case ProtocolType::NMEA:
1245  return "NMEA";
1246  case ProtocolType::RTCM:
1247  return "RTCM";
1248  case ProtocolType::ALL:
1249  return "ALL";
1250  default:
1251  return "Unrecognized";
1252  }
1253 }
1254 
1255 /**
1256  * @brief @ref ProtocolType stream operator.
1257  * @ingroup config_and_ctrl_messages
1258  */
1259 inline std::ostream& operator<<(std::ostream& stream, ProtocolType val) {
1260  stream << to_string(val) << " (" << (int)val << ")";
1261  return stream;
1262 }
1263 
1264 /**
1265  * @brief Type of I/O interface transport.
1266  */
1267 enum class TransportType : uint8_t {
1268  INVALID = 0,
1269  /** A serial data interface (e.g. an RS232 connection). */
1270  SERIAL = 1,
1271  /** A interface that writes to a file. */
1272  FILE = 2,
1273  /** An interface that will try to connect to a remote TCP server. */
1274  TCP_CLIENT = 3,
1275  /** An interface that will communicate with connected clients. */
1276  TCP_SERVER = 4,
1277  /** An interface that will try to connect to a remote UDP server. */
1278  UDP_CLIENT = 5,
1279  /** An interface that will communicate with connected clients. */
1280  UDP_SERVER = 6,
1281  /**
1282  * Set/get the configuration for the interface on which the command was
1283  * received.
1284  */
1285  CURRENT = 254,
1286  /** Set/get the configuration for the all I/O interfaces. */
1287  ALL = 255,
1288 };
1289 
1290 /**
1291  * @brief Get a human-friendly string name for the specified @ref
1292  * TransportType.
1293  * @ingroup config_and_ctrl_messages
1294  *
1295  * @param val The enum to get the string name for.
1296  *
1297  * @return The corresponding string name.
1298  */
1300  switch (val) {
1302  return "Invalid";
1303  case TransportType::SERIAL:
1304  return "Serial";
1305  case TransportType::FILE:
1306  return "File";
1308  return "TCP Client";
1310  return "TCP Server";
1312  return "UDP Client";
1314  return "UDP Server";
1316  return "Current";
1317  case TransportType::ALL:
1318  return "All";
1319  default:
1320  return "Unrecognized";
1321  }
1322 }
1323 
1324 /**
1325  * @brief @ref TransportType stream operator.
1326  * @ingroup config_and_ctrl_messages
1327  */
1328 inline std::ostream& operator<<(std::ostream& stream, TransportType val) {
1329  stream << to_string(val) << " (" << (int)val << ")";
1330  return stream;
1331 }
1332 
1333 /**
1334  * @brief Identifies an I/O interface.
1335  *
1336  * For example, serial port 1 or TCP server 2.
1337  *
1338  * @note
1339  * On most devices, serial ports (UARTs) use 1-based numbering: the first serial
1340  * port is typically index 1 (UART1).
1341  */
1342 struct alignas(4) InterfaceID {
1343  /** The interface's transport type. **/
1345  /** An identifier for the instance of this transport. */
1346  uint8_t index = 0;
1347  uint8_t reserved[2] = {0};
1348 
1350 
1352  : type(type), index(index) {}
1353 
1354  P1_CONSTEXPR_FUNC bool operator==(const InterfaceID& other) const {
1355  return type == other.type && index == other.index;
1356  }
1357 
1358  P1_CONSTEXPR_FUNC bool operator!=(const InterfaceID& other) const {
1359  return !(*this == other);
1360  }
1361 };
1362 
1363 /**
1364  * @brief @ref InterfaceID stream operator.
1365  * @ingroup config_and_ctrl_messages
1366  */
1367 inline std::ostream& operator<<(std::ostream& stream, InterfaceID val) {
1368  stream << "[type=" << val.type << ", index=" << (int)val.index << "]";
1369  return stream;
1370 }
1371 
1372 /**
1373  * @brief Integer ID for NMEA messages.
1374  */
1375 enum class NmeaMessageType : uint16_t {
1376  INVALID = 0,
1377 
1378  /**
1379  * @name Standard NMEA Messages
1380  * @{
1381  */
1382  GGA = 1,
1383  GLL = 2,
1384  GSA = 3,
1385  GSV = 4,
1386  RMC = 5,
1387  VTG = 6,
1388  /** @} */
1389 
1390  /**
1391  * @name Point One Proprietary Messages
1392  * @{
1393  */
1394  P1CALSTATUS = 1000,
1395  P1MSG = 1001,
1396  /** @} */
1397 
1398  /**
1399  * @name Quectel Proprietary Messages
1400  * @{
1401  */
1402  PQTMVERNO = 1200,
1403  PQTMVER = 1201,
1404  PQTMGNSS = 1202,
1405  PQTMVERNO_SUB = 1203,
1406  PQTMVER_SUB = 1204,
1407  PQTMTXT = 1205,
1408  /** @} */
1409 };
1410 
1411 /**
1412  * @brief Get a human-friendly string name for the specified @ref
1413  * NmeaMessageType.
1414  * @ingroup config_and_ctrl_messages
1415  *
1416  * @param value The enum to get the string name for.
1417  *
1418  * @return The corresponding string name.
1419  */
1421  switch (value) {
1423  return "INVALID";
1424  case NmeaMessageType::GGA:
1425  return "GGA";
1426  case NmeaMessageType::GLL:
1427  return "GLL";
1428  case NmeaMessageType::GSA:
1429  return "GSA";
1430  case NmeaMessageType::GSV:
1431  return "GSV";
1432  case NmeaMessageType::RMC:
1433  return "RMC";
1434  case NmeaMessageType::VTG:
1435  return "VTG";
1437  return "P1CALSTATUS";
1439  return "P1MSG";
1441  return "PQTMVERNO";
1443  return "PQTMVER";
1445  return "PQTMGNSS";
1447  return "PQTMVERNO_SUB";
1449  return "PQTMVER_SUB";
1451  return "PQTMTXT";
1452  default:
1453  return "Unrecognized";
1454  }
1455 }
1456 
1457 /**
1458  * @brief @ref NmeaMessageType stream operator.
1459  * @ingroup config_and_ctrl_messages
1460  */
1461 inline std::ostream& operator<<(std::ostream& stream, NmeaMessageType val) {
1462  stream << to_string(val) << " (" << (int)val << ")";
1463  return stream;
1464 }
1465 
1466 /**
1467  * @brief The output rate for a message type on an interface.
1468  */
1469 enum class MessageRate : uint8_t {
1470  /**
1471  * Disable output of this message.
1472  */
1473  OFF = 0,
1474  /**
1475  * Output this message each time a new value is available.
1476  */
1477  ON_CHANGE = 1,
1478  /** Alias for @ref MessageRate::ON_CHANGE. */
1479  MAX_RATE = 1,
1480  /**
1481  * Output this message every 10 milliseconds. Not supported for all messages
1482  * or platforms.
1483  */
1484  INTERVAL_10_MS = 2,
1485  /**
1486  * Output this message every 20 milliseconds. Not supported for all messages
1487  * or platforms.
1488  */
1489  INTERVAL_20_MS = 3,
1490  /**
1491  * Output this message every 40 milliseconds. Not supported for all messages
1492  * or platforms.
1493  */
1494  INTERVAL_40_MS = 4,
1495  /**
1496  * Output this message every 50 milliseconds. Not supported for all messages
1497  * or platforms.
1498  */
1499  INTERVAL_50_MS = 5,
1500  /**
1501  * Output this message every 100 milliseconds. Not supported for all messages
1502  * or platforms.
1503  */
1504  INTERVAL_100_MS = 6,
1505  /**
1506  * Output this message every 200 milliseconds. Not supported for all messages
1507  * or platforms.
1508  */
1509  INTERVAL_200_MS = 7,
1510  /**
1511  * Output this message every 500 milliseconds. Not supported for all messages
1512  * or platforms.
1513  */
1514  INTERVAL_500_MS = 8,
1515  /**
1516  * Output this message every second. Not supported for all messages or
1517  * platforms.
1518  */
1519  INTERVAL_1_S = 9,
1520  /**
1521  * Output this message every 2 seconds. Not supported for all messages or
1522  * platforms.
1523  */
1524  INTERVAL_2_S = 10,
1525  /**
1526  * Output this message every 5 seconds. Not supported for all messages or
1527  * platforms.
1528  */
1529  INTERVAL_5_S = 11,
1530  /**
1531  * Output this message every 10 seconds. Not supported for all messages or
1532  * platforms.
1533  */
1534  INTERVAL_10_S = 12,
1535  /**
1536  * Output this message every 30 seconds. Not supported for all messages or
1537  * platforms.
1538  */
1539  INTERVAL_30_S = 13,
1540  /**
1541  * Output this message every 60 seconds. Not supported for all messages or
1542  * platforms.
1543  */
1544  INTERVAL_60_S = 14,
1545  /**
1546  * Restore this message's rate back to its default value.
1547  */
1548  DEFAULT = 255
1549 };
1550 
1551 /**
1552  * @brief Get a human-friendly string name for the specified @ref
1553  * MessageRate.
1554  * @ingroup config_and_ctrl_messages
1555  *
1556  * @param value The enum to get the string name for.
1557  *
1558  * @return The corresponding string name.
1559  */
1561  switch (value) {
1562  case MessageRate::OFF:
1563  return "OFF";
1565  return "ON_CHANGE";
1567  return "INTERVAL_10_MS";
1569  return "INTERVAL_20_MS";
1571  return "INTERVAL_40_MS";
1573  return "INTERVAL_50_MS";
1575  return "INTERVAL_100_MS";
1577  return "INTERVAL_200_MS";
1579  return "INTERVAL_500_MS";
1581  return "INTERVAL_1_S";
1583  return "INTERVAL_2_S";
1585  return "INTERVAL_5_S";
1587  return "INTERVAL_10_S";
1589  return "INTERVAL_30_S";
1591  return "INTERVAL_60_S";
1592  case MessageRate::DEFAULT:
1593  return "DEFAULT";
1594  default:
1595  return "Unrecognized";
1596  }
1597 }
1598 
1599 /**
1600  * @brief @ref MessageRate stream operator.
1601  * @ingroup config_and_ctrl_messages
1602  */
1603 inline std::ostream& operator<<(std::ostream& stream, MessageRate val) {
1604  stream << to_string(val) << " (" << (int)val << ")";
1605  return stream;
1606 }
1607 
1608 /**
1609  * @brief Set the output rate for the requested message types (@ref
1610  * MessageType::SET_MESSAGE_RATE, version 1.0).
1611  *
1612  * Multiple message rates can be configured with a single command if wild cards
1613  * are used for the interface, protocol, or message ID. When multiple messages
1614  * are specified, the following behaviors apply:
1615  * - Messages that are currently @ref MessageRate::OFF will not be changed
1616  * unless the @ref FLAG_INCLUDE_DISABLED_MESSAGES bit is set in the @ref flags
1617  * or the new rate is @ref MessageRate::DEFAULT.
1618  * - If the rate is an interval, it will only affect the messages that support
1619  * being rate controlled.
1620  *
1621  * Setting all the messages on an interface to @ref MessageRate::DEFAULT will
1622  * also restore the default `*_OUTPUT_DIAGNOSTICS_MESSAGES` configuration option
1623  * value for that interface. See @ref ConfigType.
1624  *
1625  * @section set_rate_examples Typical Use Cases
1626  *
1627  * @subsection set_rate_restore Restore Default Settings For All Messages
1628  *
1629  * To restore the default configuration on UART1 for all message types across all
1630  * supported protocols, specify the following:
1631  * - Interface transport type: @ref TransportType::SERIAL
1632  * - Interface index: 1
1633  * - Protocol: @ref ProtocolType::ALL
1634  * - Message ID: @ref ALL_MESSAGES_ID
1635  * - Rate: @ref MessageRate::DEFAULT
1636  *
1637  * @subsection set_rate_restore_nmea Restore Default Settings For All NMEA
1638  *
1639  * To restore the default configuration on UART1 for all NMEA message types,
1640  * specify the following:
1641  * - Interface transport type: @ref TransportType::SERIAL
1642  * - Interface index: 1
1643  * - Protocol: @ref ProtocolType::NMEA
1644  * - Message ID: @ref ALL_MESSAGES_ID
1645  * - Rate: @ref MessageRate::DEFAULT
1646  *
1647  * @subsection set_rate_change_enabled_rate Change UART1 Output Rate To 1 Hz:
1648  *
1649  * To change the rate of all rate-controlled messages (e.g., FusionEngine @ref
1650  * PoseMessage, NMEA GGA) to 1 Hz on UART1, specify the following:
1651  * - Interface transport type: @ref TransportType::SERIAL
1652  * - Interface index: 1
1653  * - Protocol: @ref ProtocolType::ALL
1654  * - Message ID: @ref ALL_MESSAGES_ID
1655  * - Rate: @ref MessageRate::INTERVAL_1_S
1656  *
1657  * @note
1658  * Note that this will not affect any message types that are not rate controlled
1659  * (e.g., @ref MessageType::EVENT_NOTIFICATION).
1660  *
1661  * @subsection set_rate_max_all Change The Uart1 Output Rates For All Messages To Their Max:
1662  *
1663  * To change the rate of all messages to their max rate on UART1, specify the
1664  * following:
1665  * - Interface transport type: @ref TransportType::SERIAL
1666  * - Interface index: 1
1667  * - Protocol: @ref ProtocolType::ALL
1668  * - flags: @ref FLAG_INCLUDE_DISABLED_MESSAGES
1669  * - Message ID: @ref ALL_MESSAGES_ID
1670  * - Rate: @ref MessageRate::ON_CHANGE
1671  *
1672  * @note
1673  * This will enabled every message regardless of whether it's @ref
1674  * MessageRate::OFF or whether or not it's rate controlled.
1675  *
1676  * @subsection set_and_save_rate_max_all Change And Save The UART1 Output Rates For All Messages To Their Max:
1677  *
1678  * To change the rate of all messages to their max rate on UART1, specify the
1679  * following:
1680  * - Interface transport type: @ref TransportType::SERIAL
1681  * - Interface index: 1
1682  * - Protocol: @ref ProtocolType::ALL
1683  * - flags: 0x03 (@ref FLAG_INCLUDE_DISABLED_MESSAGES | @ref FLAG_APPLY_AND_SAVE)
1684  * - Message ID: @ref ALL_MESSAGES_ID
1685  * - Rate: @ref MessageRate::ON_CHANGE
1686  *
1687  * @note
1688  * Both of the bit flags are set for this message. This will cause the
1689  * configuration to be saved to non-volatile memory.
1690  *
1691  * @ingroup config_and_ctrl_messages
1692  *
1693  * # Expected Response
1694  * The device will respond with a @ref CommandResponseMessage indicating whether
1695  * or not the request succeeded.
1696  */
1697 struct alignas(4) SetMessageRate : public MessagePayload {
1699  static constexpr uint8_t MESSAGE_VERSION = 0;
1700 
1701  /** Flag to immediately save the config after applying this setting. */
1702  static constexpr uint8_t FLAG_APPLY_AND_SAVE = 0x01;
1703 
1704  /**
1705  * Flag to apply bulk interval changes to all messages instead of just
1706  * enabled messages.
1707  */
1708  static constexpr uint8_t FLAG_INCLUDE_DISABLED_MESSAGES = 0x02;
1709 
1710  /**
1711  * The output interface to configure. If @ref TransportType::ALL, set rates on
1712  * all supported interfaces.
1713  */
1715 
1716  /**
1717  * The message protocol being configured. If @ref ProtocolType::ALL, set rates
1718  * on all supported protocols and @ref message_id is ignored.
1719  */
1721 
1722  /** Bitmask of additional flags to modify the command. */
1723  uint8_t flags = 0;
1724 
1725  /**
1726  * The ID of the desired message type (e.g., 10000 for FusionEngine
1727  * @ref MessageType::POSE messages). See @ref NmeaMessageType for NMEA-0183
1728  * messages. If @ref ALL_MESSAGES_ID, set the rate for all messages on the
1729  * selected interface and protocol.
1730  */
1732 
1733  /** The desired message rate. */
1735 
1736  uint8_t reserved2[3] = {0};
1737 };
1738 
1739 /**
1740  * @brief Get the configured output rate for the he requested message type on
1741  * the specified interface (@ref MessageType::GET_MESSAGE_RATE,
1742  * version 1.0).
1743  * @ingroup config_and_ctrl_messages
1744  *
1745  * Multiple message rates can be requested with a single command if wild cards
1746  * are used for the protocol, or message ID.
1747  *
1748  * # Expected Response
1749  * The device will respond with a @ref MessageRateResponse containing the
1750  * requested values, or with an error @ref Response value if the request did not
1751  * succeed.
1752  */
1753 struct alignas(4) GetMessageRate : public MessagePayload {
1755  static constexpr uint8_t MESSAGE_VERSION = 0;
1756 
1757  /**
1758  * The output interface to be queried.
1759  *
1760  * @ref TransportType::ALL is not supported. To query for multiple transports,
1761  * send separate requests.
1762  */
1764 
1765  /**
1766  * The desired message protocol. If @ref ProtocolType::ALL, return the current
1767  * settings for all supported protocols and @ref message_id is ignored.
1768  */
1770 
1771  /** The source of the parameter value (active, saved, etc.). */
1773 
1774  /**
1775  * The ID of the desired message type (e.g., 10000 for FusionEngine
1776  * @ref MessageType::POSE messages). See @ref NmeaMessageType for NMEA-0183
1777  * messages. If @ref ALL_MESSAGES_ID, return the current settings for all
1778  * supported messages on the selected interface and protocol.
1779  */
1781 };
1782 
1783 /**
1784  * @brief An element of a @ref MessageRateResponse message.
1785  * @ingroup config_and_ctrl_messages
1786  */
1787 struct alignas(4) MessageRateResponseEntry {
1788  /**
1789  * Flag to indicate the active value for this configuration differs from the
1790  * value saved to persistent memory.
1791  */
1792  static constexpr uint8_t FLAG_ACTIVE_DIFFERS_FROM_SAVED = 0x1;
1793 
1794  /** The protocol of the message being returned. */
1796 
1797  /** Flags that describe the entry. */
1798  uint8_t flags = 0;
1799 
1800  /**
1801  * The ID of the returned message type (e.g., 10000 for FusionEngine
1802  * @ref MessageType::POSE messages). See @ref NmeaMessageType for NMEA-0183
1803  * messages.
1804  */
1805  uint16_t message_id = 0;
1806 
1807  /** The current configuration for this message. */
1809 
1810  /**
1811  * The currently active output rate for this message, factoring in effects of
1812  * additional configuration settings that may override the configured rate
1813  * such as enabling diagnostic output.
1814  */
1816 
1817  uint8_t reserved1[2] = {0};
1818 };
1819 
1820 /**
1821  * @brief Response to a @ref GetMessageRate request (@ref
1822  * MessageType::MESSAGE_RATE_RESPONSE, version 1.1).
1823  * @ingroup config_and_ctrl_messages
1824  */
1825 struct alignas(4) MessageRateResponse : public MessagePayload {
1826  static constexpr MessageType MESSAGE_TYPE =
1828  static constexpr uint8_t MESSAGE_VERSION = 1;
1829 
1830  /** The source of the parameter value (active, saved, etc.). */
1832 
1833  /** The response status (success, error, etc.). */
1835 
1836  /** The number of rates reported by this message. */
1837  uint16_t num_rates = 0;
1838 
1839  /** The output interface corresponding with this response. */
1841 
1842  /* This in then followed by an array of num_rates MessageRateResponseEntry */
1843  // MessageRateResponseEntry rates[num_rates]
1844 };
1845 
1846 /** Type of data stored on device. */
1847 enum class DataType : uint8_t {
1848  CALIBRATION_STATE = 0,
1849  CRASH_LOG = 1,
1850  FILTER_STATE = 2,
1851  USER_CONFIG = 3,
1852  INVALID = 255
1853 };
1854 
1855 /**
1856  * @brief Get a string representation of a @ref DataType.
1857  *
1858  * @param type The requested type.
1859  *
1860  * @return The corresponding string name.
1861  */
1863  switch (type) {
1865  return "CalibrationState";
1866  case DataType::CRASH_LOG:
1867  return "CrashLog";
1869  return "FilterState";
1870  case DataType::USER_CONFIG:
1871  return "UserConfig";
1872  default:
1873  return "Invalid";
1874  }
1875 }
1876 
1877 /**
1878  * @brief @ref DataType stream operator.
1879  * @ingroup config_and_ctrl_messages
1880  */
1881 inline std::ostream& operator<<(std::ostream& stream, DataType val) {
1882  stream << to_string(val) << " (" << (int)val << ")";
1883  return stream;
1884 }
1885 
1886 /**
1887  * @brief Import data from the host to the device (@ref
1888  * MessageType::IMPORT_DATA, version 1.0).
1889  * @ingroup config_and_ctrl_messages
1890  *
1891  * # Expected Response
1892  * The device will respond with a @ref CommandResponseMessage indicating whether
1893  * or not the request succeeded.
1894  */
1895 struct alignas(4) ImportDataMessage {
1897  static constexpr uint8_t MESSAGE_VERSION = 0;
1898  /**
1899  * The type of data being imported.
1900  */
1902  /**
1903  * The location of the data to update (active, saved, etc.). For data that
1904  * doesn't have separate active and saved copies, this parameter is ignored.
1905  */
1907  uint8_t reserved1[2] = {0};
1908  /** @brief Version of data contents. */
1910  uint8_t reserved2[4] = {0};
1911  /** @brief Number of bytes to update. */
1912  uint32_t data_length_bytes = 0;
1913 
1914  /**
1915  * This in then followed by an array of data_length_bytes bytes for the data
1916  * contents.
1917  */
1918  // uint8_t data[data_length_bytes]
1919 };
1920 
1921 /**
1922  * @brief Export data from the device (@ref
1923  * MessageType::EXPORT_DATA, version 1.0).
1924  * @ingroup config_and_ctrl_messages
1925  *
1926  * # Expected Response
1927  * The device will respond with a @ref PlatformStorageDataMessage.
1928  */
1929 struct alignas(4) ExportDataMessage {
1931  static constexpr uint8_t MESSAGE_VERSION = 0;
1932  /**
1933  * The type of data to be exported.
1934  */
1936  /**
1937  * The source to copy this data from. If the data_type doesn't separate active
1938  * and saved data, this will be ignored.
1939  */
1941  uint8_t reserved[2] = {0};
1942 };
1943 
1944 /**
1945  * @brief Message for reporting platform storage data (@ref
1946  * MessageType::PLATFORM_STORAGE_DATA, version 1.0).
1947  * @ingroup config_and_ctrl_messages
1948  *
1949  * See also @ref ExportDataMessage.
1950  *
1951  * Changes:
1952  * - Version 1: Added data_validity field.
1953  * - Version 2: Changed data_validity to a @ref Response enum and added
1954  * @ref source field.
1955  */
1956 struct alignas(4) PlatformStorageDataMessage {
1957  static constexpr MessageType MESSAGE_TYPE =
1959  static constexpr uint8_t MESSAGE_VERSION = 2;
1960 
1961  /**
1962  * The type of data contained in this message.
1963  */
1965  /**
1966  * The status of the specified data type on the device.
1967  */
1969  /**
1970  * The source this data was copied from. If the @ref data_type doesn't separate
1971  * active and saved data, this will be set to @ref
1972  * ConfigurationSource::ACTIVE.
1973  */
1975  uint8_t reserved[1] = {0};
1976  /** Version of data contents. */
1978  /** Number of bytes in data contents. */
1979  uint32_t data_length_bytes = 0;
1980 
1981  /**
1982  * This in then followed by an array of data_length_bytes bytes for the data
1983  * contents.
1984  */
1985  // uint8_t data[data_length_bytes]
1986 };
1987 
1988 /**
1989  * @brief A submessage header for configuration data associated with the
1990  * @ref ConfigType::INTERFACE_CONFIG.
1991  * @ingroup config_and_ctrl_messages
1992  *
1993  * In @ref SetConfigMessage, @ref GetConfigMessage, and @ref
1994  * ConfigResponseMessage this struct can be used to access settings
1995  * associated with a a particular interface. For example, to set the baudrate
1996  * for serial port 1:
1997  *
1998  * ```
1999  * {
2000  * SetConfigMessage(
2001  * config_type=INTERFACE_CONFIG),
2002  * InterfaceConfigSubmessage(
2003  * interface=InterfaceID(TransportType::SERIAL, 1),
2004  * subtype=BAUD_RATE),
2005  * uint32_t 115200
2006  * }
2007  * ```
2008  */
2009 struct alignas(4) InterfaceConfigSubmessage {
2010  /**
2011  * The interface ID to target.
2012  *
2013  * @note
2014  * TransportType::ALL is not supported.
2015  */
2017 
2018  /**
2019  * The interface setting to get/set/describe.
2020  */
2022 
2023  uint8_t reserved[3] = {0};
2024 
2025  /**
2026  * A pointer to the beginning of the configuration parameter value if
2027  * setting/describing.
2028  *
2029  * The size and format of the contents is specified by the @ref subtype.
2030  * See @ref InterfaceConfigType.
2031  */
2032  uint8_t config_data[0];
2033 };
2034 
2035 /** @} */
2036 
2037 #pragma pack(pop)
2038 
2039 } // namespace messages
2040 } // namespace fusion_engine
2041 } // namespace point_one
2042 
2043 #ifdef _MSC_VER
2044 # pragma warning(pop)
2045 #endif
@ INTERVAL_10_S
Output this message every 10 seconds.
P1_CONSTEXPR_FUNC InterfaceID()=default
@ IMPORT_DATA
ImportDataMessage
static constexpr uint8_t MESSAGE_VERSION
@ INTERVAL_10_MS
Output this message every 10 milliseconds.
uint16_t message_id
The ID of the desired message type (e.g., 10000 for FusionEngine MessageType::POSE messages).
ConfigType
An identifier for the contents of a parameter configuration message.
Definition: configuration.h:39
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
Set/get the configuration for the all I/O 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 every 5 seconds.
P1_CONSTEXPR_FUNC InterfaceID(TransportType type, uint8_t index=0)
@ RTCM
Identifies an I/O interface.
@ PQTMGNSS
TransportType type
The interface's transport type.
@ RMC
ProtocolType protocol
The message protocol being configured.
MessageType
Identifiers for the defined output message types.
Definition: defs.h:35
@ GPS_WEEK_ROLLOVER
Specify a GPS legacy week rollover count override to use when converting all legacy 10-bit GPS week n...
Library portability helper definitions.
Response to a GetConfigMessage request (MessageType::CONFIG_RESPONSE, version 1.0).
InterfaceID output_interface
The output interface to be queried.
@ SAVE
Save all active parameters to persistent storage.
static constexpr uint8_t MESSAGE_VERSION
@ OK
Response response
The response status (success, error, etc.).
@ MAX_RATE
Alias for MessageRate::ON_CHANGE.
The orientation of a device with respect to the vehicle body axes.
@ LEXUS_CT200H
@ DEFAULT
Restore this message's rate back to its default value.
@ ENABLED_GNSS_FREQUENCY_BANDS
A bitmask indicating which GNSS frequency bands are enabled.
uint8_t flags
Flags that describe the entry.
@ INVALID
Hardware wheel tick 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.
@ 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.
Response response
The status of the specified data type on the device.
static constexpr MessageType MESSAGE_TYPE
@ FILE
A interface that writes to a file.
@ UART1_BAUD
Configure the UART1 serial baud rate (in bits/second).
ConfigurationSource config_source
The source of the parameter value (active, saved, etc.).
@ INVALID
static constexpr uint8_t FLAG_REVERT_TO_DEFAULT
Flag to restore the config_type back to its default value.
@ VEHICLE_BODY
Individual vehicle speed to be applied to the system.
@ PQTMVERNO
@ UART1_OUTPUT_DIAGNOSTICS_MESSAGES
Enable/disable output of diagnostic data on UART1.
static constexpr MessageType MESSAGE_TYPE
static constexpr uint8_t MESSAGE_VERSION
static constexpr MessageType MESSAGE_TYPE
@ PQTMVER_SUB
Response to a GetMessageRate request (MessageType::MESSAGE_RATE_RESPONSE, version 1....
@ TESLA_MODEL_3
@ KIA_SPORTAGE
SteeringType
Indication of which of the vehicle's wheels are steered.
@ PQTMVERNO_SUB
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 ...
@ UNKNOWN_VEHICLE
DataType data_type
The type of data to be exported.
@ INTERVAL_500_MS
Output this message every 500 milliseconds.
@ 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).
InterfaceConfigType
An identifier for the contents of a output interface configuration submessage.
@ AUDI_Q7
DataType data_type
The type of data being imported.
SaveAction
The type configuration save operation to be performed.
Information about the vehicle including model and dimensions.
MessageRate rate
The desired message rate.
@ INTERVAL_60_S
Output this message every 60 seconds.
ConfigurationSource request_source
The source of the parameter value (active, saved, etc.).
ConfigurationSource source
The location of the data to update (active, saved, etc.).
Set the output rate for the requested message types (MessageType::SET_MESSAGE_RATE,...
@ REVERT_TO_DEFAULT
Reset the active and saved configuration to default values.
A submessage header for configuration data associated with the ConfigType::INTERFACE_CONFIG.
uint32_t wheel_tick_max_value
The maximum value (inclusive) before the wheel tick measurement will roll over.
Import data from the host to the device (MessageType::IMPORT_DATA, version 1.0).
@ MESSAGE_RATE_RESPONSE
MessageRateResponse
@ SAVE_CONFIG
SaveConfigMessage
MessageRate configured_rate
The current configuration for this message.
MessageRate
The output rate for a message type on an interface.
static constexpr uint8_t FLAG_ACTIVE_DIFFERS_FROM_SAVED
Flag to indicate the active value for this configuration differs from the value saved to persistent m...
uint8_t config_change_data[0]
A pointer to the beginning of the configuration parameter value.
MessageRate effective_rate
The currently active output rate for this message, factoring in effects of additional configuration s...
TickDirection tick_direction
When direction is TickDirection::OFF, the incoming ticks will be treated as unsigned,...
@ REMOTE_ADDRESS
Configure the network address for a client to connect to.
DataType
Type of data stored on device.
float z
@ INTERFACE_CONFIG
Change a configuration setting for a specified output interface.
@ ACTIVE
Active configuration currently in use by the device.
@ FRONT
Front wheels are steered.
P1_CONSTEXPR_FUNC bool operator!=(const InterfaceID &other) const
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 I/O interface transport.
The base class for all message payloads.
Definition: defs.h:540
@ FILTER_STATE
static constexpr MessageType MESSAGE_TYPE
@ INTERVAL_1_S
Output this message every second.
Query the value of a user configuration parameter (MessageType::GET_CONFIG, version 1....
@ ON_CHANGE
Output this message each time a new value is available.
float y
@ INTERVAL_50_MS
Output this message every 50 milliseconds.
@ PQTMVER
@ INVALID
@ INTERVAL_2_S
Output this message every 2 seconds.
@ INTERVAL_100_MS
Output this message every 100 milliseconds.
@ PQTMTXT
@ SERIAL
A serial data interface (e.g.
static constexpr uint8_t FLAG_APPLY_AND_SAVE
Flag to immediately save the config after applying this setting.
@ INVALID
@ INTERVAL_30_S
Output this message every 30 seconds.
@ OFF
Wheel tick capture disabled.
@ TCP_SERVER
An interface that will communicate with connected clients.
ConfigType config_type
The desired parameter.
ProtocolType protocol
The desired message protocol.
GNSS signal and frequency type definitions.
Definition: logging.h:36
Get the configured output rate for the he requested message type on the specified interface (MessageT...
Export data from the device (MessageType::EXPORT_DATA, version 1.0).
InterfaceID output_interface
The output interface to configure.
@ CALIBRATION_STATE
@ FRONT_WHEELS
Front wheel speed data to be applied to the system.
DataVersion data_version
Version of data contents.
DataType data_type
The type of data contained in this message.
@ INVALID
uint8_t index
An identifier for the instance of this transport.
@ UP
Aligned with vehicle +z axis.
static constexpr uint8_t FLAG_ACTIVE_DIFFERS_FROM_SAVED
Flag to indicate the active value for this configuration differs from the value saved to persistent m...
@ FRONT_AND_REAR_WHEELS
Front and rear wheel speed data to be applied to the system.
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...
@ INVALID
@ CURRENT
Set/get the configuration for the interface on which the command was received.
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).
P1_CONSTEXPR_FUNC const char * to_string(ConfigType type)
Get a human-friendly string name for the specified ConfigType.
@ 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
static constexpr uint8_t FLAG_INCLUDE_DISABLED_MESSAGES
Flag to apply bulk interval changes to all messages instead of just enabled messages.
Direction
ConfigurationSource config_source
The source of the parameter value (active, saved, etc.).
float steering_ratio
Ratio between angle of the steering wheel and the angle of the wheels on the ground.
@ INTERVAL_200_MS
Output this message every 200 milliseconds.
VehicleModel
The make and model of the vehicle.
@ GET_MESSAGE_RATE
GetMessageRate
@ DEVICE_COARSE_ORIENTATION
The orientation of the device IMU with respect to the vehicle body axes.
@ NMEA
@ INTERVAL_40_MS
Output this message every 40 milliseconds.
float wheelbase_m
The distance between the front axle and rear axle (in meters).
InterfaceID output_interface
The output interface corresponding with this response.
@ LEFT
Aligned with vehicle +y axis.
ConfigType config_type
The type of parameter to be configured.
Response
Command response status indicators.
Definition: defs.h:265
@ 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 ...
static constexpr MessageType MESSAGE_TYPE
@ OFF
Disable output of this message.
uint32_t data_length_bytes
Number of bytes in data contents.
@ EXPORT_DATA
ExportDataMessage
@ VEHICLE_SPEED
A single value indicating the vehicle speed (in meters/second).
@ GSA
@ UDP_SERVER
An interface that will communicate with connected clients.
InterfaceConfigType subtype
The interface setting to get/set/describe.
@ P1CALSTATUS
@ MAN_TGX
static constexpr uint8_t MESSAGE_VERSION
Direction z_direction
The direction of the device +z axis relative to the vehicle body axes.
ConfigurationSource source
The source to copy this data from.
ConfigurationSource request_source
The config source to request data from (active, saved, etc.).
static constexpr MessageType MESSAGE_TYPE
An element of a MessageRateResponse message.
static constexpr uint8_t MESSAGE_VERSION
Response response
The response status (success, error, etc.).
NmeaMessageType
Integer ID for NMEA messages.
ConfigurationSource source
The source this data was copied from.
@ SET_MESSAGE_RATE
SetMessageRate
uint32_t data_length_bytes
Number of bytes to update.
Save or reload configuration settings (MessageType::SAVE_CONFIG, version 1.0).
@ HYUNDAI_ELANTRA
ProtocolType
The framing protocol of a message.
@ CRASH_LOG
#define P1_CONSTEXPR_FUNC
Definition: portability.h:58
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
Message for reporting platform storage data (MessageType::PLATFORM_STORAGE_DATA, version 1....
@ VTG
ProtocolType protocol
The protocol of the message being returned.
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.
uint8_t flags
Flags that describe the configuration parameter.
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
static constexpr uint8_t MESSAGE_VERSION
@ FRONT_AND_REAR
Front and rear wheels are steered.
@ 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
@ OUTPUT_DIAGNOSTICS_MESSAGES
Enable/disable output of diagnostic data on this interface.
uint8_t optional_submessage_header[0]
When config_type is ConfigType::INTERFACE_CONFIG, a InterfaceConfigSubmessage must be added to the en...
@ SAVED
Settings currently saved to persistent storage.
uint16_t message_id
The ID of the returned message type (e.g., 10000 for FusionEngine MessageType::POSE messages).
@ SET_CONFIG
SetConfigMessage
static constexpr uint8_t FLAG_APPLY_AND_SAVE
Flag to immediately save the config after applying this setting.
@ VEHICLE_DETAILS
Information about the vehicle including model and dimensions.
@ NONE
Speed data not applied to the system.
P1_CONSTEXPR_FUNC bool operator==(const InterfaceID &other) const
std::ostream & operator<<(std::ostream &stream, ConfigType type)
ConfigType stream operator.
@ WHEEL_CONFIG
Information pertaining to wheel speed/rotation measurements when wheel data is transmitted via softwa...
Point One FusionEngine output message common definitions.
uint8_t flags
Bitmask of additional flags to modify the command.
Software vehicle/wheel speed measurement configuration settings.
@ USER_CONFIG
@ PLATFORM_STORAGE_DATA
PlatformStorageDataMessage
@ WHEEL_SPEED
Individual wheel speeds, reported in meters/second.
uint16_t message_id
The ID of the desired message type (e.g., 10000 for FusionEngine MessageType::POSE messages).
@ 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
DataVersion data_version
Version of data contents.
@ FACTION
ConfigurationSource
The type of a device's configuration settings.
@ TCP_CLIENT
An interface that will try to connect to a remote TCP server.
float x
@ INTERVAL_20_MS
Output this message every 20 milliseconds.
@ REAR_WHEELS
Rear wheel speed data to be applied to the system (recommended).
static constexpr MessageType MESSAGE_TYPE
@ GNSS_LEVER_ARM
The location of the GNSS antenna with respect to the vehicle body frame (in meters).
static constexpr MessageType MESSAGE_TYPE
float front_track_width_m
The distance between the two front wheels (in meters).
@ RIGHT
Aligned with vehicle -y axis.
uint16_t num_rates
The number of rates reported by this message.
@ BAUD_RATE
Configure the serial baud rate (in bits/second).
static constexpr uint8_t MESSAGE_VERSION
@ KIA_SORENTO
@ FUSION_ENGINE
static constexpr uint8_t MESSAGE_VERSION
@ ENABLED_GNSS_SYSTEMS
A bitmask indicating which GNSS constellations are enabled.
A struct representing the version of a data object.
Definition: data_version.h:22
@ OFF
Wheel tick direction not provided.
@ LEAP_SECOND
Specify a UTC leap second count override value to use for all UTC time conversions.
@ 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.
@ PORT
Configure the network port.
@ UART2_OUTPUT_DIAGNOSTICS_MESSAGES
Enable/disable output of diagnostic data on UART2.
@ ALL
This is used for requesting the configuration for all protocols.
@ UDP_CLIENT
An interface that will try to connect to a remote UDP server.
constexpr uint16_t ALL_MESSAGES_ID
Setting message_id to this value acts as a wild card.
AppliedSpeedType
The type of vehicle/wheel speed measurements to be applied.
uint8_t config_data[0]
A pointer to the beginning of the configuration parameter value if setting/describing.
@ J1939
@ UNKNOWN
Steered wheels unknown.
@ INVALID
@ FORWARD
Aligned with vehicle +x axis.
@ CONFIG_RESPONSE
ConfigResponseMessage