1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26#include <cinttypes>
27#include <cstdint>
28#include <cstdlib>
29
30
31
32
40
41
42
43
44
52
53
54
55
56
57
58
59
60
61
62
63const uint8_t SAMPLE_DATA_1[] = {
64
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"
67
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"
70
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"
77
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"
84
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"
89
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"
92
93 "$FP,ODOMETRY,2,2348,579519.500000,4278387.7342,635620.5918,4672339.8925,-0.700505,0.286"
94};
95const std::size_t SAMPLE_SIZE_1 = sizeof(SAMPLE_DATA_1) - 1;
96
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"
108};
109const std::size_t SAMPLE_SIZE_2 = sizeof(SAMPLE_DATA_2) - 1;
110
111
112int main(int , char** )
113{
114#ifndef NDEBUG
116#endif
118
119
120
121
122 NOTICE(
"----- Parsing the data into messages -----");
123
124
125
126
127
128
129
130
131
133
134
135
136 INFO(
"Adding SAMPLE_DATA_1 (%" PRIuMAX
" bytes)", SAMPLE_SIZE_1);
137 if (!
parser.Add(SAMPLE_DATA_1, SAMPLE_SIZE_1)) {
138 WARNING(
"Parser overflow, SAMPLE_DATA_1 is too large!");
139 }
140
141
142
143
144
146 while (
parser.Process(msg)) {
147 INFO(
"Message %-20s (size %" PRIuMAX
" bytes)", msg.
name_.c_str(), msg.
data_.size());
148
149 }
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180 INFO(
"Adding SAMPLE_DATA_2 (%" PRIuMAX
" bytes)", SAMPLE_SIZE_2);
181 if (!
parser.Add(SAMPLE_DATA_2, SAMPLE_SIZE_2)) {
182 WARNING(
"Parser overflow, SAMPLE_DATA_2 is too large!");
183 }
184 while (
parser.Process(msg)) {
185 INFO(
"Message %-20s (size %" PRIuMAX
" bytes)", msg.
name_.c_str(), msg.
data_.size());
186
187 }
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206 INFO(
"Flushing parser");
207 while (
parser.Flush(msg)) {
208 INFO(
"Message %-20s (size %" PRIuMAX
" bytes)", msg.
name_.c_str(), msg.
data_.size());
210 }
211
212
213
214
215
216
217
218
219
220
221
222
223
224 NOTICE(
"----- Decoding the data in the messages -----");
225
226
227
228
229
230 INFO(
"Adding SAMPLE_DATA_1+SAMPLE_DATA_2 (%" PRIuMAX
" bytes)", SAMPLE_SIZE_1 + SAMPLE_SIZE_2);
232 if (!
parser.Add(SAMPLE_DATA_1, SAMPLE_SIZE_1) || !
parser.Add(SAMPLE_DATA_2, SAMPLE_SIZE_2)) {
233 WARNING(
"Parser overflow, SAMPLE_DATA_1+SAMPLE_DATA_2 is too large!");
234 }
235
236
237 while (
parser.Process(msg)) {
238
240 INFO(
"Message %-20s (size %" PRIuMAX
" bytes)", msg.
name_.c_str(), msg.
data_.size());
241
245 }
246
247 else {
249 }
250 }
251 }
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273 NOTICE(
"----- Using decoded data in the messages -----");
274
275
276
277
278 INFO(
"Adding SAMPLE_DATA_1+SAMPLE_DATA_2 (%" PRIuMAX
" bytes)", SAMPLE_SIZE_1 + SAMPLE_SIZE_2);
280 if (!
parser.Add(SAMPLE_DATA_1, SAMPLE_SIZE_1) || !
parser.Add(SAMPLE_DATA_2, SAMPLE_SIZE_2)) {
281 WARNING(
"Parser overflow, SAMPLE_DATA_1+SAMPLE_DATA_2 is too large!");
282 }
283
284
285 while (
parser.Process(msg)) {
286
288 continue;
289 }
290
293 continue;
294 }
295
296 INFO(
"Message %-20s (size %" PRIuMAX
" bytes)", msg.
name_.c_str(), msg.
data_.size());
297
298
299
300
301
302
303
304
305
308
309 if (
time.SetWnoTow({ payload.gps_time.week.value, payload.gps_time.tow.value, WnoTow::Sys::GPS })) {
311 time.StrUtcTime().c_str());
312 } else {
314 }
315 } else {
316 INFO(
"GPS time not available");
317 }
318
319
323 } else {
324 INFO(
"Position not available");
325 }
326
327
328
329
330
331
335 }
336 }
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351 return EXIT_SUCCESS;
352}
353
354
Fixposition SDK: Utilities for apps.
Helper to print a strack trace on SIGSEGV and SIGABRT.
Fixposition SDK: Parser FP_A routines and types.
Fixposition SDK: Logging.
#define NOTICE(...)
Print a notice message.
#define WARNING(...)
Print a warning message.
#define DEBUG_HEXDUMP(data, size, prefix,...)
Print a debug hexdump.
#define INFO(...)
Print a info message.
Fixposition SDK: Math utilities.
LoggingParams LoggingSetParams(const LoggingParams ¶ms)
Configure logging.
@ TRACE
[7/debug] Extra debugging, only compiled-in in non-Release builds
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.
static constexpr const char * MSG_NAME
Message name.
Fixposition SDK: Time utilities.
Fixposition SDK: Transformation utilities.