63const uint8_t SAMPLE_DATA_1[] = {
65 "2650,0.00283,-0.00305,-0.02449,0.00108,0.00054,0.00057,-0.00009,-0.00002,0.00024,"
66 "fp_vrtk2-integ_6912e460-1703*3C\r\n"
68 "$FP,ODOMSTATUS,1,2348,574451.500000,2,2,1,1,1,1,,0,,,,,,0,1,3,8,8,3,5,5,,0,6,,,,,,,,,,,,*2D\r\n"
69 "$FP,EOE,1,2348,574451.500000,FUSION*6C\r\n"
71 "$FP,ODOMETRY,2,2348,574452.000000,4278387.7000,635620.5134,4672339.9355,-0.603913,0.313038,-0.179283,"
72 "0.710741,0.0003,-0.0009,0.0012,-0.00110,0.00128,0.00026,0.2101,0.1256,9.8099,4,0,8,8,-1,0.00073,"
73 "0.00294,0.00107,0.00141,-0.00170,-0.00083,0.02271,0.00042,0.02650,0.00283,-0.00305,-0.02448,0.00101,"
74 "0.00053,0.00056,-0.00008,-0.00002,0.00021,fp_vrtk2-integ_6912e460-1703*17\r\n"
75 "$FP,ODOMSTATUS,1,2348,574452.000000,2,2,1,1,1,1,,0,,,,,,0,1,3,8,8,3,5,5,,0,6,,,,,,,,,,,,*2B\r\n"
76 "$FP,EOE,1,2348,574452.000000,FUSION*6A\r\n"
78 "$FP,ODOMETRY,2,2348,574452.500000,4278387.6984,635620.5126,4672339.9366,0.313004,-0.179369,0.710598,"
79 "0.0002,-0.0008,0.0009,0.00060,-0.00117,0.00038,0.2129,0.1266,9.8185,4,0,8,8,-1,0.00073,0.00294,0.00107,"
80 "0.00141,-0.00169,-0.00083,0.02270,0.00042,0.02650,0.00283,-0.00305,-0.02448,0.00098,0.00053,0.00056,"
81 "-0.00008,-0.00002,0.00019,fp_vrtk2-integ_6912e460-1703*01\r\n"
82 "$FP,ODOMSTATUS,1,2348,574452.500000,2,2,1,1,1,1,,0,,,,,,0,1,3,8,8,3,5,5,,0,6,,,,,,,,,,,,*2E\r\n"
83 "$FP,EOE,1,2348,574452.500000,FUSION*6F\r\n"
85 "$FP,ODOM3TRY,2,2348,574453.000000,4278387.6988,6\xaa\x55\xaa\x55.604077,0.312982\xba\xad\xc0\xff\xee.71"
86 "0587,0.0010,-0.0005,0.0018,0.00368,-0.00044,0.00092,0.2163,0.1214,9.8162,4,0,8,8,-1,0.00073,0.00294,"
87 "0.00107,0.00141,-0.00170,-0.00083,0.02269,0.00042,0.02650,0.00283,-0.00305,-0.02448,0.00100,0.00053,"
88 "0.00056,-0.00008,-0.00002,0.00021,fp_vrtk2-integ_6912e460-1703*12\r\n"
90 "$FP,ODOMSTATUS,1,2348,574453.000000,2,2,1,1,1,1,,0,,,,,,0,1,3,8,8,3,5,5,,0,6,,,,,,,,,,,,*2A\r\n"
91 "$FP,EOE,1,2348,574453.000000,FUSION*6B\r\n"
93 "$FP,ODOMETRY,2,2348,579519.500000,4278387.7342,635620.5918,4672339.8925,-0.700505,0.286"
95const std::size_t SAMPLE_SIZE_1 =
sizeof(SAMPLE_DATA_1) - 1;
97const uint8_t SAMPLE_DATA_2[] = {
98 "891,-0.222201,0.614502,0.0002,0.0000,-0.0002,-0.00071,-0.00146,-0.00001,0.2974,0.0215,9.8060,4,0,8,8,-1,"
99 "0.00025,0.00493,0.00060,0.00099,-0.00161,-0.00033,0.02743,0.00044,0.03268,0.00316,-0.00342,-0.02989,"
100 "0.00094,0.00066,0.00049,-0.00023,-0.00003,0.00007,fp_vrtk2-integ_6912e460-1703*18\r\n"
101 "$FP,ODOMSTATUS,1,2348,579519.500000,2,2,1,1,1,1,,0,,,,,,0,1,3,8,8,3,5,5,,0,6,,,,,,,,,,,,*2D\r\n"
102 "$FP,EOE,1,2348,579519.500000,FUSION*6C\r\n"
103 "$FP,ODOMETRY,2,2348,579520.000000,,,,-0.700563,0.286828,-0.222129,0.614491,0.0013,-0.0012,0.0004,"
104 "-0.00513,-0.00055,-0.00092,0.2984,0.0225,9.8047,4,0,8,8,-1,0.00025,0.00493,0.00060,0.00099,-0.00161,"
105 "-0.00033,0.02743,0.00044,0.03268,0.00316,-0.00342,-0.02989,0.00094,0.00066,0.00048,-0.00024,-0.00003,"
106 "0.00007,fp_vrtk2-integ_6912e460-1703*35\r\n"
107 "$FP,ODOMSTATUS,1,2348,579520.00000"
109const std::size_t SAMPLE_SIZE_2 =
sizeof(SAMPLE_DATA_2) - 1;
112int main(
int ,
char** )
117 LoggingSetParams({ LoggingLevel::TRACE });
122 NOTICE(
"----- Parsing the data into messages -----");
137 INFO(
"Adding SAMPLE_DATA_1 (%" PRIuMAX
" bytes)", SAMPLE_SIZE_1);
138 if (!parser.
Add(SAMPLE_DATA_1, SAMPLE_SIZE_1)) {
139 WARNING(
"Parser overflow, SAMPLE_DATA_1 is too large!");
148 INFO(
"Message %-20s (size %" PRIuMAX
" bytes)", msg.
name_.c_str(), msg.
data_.size());
181 INFO(
"Adding SAMPLE_DATA_2 (%" PRIuMAX
" bytes)", SAMPLE_SIZE_2);
182 if (!parser.
Add(SAMPLE_DATA_2, SAMPLE_SIZE_2)) {
183 WARNING(
"Parser overflow, SAMPLE_DATA_2 is too large!");
186 INFO(
"Message %-20s (size %" PRIuMAX
" bytes)", msg.
name_.c_str(), msg.
data_.size());
207 INFO(
"Flushing parser");
208 while (parser.
Flush(msg)) {
209 INFO(
"Message %-20s (size %" PRIuMAX
" bytes)", msg.
name_.c_str(), msg.
data_.size());
225 NOTICE(
"----- Decoding the data in the messages -----");
231 INFO(
"Adding SAMPLE_DATA_1+SAMPLE_DATA_2 (%" PRIuMAX
" bytes)", SAMPLE_SIZE_1 + SAMPLE_SIZE_2);
233 if (!parser.
Add(SAMPLE_DATA_1, SAMPLE_SIZE_1) || !parser.
Add(SAMPLE_DATA_2, SAMPLE_SIZE_2)) {
234 WARNING(
"Parser overflow, SAMPLE_DATA_1+SAMPLE_DATA_2 is too large!");
240 if (msg.
name_ == FpaOdometryPayload::MSG_NAME) {
241 INFO(
"Message %-20s (size %" PRIuMAX
" bytes)", msg.
name_.c_str(), msg.
data_.size());
274 NOTICE(
"----- Using decoded data in the messages -----");
279 INFO(
"Adding SAMPLE_DATA_1+SAMPLE_DATA_2 (%" PRIuMAX
" bytes)", SAMPLE_SIZE_1 + SAMPLE_SIZE_2);
281 if (!parser.
Add(SAMPLE_DATA_1, SAMPLE_SIZE_1) || !parser.
Add(SAMPLE_DATA_2, SAMPLE_SIZE_2)) {
282 WARNING(
"Parser overflow, SAMPLE_DATA_1+SAMPLE_DATA_2 is too large!");
288 if (msg.
name_ != FpaOdometryPayload::MSG_NAME) {
297 INFO(
"Message %-20s (size %" PRIuMAX
" bytes)", msg.
name_.c_str(), msg.
data_.size());
310 if (time.
SetWnoTow({ payload.gps_time.week.value, payload.gps_time.tow.value, WnoTow::Sys::GPS })) {
317 INFO(
"GPS time not available");
325 INFO(
"Position not available");
Fixposition SDK: Utilities for apps.
Helper to print a strack trace on SIGSEGV and SIGABRT.
bool Flush(ParserMsg &msg)
Get remaining data from parser as OTHER message(s)
void Reset()
Reset parser.
bool Process(ParserMsg &msg)
Process data in parser, return message.
bool Add(const uint8_t *data, const std::size_t size)
Add data to parser.
std::string StrUtcTime(const int prec=3) const
Stringify as year, month, day, hour, minute and second time (UTC)
bool SetWnoTow(const WnoTow &wnotow)
Set time from GNSS (GPS, Galileo, BeiDou) time (atomic)
Fixposition SDK: Parser FP_A routines and types.
Fixposition SDK: Logging.
#define NOTICE(fmt,...)
Print a notice message.
#define DEBUG_HEXDUMP(data, size, prefix, fmt,...)
Print a debug hexdump.
#define INFO(fmt,...)
Print a info message.
#define WARNING(fmt,...)
Print a warning message.
Fixposition SDK: Math utilities.
constexpr T RadToDeg(T radians)
Convert radians to degrees.
Parser FP_A routines and types.
Transformation utilities.
Eigen::Vector3d TfWgs84LlhEcef(const Eigen::Vector3d &ecef)
Convert ECEF (x, y, z) coordinates to geodetic coordinates (latitude, longitude, height)
Message frame output by the Parser.
std::string name_
Name of the message.
std::vector< uint8_t > data_
Message data.
std::array< double, 3 > values
Values.
FpaInt week
GPS week number, range 0-9999, or null if time not (yet) available.
FpaFloat tow
GPS time of week, range 0.000-604799.999999, or null if time not (yet) available.
FpaFloat3 pos
Position, X/Y/Z components.
FP_A-ODOMETRY (version 2) messages payload (ECEF)
bool SetFromMsg(const uint8_t *msg, const std::size_t msg_size) final
Set data from message.
Fixposition SDK: Time utilities.
Fixposition SDK: Transformation utilities.