Fixposition SDK 0.0.0-heads/main-0-g97f6014
Collection of c++ libraries and apps for use with Fixposition products on Linux
Loading...
Searching...
No Matches
fpa.hpp
Go to the documentation of this file.
1/**
2 * \verbatim
3 * ___ ___
4 * \ \ / /
5 * \ \/ / Copyright (c) Fixposition AG (www.fixposition.com) and contributors
6 * / /\ \ License: see the LICENSE file
7 * /__/ \__\
8 *
9 * Based on work by flipflip (https://github.com/phkehl)
10 * \endverbatim
11 *
12 * @file
13 * @brief Fixposition SDK: Parser FP_A routines and types
14 */
15// clang-format off
16/**
17 * @page FPSDK_COMMON_PARSER_FPA Parser FP_A routines and types
18 *
19 * **API**: fpsdk_common/parser/fpa.hpp and fpsdk::common::parser::fpa
20 *
21 * @fp_msgspec_begin{FP_A-Protocol}
22 *
23 * Messages are in this form:
24 *
25 * <code><b style="color: red;">$</b><b style="color: green;">FP</b>,<b style="color: blue;">msg_type</b>,<b style="color: blue;">msg_version</b>,<em>field<sub>3</sub></em>,<em>field<sub>4</sub></em>,…,<em>field<sub>N</sub></em><b style="color: red;">*CC</b><b style="color: red;">\\r\\n</b></code>
26 *
27 * Where:
28 *
29 * - The FP_A style framing:
30 * - <code><b style="color: red;">\$</b></code>
31 * -- Start character ("$", ASCII 36)
32 * - <code><b style="color: red;">\*CC</b></code>
33 * -- Checksum: "*" (ASCII 42) and two digit XOR value of all payload
34 * characters in captial hexadecimal notation, for example:
35 * "FPX" = <code>'F' ^ 'P' ^ 'X' = 70 ^ 80 ^ 88 = 78 = 0x4e</code> = checksum <code>4E</code>
36 * - <code><b style="color: red;">\\r\\n</b></code> -- Message termination characters (CR + LF, ASCII 13 + 10)
37 * - A Fixposition identifier:
38 * - <code><b style="color: green;">FP</b></code>
39 * -- Fixposition ASCII message identifier, "FP" (ASCII 70 + 80)
40 * - Fixposition message type and version:
41 * - <code><b style="color: blue;">msg_type</b></code> (= <code><em>field<sub>1</sub></em></code>)
42 * -- Message type, all capital letters (ASCII 65--90)
43 * - <code><b style="color: blue;">msg_version</b></code> (= <code><em>field<sub>2</sub></em></code>)
44 * -- Message version, decimal number (letters 0--9, ASCII 48--57), range 1--…
45 * - Data fields (payload)
46 * - <code><em>field<sub>3</sub></em>,<em>field<sub>4</sub></em>,…,<em>field<sub>N</sub></em></code>
47 * -- The structure of the message data is defined by the <code><b style="color: blue;">msg_type</b></code>
48 * and <code><b style="color: blue;">version</b></code>.
49 * Each field can contain all printable 7-bit ASCII characters (ASCII 32–126), excluding the
50 * reserved characters `!` (ASCII 33), `$` (ASCII 36), `*` (ASCII 42), `,` (ASCII 44),
51 * `\` (ASCII 92), `~` (ASCII 126).
52 * - Field separators
53 * - All fields (identifier, message type, message version, data fields) are separated by a `,` (comma, ASCII 44)
54 * - Null fields
55 * - Data fields can be _null_, meaning their value is absent to indicate that no data is
56 * available. The data for null fields is the empty string. For example:
57 * - Definition: <code>…,<em>field<sub>i</sub></em>,<em>field<sub>i+1</sub></em>,<em>field<sub>i+2</sub></em>,…</code>
58 * - Values: <code><em>field<sub>i</sub></em></code> = 123, <code><em>field<sub>i+1</sub></em></code> = _null_,
59 * <code><em>field<sub>i+2</sub></em></code> = 456
60 * - Payload string: <code>…,123,,456,…</code>
61 * - Data field types:
62 * - _Numeric_: Decimal integer number, one or more digits (0-9) and optional leading "-" sign
63 * - _Float (.x)_: Decimal floating point number, one or more digits (0-9) and optional leading "-" sign, with
64 * _x_ digits fractional part separated by a dot (".")
65 * - _Float (x)_: Decimal floating point number with _x_ significant digits, optional leading "-", optional fractional
66 * part separated by a dot (".")
67 * - _String_: String of allowed payload characters (but not the `,` field separator)
68 * - ...
69 * - ...
70 *
71 * @fp_msgspec_end
72 *
73 */
74// clang-format on
75#ifndef __FPSDK_COMMON_PARSER_FPA_HPP__
76#define __FPSDK_COMMON_PARSER_FPA_HPP__
77
78/* LIBC/STL */
79#include <array>
80#include <cstdint>
81#include <memory>
82#include <string>
83#include <vector>
84
85/* EXTERNAL */
86
87/* PACKAGE */
88#include "../logging.hpp"
89#include "../types.hpp"
90#include "types.hpp"
91
92namespace fpsdk {
93namespace common {
94namespace parser {
95/**
96 * @brief Parser FP_A routines and types
97 */
98namespace fpa {
99/* ****************************************************************************************************************** */
100
101static constexpr uint8_t FP_A_PREAMBLE = '$'; //!< FP_A framing preamble
102static constexpr int FP_A_FRAME_SIZE = 6; //!< FP_A frame size ("$*cc\r\n")
103
104//! FP_A message meta data
106{
107 char msg_type_[40] = { 0 }; //!< Message type (for example, "ODOMETRY"), nul-terminated string
108 int msg_version_ = 0; //!< Message version (for example, 1), < 0 if unknown
109 int payload_ix0_ = 0; //!< Index (offset) for start of payload, 0 if no payload available
110 int payload_ix1_ = 0; //!< Index (offset) for end of payload, 0 if no payload available
111};
112
113/**
114 * @brief Get FP_A message meta data
115 *
116 * @param[out] meta The meta data
117 * @param[in] msg Pointer to the FP_A message
118 * @param[in] msg_size Size of the FP_A message (>= 11)
119 *
120 * @note No check on the data provided is done. The caller must ensure that the data is a correct FP_A message.
121 *
122 * @returns true if the meta data was successfully extracted, false otherwise
123 */
124bool FpaGetMessageMeta(FpaMessageMeta& meta, const uint8_t* msg, const std::size_t msg_size);
125
126/**
127 * @brief Get FP_A message name
128 *
129 * Generates a name (string) in the form "FP_A-MESSAGEID" (for example, "FP_A-ODOMETRY").
130 *
131 * @param[out] name String to write the name to
132 * @param[in] size Size of \c name (incl. nul termination)
133 * @param[in] msg Pointer to the FP_A message
134 * @param[in] msg_size Size of the \c msg
135 *
136 * @note No check on the data provided is done. The caller must ensure that the data is a valid FP_A or FP_A message.
137 *
138 * @returns true if message name was generated, false if \c name buffer was too small
139 */
140bool FpaGetMessageName(char* name, const std::size_t size, const uint8_t* msg, const std::size_t msg_size);
141
142/**
143 * @brief Get FP_A message info
144 *
145 * This stringifies the content of some FP_A messages, for debugging.
146 *
147 * @param[out] info String to write the info to
148 * @param[in] size Size of \c name (incl. nul termination)
149 * @param[in] msg Pointer to the FP_A message
150 * @param[in] msg_size Size of the \c msg
151 *
152 * @note No check on the data provided is done. The caller must ensure that the data is a valid FP_A message.
153 *
154 * @returns true if message info was generated (even if info is empty), false if \c name buffer was too small
155 */
156bool FpaGetMessageInfo(char* info, const std::size_t size, const uint8_t* msg, const std::size_t msg_size);
157
158/**
159 * @brief FP_A fusion initialisation status
160 */
161enum class FpaInitStatus : int
162{ // clang-format off
163 UNSPECIFIED = '!', //!< Unspecified
164 NOT_INIT = '0', //!< Not initialised
165 LOCAL_INIT = '1', //!< Locally initialised
166 GLOBAL_INIT = '2', //!< Globally initialised
167}; // clang-format on
168
169/**
170 * @brief Stringify initialisation status
171 *
172 * @param[in] status The initialisation status
173 *
174 * @returns the stringification of the initialisation status
175 */
176const char* FpaInitStatusStr(const FpaInitStatus status);
177
178/**
179 * @brief FP_A legacy fusion status
180 */
181enum class FpaFusionStatusLegacy : int
182{ // clang-format off
183 UNSPECIFIED = '!', //!< Unspecified
184 NONE = '0', //!< Not started
185 VISION = '1', //!< Vision only
186 VIO = '2', //!< Visual-inertial fusion
187 IMU_GNSS = '3', //!< Inertial-GNSS fusion
188 VIO_GNSS = '4' //!< Visual-inertial-GNSS fusion
189}; // clang-format on
190
191/**
192 * @brief Stringify legacy fusion status
193 *
194 * @param[in] status The legacy fusion status
195 *
196 * @returns the stringification of the legacy fusion status
197 */
199
200/**
201 * @brief FP_A fusion measurement status
202 */
203enum class FpaMeasStatus : int
204{ // clang-format off
205 UNSPECIFIED = '!', //!< Unspecified
206 NOT_USED = '0', //!< Not used
207 USED = '1', //!< Used
208 DEGRADED = '2', //!< Degraded
209}; // clang-format on
210
211/**
212 * @brief Stringify fusion measurement status
213 *
214 * @param[in] status The fusion measurement status
215 *
216 * @returns the stringification of the fusion measurement status
217 */
218const char* FpaMeasStatusStr(const FpaMeasStatus status);
219
220/**
221 * @brief FP_A IMU bias status
222 */
223enum class FpaImuStatus : int
224{ // clang-format off
225 UNSPECIFIED = '!', //!< Unspecified
226 NOT_CONVERGED = '0', //!< Not converged
227 WARMSTARTED = '1', //!< Warmstarted
228 ROUGH_CONVERGED = '2', //!< Rough convergence
229 FINE_CONVERGED = '3', //!< Fine convergence
230}; // clang-format on
231
232/**
233 * @brief Stringify IMU bias status
234 *
235 * @param[in] status The IMU bias status
236 *
237 * @returns the stringification of the IMU bias status
238 */
239const char* FpaImuStatusStr(const FpaImuStatus status);
240
241/**
242 * @brief FP_A legacy IMU bias status
243 */
244enum class FpaImuStatusLegacy : int
245{ // clang-format off
246 UNSPECIFIED = '!', //!< Unspecified
247 NOT_CONVERGED = '0', //!< Not converged
248 CONVERGED = '1', //!< Converged
249}; // clang-format on
250
251/**
252 * @brief Stringify legacy IMU bias status
253 *
254 * @param[in] status The legacy IMU bias status
255 *
256 * @returns the stringification of the legacy IMU bias status
257 */
259
260/**
261 * @brief FP_A IMU variance
262 */
263enum class FpaImuNoise : int
264{ // clang-format off
265 UNSPECIFIED = '!', //!< Unspecified
266 LOW_NOISE = '1', //!< Low noise
267 MEDIUM_NOISE = '2', //!< Medium noise
268 HIGH_NOISE = '3', //!< High noise
269 RESERVED4 = '4', //!< Reserved
270 RESERVED5 = '5', //!< Reserved
271 RESERVED6 = '6', //!< Reserved
272 RESERVED7 = '7', //!< Reserved
273}; // clang-format on
274
275/**
276 * @brief Stringify IMU variance
277 *
278 * @param[in] noise The IMU variance
279 *
280 * @returns the stringification of the IMU variance
281 */
282const char* FpaImuNoiseStr(const FpaImuNoise noise);
283
284/**
285 * @brief FP_A IMU accelerometer and gyroscope convergence
286 */
287enum class FpaImuConv : int
288{ // clang-format off
289 UNSPECIFIED = '!', //!< Unspecified
290 RESERVED0 = '0', //!< Reserved
291 WAIT_IMU_MEAS = '1', //!< Awaiting IMU measurements
292 WAIT_GLOBAL_MEAS = '2', //!< Insufficient global measurements
293 WAIT_MOTION = '3', //!< Insufficient motion
294 CONVERGING = '4', //!< Converging
295 RESERVED5 = '5', //!< Reserved
296 RESERVED6 = '6', //!< Reserved
297 IDLE = '7', //!< Idle
298}; // clang-format on
299
300/**
301 * @brief Stringify IMU accelerometer and gyroscope convergence
302 *
303 * @param[in] conv The IMU accelerometer and gyroscope convergence
304 *
305 * @returns the stringification of the IMU accelerometer and gyroscope convergence
306 */
307const char* FpaImuConvStr(const FpaImuConv conv);
308
309/**
310 * @brief FP_A GNSS fix status
311 */
312enum class FpaGnssStatus : int
313{ // clang-format off
314 UNSPECIFIED = '!', //!< Unspecified
315 NO_FIX = '0', //!< No fix
316 SPP = '1', //!< Single-point positioning (SPP)
317 RTK_MB = '2', //!< RTK moving baseline
318 RESERVED3 = '3', //!< Reserved
319 RESERVED4 = '4', //!< Reserved
320 RTK_FLOAT = '5', //!< RTK float
321 RESERVED6 = '6', //!< Reserved
322 RESERVED7 = '7', //!< Reserved
323 RTK_FIXED = '8', //!< RTK fixed
324 RESERVED9 = '9', //!< Reserved
325}; // clang-format on
326
327/**
328 * @brief Stringify GNSS fix status
329 *
330 * @param[in] status TheGNSS fix status
331 *
332 * @returns the stringification of the GNSS fix status
333 */
334const char* FpaGnssStatusStr(const FpaGnssStatus status);
335
336/**
337 * @brief FP_A GNSS correction status
338 */
339enum class FpaCorrStatus : int
340{ // clang-format off
341 UNSPECIFIED = '!', //!< Unspecified
342 WAITING_FUSION = '0', //!< Waiting fusion
343 NO_GNSS = '1', //!< No GNSS available
344 NO_CORR = '2', //!< No corrections used
345 LIMITED_CORR = '3', //!< Limited corrections used: station data & at least one of the constellations (both bands) among the valid rover measurements
346 OLD_CORR = '4', //!< Corrections are too old (TBD)
347 GOOD_CORR = '5', //!< Sufficient corrections used: station data and corrections for ALL bands among the valid rover measurements
348 RESERVED6 = '6', //!< Reserved
349 RESERVED7 = '7', //!< Reserved
350 RESERVED8 = '8', //!< Reserved
351 RESERVED9 = '9', //!< Reserved
352}; // clang-format on
353
354/**
355 * @brief Stringify GNSS correction status
356 *
357 * @param[in] status The GNSS correction status
358 *
359 * @returns the stringification of the GNSS correction status
360 */
361const char* FpaCorrStatusStr(const FpaCorrStatus status);
362
363/**
364 * @brief FP_A baseline status
365 */
366enum class FpaBaselineStatus : int
367{ // clang-format off
368 UNSPECIFIED = '!', //!< Unspecified
369 WAITING_FUSION = '0', //!< Waiting fusion
370 NO_FIX = '1', //!< Not available or no fix
371 FAILING = '2', //!< Failing
372 PASSING = '3', //!< Passing
373}; // clang-format on
374
375/**
376 * @brief Stringify baseline status
377 *
378 * @param[in] status The baseline status
379 *
380 * @returns the stringification of the baseline status
381 */
382const char* FpaBaselineStatusStr(const FpaBaselineStatus status);
383
384/**
385 * @brief FP_A camera status
386 */
387enum class FpaCamStatus : int
388{ // clang-format off
389 UNSPECIFIED = '!', //!< Unspecified
390 CAM_UNAVL = '0', //!< Camera not available
391 BAD_FEAT = '1', //!< Camera available, but not usable (e.g. too dark)
392 RESERVED2 = '2', //!< Reserved
393 RESERVED3 = '3', //!< Reserved
394 RESERVED4 = '4', //!< Reserved
395 GOOD = '5', //!< Camera working and available
396}; // clang-format on
397
398/**
399 * @brief Stringify camera status
400 *
401 * @param[in] status The camera status
402 *
403 * @returns the stringification of the camera status
404 */
405const char* FpaCamStatusStr(const FpaCamStatus status);
406
407/**
408 * @brief FP_A wheelspeed status
409 */
410enum class FpaWsStatus : int
411{ // clang-format off
412 UNSPECIFIED = '!', //!< Unspecified
413 NOT_ENABLED = '0', //!< No wheelspeed enabled
414 MISS_MEAS = '1', //!< Missing wheelspeed measurements
415 NONE_CONVERGED = '2', //!< At least one wheelspeed enabled, no wheelspeed converged
416 ONE_CONVERGED = '3', //!< At least one wheelspeed enabled and at least one converged
417 ALL_CONVERGED = '4', //!< At least one wheelspeed enabled and all converged
418}; // clang-format on
419
420/**
421 * @brief Stringify wheelspeed status
422 *
423 * @param[in] status The wheelspeed status
424 *
425 * @returns the stringification of the wheelspeed status
426 */
427const char* FpaWsStatusStr(const FpaWsStatus status);
428
429/**
430 * @brief FP_A legacy wheelspeed status
431 */
432enum class FpaWsStatusLegacy : int
433{ // clang-format off
434 UNSPECIFIED = '!', //!< Unspecified
435 NOT_ENABLED = '-', //!< No wheelspeed enabled
436 NONE_CONVERGED = '0', //!< None converged
437 ONE_OR_MORE_CONVERGED = '1', //!< At least one converged
438}; // clang-format on
439
440/**
441 * @brief Stringify legacy wheelspeed status
442 *
443 * @param[in] status The legacy wheelspeed status
444 *
445 * @returns the stringification of the legacy wheelspeed status
446 */
447const char* FpaWsStatusLegacyStr(const FpaWsStatusLegacy status);
448
449/**
450 * @brief FP_A wheelspeed convergence status
451 */
452enum class FpaWsConv : int
453{ // clang-format off
454 UNSPECIFIED = '!', //!< Unspecified
455 WAIT_FUSION = '0', //!< Awaiting Fusion
456 WAIT_WS_MEAS = '1', //!< Missing wheelspeed measurements
457 WAIT_GLOBAL_MEAS = '2', //!< Insufficient global measurements
458 WAIT_MOTION = '3', //!< Insufficient motion
459 WAIT_IMU_BIAS = '4', //!< Insufficient imu bias convergence
460 CONVERGING = '5', //!< Converging
461 IDLE = '6', //!< Idle
462}; // clang-format on
463
464/**
465 * @brief Stringify wheelspeed convergence status
466 *
467 * @param[in] status The wheelspeed convergence status
468 *
469 * @returns the stringification of the wheelspeed convergence status
470 */
471const char* FpaWsConvStr(const FpaWsConv status);
472
473/**
474 * @brief FP_A markers status
475 */
476enum class FpaMarkersStatus : int
477{ // clang-format off
478 UNSPECIFIED = '!', //!< Unspecified
479 NOT_ENABLED = '0', //!< No markers available
480 NONE_CONVERGED = '1', //!< Markers available
481 ONE_CONVERGED = '2', //!< Markers available and used
482 ALL_CONVERGED = '3', //!< All markers available and used
483}; // clang-format on
484
485/**
486 * @brief Stringify markers status
487 *
488 * @param[in] status The markers status
489 *
490 * @returns the stringification of the markers status
491 */
492const char* FpaMarkersStatusStr(const FpaMarkersStatus status);
493
494/**
495 * @brief FP_A markers convergence status
496 */
497enum class FpaMarkersConv : int
498{ // clang-format off
499 UNSPECIFIED = '!', //!< Unspecified
500 WAIT_FUSION = '0', //!< Awaiting Fusion
501 WAIT_MARKER_MEAS = '1', //!< Waiting marker measurements
502 WAIT_GLOBAL_MEAS = '2', //!< Insufficient global measurements
503 CONVERGING = '3', //!< Converging
504 IDLE = '4', //!< Idle
505}; // clang-format on
506
507/**
508 * @brief Stringify markers convergence status
509 *
510 * @param[in] conv The markers convergence status
511 *
512 * @returns the stringification of the markers convergence status
513 */
514const char* FpaMarkersConvStr(const FpaMarkersConv conv);
515
516/**
517 * @brief FP_A GNSS fix type
518 */
519enum class FpaGnssFix : int
520{ // clang-format off
521 UNSPECIFIED = '!', //!< Unspecified
522 UNKNOWN = '0', //!< Unknown
523 NOFIX = '1', //!< No fix
524 DRONLY = '2', //!< Dead-reckoning only
525 TIME = '3', //!< Time-only fix
526 S2D = '4', //!< Single 2D fix
527 S3D = '5', //!< Single 3D fix
528 S3D_DR = '6', //!< Single 3D fix with dead-reckoning
529 RTK_FLOAT = '7', //!< RTK float fix
530 RTK_FIXED = '8', //!< RTK fixed fix
531}; // clang-format on
532
533/**
534 * @brief Stringify fix type
535 *
536 * @param[in] fix The fix type
537 *
538 * @returns the stringification of the fix type ("S3D", "RTK_FLOAT", etc.)
539 */
540const char* FpaGnssFixStr(const FpaGnssFix fix);
541
542/**
543 * @brief FP_A epoch type
544 */
545enum class FpaEpoch : int
546{
547 UNSPECIFIED = 0, //!< Unspecified
548 GNSS1, //!< GNSS 1
549 GNSS2, //!< GNSS 2
550 GNSS, //!< Combined GNSS
551 FUSION, //!< Fusion
552};
553
554/**
555 * @brief Stringify epoch type
556 *
557 * @param[in] epoch The epoch type
558 *
559 * @returns the stringification of the epoch type ("FUSION", "GNSS1", etc.)
560 */
561const char* FpaEpochStr(const FpaEpoch epoch);
562
563/**
564 * @brief FP_A GNSS antenna state
565 */
566enum class FpaAntState : int
567{
568 UNSPECIFIED = 0, //!< Unspecified
569 OPEN, //!< No antenna detected (or connected via DC block)
570 OK, //!< Antenna detected and good
571 SHORT, //!< Antenna short circuit detected
572};
573
574/**
575 * @brief Stringify antenna state
576 *
577 * @param[in] state The antenna state
578 *
579 * @returns the stringification of the antenna state ("OPEN", "OK", etc.)
580 */
581const char* FpaAntStateStr(const FpaAntState state);
582
583/**
584 * @brief FP_A GNSS antenna power
585 */
586enum class FpaAntPower : int
587{
588 UNSPECIFIED = 0, //!< Unspecified
589 ON, //!< Antenna power supply is on
590 OFF, //!< Antenna power supply is off
591};
592
593/**
594 * @brief Stringify antenna power
595 *
596 * @param[in] power The antenna power
597 *
598 * @returns the stringification of the antenna power ("ON", "OFF", etc.)
599 */
600const char* FpaAntPowerStr(const FpaAntPower power);
601
602/**
603 * @brief FP_A text levels
604 */
605enum class FpaTextLevel : int
606{ // clang-format off
607 UNSPECIFIED = 0, //!< Unspecified
612}; // clang-format on
613
614/**
615 * @brief Stringify text level
616 *
617 * @param[in] level The text level
618 *
619 * @returns the stringification of the text level ("ERROR", "INFO", etc.)
620 */
621const char* FpaTextLevelStr(const FpaTextLevel level);
622
623/**
624 * @brief FP_A time base
625 */
626enum class FpaTimebase : int
627{ // clang-format off
628 UNSPECIFIED = 0, //!< Unspecified
629 NONE, //!< None
630 GNSS, //!< GNSS
631 UTC, //!< UTC
632}; // clang-format on
633
634/**
635 * @brief Stringify time base
636 *
637 * @param[in] base The time base
638 *
639 * @returns the stringification of the time base ("GNSS", "UTC", etc.)
640 */
641const char* FpaTimebaseStr(const FpaTimebase base);
642
643/**
644 * @brief FP_A time reference
645 */
646enum class FpaTimeref : int
647{ // clang-format off
648 UNSPECIFIED = 0, //!< Unspecified
649 UTC_NONE, //!< UTC: None (UTC params not yet known)
650 UTC_CRL, //!< UTC: Communications Research Laboratory (CRL), Japan
651 UTC_NIST, //!< UTC: National Institute of Standards and Technology (NIST)
652 UTC_USNO, //!< UTC: U.S. Naval Observatory (USNO)
653 UTC_BIPM, //!< UTC: International Bureau of Weights and Measures (BIPM)
654 UTC_EU, //!< UTC: European laboratories
655 UTC_SU, //!< UTC: Former Soviet Union (SU)
656 UTC_NTSC, //!< UTC: National Time Service Center (NTSC), China
657 GNSS_GPS, //!< GNSS: GPS
658 GNSS_GAL, //!< GNSS: Galileo
659 GNSS_BDS, //!< GNSS: BeiDou
660 GNSS_GLO, //!< GNSS: GLONASS
661 GNSS_NVC, //!< GNSS: NavIC
662 OTHER, //!< other/unknown GNSS/UTC
663}; // clang-format on
664
665/**
666 * @brief Stringify time reference
667 *
668 * @param[in] ref The time reference
669 *
670 * @returns the stringification of the time reference ("UTC_NONE", "GNSS_GPS", etc.)
671 */
672const char* FpaTimerefStr(const FpaTimeref ref);
673
674/**
675 * @brief FP_A integer value
676 */
677struct FpaInt
678{
679 bool valid = false; //!< Data is valid
680 int value = 0; //!< Value
681};
682
683/**
684 * @brief FP_A float value
685 */
687{
688 bool valid = false; //!< Data is valid
689 double value = 0.0; //!< Value
690};
691
692/**
693 * @brief FP_A three float values
694 */
696{
697 bool valid = false; //!< Data is valid
698 std::array<double, 3> values = { { 0.0, 0.0, 0.0 } }; //!< Values
699};
700
701/**
702 * @brief FP_A four float values
703 */
705{
706 bool valid = false; //!< Data is valid
707 std::array<double, 4> values = { { 0.0, 0.0, 0.0, 0.0 } }; //!< Values
708};
709
710/**
711 * @brief FP_A six float values
712 */
714{
715 bool valid = false; //!< Data is valid
716 std::array<double, 6> values = { { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 } }; //!< Values
717};
718
719/**
720 * @brief FP_A GPS time
721 */
723{
724 FpaInt week; //!< GPS week number, range 0-9999, or null if time not (yet) available
725 FpaFloat tow; //!< GPS time of week, range 0.000-604799.999999, or null if time not (yet) available
726
727 bool operator==(const FpaGpsTime& rhs) const; //!< Equal (epsilon = 1e-6)
728 bool operator!=(const FpaGpsTime& rhs) const; //!< Not equal (epsilon = 1e-6)
729 bool operator<(const FpaGpsTime& rhs) const; //!< Less than
730 bool operator>(const FpaGpsTime& rhs) const; //!< Greater than
731 bool operator<=(const FpaGpsTime& rhs) const; //!< Less or equal than
732 bool operator>=(const FpaGpsTime& rhs) const; //!< Greater or equal than
733};
734
735/**
736 * @brief FP_A message types
737 */
739{
740 UNSPECIFIED, //!< Unspecified
741 EOE, //!< FpaEoePayload
742 GNSSANT, //!< FpaGnssantPayload
743 GNSSCORR, //!< FpaGnsscorrPayload
744 RAWIMU, //!< FpaRawimuPayload
745 CORRIMU, //!< FpaCorrimuPayload
746 IMUBIAS, //!< FpaImubiasPayload
747 LLH, //!< FpaLlhPayload
748 ODOMETRY, //!< FpaOdometryPayload
749 ODOMENU, //!< FpaOdomenuPayload
750 ODOMSH, //!< FpaOdomshPayload
751 ODOMSTATUS, //!< FpaOdomstatusPayload
752 TEXT, //!< FpaTextPayload
753 TF, //!< FpaTfPayload
754 TP, //!< FpaTpPayload
755 VERSION, //!< FpaVersionPayload
756};
757
758/**
759 * @brief FP_A payload base class
760 */
762{
763 bool valid_ = false; //!< Payload successfully decoded (true), or not (yet) decoded (false)
765 virtual ~FpaPayload() = default; //!< Virtual dtor for polymorphism
766
767 /**
768 * @brief Set data from message
769 *
770 * @param[in] msg Pointer to the FP_A message
771 * @param[in] msg_size Size of the FP_A message (>= 11)
772 *
773 * @returns true if message payload was correct and all data could be extracted (fields are now valid), or false
774 * otherwise (fields are now invalid)
775 */
776 virtual bool SetFromMsg(const uint8_t* msg, const std::size_t msg_size) = 0;
777
778 /**
779 * @brief Set data from message
780 *
781 * @param[in] buf The FP_A message data
782 *
783 * @returns true if message payload was correct and all data could be extracted (fields are now valid), or false
784 * otherwise (fields are now invalid)
785 */
786 inline bool SetFromBuf(const std::vector<uint8_t>& buf)
787 {
788 return SetFromMsg(buf.data(), buf.size());
789 }
790};
791
792/**
793 * @brief FP_A-EOE (version 1) message payload
794 */
796{
798 FpaEpoch epoch = FpaEpoch::UNSPECIFIED; //!< Indicates which epoch ended ("FUSION", "GNSS", "GNSS1", "GNSS2")
799
800 bool SetFromMsg(const uint8_t* msg, const std::size_t msg_size) final;
801
802 static constexpr const char* MSG_NAME = "FP_A-EOE"; //!< Message name
803};
804
805/**
806 * @brief FP_A-GNSSANT (version 1) message payload
807 */
809{ // clang-format off
813 FpaInt gnss1_age; //!< Time since gnss1_state or gnss1_power information last changed, 0-604800
816 FpaInt gnss2_age; //!< Time since gnss2_state or gnss2_power information last changed, 0-604800
817 // clang-format on
818
819 bool SetFromMsg(const uint8_t* msg, const std::size_t msg_size) final;
820
821 static constexpr const char* MSG_NAME = "FP_A-GNSSANT"; //!< Message name
822};
823
824/**
825 * @brief FP_A-GNSSCORR (version 1) message payload
826 */
828{ // clang-format off
830 FpaGnssFix gnss1_fix = FpaGnssFix::UNSPECIFIED; //!< Fix status of GNSS1
831 FpaInt gnss1_nsig_l1; //!< Number of L1 signals with correction data tracked by GNSS1 receiver, range 0-100
832 FpaInt gnss1_nsig_l2; //!< Number of L2 signals with correction data tracked by GNSS1 receiver, range 0-100
833 FpaGnssFix gnss2_fix = FpaGnssFix::UNSPECIFIED; //!< Fix status of GNSS2 receiver
834 FpaInt gnss2_nsig_l1; //!< Number of L1 signals with correction data tracked by GNSS2 receiver, range 0-100
835 FpaInt gnss2_nsig_l2; //!< Number of L2 signals with correction data tracked by GNSS2 receiver, range 0-100
836 FpaFloat corr_latency; //!< Average correction data latency (10s window), range 0.0-99.9
837 FpaFloat corr_update_rate; //!< Average correction update rate (10s window), range 0.0-0.0
838 FpaFloat corr_data_rate; //!< Average correction data rate (10s window), range 0.0-50.0
839 FpaFloat corr_msg_rate; //!< Average correction message rate (10s window), range 0-50
840 FpaInt sta_id; //!< Correction station ID, range 0--4095
841 FpaFloat3 sta_llh; //!< Correction station latitude/longitude/height [deg, deg, m]
842 FpaInt sta_dist; //!< Correction station baseline length (approximate 3d distance), range 0-100000
843 // clang-format on
844
845 bool SetFromMsg(const uint8_t* msg, const std::size_t msg_size) final;
846
847 static constexpr const char* MSG_NAME = "FP_A-GNSSCORR"; //!< Message name
848};
849
850/**
851 * @brief FP_A-...IMU (versions 1 and 2) messages payload
852 */
854{
855 // clang-format off
857 FpaFloat3 acc; //!< Raw acceleration in output frame, X/Y/Z components
858 FpaFloat3 rot; //!< Raw angular velocity in output frame, X/Y/Z components
859 bool bias_comp = false; //!< Signal is bias compensated (true) or not (false), always false for RAWIMU, may be true for CORRIMU
860 FpaImuStatus imu_status = FpaImuStatus::UNSPECIFIED; //!< IMU bias status (only available for version 2 messages)
861 // clang-format on
862};
863
864/**
865 * @brief FP_A-RAWIMU (version 1) message payload
866 */
868{
869 bool SetFromMsg(const uint8_t* msg, const std::size_t msg_size) final;
870
871 static constexpr const char* MSG_NAME = "FP_A-RAWIMU"; //!< Message name
872};
873
874/**
875 * @brief FP_A-CORRIMU (version 1) message payload
876 */
878{
879 bool SetFromMsg(const uint8_t* msg, const std::size_t msg_size) final;
880
881 static constexpr const char* MSG_NAME = "FP_A-CORRIMU"; //!< Message name
882};
883
884/**
885 * @brief FP_A-IMUBIAS (version 1) message payload
886 */
888{ // clang-format off
890 FpaMeasStatus fusion_imu; //!< Fusion measurement status: IMU
891 FpaImuStatus imu_status; //!< IMU bias status
892 FpaImuNoise imu_noise; //!< IMU variance status
893 FpaImuConv imu_conv; //!< IMU convergence status
894 FpaFloat3 bias_acc; //!< Accelerometer bias, X/Y/Z components
895 FpaFloat3 bias_gyr; //!< Gyroscope bias, X/Y/Z components
896 FpaFloat3 bias_cov_acc; //!< Accelerometer bias covariance, X/Y/Z components
897 FpaFloat3 bias_cov_gyr; //!< Gyroscope bias covariance, X/Y/Z components
898 // clang-format on
899
900 bool SetFromMsg(const uint8_t* msg, const std::size_t msg_size) final;
901
902 static constexpr const char* MSG_NAME = "FP_A-IMUBIAS"; //!< Message name
903};
904
905/**
906 * @brief FP_A-LLH (version 1) message payload
907 */
909{ // clang-format off
911 FpaFloat3 llh; //!< Latitude/longitude/height [deg, deg, m]
912 FpaFloat6 cov_enu; //!< Position covariance in ENU, EE/NN/UU/EN/NU/EU components [m^2]
913 // clang-format on
914
915 bool SetFromMsg(const uint8_t* msg, const std::size_t msg_size) final;
916
917 static constexpr const char* MSG_NAME = "FP_A-LLH"; //!< Message name
918};
919
920/**
921 * @brief FP_A-ODOM... (version 1) messages payload
922 */
924{
925 // clang-format off
927 FpaFloat3 pos; //!< Position, X/Y/Z components
928 FpaFloat4 orientation; //!< Quaternion, W/X/Y/Z components
929 FpaFloat3 vel; //!< Velocity, X/Y/Z components
930 FpaFloat3 rot; //!< Bias corrected angular velocity, X/Y/Z components
931 FpaFloat3 acc; //!< Bias corrected acceleration, X/Y/Z components
934 FpaGnssFix gnss1_fix; //!< Fix status of GNSS1 receiver
935 FpaGnssFix gnss2_fix; //!< Fix status of GNSS2 receiver
936 FpaWsStatusLegacy wheelspeed_status; //!< Wheelspeed status
937 FpaFloat6 pos_cov; //!< Position covariance, XX/YY/ZZ/XY/YZ/XZ components
938 FpaFloat6 orientation_cov; //!< Orientation covariance, XX/YY/ZZ/XY/YZ/XZ components
939 FpaFloat6 vel_cov; //!< Velocity covariance, XX/YY/ZZ/XY/YZ/XZ components
940 char version[100] = { 0 }; //!< Software version string
941 // clang-format on
942
943 virtual bool SetFromMsg(const uint8_t* msg, const std::size_t msg_size) = 0;
944};
945
946/**
947 * @brief FP_A-ODOMETRY (version 2) messages payload (ECEF)
948 */
950{
951 bool SetFromMsg(const uint8_t* msg, const std::size_t msg_size) final;
952
953 static constexpr const char* MSG_NAME = "FP_A-ODOMETRY"; //!< Message name
954};
955
956/**
957 * @brief FP_A-ODOMENU (version 1) messages payload (ENU0)
958 */
960{
961 bool SetFromMsg(const uint8_t* msg, const std::size_t msg_size) final;
962
963 static constexpr const char* MSG_NAME = "FP_A-ODOMENU"; //!< Message name
964};
965
966/**
967 * @brief FP_A-ODOMSH (version 1) messages payload (ECEF)
968 */
970{
971 bool SetFromMsg(const uint8_t* msg, const std::size_t msg_size) final;
972
973 static constexpr const char* MSG_NAME = "FP_A-ODOMSH"; //!< Message name
974};
975
976/**
977 * @brief FP_A-ODOMSTATUS (version 1) messages payload
978 */
980{ // clang-format off
982 FpaInitStatus init_status; //!< Fusion init status
983 FpaMeasStatus fusion_imu; //!< Fusion measurement status: IMU
984 FpaMeasStatus fusion_gnss1; //!< Fusion measurement status: GNSS 1
985 FpaMeasStatus fusion_gnss2; //!< Fusion measurement status: GNSS 2
986 FpaMeasStatus fusion_corr; //!< Fusion measurement status: GNSS corrections
987 FpaMeasStatus fusion_cam1; //!< Fusion measurement status: camera
988 FpaMeasStatus fusion_ws; //!< Fusion measurement status: wheelspeed
989 FpaMeasStatus fusion_markers; //!< Fusion measurement status: markers
990 FpaImuStatus imu_status; //!< IMU bias status
991 FpaImuNoise imu_noise; //!< IMU variance status
992 FpaImuConv imu_conv; //!< IMU convergence status
993 FpaGnssStatus gnss1_status; //!< GNSS 1 status
994 FpaGnssStatus gnss2_status; //!< GNSS 2 status
995 FpaBaselineStatus baseline_status; //!< Baseline status
996 FpaCorrStatus corr_status; //!< GNSS correction status
997 FpaCamStatus cam1_status; //!< Camera 1 status
998 FpaWsStatus ws_status; //!< Wheelspeed status
999 FpaWsConv ws_conv; //!< Wheelspeed convergence status
1001 FpaMarkersConv markers_conv; //!< Marker convergence status
1002 // clang-format on
1003
1004 bool SetFromMsg(const uint8_t* msg, const std::size_t msg_size) final;
1005
1006 static constexpr const char* MSG_NAME = "FP_A-ODOMSTATUS"; //!< Message name
1007};
1008
1009/**
1010 * @brief FP_A-TEXT (version 1) message payload
1011 */
1013{ // clang-format off
1015 char text[MAX_FP_A_SIZE] = { 0 }; //!< Text (nul-terminated string)
1016 // clang-format on
1017
1018 bool SetFromMsg(const uint8_t* msg, const std::size_t msg_size) final;
1019
1020 static constexpr const char* MSG_NAME = "FP_A-TEXT"; //!< Message name
1021};
1022
1023/**
1024 * @brief FP_A-TF (version 2) message payload
1025 */
1027{ // clang-format off
1029 char frame_a[10] = { 0 }; //!< Target frame (nul-terminated string)
1030 char frame_b[10] = { 0 }; //!< Initial frame (nul-terminated string)
1031 FpaFloat3 translation; //!< Translation, X/Y/Z components
1032 FpaFloat4 orientation; //!< Rotation in quaternion, W/X/Y/Z components
1033 // clang-format on
1034
1035 bool SetFromMsg(const uint8_t* msg, const std::size_t msg_size) final;
1036
1037 static constexpr const char* MSG_NAME = "FP_A-TF"; //!< Message name
1038};
1039
1040/**
1041 * @brief FP_A-TP (versions 1 and 2) message payload
1042 */
1044{ // clang-format off
1045 char tp_name[10] = { 0 }; //!< Timepulse name (nul-terminated string)
1048 FpaInt tp_week; //!< Timepulse week number (only since version 2 of the message)
1049 FpaInt tp_tow_sec; //!< Timepulse time seconds of week, integer second part (0--604799)
1050 FpaFloat tp_tow_psec; //!< Timepulse time seconds of week, sub-second part (0.000000000000--0.999999999999)
1051 FpaInt gps_leaps; //!< GPS leapseconds
1052 // clang-format on
1053
1054 bool SetFromMsg(const uint8_t* msg, const std::size_t msg_size) final;
1055
1056 static constexpr const char* MSG_NAME = "FP_A-TP"; //!< Message name
1057};
1058
1059/**
1060 * @brief FP_A-VERSION (version 1) message payload
1061 */
1063{ // clang-format off
1064 char sw_version[100] = { 0 }; //!< Software version string
1065 char hw_name[100] = { 0 }; //!< Hardware name
1066 char hw_ver[100] = { 0 }; //!< Hardware version string
1067 char hw_uid[100] = { 0 }; //!< Hardware UID
1068 char product_model[100] = { 0 }; //!< Product model
1069 // clang-format on
1070
1071 bool SetFromMsg(const uint8_t* msg, const std::size_t msg_size) final;
1072
1073 static constexpr const char* MSG_NAME = "FP_A-VERSION"; //!< Message name
1074};
1075
1076// ---------------------------------------------------------------------------------------------------------------------
1077
1078//! Pointer to FP_A payload
1079using FpaPayloadPtr = std::unique_ptr<FpaPayload>;
1080
1081/**
1082 * @brief Decode FP_A message
1083 *
1084 * @param[in] msg Pointer to the FP_A message
1085 * @param[in] msg_size Size of the FP_A message (>= 11)
1086 *
1087 * @returns an instance of the decoded payload on success, nullptr otherwise (bad or unknown message)
1088 */
1089FpaPayloadPtr FpaDecodeMessage(const uint8_t* msg, const std::size_t msg_size);
1090
1091/**
1092 * @brief Decode FP_A message
1093 *
1094 * @param[in] msg The FP_A message data
1095 *
1096 * @returns an instance of the decoded payload on success, nullptr otherwise (bad or unknown message)
1097 */
1098inline FpaPayloadPtr FpaDecodeMessage(const std::vector<uint8_t>& msg)
1099{
1100 return FpaDecodeMessage(msg.data(), msg.size());
1101}
1102
1103/* ****************************************************************************************************************** */
1104} // namespace fpa
1105} // namespace parser
1106} // namespace common
1107} // namespace fpsdk
1108#endif // __FPSDK_COMMON_PARSER_FPA_HPP__
Fixposition SDK: Logging.
@ WARNING
[4/warning] Warnings (for libs and apps)
Definition logging.hpp:202
@ INFO
[6/info] Interesting stuff, the default level (for apps)
Definition logging.hpp:204
@ ERROR
[3/err] Errors (for apps)
Definition logging.hpp:201
@ DEBUG
[7/debug] Debugging (for libs and apps)
Definition logging.hpp:205
Parser FP_A routines and types.
Definition fpa.hpp:98
FpaEpoch
FP_A epoch type.
Definition fpa.hpp:546
const char * FpaAntPowerStr(const FpaAntPower power)
Stringify antenna power.
FpaGnssStatus
FP_A GNSS fix status.
Definition fpa.hpp:313
@ SPP
Single-point positioning (SPP)
Definition fpa.hpp:316
FpaCorrStatus
FP_A GNSS correction status.
Definition fpa.hpp:340
@ OLD_CORR
Corrections are too old (TBD)
Definition fpa.hpp:346
@ GOOD_CORR
Sufficient corrections used: station data and corrections for ALL bands among the valid rover measure...
Definition fpa.hpp:347
@ LIMITED_CORR
Limited corrections used: station data & at least one of the constellations (both bands) among the va...
Definition fpa.hpp:345
FpaTimeref
FP_A time reference.
Definition fpa.hpp:647
@ OTHER
other/unknown GNSS/UTC
Definition fpa.hpp:662
@ UTC_NTSC
UTC: National Time Service Center (NTSC), China.
Definition fpa.hpp:656
@ UTC_EU
UTC: European laboratories.
Definition fpa.hpp:654
@ UTC_NONE
UTC: None (UTC params not yet known)
Definition fpa.hpp:649
@ UTC_USNO
UTC: U.S. Naval Observatory (USNO)
Definition fpa.hpp:652
@ UTC_CRL
UTC: Communications Research Laboratory (CRL), Japan.
Definition fpa.hpp:650
@ UTC_BIPM
UTC: International Bureau of Weights and Measures (BIPM)
Definition fpa.hpp:653
@ UTC_SU
UTC: Former Soviet Union (SU)
Definition fpa.hpp:655
@ UTC_NIST
UTC: National Institute of Standards and Technology (NIST)
Definition fpa.hpp:651
const char * FpaCamStatusStr(const FpaCamStatus status)
Stringify camera status.
const char * FpaEpochStr(const FpaEpoch epoch)
Stringify epoch type.
FpaTextLevel
FP_A text levels.
Definition fpa.hpp:606
FpaAntPower
FP_A GNSS antenna power.
Definition fpa.hpp:587
@ OFF
Antenna power supply is off.
Definition fpa.hpp:590
@ ON
Antenna power supply is on.
Definition fpa.hpp:589
static constexpr int FP_A_FRAME_SIZE
FP_A frame size ("$*cc\r\n")
Definition fpa.hpp:102
const char * FpaCorrStatusStr(const FpaCorrStatus status)
Stringify GNSS correction status.
FpaMeasStatus
FP_A fusion measurement status.
Definition fpa.hpp:204
FpaBaselineStatus
FP_A baseline status.
Definition fpa.hpp:367
bool FpaGetMessageMeta(FpaMessageMeta &meta, const uint8_t *msg, const std::size_t msg_size)
Get FP_A message meta data.
const char * FpaTextLevelStr(const FpaTextLevel level)
Stringify text level.
const char * FpaImuStatusStr(const FpaImuStatus status)
Stringify IMU bias status.
FpaWsStatus
FP_A wheelspeed status.
Definition fpa.hpp:411
@ MISS_MEAS
Missing wheelspeed measurements.
Definition fpa.hpp:414
@ ALL_CONVERGED
At least one wheelspeed enabled and all converged.
Definition fpa.hpp:417
@ NONE_CONVERGED
At least one wheelspeed enabled, no wheelspeed converged.
Definition fpa.hpp:415
@ ONE_CONVERGED
At least one wheelspeed enabled and at least one converged.
Definition fpa.hpp:416
@ NOT_ENABLED
No wheelspeed enabled.
Definition fpa.hpp:413
const char * FpaAntStateStr(const FpaAntState state)
Stringify antenna state.
const char * FpaImuConvStr(const FpaImuConv conv)
Stringify IMU accelerometer and gyroscope convergence.
FpaPayloadPtr FpaDecodeMessage(const uint8_t *msg, const std::size_t msg_size)
Decode FP_A message.
FpaGnssFix
FP_A GNSS fix type.
Definition fpa.hpp:520
@ DRONLY
Dead-reckoning only.
Definition fpa.hpp:524
@ S3D_DR
Single 3D fix with dead-reckoning.
Definition fpa.hpp:528
static constexpr uint8_t FP_A_PREAMBLE
FP_A framing preamble.
Definition fpa.hpp:101
const char * FpaWsStatusStr(const FpaWsStatus status)
Stringify wheelspeed status.
const char * FpaBaselineStatusStr(const FpaBaselineStatus status)
Stringify baseline status.
const char * FpaFusionStatusLegacyStr(const FpaFusionStatusLegacy status)
Stringify legacy fusion status.
const char * FpaMarkersConvStr(const FpaMarkersConv conv)
Stringify markers convergence status.
FpaFusionStatusLegacy
FP_A legacy fusion status.
Definition fpa.hpp:182
@ VIO_GNSS
Visual-inertial-GNSS fusion.
Definition fpa.hpp:188
const char * FpaWsStatusLegacyStr(const FpaWsStatusLegacy status)
Stringify legacy wheelspeed status.
FpaMarkersConv
FP_A markers convergence status.
Definition fpa.hpp:498
@ WAIT_MARKER_MEAS
Waiting marker measurements.
Definition fpa.hpp:501
FpaImuNoise
FP_A IMU variance.
Definition fpa.hpp:264
const char * FpaMeasStatusStr(const FpaMeasStatus status)
Stringify fusion measurement status.
FpaCamStatus
FP_A camera status.
Definition fpa.hpp:388
@ GOOD
Camera working and available.
Definition fpa.hpp:395
@ CAM_UNAVL
Camera not available.
Definition fpa.hpp:390
@ BAD_FEAT
Camera available, but not usable (e.g. too dark)
Definition fpa.hpp:391
FpaWsConv
FP_A wheelspeed convergence status.
Definition fpa.hpp:453
@ WAIT_IMU_BIAS
Insufficient imu bias convergence.
Definition fpa.hpp:459
@ WAIT_WS_MEAS
Missing wheelspeed measurements.
Definition fpa.hpp:456
FpaMarkersStatus
FP_A markers status.
Definition fpa.hpp:477
const char * FpaMarkersStatusStr(const FpaMarkersStatus status)
Stringify markers status.
FpaImuStatus
FP_A IMU bias status.
Definition fpa.hpp:224
@ ROUGH_CONVERGED
Rough convergence.
Definition fpa.hpp:228
FpaInitStatus
FP_A fusion initialisation status.
Definition fpa.hpp:162
@ GLOBAL_INIT
Globally initialised.
Definition fpa.hpp:166
@ LOCAL_INIT
Locally initialised.
Definition fpa.hpp:165
FpaImuStatusLegacy
FP_A legacy IMU bias status.
Definition fpa.hpp:245
bool FpaGetMessageInfo(char *info, const std::size_t size, const uint8_t *msg, const std::size_t msg_size)
Get FP_A message info.
const char * FpaTimerefStr(const FpaTimeref ref)
Stringify time reference.
FpaAntState
FP_A GNSS antenna state.
Definition fpa.hpp:567
@ SHORT
Antenna short circuit detected.
Definition fpa.hpp:571
@ OPEN
No antenna detected (or connected via DC block)
Definition fpa.hpp:569
@ OK
Antenna detected and good.
Definition fpa.hpp:570
FpaTimebase
FP_A time base.
Definition fpa.hpp:627
const char * FpaImuNoiseStr(const FpaImuNoise noise)
Stringify IMU variance.
const char * FpaGnssFixStr(const FpaGnssFix fix)
Stringify fix type.
bool FpaGetMessageName(char *name, const std::size_t size, const uint8_t *msg, const std::size_t msg_size)
Get FP_A message name.
const char * FpaWsConvStr(const FpaWsConv status)
Stringify wheelspeed convergence status.
FpaMessageType
FP_A message types.
Definition fpa.hpp:739
@ ODOMSTATUS
FpaOdomstatusPayload.
Definition fpa.hpp:751
std::unique_ptr< FpaPayload > FpaPayloadPtr
Pointer to FP_A payload.
Definition fpa.hpp:1079
FpaImuConv
FP_A IMU accelerometer and gyroscope convergence.
Definition fpa.hpp:288
@ WAIT_IMU_MEAS
Awaiting IMU measurements.
Definition fpa.hpp:291
@ WAIT_GLOBAL_MEAS
Insufficient global measurements.
Definition fpa.hpp:292
@ WAIT_MOTION
Insufficient motion.
Definition fpa.hpp:293
const char * FpaImuStatusLegacyStr(const FpaImuStatusLegacy status)
Stringify legacy IMU bias status.
const char * FpaGnssStatusStr(const FpaGnssStatus status)
Stringify GNSS fix status.
FpaWsStatusLegacy
FP_A legacy wheelspeed status.
Definition fpa.hpp:433
@ ONE_OR_MORE_CONVERGED
At least one converged.
Definition fpa.hpp:437
const char * FpaTimebaseStr(const FpaTimebase base)
Stringify time base.
const char * FpaInitStatusStr(const FpaInitStatus status)
Stringify initialisation status.
static constexpr std::size_t MAX_FP_A_SIZE
Maximum FP_A message size (must be the same as MAX_NMEA_SIZE)
Definition types.hpp:174
constexpr std::underlying_type< T >::type EnumToVal(T enum_val)
Convert enum class constant to the underlying integral type value.
Definition types.hpp:47
Fixposition SDK: Common library.
Definition doc.hpp:21
Fixposition SDK.
Fixposition SDK: Parser.
FP_A-CORRIMU (version 1) message payload.
Definition fpa.hpp:878
bool SetFromMsg(const uint8_t *msg, const std::size_t msg_size) final
Set data from message.
static constexpr const char * MSG_NAME
Message name.
Definition fpa.hpp:881
FP_A-EOE (version 1) message payload.
Definition fpa.hpp:796
static constexpr const char * MSG_NAME
Message name.
Definition fpa.hpp:802
bool SetFromMsg(const uint8_t *msg, const std::size_t msg_size) final
Set data from message.
FpaEpoch epoch
Indicates which epoch ended ("FUSION", "GNSS", "GNSS1", "GNSS2")
Definition fpa.hpp:798
FP_A three float values.
Definition fpa.hpp:696
std::array< double, 3 > values
Values.
Definition fpa.hpp:698
FP_A four float values.
Definition fpa.hpp:705
std::array< double, 4 > values
Values.
Definition fpa.hpp:707
FP_A six float values.
Definition fpa.hpp:714
std::array< double, 6 > values
Values.
Definition fpa.hpp:716
FP_A-GNSSANT (version 1) message payload.
Definition fpa.hpp:809
FpaAntPower gnss1_power
GNSS1 antenna power.
Definition fpa.hpp:812
static constexpr const char * MSG_NAME
Message name.
Definition fpa.hpp:821
FpaAntPower gnss2_power
GNSS2 antenna power.
Definition fpa.hpp:815
FpaAntState gnss2_state
GNSS2 antenna state.
Definition fpa.hpp:814
FpaInt gnss1_age
Time since gnss1_state or gnss1_power information last changed, 0-604800.
Definition fpa.hpp:813
FpaAntState gnss1_state
GNSS1 antenna state.
Definition fpa.hpp:811
FpaInt gnss2_age
Time since gnss2_state or gnss2_power information last changed, 0-604800.
Definition fpa.hpp:816
bool SetFromMsg(const uint8_t *msg, const std::size_t msg_size) final
Set data from message.
FP_A-GNSSCORR (version 1) message payload.
Definition fpa.hpp:828
FpaGnssFix gnss1_fix
Fix status of GNSS1.
Definition fpa.hpp:830
static constexpr const char * MSG_NAME
Message name.
Definition fpa.hpp:847
FpaInt gnss2_nsig_l1
Number of L1 signals with correction data tracked by GNSS2 receiver, range 0-100.
Definition fpa.hpp:834
FpaFloat corr_latency
Average correction data latency (10s window), range 0.0-99.9.
Definition fpa.hpp:836
FpaInt gnss1_nsig_l1
Number of L1 signals with correction data tracked by GNSS1 receiver, range 0-100.
Definition fpa.hpp:831
FpaInt sta_dist
Correction station baseline length (approximate 3d distance), range 0-100000.
Definition fpa.hpp:842
FpaInt gnss2_nsig_l2
Number of L2 signals with correction data tracked by GNSS2 receiver, range 0-100.
Definition fpa.hpp:835
FpaInt gnss1_nsig_l2
Number of L2 signals with correction data tracked by GNSS1 receiver, range 0-100.
Definition fpa.hpp:832
bool SetFromMsg(const uint8_t *msg, const std::size_t msg_size) final
Set data from message.
FpaInt sta_id
Correction station ID, range 0–4095.
Definition fpa.hpp:840
FpaFloat corr_msg_rate
Average correction message rate (10s window), range 0-50.
Definition fpa.hpp:839
FpaFloat3 sta_llh
Correction station latitude/longitude/height [deg, deg, m].
Definition fpa.hpp:841
FpaFloat corr_update_rate
Average correction update rate (10s window), range 0.0-0.0.
Definition fpa.hpp:837
FpaGnssFix gnss2_fix
Fix status of GNSS2 receiver.
Definition fpa.hpp:833
FpaFloat corr_data_rate
Average correction data rate (10s window), range 0.0-50.0.
Definition fpa.hpp:838
FpaInt week
GPS week number, range 0-9999, or null if time not (yet) available.
Definition fpa.hpp:724
bool operator!=(const FpaGpsTime &rhs) const
Not equal (epsilon = 1e-6)
bool operator>=(const FpaGpsTime &rhs) const
Greater or equal than.
bool operator==(const FpaGpsTime &rhs) const
Equal (epsilon = 1e-6)
bool operator<=(const FpaGpsTime &rhs) const
Less or equal than.
bool operator<(const FpaGpsTime &rhs) const
Less than.
bool operator>(const FpaGpsTime &rhs) const
Greater than.
FpaFloat tow
GPS time of week, range 0.000-604799.999999, or null if time not (yet) available.
Definition fpa.hpp:725
FP_A-...IMU (versions 1 and 2) messages payload.
Definition fpa.hpp:854
FpaImuStatus imu_status
IMU bias status (only available for version 2 messages)
Definition fpa.hpp:860
bool bias_comp
Signal is bias compensated (true) or not (false), always false for RAWIMU, may be true for CORRIMU.
Definition fpa.hpp:859
FpaFloat3 acc
Raw acceleration in output frame, X/Y/Z components.
Definition fpa.hpp:857
FpaFloat3 rot
Raw angular velocity in output frame, X/Y/Z components.
Definition fpa.hpp:858
FP_A-IMUBIAS (version 1) message payload.
Definition fpa.hpp:888
FpaImuStatus imu_status
IMU bias status.
Definition fpa.hpp:891
FpaMeasStatus fusion_imu
Fusion measurement status: IMU.
Definition fpa.hpp:890
FpaFloat3 bias_cov_acc
Accelerometer bias covariance, X/Y/Z components.
Definition fpa.hpp:896
FpaFloat3 bias_cov_gyr
Gyroscope bias covariance, X/Y/Z components.
Definition fpa.hpp:897
FpaFloat3 bias_gyr
Gyroscope bias, X/Y/Z components.
Definition fpa.hpp:895
FpaImuConv imu_conv
IMU convergence status.
Definition fpa.hpp:893
FpaImuNoise imu_noise
IMU variance status.
Definition fpa.hpp:892
bool SetFromMsg(const uint8_t *msg, const std::size_t msg_size) final
Set data from message.
FpaFloat3 bias_acc
Accelerometer bias, X/Y/Z components.
Definition fpa.hpp:894
static constexpr const char * MSG_NAME
Message name.
Definition fpa.hpp:902
FP_A integer value.
Definition fpa.hpp:678
bool valid
Data is valid.
Definition fpa.hpp:679
FP_A-LLH (version 1) message payload.
Definition fpa.hpp:909
FpaFloat3 llh
Latitude/longitude/height [deg, deg, m].
Definition fpa.hpp:911
bool SetFromMsg(const uint8_t *msg, const std::size_t msg_size) final
Set data from message.
static constexpr const char * MSG_NAME
Message name.
Definition fpa.hpp:917
FpaFloat6 cov_enu
Position covariance in ENU, EE/NN/UU/EN/NU/EU components [m^2].
Definition fpa.hpp:912
char msg_type_[40]
Message type (for example, "ODOMETRY"), nul-terminated string.
Definition fpa.hpp:107
int msg_version_
Message version (for example, 1), < 0 if unknown.
Definition fpa.hpp:108
int payload_ix1_
Index (offset) for end of payload, 0 if no payload available.
Definition fpa.hpp:110
int payload_ix0_
Index (offset) for start of payload, 0 if no payload available.
Definition fpa.hpp:109
FP_A-ODOM... (version 1) messages payload.
Definition fpa.hpp:924
FpaFusionStatusLegacy fusion_status
Fustion status.
Definition fpa.hpp:932
FpaWsStatusLegacy wheelspeed_status
Wheelspeed status.
Definition fpa.hpp:936
virtual bool SetFromMsg(const uint8_t *msg, const std::size_t msg_size)=0
Set data from message.
FpaGnssFix gnss2_fix
Fix status of GNSS2 receiver.
Definition fpa.hpp:935
FpaFloat6 vel_cov
Velocity covariance, XX/YY/ZZ/XY/YZ/XZ components.
Definition fpa.hpp:939
FpaGnssFix gnss1_fix
Fix status of GNSS1 receiver.
Definition fpa.hpp:934
FpaFloat3 vel
Velocity, X/Y/Z components.
Definition fpa.hpp:929
FpaImuStatusLegacy imu_bias_status
IMU bias status.
Definition fpa.hpp:933
FpaFloat6 orientation_cov
Orientation covariance, XX/YY/ZZ/XY/YZ/XZ components.
Definition fpa.hpp:938
char version[100]
Software version string.
Definition fpa.hpp:940
FpaFloat3 acc
Bias corrected acceleration, X/Y/Z components.
Definition fpa.hpp:931
FpaFloat3 pos
Position, X/Y/Z components.
Definition fpa.hpp:927
FpaFloat6 pos_cov
Position covariance, XX/YY/ZZ/XY/YZ/XZ components.
Definition fpa.hpp:937
FpaFloat3 rot
Bias corrected angular velocity, X/Y/Z components.
Definition fpa.hpp:930
FpaFloat4 orientation
Quaternion, W/X/Y/Z components.
Definition fpa.hpp:928
FP_A-ODOMENU (version 1) messages payload (ENU0)
Definition fpa.hpp:960
bool SetFromMsg(const uint8_t *msg, const std::size_t msg_size) final
Set data from message.
static constexpr const char * MSG_NAME
Message name.
Definition fpa.hpp:963
FP_A-ODOMETRY (version 2) messages payload (ECEF)
Definition fpa.hpp:950
bool SetFromMsg(const uint8_t *msg, const std::size_t msg_size) final
Set data from message.
static constexpr const char * MSG_NAME
Message name.
Definition fpa.hpp:953
FP_A-ODOMSH (version 1) messages payload (ECEF)
Definition fpa.hpp:970
static constexpr const char * MSG_NAME
Message name.
Definition fpa.hpp:973
bool SetFromMsg(const uint8_t *msg, const std::size_t msg_size) final
Set data from message.
FP_A-ODOMSTATUS (version 1) messages payload.
Definition fpa.hpp:980
FpaWsStatus ws_status
Wheelspeed status.
Definition fpa.hpp:998
FpaMarkersConv markers_conv
Marker convergence status.
Definition fpa.hpp:1001
FpaImuConv imu_conv
IMU convergence status.
Definition fpa.hpp:992
FpaMarkersStatus markers_status
Marker status.
Definition fpa.hpp:1000
FpaGnssStatus gnss1_status
GNSS 1 status.
Definition fpa.hpp:993
FpaMeasStatus fusion_gnss1
Fusion measurement status: GNSS 1.
Definition fpa.hpp:984
FpaMeasStatus fusion_gnss2
Fusion measurement status: GNSS 2.
Definition fpa.hpp:985
static constexpr const char * MSG_NAME
Message name.
Definition fpa.hpp:1006
FpaImuNoise imu_noise
IMU variance status.
Definition fpa.hpp:991
FpaBaselineStatus baseline_status
Baseline status.
Definition fpa.hpp:995
FpaInitStatus init_status
Fusion init status.
Definition fpa.hpp:982
bool SetFromMsg(const uint8_t *msg, const std::size_t msg_size) final
Set data from message.
FpaMeasStatus fusion_imu
Fusion measurement status: IMU.
Definition fpa.hpp:983
FpaWsConv ws_conv
Wheelspeed convergence status.
Definition fpa.hpp:999
FpaMeasStatus fusion_cam1
Fusion measurement status: camera.
Definition fpa.hpp:987
FpaCamStatus cam1_status
Camera 1 status.
Definition fpa.hpp:997
FpaMeasStatus fusion_ws
Fusion measurement status: wheelspeed.
Definition fpa.hpp:988
FpaCorrStatus corr_status
GNSS correction status.
Definition fpa.hpp:996
FpaMeasStatus fusion_markers
Fusion measurement status: markers.
Definition fpa.hpp:989
FpaImuStatus imu_status
IMU bias status.
Definition fpa.hpp:990
FpaGnssStatus gnss2_status
GNSS 2 status.
Definition fpa.hpp:994
FpaMeasStatus fusion_corr
Fusion measurement status: GNSS corrections.
Definition fpa.hpp:986
FP_A payload base class.
Definition fpa.hpp:762
bool SetFromBuf(const std::vector< uint8_t > &buf)
Set data from message.
Definition fpa.hpp:786
bool valid_
Payload successfully decoded (true), or not (yet) decoded (false)
Definition fpa.hpp:763
virtual ~FpaPayload()=default
Virtual dtor for polymorphism.
virtual bool SetFromMsg(const uint8_t *msg, const std::size_t msg_size)=0
Set data from message.
FpaMessageType msg_type_
Message (payload) type.
Definition fpa.hpp:764
FP_A-RAWIMU (version 1) message payload.
Definition fpa.hpp:868
static constexpr const char * MSG_NAME
Message name.
Definition fpa.hpp:871
bool SetFromMsg(const uint8_t *msg, const std::size_t msg_size) final
Set data from message.
FP_A-TEXT (version 1) message payload.
Definition fpa.hpp:1013
char text[MAX_FP_A_SIZE]
Text (nul-terminated string)
Definition fpa.hpp:1015
bool SetFromMsg(const uint8_t *msg, const std::size_t msg_size) final
Set data from message.
static constexpr const char * MSG_NAME
Message name.
Definition fpa.hpp:1020
FP_A-TF (version 2) message payload.
Definition fpa.hpp:1027
static constexpr const char * MSG_NAME
Message name.
Definition fpa.hpp:1037
bool SetFromMsg(const uint8_t *msg, const std::size_t msg_size) final
Set data from message.
char frame_b[10]
Initial frame (nul-terminated string)
Definition fpa.hpp:1030
FpaFloat4 orientation
Rotation in quaternion, W/X/Y/Z components.
Definition fpa.hpp:1032
char frame_a[10]
Target frame (nul-terminated string)
Definition fpa.hpp:1029
FpaFloat3 translation
Translation, X/Y/Z components.
Definition fpa.hpp:1031
FP_A-TP (versions 1 and 2) message payload.
Definition fpa.hpp:1044
FpaInt tp_tow_sec
Timepulse time seconds of week, integer second part (0–604799)
Definition fpa.hpp:1049
FpaInt tp_week
Timepulse week number (only since version 2 of the message)
Definition fpa.hpp:1048
static constexpr const char * MSG_NAME
Message name.
Definition fpa.hpp:1056
bool SetFromMsg(const uint8_t *msg, const std::size_t msg_size) final
Set data from message.
FpaTimeref timeref
Time reference.
Definition fpa.hpp:1047
FpaFloat tp_tow_psec
Timepulse time seconds of week, sub-second part (0.000000000000–0.999999999999)
Definition fpa.hpp:1050
FpaInt gps_leaps
GPS leapseconds.
Definition fpa.hpp:1051
char tp_name[10]
Timepulse name (nul-terminated string)
Definition fpa.hpp:1045
FP_A-VERSION (version 1) message payload.
Definition fpa.hpp:1063
char sw_version[100]
Software version string.
Definition fpa.hpp:1064
char hw_ver[100]
Hardware version string.
Definition fpa.hpp:1066
static constexpr const char * MSG_NAME
Message name.
Definition fpa.hpp:1073
bool SetFromMsg(const uint8_t *msg, const std::size_t msg_size) final
Set data from message.
char product_model[100]
Product model.
Definition fpa.hpp:1068
Fixposition SDK: Common types and type helpers.