MRPT  1.9.9
cmtdef.h
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | http://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2018, Individual contributors, see AUTHORS file |
6  | See: http://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See details in http://www.mrpt.org/License |
8  +------------------------------------------------------------------------+ */
9 
10 #ifndef _CMTDEF_H_2006_05_01
11 #define _CMTDEF_H_2006_05_01
12 
13 #include <cstdint>
14 #include <mrpt/core/exceptions.h>
15 #include <time.h>
16 
17 #ifdef _WIN32
18 #else
19 #include <termios.h>
20 #include <string.h>
21 #ifndef B460800
22 #undef B230400
23 #define B230400 0010003
24 #define B460800 0010004
25 #define B921600 0010007
26 #endif
27 // required for gnu c++ compiler due to difference in attribute declarations
28 #define __cdecl // __attribute__((cdecl)) // JLBC @ MRPT: GCC warns about
29 // ignored attribute
30 #define __stdcall // __attribute__((stdcall)) // JLBC @ MRPT: GCC warns about
31 // ignored attribute
32 #endif
33 
34 #ifndef _XSENS_STD_H_2006_09_11
35 #include "xsens_std.h"
36 #endif
37 #if !defined(_XSENS_TIME_2006_09_12) && !defined(_CMT_DLL_IMPORT)
38 #include "xsens_time.h"
39 #endif
40 
41 #ifndef _CMT_FILE_DEF_H_2007_01_24
42 #include "cmtf.h"
43 #endif
44 
45 #ifdef _CMT_STATIC_LIB
46 // namespace xsens {
47 #endif
48 
49 //////////////////////////////////////////////////////////////////////////////////////////
50 // Field message indices
51 #define CMT_IND_PREAMBLE 0
52 #define CMT_IND_BID 1
53 #define CMT_IND_MID 2
54 #define CMT_IND_LEN 3
55 #define CMT_IND_DATA0 4
56 #define CMT_IND_LENEXTH 4
57 #define CMT_IND_LENEXTL 5
58 #define CMT_IND_DATAEXT0 6
59 
60 #define CMT_PREAMBLE 0xFA
61 #define CMT_BID_MASTER 0xFF
62 #define CMT_BID_MT 0x01
63 #define CMT_EXTLENCODE 0xFF
64 
65 #define CMT_LEN_MSGHEADER 4
66 #define CMT_LEN_MSGEXTHEADER 6
67 #define CMT_LEN_MSGHEADERCS 5
68 #define CMT_LEN_MSGEXTHEADERCS 7
69 #define CMT_LEN_CHECKSUM 1
70 #define CMT_LEN_UNSIGSHORT 2
71 #define CMT_LEN_UNSIGINT 4
72 #define CMT_LEN_FLOAT 4
73 
74 // Maximum message/data length
75 #define CMT_MAXDATALEN 8192
76 #define CMT_MAXSHORTDATALEN 254
77 #define CMT_MAXMSGLEN (CMT_MAXDATALEN + 7)
78 #define CMT_MAXSHORTMSGLEN (CMT_MAXSHORTDATALEN + 5)
79 #define CMT_MAXGARBAGE (CMT_MAXMSGLEN + 1)
80 
81 // DID Type (high nibble)
82 #define CMT_DID_TYPEH_MASK 0x00F00000
83 #define CMT_DID_TYPEH_MT 0x00000000
84 #define CMT_DID_TYPEH_XM 0x00100000
85 #define CMT_DID_TYPEH_MTI_MTX 0x00300000
86 #define CMT_DID_TYPEH_MTIG 0x00500000
87 
88 // All Message identifiers
89 // WakeUp state messages
90 #define CMT_MID_WAKEUP 0x3E
91 #define CMT_MID_WAKEUPACK 0x3F
92 
93 // Config state messages
94 #define CMT_MID_REQDID 0x00
95 #define CMT_MID_DEVICEID 0x01
96 #define CMT_LEN_DEVICEID 4
97 #define CMT_MID_INITBUS 0x02
98 #define CMT_MID_INITBUSRESULTS 0x03
99 #define CMT_LEN_INITBUSRESULTS 4
100 #define CMT_MID_REQPERIOD 0x04
101 #define CMT_MID_REQPERIODACK 0x05
102 #define CMT_LEN_PERIOD 2
103 #define CMT_MID_SETPERIOD 0x04
104 #define CMT_MID_SETPERIODACK 0x05
105 // XbusMaster
106 #define CMT_MID_SETBID 0x06
107 #define CMT_MID_SETBIDACK 0x07
108 #define CMT_MID_AUTOSTART 0x06
109 #define CMT_MID_AUTOSTARTACK 0x07
110 #define CMT_MID_BUSPWR 0x08
111 #define CMT_LEN_BUSPWR 2
112 #define CMT_MID_BUSPWRACK 0x09
113 // End XbusMaster
114 #define CMT_MID_REQDATALENGTH 0x0A
115 #define CMT_MID_DATALENGTH 0x0B
116 #define CMT_LEN_DATALENGTH 2
117 #define CMT_MID_REQCONFIGURATION 0x0C
118 #define CMT_MID_CONFIGURATION 0x0D
119 #define CMT_LEN_CONFIGURATION 118
120 #define CMT_MID_RESTOREFACTORYDEF 0x0E
121 #define CMT_MID_RESTOREFACTORYDEFACK 0x0F
122 
123 #define CMT_MID_GOTOMEASUREMENT 0x10
124 #define CMT_MID_GOTOMEASUREMENTACK 0x11
125 #define CMT_MID_REQFWREV 0x12
126 #define CMT_MID_FIRMWAREREV 0x13
127 #define CMT_LEN_FIRMWAREREV 3
128 // XbusMaster
129 #define CMT_MID_REQBTDISABLE 0x14
130 #define CMT_MID_REQBTDISABLEACK 0x15
131 #define CMT_LEN_BTDISABLE 1
132 #define CMT_MID_DISABLEBT 0x14
133 #define CMT_MID_DISABLEBTACK 0x15
134 #define CMT_MID_REQOPMODE 0x16
135 #define CMT_MID_REQOPMODEACK 0x17
136 #define CMT_LEN_OPMODE 1
137 #define CMT_MID_SETOPMODE 0x16
138 #define CMT_MID_SETOPMODEACK 0x17
139 // End XbusMaster
140 #define CMT_MID_REQBAUDRATE 0x18
141 #define CMT_MID_REQBAUDRATEACK 0x19
142 #define CMT_LEN_BAUDRATE 1
143 #define CMT_MID_SETBAUDRATE 0x18
144 #define CMT_MID_SETBAUDRATEACK 0x19
145 // XbusMaster
146 #define CMT_MID_REQSYNCMODE 0x1A
147 #define CMT_MID_REQSYNCMODEACK 0x1B
148 #define CMT_LEN_SYNCMODE 1
149 #define CMT_MID_SETSYNCMODE 0x1A
150 #define CMT_MID_SETSYNCMODEACK 0x1B
151 // End XbusMaster
152 #define CMT_MID_REQPRODUCTCODE 0x1C
153 #define CMT_MID_PRODUCTCODE 0x1D
154 #define CMT_LEN_PRODUCTCODE 20
155 
156 // XbusMaster
157 #define CMT_MID_XMPWROFF 0x44
158 #define CMT_LEN_XMPWROFF 0
159 // End XbusMaster
160 
161 #define CMT_MID_REQOUTPUTMODE 0xD0
162 #define CMT_MID_REQOUTPUTMODEACK 0xD1
163 #define CMT_LEN_OUTPUTMODE 2
164 #define CMT_MID_SETOUTPUTMODE 0xD0
165 #define CMT_MID_SETOUTPUTMODEACK 0xD1
166 
167 #define CMT_MID_REQOUTPUTSETTINGS 0xD2
168 #define CMT_MID_REQOUTPUTSETTINGSACK 0xD3
169 #define CMT_LEN_OUTPUTSETTINGS 4
170 #define CMT_MID_SETOUTPUTSETTINGS 0xD2
171 #define CMT_MID_SETOUTPUTSETTINGSACK 0xD3
172 
173 #define CMT_MID_REQOUTPUTSKIPFACTOR 0xD4
174 #define CMT_MID_REQOUTPUTSKIPFACTORACK 0xD5
175 #define CMT_LEN_OUTPUTSKIPFACTOR 2
176 #define CMT_MID_SETOUTPUTSKIPFACTOR 0xD4
177 #define CMT_MID_SETOUTPUTSKIPFACTORACK 0xD5
178 
179 #define CMT_MID_REQSYNCINSETTINGS 0xD6
180 #define CMT_MID_REQSYNCINSETTINGSACK 0xD7
181 #define CMT_LEN_SYNCINMODE 2
182 #define CMT_LEN_SYNCINSKIPFACTOR 2
183 #define CMT_LEN_SYNCINOFFSET 4
184 #define CMT_MID_SETSYNCINSETTINGS 0xD6
185 #define CMT_MID_SETSYNCINSETTINGSACK 0xD7
186 
187 #define CMT_MID_REQSYNCOUTSETTINGS 0xD8
188 #define CMT_MID_REQSYNCOUTSETTINGSACK 0xD9
189 #define CMT_LEN_SYNCOUTMODE 2
190 #define CMT_LEN_SYNCOUTSKIPFACTOR 2
191 #define CMT_LEN_SYNCOUTOFFSET 4
192 #define CMT_LEN_SYNCOUTPULSEWIDTH 4
193 #define CMT_MID_SETSYNCOUTSETTINGS 0xD8
194 #define CMT_MID_SETSYNCOUTSETTINGSACK 0xD9
195 
196 #define CMT_MID_REQERRORMODE 0xDA
197 #define CMT_MID_REQERRORMODEACK 0xDB
198 #define CMT_LEN_ERRORMODE 2
199 #define CMT_MID_SETERRORMODE 0xDA
200 #define CMT_MID_SETERRORMODEACK 0xDB
201 
202 #define CMT_MID_REQTRANSMITDELAY 0xDC
203 #define CMT_MID_REQTRANSMITDELAYACK 0xDD
204 #define CMT_LEN_TRANSMITDELAY 2
205 #define CMT_MID_SETTRANSMITDELAY 0xDC
206 #define CMT_MID_SETTRANSMITDELAYACK 0xDD
207 
208 // Xbus Master
209 #define CMT_MID_REQXMERRORMODE 0x82
210 #define CMT_MID_REQXMERRORMODEACK 0x83
211 #define CMT_LEN_XMERRORMODE 2
212 #define CMT_MID_SETXMERRORMODE 0x82
213 #define CMT_MID_SETXMERRORMODEACK 0x83
214 
215 #define CMT_MID_REQBUFFERSIZE 0x84
216 #define CMT_MID_REQBUFFERSIZEACK 0x85
217 #define CMT_LEN_BUFFERSIZE 2
218 #define CMT_MID_SETBUFFERSIZE 0x84
219 #define CMT_MID_SETBUFFERSIZEACK 0x85
220 // End Xbus Master
221 
222 #define CMT_MID_REQHEADING 0x82
223 #define CMT_MID_REQHEADINGACK 0x83
224 #define CMT_LEN_HEADING 4
225 #define CMT_MID_SETHEADING 0x82
226 #define CMT_MID_SETHEADINGACK 0x83
227 
228 #define CMT_MID_REQMAGNETICDECLINATION 0x6A
229 #define CMT_MID_REQMAGNETICDECLINATIONACK 0x6B
230 #define CMT_LEN_MAGNETICDECLINATION 4
231 #define CMT_MID_SETMAGNETICDECLINATION 0x6A
232 #define CMT_MID_SETMAGNETICDECLINATIONACK 0x6B
233 
234 #define CMT_MID_REQLOCATIONID 0x84
235 #define CMT_MID_REQLOCATIONIDACK 0x85
236 #define CMT_LEN_LOCATIONID 2
237 #define CMT_MID_SETLOCATIONID 0x84
238 #define CMT_MID_SETLOCATIONIDACK 0x85
239 
240 #define CMT_MID_REQEXTOUTPUTMODE 0x86
241 #define CMT_MID_REQEXTOUTPUTMODEACK 0x87
242 #define CMT_LEN_EXTOUTPUTMODE 2
243 #define CMT_MID_SETEXTOUTPUTMODE 0x86
244 #define CMT_MID_SETEXTOUTPUTMODEACK 0x87
245 
246 // XbusMaster
247 #define CMT_MID_REQBATLEVEL 0x88
248 #define CMT_MID_BATLEVEL 0x89
249 // End XbusMaster
250 
251 #define CMT_MID_REQINITTRACKMODE 0x88
252 #define CMT_MID_REQINITTRACKMODEACK 0x89
253 #define CMT_LEN_INITTRACKMODE 2
254 #define CMT_MID_SETINITTRACKMODE 0x88
255 #define CMT_MID_SETINITTRACKMODEACK 0x89
256 
257 // obsolete
258 //#define CMT_MID_STOREFILTERSTATE 0x8A
259 //#define CMT_LEN_STOREFILTERSTATE 0
260 //#define CMT_MID_STOREFILTERSTATEACK 0x8B
261 // new definition
262 #define CMT_MID_STOREXKFSTATE 0x8A
263 #define CMT_LEN_STOREXKFSTATE 0
264 #define CMT_MID_STOREXKFSTATEACK 0x8B
265 
266 #define CMT_MID_REQUTCTIME 0x60
267 #define CMT_MID_UTCTIME 0x61
268 #define CMT_LEN_UTCTIME 12
269 
270 #define CMT_LEN_SCENARIOLABEL 20
271 #define CMT_LEN_SCENARIOFULL (1 + 1 + CMT_LEN_SCENARIOLABEL)
272 #define CMT_MID_REQAVAILABLESCENARIOS 0x62
273 #define CMT_MID_AVAILABLESCENARIOS 0x63
274 #define CMT_LEN_AVAILABLESCENARIOS \
275  (CMT_MAX_SCENARIOS_IN_MT * CMT_LEN_SCENARIOFULL)
276 
277 #define CMT_MID_REQSCENARIO 0x64
278 #define CMT_MID_REQSCENARIOACK 0x65
279 #define CMT_LEN_REQSCENARIOACK 2
280 #define CMT_MID_SETSCENARIO 0x64
281 #define CMT_MID_SETSCENARIOACK 0x65
282 #define CMT_LEN_SETSCENARIO 1
283 
284 #define CMT_MID_REQGRAVITYMAGNITUDE 0x66
285 #define CMT_MID_REQGRAVITYMAGNITUDEACK 0x67
286 #define CMT_MID_SETGRAVITYMAGNITUDE 0x66
287 #define CMT_MID_SETGRAVITYMAGNITUDEACK 0x67
288 #define CMT_LEN_GRAVITYMAGNITUDE 4
289 
290 #define CMT_MID_REQGPSLEVERARM 0x68
291 #define CMT_MID_REQGPSLEVERARMACK 0x69
292 #define CMT_MID_SETGPSLEVERARM 0x68
293 #define CMT_MID_SETGPSLEVERARMACK 0x69
294 #define CMT_LEN_GPSLEVERARM 12
295 
296 // Measurement state
297 #define CMT_MID_GOTOCONFIG 0x30
298 #define CMT_MID_GOTOCONFIGACK 0x31
299 #define CMT_MID_BUSDATA 0x32
300 #define CMT_MID_MTDATA 0x32
301 
302 // Manual
303 #define CMT_MID_PREPAREDATA 0x32
304 #define CMT_MID_REQDATA 0x34
305 #define CMT_MID_REQDATAACK 0x35
306 
307 // MTData defines
308 // Length of data blocks in bytes
309 #define CMT_LEN_RAWDATA 20
310 #define CMT_LEN_CALIBDATA 36
311 #define CMT_LEN_CALIB_ACCDATA 12
312 #define CMT_LEN_CALIB_GYRDATA 12
313 #define CMT_LEN_CALIB_MAGDATA 12
314 #define CMT_LEN_ORIENT_QUATDATA 16
315 #define CMT_LEN_ORIENT_EULERDATA 12
316 #define CMT_LEN_ORIENT_MATRIXDATA 36
317 #define CMT_LEN_SAMPLECNT 2
318 #define CMT_LEN_TEMPDATA 4
319 
320 // Length of data blocks in floats
321 #define CMT_LEN_CALIBDATA_FLT 9
322 #define CMT_LEN_ORIENT_QUATDATA_FLT 4
323 #define CMT_LEN_ORIENT_EULERDATA_FLT 3
324 #define CMT_LEN_ORIENT_MATRIXDATA_FLT 9
325 
326 // Indices of fields in DATA field of MTData message in bytes
327 // use in combination with LEN_CALIB etc
328 // Un-calibrated raw data
329 #define CMT_IND_RAW_ACCX 0
330 #define CMT_IND_RAW_ACCY 2
331 #define CMT_IND_RAW_ACCZ 4
332 #define CMT_IND_RAW_GYRX 6
333 #define CMT_IND_RAW_GYRY 8
334 #define CMT_IND_RAW_GYRZ 10
335 #define CMT_IND_RAW_MAGX 12
336 #define CMT_IND_RAW_MAGY 14
337 #define CMT_IND_RAW_MAGZ 16
338 #define CMT_IND_RAW_TEMP 18
339 // Calibrated data
340 #define CMT_IND_CALIB_ACCX 0
341 #define CMT_IND_CALIB_ACCY 4
342 #define CMT_IND_CALIB_ACCZ 8
343 #define CMT_IND_CALIB_GYRX 12
344 #define CMT_IND_CALIB_GYRY 16
345 #define CMT_IND_CALIB_GYRZ 20
346 #define CMT_IND_CALIB_MAGX 24
347 #define CMT_IND_CALIB_MAGY 28
348 #define CMT_IND_CALIB_MAGZ 32
349 // Orientation data - quat
350 #define CMT_IND_ORIENT_Q0 0
351 #define CMT_IND_ORIENT_Q1 4
352 #define CMT_IND_ORIENT_Q2 8
353 #define CMT_IND_ORIENT_Q3 12
354 // Orientation data - euler
355 #define CMT_IND_ORIENT_ROLL 0
356 #define CMT_IND_ORIENT_PITCH 4
357 #define CMT_IND_ORIENT_YAW 8
358 // Orientation data - matrix
359 #define CMT_IND_ORIENT_A 0
360 #define CMT_IND_ORIENT_B 4
361 #define CMT_IND_ORIENT_C 8
362 #define CMT_IND_ORIENT_D 12
363 #define CMT_IND_ORIENT_E 16
364 #define CMT_IND_ORIENT_F 20
365 #define CMT_IND_ORIENT_G 24
366 #define CMT_IND_ORIENT_H 28
367 #define CMT_IND_ORIENT_I 32
368 // Orientation data - euler
369 #define CMT_IND_SAMPLECNTH 0
370 #define CMT_IND_SAMPLECNTL 1
371 
372 // Indices of fields in DATA field of MTData message
373 // Un-calibrated raw data
374 #define CMT_FLDNUM_RAW_ACCX 0
375 #define CMT_FLDNUM_RAW_ACCY 1
376 #define CMT_FLDNUM_RAW_ACCZ 2
377 #define CMT_FLDNUM_RAW_GYRX 3
378 #define CMT_FLDNUM_RAW_GYRY 4
379 #define CMT_FLDNUM_RAW_GYRZ 5
380 #define CMT_FLDNUM_RAW_MAGX 6
381 #define CMT_FLDNUM_RAW_MAGY 7
382 #define CMT_FLDNUM_RAW_MAGZ 8
383 #define CMT_FLDNUM_RAW_TEMP 9
384 // Calibrated data
385 #define CMT_FLDNUM_CALIB_ACCX 0
386 #define CMT_FLDNUM_CALIB_ACCY 1
387 #define CMT_FLDNUM_CALIB_ACCZ 2
388 #define CMT_FLDNUM_CALIB_GYRX 3
389 #define CMT_FLDNUM_CALIB_GYRY 4
390 #define CMT_FLDNUM_CALIB_GYRZ 5
391 #define CMT_FLDNUM_CALIB_MAGX 6
392 #define CMT_FLDNUM_CALIB_MAGY 7
393 #define CMT_FLDNUM_CALIB_MAGZ 8
394 // Orientation data - quat
395 #define CMT_FLDNUM_ORIENT_Q0 0
396 #define CMT_FLDNUM_ORIENT_Q1 1
397 #define CMT_FLDNUM_ORIENT_Q2 2
398 #define CMT_FLDNUM_ORIENT_Q3 3
399 // Orientation data - euler
400 #define CMT_FLDNUM_ORIENT_ROLL 0
401 #define CMT_FLDNUM_ORIENT_PITCH 1
402 #define CMT_FLDNUM_ORIENT_YAW 2
403 // Orientation data - matrix
404 #define CMT_FLDNUM_ORIENT_A 0
405 #define CMT_FLDNUM_ORIENT_B 1
406 #define CMT_FLDNUM_ORIENT_C 2
407 #define CMT_FLDNUM_ORIENT_D 3
408 #define CMT_FLDNUM_ORIENT_E 4
409 #define CMT_FLDNUM_ORIENT_F 5
410 #define CMT_FLDNUM_ORIENT_G 6
411 #define CMT_FLDNUM_ORIENT_H 7
412 #define CMT_FLDNUM_ORIENT_I 8
413 // Length
414 // Uncalibrated raw data
415 #define CMT_LEN_RAW_ACCX 2
416 #define CMT_LEN_RAW_ACCY 2
417 #define CMT_LEN_RAW_ACCZ 2
418 #define CMT_LEN_RAW_GYRX 2
419 #define CMT_LEN_RAW_GYRY 2
420 #define CMT_LEN_RAW_GYRZ 2
421 #define CMT_LEN_RAW_MAGX 2
422 #define CMT_LEN_RAW_MAGY 2
423 #define CMT_LEN_RAW_MAGZ 2
424 #define CMT_LEN_RAW_TEMP 2
425 // Calibrated data
426 #define CMT_LEN_CALIB_ACCX 4
427 #define CMT_LEN_CALIB_ACCY 4
428 #define CMT_LEN_CALIB_ACCZ 4
429 #define CMT_LEN_CALIB_GYRX 4
430 #define CMT_LEN_CALIB_GYRY 4
431 #define CMT_LEN_CALIB_GYRZ 4
432 #define CMT_LEN_CALIB_MAGX 4
433 #define CMT_LEN_CALIB_MAGY 4
434 #define CMT_LEN_CALIB_MAGZ 4
435 // Orientation data - quat
436 #define CMT_LEN_ORIENT_Q0 4
437 #define CMT_LEN_ORIENT_Q1 4
438 #define CMT_LEN_ORIENT_Q2 4
439 #define CMT_LEN_ORIENT_Q3 4
440 // Orientation data - euler
441 #define CMT_LEN_ORIENT_ROLL 4
442 #define CMT_LEN_ORIENT_PITCH 4
443 #define CMT_LEN_ORIENT_YAW 4
444 // Orientation data - matrix
445 #define CMT_LEN_ORIENT_A 4
446 #define CMT_LEN_ORIENT_B 4
447 #define CMT_LEN_ORIENT_C 4
448 #define CMT_LEN_ORIENT_D 4
449 #define CMT_LEN_ORIENT_E 4
450 #define CMT_LEN_ORIENT_F 4
451 #define CMT_LEN_ORIENT_G 4
452 #define CMT_LEN_ORIENT_H 4
453 #define CMT_LEN_ORIENT_I 4
454 
455 // Defines for getDataValue
456 #define CMT_VALUE_RAW_ACC 0
457 #define CMT_VALUE_RAW_GYR 1
458 #define CMT_VALUE_RAW_MAG 2
459 #define CMT_VALUE_RAW_TEMP 3
460 #define CMT_VALUE_CALIB_ACC 4
461 #define CMT_VALUE_CALIB_GYR 5
462 #define CMT_VALUE_CALIB_MAG 6
463 #define CMT_VALUE_ORIENT_QUAT 7
464 #define CMT_VALUE_ORIENT_EULER 8
465 #define CMT_VALUE_ORIENT_MATRIX 9
466 #define CMT_VALUE_SAMPLECNT 10
467 #define CMT_VALUE_TEMP 11
468 
469 #define CMT_INVALIDSETTINGVALUE 0xFFFFFFFF
470 
471 // Valid in all states
472 #define CMT_MID_RESET 0x40
473 #define CMT_MID_RESETACK 0x41
474 #define CMT_MID_ERROR 0x42
475 //#define CMT_LEN_ERROR 1
476 // XbusMaster
477 #define CMT_MID_XMPWROFF 0x44
478 // End XbusMaster
479 
480 #define CMT_MID_REQFILTERSETTINGS 0xA0
481 #define CMT_MID_REQFILTERSETTINGSACK 0xA1
482 #define CMT_LEN_FILTERSETTINGS 4
483 #define CMT_MID_SETFILTERSETTINGS 0xA0
484 #define CMT_MID_SETFILTERSETTINGSACK 0xA1
485 #define CMT_MID_REQAMD 0xA2
486 #define CMT_MID_REQAMDACK 0xA3
487 #define CMT_LEN_AMD 2
488 #define CMT_MID_SETAMD 0xA2
489 #define CMT_MID_SETAMDACK 0xA3
490 #define CMT_MID_RESETORIENTATION 0xA4
491 #define CMT_MID_RESETORIENTATIONACK 0xA5
492 #define CMT_LEN_RESETORIENTATION 2
493 
494 #define CMT_MID_REQGPSSTATUS 0xA6
495 #define CMT_MID_GPSSTATUS 0xA7
496 #define CMT_LEN_GPSSTATUS (1 + 5 * 16)
497 
498 // Baudrate defines for SetBaudrate message
499 #define CMT_BAUDCODE_9K6 0x09
500 // #define CMT_BAUDCODE_14K4 0x08
501 #define CMT_BAUDCODE_19K2 0x07
502 // #define CMT_BAUDCODE_28K8 0x06
503 #define CMT_BAUDCODE_38K4 0x05
504 #define CMT_BAUDCODE_57K6 0x04
505 // #define CMT_BAUDCODE_76K8 0x03
506 #define CMT_BAUDCODE_115K2 0x02
507 #define CMT_BAUDCODE_230K4 0x01
508 #define CMT_BAUDCODE_460K8 0x00
509 #define CMT_BAUDCODE_921K6 0x80
510 
511 // Xbus protocol error codes (Error)
512 #define CMT_ERROR_NOBUSCOMM 0x01
513 #define CMT_ERROR_BUSNOTREADY 0x02
514 #define CMT_ERROR_PERIODINVALID 0x03
515 #define CMT_ERROR_MESSAGEINVALID 0x04
516 #define CMT_ERROR_INITOFBUSFAILED1 0x10
517 #define CMT_ERROR_INITOFBUSFAILED2 0x11
518 #define CMT_ERROR_INITOFBUSFAILED3 0x12
519 #define CMT_ERROR_SETBIDPROCFAILED1 0x14
520 #define CMT_ERROR_SETBIDPROCFAILED2 0x15
521 #define CMT_ERROR_MEASUREMENTFAILED1 0x18
522 #define CMT_ERROR_MEASUREMENTFAILED2 0x19
523 #define CMT_ERROR_MEASUREMENTFAILED3 0x1A
524 #define CMT_ERROR_MEASUREMENTFAILED4 0x1B
525 #define CMT_ERROR_MEASUREMENTFAILED5 0x1C
526 #define CMT_ERROR_MEASUREMENTFAILED6 0x1D
527 #define CMT_ERROR_TIMEROVERFLOW 0x1E
528 #define CMT_ERROR_BAUDRATEINVALID 0x20
529 #define CMT_ERROR_PARAMETERINVALID 0x21
530 #define CMT_ERROR_MEASUREMENTFAILED7 0x23
531 
532 // Error modes (SetErrorMode)
533 #define CMT_ERRORMODE_IGNORE 0x0000
534 #define CMT_ERRORMODE_INCSAMPLECNT 0x0001
535 #define CMT_ERRORMODE_INCSAMPLECNT_SENDERROR 0x0002
536 #define CMT_ERRORMODE_SENDERROR_GOTOCONFIG 0x0003
537 
538 // Configuration message defines
539 #define CMT_CONF_MASTERDID 0
540 #define CMT_CONF_PERIOD 4
541 #define CMT_CONF_OUTPUTSKIPFACTOR 6
542 #define CMT_CONF_SYNCIN_MODE 8
543 #define CMT_CONF_SYNCIN_SKIPFACTOR 10
544 #define CMT_CONF_SYNCIN_OFFSET 12
545 #define CMT_CONF_DATE 16
546 #define CMT_CONF_TIME 24
547 #define CMT_CONF_NUMDEVICES 96
548 // Configuration sensor block properties
549 #define CMT_CONF_DID 98
550 #define CMT_CONF_DATALENGTH 102
551 #define CMT_CONF_OUTPUTMODE 104
552 #define CMT_CONF_OUTPUTSETTINGS 106
553 #define CMT_CONF_BLOCKLEN 20
554 // To calculate the offset in data field for output mode of sensor #2 use
555 // CONF_OUTPUTMODE + 1*CONF_BLOCKLEN
556 #define CMT_CONF_MASTERDIDLEN 4
557 #define CMT_CONF_PERIODLEN 2
558 #define CMT_CONF_OUTPUTSKIPFACTORLEN 2
559 #define CMT_CONF_SYNCIN_MODELEN 2
560 #define CMT_CONF_SYNCIN_SKIPFACTORLEN 2
561 #define CMT_CONF_SYNCIN_OFFSETLEN 4
562 #define CMT_CONF_DATELEN 8
563 #define CMT_CONF_TIMELEN 8
564 #define CMT_CONF_RESERVED_CLIENTLEN 32
565 #define CMT_CONF_RESERVED_HOSTLEN 32
566 #define CMT_CONF_NUMDEVICESLEN 2
567 // Configuration sensor block properties
568 #define CMT_CONF_DIDLEN 4
569 #define CMT_CONF_DATALENGTHLEN 2
570 #define CMT_CONF_OUTPUTMODELEN 2
571 #define CMT_CONF_OUTPUTSETTINGSLEN 4
572 
573 // Clock frequency for offset & pulse width
574 #define CMT_SYNC_CLOCKFREQMHZ 29.4912
575 #define CMT_SYNC_CLOCK_NS_TO_TICKS (CMT_SYNC_CLOCKFREQMHZ * 1.0e-3)
576 #define CMT_SYNC_CLOCK_TICKS_TO_NS (1.0e3 / CMT_SYNC_CLOCKFREQMHZ)
577 
578 // SyncIn params
579 #define CMT_PARAM_SYNCIN_MODE 0x00
580 #define CMT_PARAM_SYNCIN_SKIPFACTOR 0x01
581 #define CMT_PARAM_SYNCIN_OFFSET 0x02
582 
583 // SyncIn mode
584 #define CMT_SYNCIN_DISABLED 0x0000
585 #define CMT_SYNCIN_EDGE_RISING 0x0001
586 #define CMT_SYNCIN_EDGE_FALLING 0x0002
587 #define CMT_SYNCIN_EDGE_BOTH 0x0003
588 #define CMT_SYNCIN_EDGE_MASK 0x0003
589 #define CMT_SYNCIN_TYPE_DOSAMPLING 0x0000
590 #define CMT_SYNCIN_TYPE_SENDLASTDATA 0x0004
591 #define CMT_SYNCIN_TYPE_CLOCK 0x0010
592 #define CMT_SYNCIN_TYPE_MASK 0x001C
593 
594 // SyncOut params
595 #define CMT_PARAM_SYNCOUT_MODE 0x00
596 #define CMT_PARAM_SYNCOUT_SKIPFACTOR 0x01
597 #define CMT_PARAM_SYNCOUT_OFFSET 0x02
598 #define CMT_PARAM_SYNCOUT_PULSEWIDTH 0x03
599 
600 // SyncOut mode
601 #define CMT_SYNCOUT_DISABLED 0x0000
602 #define CMT_SYNCOUT_TYPE_TOGGLE 0x0001
603 #define CMT_SYNCOUT_TYPE_PULSE 0x0002
604 #define CMT_SYNCOUT_POL_NEG 0x0000
605 #define CMT_SYNCOUT_POL_POS 0x0010
606 #define CMT_SYNCOUT_TYPE_MASK 0x000F
607 #define CMT_SYNCOUT_POL_MASK 0x0010
608 
609 // OutputModes
610 #define CMT_OUTPUTMODE_MT9 0x8000
611 #define CMT_OUTPUTMODE_XM 0x0000
612 #define CMT_OUTPUTMODE_RAW 0x4000
613 #define CMT_OUTPUTMODE_RAWGPSPRINT 0x1000
614 #define CMT_OUTPUTMODE_TEMP 0x0001
615 #define CMT_OUTPUTMODE_CALIB 0x0002
616 #define CMT_OUTPUTMODE_ORIENT 0x0004
617 #define CMT_OUTPUTMODE_AUXILIARY 0x0008
618 #define CMT_OUTPUTMODE_POSITION 0x0010
619 #define CMT_OUTPUTMODE_VELOCITY 0x0020
620 #define CMT_OUTPUTMODE_STATUS 0x0800
621 
622 // CmtOutputSettings
623 #define CMT_OUTPUTSETTINGS_XM 0x00000001
624 #define CMT_OUTPUTSETTINGS_TIMESTAMP_NONE 0x00000000
625 #define CMT_OUTPUTSETTINGS_TIMESTAMP_SAMPLECNT 0x00000001
626 #define CMT_OUTPUTSETTINGS_ORIENTMODE_QUATERNION 0x00000000
627 #define CMT_OUTPUTSETTINGS_ORIENTMODE_EULER 0x00000004
628 #define CMT_OUTPUTSETTINGS_ORIENTMODE_MATRIX 0x00000008
629 #define CMT_OUTPUTSETTINGS_CALIBMODE_ACCGYRMAG 0x00000000
630 #define CMT_OUTPUTSETTINGS_CALIBMODE_ACC 0x00000060
631 #define CMT_OUTPUTSETTINGS_CALIBMODE_ACCGYR 0x00000040
632 #define CMT_OUTPUTSETTINGS_CALIBMODE_ACCMAG 0x00000020
633 #define CMT_OUTPUTSETTINGS_CALIBMODE_GYR 0x00000050
634 #define CMT_OUTPUTSETTINGS_CALIBMODE_GYRMAG 0x00000010
635 #define CMT_OUTPUTSETTINGS_CALIBMODE_MAG 0x00000030
636 #define CMT_OUTPUTSETTINGS_DATAFORMAT_FLOAT 0x00000000
637 #define CMT_OUTPUTSETTINGS_DATAFORMAT_F1220 0x00000100
638 #define CMT_OUTPUTSETTINGS_DATAFORMAT_FP1632 0x00000200
639 #define CMT_OUTPUTSETTINGS_DATAFORMAT_DOUBLE 0x00000300
640 #define CMT_OUTPUTSETTINGS_AUXILIARYMODE_AIN1 0x00000800
641 #define CMT_OUTPUTSETTINGS_AUXILIARYMODE_AIN2 0x00000400
642 #define CMT_OUTPUTSETTINGS_POSITIONMODE_LLA_WGS84 0x00000000
643 #define CMT_OUTPUTSETTINGS_VELOCITYMODE_NED 0x00000000
644 #define CMT_OUTPUTSETTINGS_UNCERTAINTY_ORIENT 0x00100000
645 #define CMT_OUTPUTSETTINGS_UNCERTAINTY_POS 0x00200000
646 #define CMT_OUTPUTSETTINGS_UNCERTAINTY_VEL 0x00400000
647 #define CMT_OUTPUTSETTINGS_TIMESTAMP_MASK 0x00000003
648 #define CMT_OUTPUTSETTINGS_ORIENTMODE_MASK 0x0000000C
649 #define CMT_OUTPUTSETTINGS_CALIBMODE_ACC_MASK 0x00000010
650 #define CMT_OUTPUTSETTINGS_CALIBMODE_GYR_MASK 0x00000020
651 #define CMT_OUTPUTSETTINGS_CALIBMODE_MAG_MASK 0x00000040
652 #define CMT_OUTPUTSETTINGS_CALIBMODE_MASK 0x00000070
653 #define CMT_OUTPUTSETTINGS_DATAFORMAT_MASK 0x00000300
654 #define CMT_OUTPUTSETTINGS_AUXILIARYMODE_AIN1_MASK 0x00000400
655 #define CMT_OUTPUTSETTINGS_AUXILIARYMODE_AIN2_MASK 0x00000800
656 #define CMT_OUTPUTSETTINGS_AUXILIARYMODE_MASK 0x00000C00
657 #define CMT_OUTPUTSETTINGS_POSITIONMODE_MASK 0x0001C000
658 #define CMT_OUTPUTSETTINGS_VELOCITYMODE_MASK 0x00060000
659 #define CMT_OUTPUTSETTINGS_UNCERTAINTY_MASK 0x00F00000
660 #define CMT_OUTPUTSETTINGS_COORDINATES_NED 0x80000000
661 
662 //#define CMT_OUTPUTMODE_XKF3_ACCG 0x100000000
663 
664 // Extended (analog) Output Modes
665 #define CMT_EXTOUTPUTMODE_DISABLED 0x0000
666 #define CMT_EXTOUTPUTMODE_EULER 0x0001
667 
668 // Factory Output Mode
669 #define CMT_FACTORYOUTPUTMODE_DISABLE 0x0000
670 #define CMT_FACTORYOUTPUTMODE_DEFAULT 0x0001
671 #define CMT_FACTORYOUTPUTMODE_CUSTOM 0x0002
672 
673 // Initial tracking mode (SetInitTrackMode)
674 #define CMT_INITTRACKMODE_DISABLED 0x0000
675 #define CMT_INITTRACKMODE_ENABLED 0x0001
676 
677 // Filter settings params
678 #define CMT_PARAM_FILTER_GAIN 0x00
679 #define CMT_PARAM_FILTER_RHO 0x01
680 #define CMT_DONOTSTORE 0x00
681 #define CMT_STORE 0x01
682 
683 // AMDSetting (SetAMD)
684 #define CMT_AMDSETTING_DISABLED 0x0000
685 #define CMT_AMDSETTING_ENABLED 0x0001
686 
687 // Send raw string mode
688 #define CMT_SENDRAWSTRING_INIT 0
689 #define CMT_SENDRAWSTRING_DEFAULT 1
690 #define CMT_SENDRAWSTRING_SEND 2
691 
692 // Timeouts
693 #define CMT_TO_DEFAULT 500
694 #define CMT_TO_INIT 250
695 #define CMT_TO_RETRY 50
696 
697 #define CMT_PERIOD_10HZ 11520 // invalid with gps pulse time correction
698 #define CMT_PERIOD_12HZ 9600
699 #define CMT_PERIOD_15HZ 7680 // invalid with gps pulse time correction
700 #define CMT_PERIOD_16HZ 7200
701 #define CMT_PERIOD_18HZ 6400 // invalid with gps pulse time correction
702 #define CMT_PERIOD_20HZ 5760
703 #define CMT_PERIOD_24HZ 4800
704 #define CMT_PERIOD_25HZ 4608 // invalid with gps pulse time correction
705 #define CMT_PERIOD_30HZ 3840
706 #define CMT_PERIOD_32HZ 3600
707 #define CMT_PERIOD_36HZ 3200
708 #define CMT_PERIOD_40HZ 2880
709 #define CMT_PERIOD_45HZ 2560 // invalid with gps pulse time correction
710 #define CMT_PERIOD_48HZ 2400
711 #define CMT_PERIOD_50HZ 2304 // invalid with gps pulse time correction
712 #define CMT_PERIOD_60HZ 1920
713 #define CMT_PERIOD_64HZ 1800
714 #define CMT_PERIOD_72HZ 1600
715 #define CMT_PERIOD_75HZ 1536 // invalid with gps pulse time correction
716 #define CMT_PERIOD_80HZ 1440
717 #define CMT_PERIOD_90HZ 1280 // invalid with gps pulse time correction
718 #define CMT_PERIOD_96HZ 1200
719 
720 #define CMT_PERIOD_100HZ 1152
721 #define CMT_PERIOD_120HZ 960
722 #define CMT_PERIOD_128HZ 900
723 #define CMT_PERIOD_144HZ 800
724 #define CMT_PERIOD_150HZ 768 // invalid with gps pulse time correction
725 #define CMT_PERIOD_160HZ 720
726 #define CMT_PERIOD_180HZ 640
727 #define CMT_PERIOD_192HZ 600
728 #define CMT_PERIOD_200HZ 576
729 #define CMT_PERIOD_225HZ 512 // invalid with gps pulse time correction
730 #define CMT_PERIOD_240HZ 480
731 #define CMT_PERIOD_256HZ 450
732 #define CMT_PERIOD_288HZ 400
733 #define CMT_PERIOD_300HZ 384
734 #define CMT_PERIOD_320HZ 360
735 #define CMT_PERIOD_360HZ 320
736 #define CMT_PERIOD_384HZ 300
737 #define CMT_PERIOD_400HZ 288
738 #define CMT_PERIOD_450HZ 256 // invalid with gps pulse time correction
739 #define CMT_PERIOD_480HZ 240
740 #define CMT_PERIOD_512HZ 225
741 
742 // openPort baudrates
743 #ifdef _WIN32
744 #define CMT_BAUD_RATE_9600 CBR_9600
745 // #define CMT_BAUD_RATE_14K4 CBR_14400
746 #define CMT_BAUD_RATE_19K2 CBR_19200
747 // #define CMT_BAUD_RATE_28K8 28800
748 #define CMT_BAUD_RATE_38K4 CBR_38400
749 #define CMT_BAUD_RATE_57K6 CBR_57600
750 #define CMT_BAUD_RATE_115K2 CBR_115200
751 #define CMT_BAUD_RATE_230K4 230400
752 #define CMT_BAUD_RATE_460K8 460800
753 #define CMT_BAUD_RATE_921K6 921600
754 #else
755 #define CMT_BAUD_RATE_9600 B9600
756 // #define CMT_BAUD_RATE_14K4 B14400
757 #define CMT_BAUD_RATE_19K2 B19200
758 // #define CMT_BAUD_RATE_28K8 B28800
759 #define CMT_BAUD_RATE_38K4 B38400
760 #define CMT_BAUD_RATE_57K6 B57600
761 #define CMT_BAUD_RATE_115K2 B115200
762 #define CMT_BAUD_RATE_230K4 B230400
763 #define CMT_BAUD_RATE_460K8 B460800
764 #define CMT_BAUD_RATE_921K6 B921600
765 #endif
766 
767 #define CMT_DEFAULT_OUTPUT_MODE CMT_OUTPUTMODE_ORIENT
768 #define CMT_DEFAULT_OUTPUT_SETTINGS \
769  (CMT_OUTPUTSETTINGS_ORIENTMODE_QUATERNION | \
770  CMT_OUTPUTSETTINGS_TIMESTAMP_SAMPLECNT)
771 
772 #define CMT_GOTO_CONFIG_TRIES 3 // 50
773 
774 #define CMT_MAX_DEVICES_PER_PORT 11
775 #define CMT_DEFAULT_SAMPLE_FREQUENCY 100
776 #define CMT_DEFAULT_PERIOD 1152
777 #define CMT_DEFAULT_SKIP 0
778 #define CMT_DEFAULT_FILTER_GAIN 1.0f
779 #define CMT_DEFAULT_FILTER_WEIGHTING 1.0f
780 #define CMT_SYNCOUT_DEFAULT_PULSE_WIDTH 1000000 // 1ms = 1M ns
781 
782 #define CMT_MAX_PORTS_PER_THREAD 20
783 #define CMT_MAX_FILES_PER_THREAD 20
784 #if CMT_MAX_PORTS_PER_THREAD >= CMT_MAX_FILES_PER_THREAD
785 #define CMT_MAX_DEVICES (CMT_MAX_PORTS_PER_THREAD * CMT_MAX_DEVICES_PER_PORT)
786 #else
787 #define CMT_MAX_DEVICES (CMT_MAX_FILES_PER_THREAD * CMT_MAX_DEVICES_PER_PORT)
788 #endif
789 #define CMT_MAX_PACKETS_PER_BUNDLE CMT_MAX_PORTS_PER_THREAD
790 #define CMT_BUNDLE_QUEUE_SIZE 256
791 #define CMT_MAX_ITEMS_IN_PACKET 10
792 
793 //! The default size of the serial read buffer in bytes
794 #define CMT_DEFAULT_READ_BUFFER_SIZE (CMT_MAXDATALEN * 8)
795 //! The default size of the serial write buffer in bytes
796 #define CMT_DEFAULT_WRITE_BUFFER_SIZE CMT_MAXDATALEN
797 //! The default baud rate of the Cmt1s serial communication
798 #define CMT_DEFAULT_BAUD_RATE CMT_BAUD_RATE_115K2
799 //! The size of the L2 data-message fifo-queue
800 #define CMT2_DATA_QUEUE_SIZE 60
801 
802 //! The timeout value for "goto config"-message acknowledgement
803 #define CMT3_CONFIG_TIMEOUT 100
804 //! The default timeout value for blocking CMT1s operations in ms
805 #define CMT1_DEFAULT_TIMEOUT 10
806 //! Timeout in ms for level 2
807 #define CMT2_DEFAULT_TIMEOUT 50
808 //! The default timeout value for L3 data reading
809 #define CMT3_DEFAULT_TIMEOUT_MEAS 16
810 //! The default timeout value for L3 configuration settings
811 #define CMT3_DEFAULT_TIMEOUT_CONF 3000
812 //! The default timeout value for L4 data reading at L2 and 3
813 #define CMT4_DEFAULT_TIMEOUT_MEAS 1
814 //! The default timeout value for L4 configuration settings
815 #define CMT4_DEFAULT_TIMEOUT_CONF CMT3_DEFAULT_TIMEOUT_CONF
816 //! The timeout to use for requests during measurement mode
817 #define CMT4_MEASUREMENT_REQ_TIMEOUT 100
818 //! The standard timeout to use for data receipt in measurement mode
819 #define CMT4_DEFAULT_TIMEOUT_DATA 3000
820 
822 {
823  CMT_CONTROL_DCD = 0x0001, // pin 1: Carrier Detect
824  CMT_CONTROL_RD = 0x0002, // pin 2: Received Data
825  CMT_CONTROL_TD = 0x0004, // pin 3: Transmitted Data
826  CMT_CONTROL_DTR = 0x0008, // pin 4: Data Terminal Ready
827  CMT_CONTROL_GND = 0x0010, // pin 5: Common Ground
828  CMT_CONTROL_DSR = 0x0020, // pin 6: Data Set Ready
829  CMT_CONTROL_RTS = 0x0040, // pin 7: Request To Send
830  CMT_CONTROL_CTS = 0x0080, // pin 8: Clear To Send
831  CMT_CONTROL_RI = 0x0100 // pin 9: Ring Indicator
832 };
833 
834 // Reset orientation message type
836 {
842 };
843 
845 {
851 };
852 
853 //! The type of a Device Id
855 
856 /* different alignment commands for gcc / MSVS, the structure needs to be 2-byte
857  aligned
858  because the deviceId field is 4 bytes long on offset 98.
859 */
860 #ifdef _MSC_VER
861 #pragma pack(push, 2)
862 #endif
863 //! Structure containing a full device configuration as returned by the
864 //! ReqConfig message.
866 {
878  struct _devInfo
879  {
886 
887 #ifndef _CMT_DLL_IMPORT
888  void readFromMessage(const void* message);
889 #endif
890 }
891 // different alignment commands for gcc / MSVS
892 #ifdef _MSC_VER
893 ;
894 #pragma pack(pop)
895 #else
896 /*! \cond NODOXYGEN */ __attribute__((__packed__)) /*! \endcond */;
897 #endif
898 
899 //////////////////////////////////////////////////////////////////////////////////////////
900 
901 //! An output mode bit-field
903 //! An output settings bit-field
905 
906 //! A structure for storing data formats
908 {
911 
912 #ifndef _CMT_DLL_IMPORT
913  //! default constructor, initializes to the given (default) MT settings
917  : m_outputMode(mode), m_outputSettings(settings)
918  {
919  }
920 #endif
921 };
922 
923 //! An MT timestamp (sample count)
925 
926 #define CMT_MAX_FILENAME_LENGTH 512
927 
928 #define CMT_DID_BROADCAST 0x80000000
929 #define CMT_DID_MASTER 0
930 
931 #ifdef _CMT_ADD_PRIVATE
932 #include "cmtprivate.h"
933 #endif
934 
935 //! A structure for storing the firmware version
937 {
941 };
942 
943 //! A structure for storing sync in settings
945 {
948  /** Offset in ns */
950 
951 #ifndef _CMT_DLL_IMPORT
952  //! default constructor, initializes to the given (default) MT settings
954  const uint16_t mode = 0, const uint16_t skip = 0,
955  const uint32_t offset = 0)
957  {
958  }
959 #endif
960 };
961 
962 //! A structure for storing sync out settings
964 {
967  /** Offset in ns */
969  /** Pulse width in ns */
971 
972 #ifndef _CMT_DLL_IMPORT
973  //! default constructor, initializes to the given (default) MT settings
975  const uint16_t mode = 0, const uint16_t skip = 0,
976  const uint32_t offset = 0,
978  : m_mode(mode),
979  m_skipFactor(skip),
980  m_offset(offset),
982  {
983  }
984 #endif
985 };
986 
987 //! A structure for storing UTC Time values
989 {
997  /** When set to 1, the time is valid, when set to 2, the time part is valid,
998  * but the date may not be valid. when set to 0, the time is invalid and
999  * should be ignored. */
1001 };
1002 
1003 //! A structure for storing device modes
1005 {
1009 
1010 #ifndef _CMT_DLL_IMPORT
1011  //! default constructor, initializes to the given (default) MT settings
1015  const uint16_t frequency = CMT_DEFAULT_SAMPLE_FREQUENCY)
1016  : m_outputMode(mode),
1017  m_outputSettings(settings),
1018  m_sampleFrequency(frequency)
1019  {
1020  }
1021 
1022  /*! \brief Compute the period and skip factor.
1023 
1024  This function computes the period and skipFactor fields from the stored
1025  m_sampleFrequency field. The maximum error in the frequency is
1026  approximately
1027  0.4%, which occurs at 510Hz (= actually 512 Hz). In general, the higher
1028  frequencies are harder to set up exactly.
1029  */
1030  void getPeriodAndSkipFactor(uint16_t& period, uint16_t& skip) const;
1031  /*! \brief Return the real sample frequency in Hz.
1032 
1033  This may be up to 2Hz different from the value that is set.
1034  */
1035  double getRealSampleFrequency(void) const;
1036  /*! \brief Compute the sample frequency from a period and skip factor.
1037 
1038  This function does the reverse of the getPeriodAndSkipFactor function,
1039  storing the
1040  value in the m_sampleFrequency field.
1041  */
1042  void setPeriodAndSkipFactor(uint16_t period, uint16_t skip);
1043 
1044  //! Check if all fields of the two structures are equal
1045  bool operator==(const CmtDeviceMode& dev) const;
1046 #endif
1047 };
1048 
1049 //! A structure for storing device modes using period and skip factor (new
1050 //! default)
1052 {
1057 
1058 #ifndef _CMT_DLL_IMPORT
1059  //! default constructor, initializes to the given (default) MT settings
1063  const uint16_t period = CMT_DEFAULT_PERIOD,
1064  const uint16_t skip = CMT_DEFAULT_SKIP)
1065  : m_outputMode(mode),
1066  m_outputSettings(settings),
1067  m_period(period),
1068  m_skip(skip)
1069  {
1070  }
1071 
1072  /*! \brief Return the real sample frequency in Hz.
1073 
1074  This may be up to 2Hz different from the value that is set.
1075  */
1076  double getRealSampleFrequency(void) const;
1077  /*! \brief Return the sample frequency in Hz.
1078 
1079  This may be up to 2Hz different from the value that is set.
1080  */
1081  uint16_t getSampleFrequency(void) const;
1082  /*! \brief Compute the period and skip factor from a sample frequency.
1083 
1084  This function does the reverse of the getPeriodAndSkipFactor function,
1085  storing the
1086  value in the m_period and m_skip field.
1087  */
1088  void setSampleFrequency(uint16_t freq);
1089 
1090  //! Check if all fields of the two structures are equal
1091  bool operator==(const CmtDeviceMode2& dev) const;
1092 #endif
1093 };
1094 
1095 #define CMT_MAX_SCENARIOS_IN_MT 5
1096 #define CMT_MAX_SCENARIOS 254
1097 
1098 //! A structure for storing scenario information
1100 {
1101  /** The type of the scenario. When set to 255 in an operation, the 'current'
1102  * scenario is used. */
1104  /** The version of the scenario. */
1106  /** The label of the scenario. */
1108  // bool m_inSensor; //!< When set to true, the
1109  // scenario
1110  // is
1111  // available
1112  // in the sensor
1113  /** The type of filter this scenario is intended for '3': XKF-3, '6': XKF-6.
1114  * \note The value is a character, so XKF-3 is '3', which is hex 0x33 */
1116 };
1117 
1118 #define CMT_MAX_OBJECTS 20
1119 
1121 {
1122  /** Callback function, called right before sending a GotoMeasurement message
1123  */
1125  /** Callback function, called right after successfully switching to
1126  Measurement mode */
1128  /** Callback function, called right before switching from Measurement mode
1129  to Config mode */
1131  /** Callback function, called when a full data bundle is available and has
1132  been processed by the CMT. The first void* parameter supplied to this
1133  function can be handed as the bundle parameter in cmtData... functions to
1134  manipulate the newly received bundle. */
1136  /** Callback function, called when bytes have been read from a port */
1138  /** Callback function, called when a full message has been received from a
1139  port */
1141  /** Callback function, called when a full message has been sent by a port */
1143 };
1144 
1146 {
1150 };
1151 
1153 {
1157 };
1158 
1159 //#ifdef _WIN32
1161  int32_t, CmtCallbackSelector, void*, void*);
1162 //#else
1163 // typedef __attribute__((cdecl)) XsensResultValue (*
1164 // CmtCallbackFunction)(int32_t, CmtCallbackSelector, void*, void*);
1165 //#endif
1166 
1167 //! \brief Structure for storing information about a serial port
1169 {
1170  /** The baudrate at which an Xsens device was detected */
1172  /** The device Id of the detected Xsens device */
1174  /** The port number */
1176  /** The port name */
1177  char m_portName[270];
1178 
1180 #ifdef __cplusplus
1181 #ifdef _WIN32
1182  //! greater than operator, used for sorting the list
1183  bool operator>(const CmtPortInfo& p) const { return m_portNr > p.m_portNr; }
1184  //! less than operator, used for sorting the list
1185  bool operator<(const CmtPortInfo& p) const { return m_portNr < p.m_portNr; }
1186  //! equality operator, used for finding items in a list
1187  bool operator==(const CmtPortInfo& p) const
1188  {
1189  return m_portNr == p.m_portNr;
1190  }
1191  //! equality operator, used for finding items in a list
1192  bool operator==(const uint8_t port) const { return m_portNr == port; }
1193 #else // Linux
1194  //! greater than operator, used for sorting the list
1195  bool operator>(const CmtPortInfo& p) const
1196  {
1197  return strcmp(m_portName, p.m_portName) > 0;
1198  }
1199  //! less than operator, used for sorting the list
1200  bool operator<(const CmtPortInfo& p) const
1201  {
1202  return strcmp(m_portName, p.m_portName) < 0;
1203  }
1204  //! equality operator, used for finding items in a list
1205  bool operator==(const CmtPortInfo& p) const
1206  {
1207  return strcmp(m_portName, p.m_portName) == 0;
1208  }
1209  //! equality operator, used for finding items in a list
1210  bool operator==(const uint8_t port) const
1211  {
1212  MRPT_UNUSED_PARAM(port);
1213  return false;
1214  }
1215 #endif // ifdef _WIN32/Linux
1216 #endif
1217 };
1218 
1220 {
1222 };
1224 {
1227 };
1229 {
1243 };
1245 {
1248 };
1250 {
1251  double m_data[3];
1252 };
1254 {
1256 };
1257 struct CmtQuat
1258 {
1259  double m_data[4];
1260 };
1261 struct CmtEuler
1262 {
1263  /** The roll (rotation around x-axis / back-front-line) */
1264  double m_roll;
1265  /** The pitch (rotation around y-axis / right-left-line) */
1266  double m_pitch;
1267  /** The yaw (rotation around z-axis / down-up-line) */
1268  double m_yaw;
1269 };
1271 {
1272  double m_data[3][3];
1273 };
1274 
1275 #define CMT_MAX_SVINFO 16
1277 {
1282 };
1284 {
1286 };
1287 
1289 
1290 #define CMT_AUTO_SAVE_FRAMES 5000
1291 #define CMT_FILE_LAST_FRAME 0xFFFFFFFF
1292 
1293 #define CMT_BID_BROADCAST (const uint8_t)0x00
1294 #define CMT_BID_INVALID (const uint8_t)0xFE
1295 #define CMT_MID_REQEMTS (const uint8_t)0x90
1296 #define CMT_MID_EMTSDATA (const uint8_t)0x91
1297 #define CMT_EMTS_SIZE 1056
1298 
1299 #endif
void readFromMessage(const void *message)
Definition: cmt3.cpp:65
A structure for storing the firmware version.
Definition: cmtdef.h:936
int32_t m_height
Definition: cmtdef.h:1235
char m_filterType
The type of filter this scenario is intended for &#39;3&#39;: XKF-3, &#39;6&#39;: XKF-6.
Definition: cmtdef.h:1115
uint16_t m_period
Definition: cmtdef.h:1055
uint32_t m_vacc
Definition: cmtdef.h:1240
CmtVector m_acc
Definition: cmtdef.h:1255
uint8_t m_type
The type of the scenario.
Definition: cmtdef.h:1103
uint64_t CmtTimeStamp
Definition: cmtdef.h:1288
CmtShortVector m_mag
Definition: cmtdef.h:1225
uint8_t m_day
Definition: cmtdef.h:993
unsigned __int16 uint16_t
Definition: rptypes.h:44
#define CMT_SYNCOUT_DEFAULT_PULSE_WIDTH
Definition: cmtdef.h:780
A structure for storing data formats.
Definition: cmtdef.h:907
uint8_t m_version
The version of the scenario.
Definition: cmtdef.h:1105
uint8_t m_valid
When set to 1, the time is valid, when set to 2, the time part is valid, but the date may not be vali...
Definition: cmtdef.h:1000
CmtVector m_gyr
Definition: cmtdef.h:1255
uint16_t m_skipFactor
Definition: cmtdef.h:966
Structure for storing information about a serial port.
Definition: cmtdef.h:1168
uint32_t m_deviceId
The device Id of the detected Xsens device.
Definition: cmtdef.h:1173
uint32_t m_offset
Offset in ns.
Definition: cmtdef.h:968
uint32_t m_sacc
Definition: cmtdef.h:1241
A structure for storing sync out settings.
Definition: cmtdef.h:963
Callback function, called right before switching from Measurement mode to Config mode.
Definition: cmtdef.h:1130
int32_t m_veln
Definition: cmtdef.h:1236
uint8_t m_minor
Definition: cmtdef.h:939
uint16_t m_syncinMode
Definition: cmtdef.h:870
uint8_t m_reservedForClient[32]
Definition: cmtdef.h:876
GLintptr offset
Definition: glext.h:3925
int32_t m_latitude
Definition: cmtdef.h:1233
#define CMT_MAXMSGLEN
Definition: cmtdef.h:77
CmtControlLine
Definition: cmtdef.h:821
double getRealSampleFrequency(void) const
Return the real sample frequency in Hz.
Definition: cmt3.cpp:151
A structure for storing UTC Time values.
Definition: cmtdef.h:988
double m_pitch
The pitch (rotation around y-axis / right-left-line)
Definition: cmtdef.h:1266
Callback function, called when a full message has been received from a port.
Definition: cmtdef.h:1140
uint8_t m_month
Definition: cmtdef.h:992
uint8_t m_signalQuality
Definition: cmtdef.h:1280
uint8_t m_hour
Definition: cmtdef.h:994
A structure for storing sync in settings.
Definition: cmtdef.h:944
uint32_t m_pulseWidth
Pulse width in ns.
Definition: cmtdef.h:970
uint32_t m_offset
Offset in ns.
Definition: cmtdef.h:949
uint8_t m_signalStrength
Definition: cmtdef.h:1281
void getPeriodAndSkipFactor(uint16_t &period, uint16_t &skip) const
Compute the period and skip factor.
Definition: cmt3.cpp:93
char m_portName[270]
The port name.
Definition: cmtdef.h:1177
GLenum GLsizei width
Definition: glext.h:3531
uint16_t m_year
Definition: cmtdef.h:991
CmtQueueMode
Definition: cmtdef.h:1145
uint16_t m_skipFactor
Definition: cmtdef.h:947
#define CMT_DEFAULT_SAMPLE_FREQUENCY
Definition: cmtdef.h:775
unsigned char uint8_t
Definition: rptypes.h:41
bool operator==(const CmtDeviceMode &dev) const
Check if all fields of the two structures are equal.
Definition: cmt3.cpp:142
int32_t m_vele
Definition: cmtdef.h:1237
Callback function, called when a full message has been sent by a port.
Definition: cmtdef.h:1142
Structure containing a full device configuration as returned by the ReqConfig message.
Definition: cmtdef.h:865
CmtXmSyncMode
Definition: cmtdef.h:844
CmtDeviceMode(const CmtOutputMode mode=CMT_DEFAULT_OUTPUT_MODE, const CmtOutputSettings settings=CMT_DEFAULT_OUTPUT_SETTINGS, const uint16_t frequency=CMT_DEFAULT_SAMPLE_FREQUENCY)
default constructor, initializes to the given (default) MT settings
Definition: cmtdef.h:1012
uint32_t m_syncinOffset
Definition: cmtdef.h:872
#define CMT_DEFAULT_PERIOD
Definition: cmtdef.h:776
CmtOutputMode m_outputMode
Definition: cmtdef.h:1006
CmtSyncInSettings(const uint16_t mode=0, const uint16_t skip=0, const uint32_t offset=0)
default constructor, initializes to the given (default) MT settings
Definition: cmtdef.h:953
uint16_t m_samplingPeriod
Definition: cmtdef.h:868
bool operator==(const CmtDeviceMode2 &dev) const
Check if all fields of the two structures are equal.
Definition: cmt3.cpp:201
uint16_t m_mode
Definition: cmtdef.h:965
struct CmtDeviceConfiguration::_devInfo m_deviceInfo[CMT_MAX_DEVICES_PER_PORT]
uint16_t m_numberOfDevices
Definition: cmtdef.h:877
XsensResultValue
Xsens return values.
Definition: xsens_std.h:31
CmtPortInfo()
Definition: cmtdef.h:1179
double m_data[4]
Definition: cmtdef.h:1259
XsensResultValue(__cdecl * CmtCallbackFunction)(int32_t, CmtCallbackSelector, void *, void *)
Definition: cmtdef.h:1160
double m_data[3][3]
Definition: cmtdef.h:1272
double m_roll
The roll (rotation around x-axis / back-front-line)
Definition: cmtdef.h:1264
uint16_t m_skip
Definition: cmtdef.h:1056
void setSampleFrequency(uint16_t freq)
Compute the period and skip factor from a sample frequency.
Definition: cmt3.cpp:170
uint32_t m_baudrate
The baudrate at which an Xsens device was detected.
Definition: cmtdef.h:1171
double getRealSampleFrequency(void) const
Return the real sample frequency in Hz.
Definition: cmt3.cpp:125
uint16_t m_temp
Definition: cmtdef.h:1226
#define CMT_LEN_SCENARIOLABEL
Definition: cmtdef.h:270
uint8_t m_time[8]
Definition: cmtdef.h:874
uint16_t m_data[3]
Definition: cmtdef.h:1221
int32_t m_veld
Definition: cmtdef.h:1238
CmtOutputSettings m_outputSettings
Definition: cmtdef.h:1007
double m_data[3]
Definition: cmtdef.h:1251
CmtSyncOutSettings(const uint16_t mode=0, const uint16_t skip=0, const uint32_t offset=0, const uint32_t width=CMT_SYNCOUT_DEFAULT_PULSE_WIDTH)
default constructor, initializes to the given (default) MT settings
Definition: cmtdef.h:974
bool operator==(const mrpt::img::TCamera &a, const mrpt::img::TCamera &b)
Definition: TCamera.cpp:201
uint8_t m_minute
Definition: cmtdef.h:995
char m_label[CMT_LEN_SCENARIOLABEL+1]
The label of the scenario.
Definition: cmtdef.h:1107
uint8_t m_portNr
The port number.
Definition: cmtdef.h:1175
A structure for storing device modes using period and skip factor (new default)
Definition: cmtdef.h:1051
GLint mode
Definition: glext.h:5669
__int32 int32_t
Definition: rptypes.h:46
uint16_t m_sampleFrequency
Definition: cmtdef.h:1008
unsigned __int64 uint64_t
Definition: rptypes.h:50
void setPeriodAndSkipFactor(uint16_t period, uint16_t skip)
Compute the sample frequency from a period and skip factor.
Definition: cmt3.cpp:134
CmtShortVector m_gyr
Definition: cmtdef.h:1225
Callback function, called right after successfully switching to Measurement mode. ...
Definition: cmtdef.h:1127
uint32_t m_itow
Definition: cmtdef.h:1232
uint8_t m_revision
Definition: cmtdef.h:940
#define CMT_DEFAULT_OUTPUT_SETTINGS
Definition: cmtdef.h:768
uint16_t m_data
Definition: cmtdef.h:1247
#define CMT_DEFAULT_SKIP
Definition: cmtdef.h:777
int32_t m_longitude
Definition: cmtdef.h:1234
uint32_t CmtOutputMode
An output mode bit-field.
Definition: cmtdef.h:902
CmtDeviceMode2(const CmtOutputMode mode=CMT_DEFAULT_OUTPUT_MODE, const CmtOutputSettings settings=CMT_DEFAULT_OUTPUT_SETTINGS, const uint16_t period=CMT_DEFAULT_PERIOD, const uint16_t skip=CMT_DEFAULT_SKIP)
default constructor, initializes to the given (default) MT settings
Definition: cmtdef.h:1060
uint8_t m_pressureAge
Definition: cmtdef.h:1231
CmtResetMethod
Definition: cmtdef.h:835
CmtVector m_mag
Definition: cmtdef.h:1255
uint8_t m_second
Definition: cmtdef.h:996
uint32_t m_nano
Definition: cmtdef.h:990
Callback function, called right before sending a GotoMeasurement message.
Definition: cmtdef.h:1124
uint16_t m_mode
Definition: cmtdef.h:946
CmtCallbackSelector
Definition: cmtdef.h:1120
CmtOutputMode m_outputMode
Definition: cmtdef.h:909
double m_yaw
The yaw (rotation around z-axis / down-up-line)
Definition: cmtdef.h:1268
uint8_t m_date[8]
Definition: cmtdef.h:873
CmtDataFormat(const CmtOutputMode mode=CMT_DEFAULT_OUTPUT_MODE, const CmtOutputSettings settings=CMT_DEFAULT_OUTPUT_SETTINGS)
default constructor, initializes to the given (default) MT settings
Definition: cmtdef.h:914
CmtOutputSettings m_outputSettings
Definition: cmtdef.h:1054
CmtOutputSettings m_outputSettings
Definition: cmtdef.h:910
Callback function, called when bytes have been read from a port.
Definition: cmtdef.h:1137
uint16_t getSampleFrequency(void) const
Return the sample frequency in Hz.
Definition: cmt3.cpp:161
A structure for storing device modes.
Definition: cmtdef.h:1004
uint32_t m_masterDeviceId
Definition: cmtdef.h:867
CmtOutputMode m_outputMode
Definition: cmtdef.h:1053
CmtGpsSatelliteInfo m_svInfo[CMT_MAX_SVINFO]
Definition: cmtdef.h:1285
#define __attribute__(x)
Definition: rptypes.h:74
bool operator<(const COccupancyGridMap2D::TPairLikelihoodIndex &e1, const COccupancyGridMap2D::TPairLikelihoodIndex &e2)
unsigned __int32 uint32_t
Definition: rptypes.h:47
#define CMT_DEFAULT_OUTPUT_MODE
Definition: cmtdef.h:767
#define CMT_MAX_DEVICES_PER_PORT
Definition: cmtdef.h:774
GLfloat GLfloat p
Definition: glext.h:6305
uint8_t m_navigationStatus
Definition: cmtdef.h:1279
uint32_t CmtDeviceId
The type of a Device Id.
Definition: cmtdef.h:854
uint8_t m_major
Definition: cmtdef.h:938
uint16_t CmtMtTimeStamp
An MT timestamp (sample count)
Definition: cmtdef.h:924
A structure for storing scenario information.
Definition: cmtdef.h:1099
uint8_t m_reservedForHost[32]
Definition: cmtdef.h:875
uint8_t m_data[CMT_MAXMSGLEN]
Definition: cmtdef.h:1155
Callback function, called when a full data bundle is available and has been processed by the CMT...
Definition: cmtdef.h:1135
uint16_t m_syncinSkipFactor
Definition: cmtdef.h:871
uint8_t m_portNr
Definition: cmtdef.h:1156
uint16_t m_pressure
Definition: cmtdef.h:1230
CmtShortVector m_acc
Definition: cmtdef.h:1225
uint64_t CmtOutputSettings
An output settings bit-field.
Definition: cmtdef.h:904
uint8_t m_gpsAge
Definition: cmtdef.h:1242
#define CMT_MAX_SVINFO
Definition: cmtdef.h:1275
int32_t m_size
Definition: cmtdef.h:1154
#define MRPT_UNUSED_PARAM(a)
Determines whether this is an X86 or AMD64 platform.
Definition: common.h:186
uint32_t m_hacc
Definition: cmtdef.h:1239
uint16_t m_outputSkipFactor
Definition: cmtdef.h:869



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: 7d5e6d718 Fri Aug 24 01:51:28 2018 +0200 at lun nov 2 08:35:50 CET 2020