Main MRPT website > C++ reference for MRPT 1.5.7
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-2017, 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 <mrpt/utils/mrpt_stdint.h>
14 #include <mrpt/utils/mrpt_macros.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 ignored attribute
29 # define __stdcall // __attribute__((stdcall)) // JLBC @ MRPT: GCC warns about ignored attribute
30 #endif
31 
32 #ifndef _XSENS_STD_H_2006_09_11
33 # include "xsens_std.h"
34 #endif
35 #if !defined(_XSENS_TIME_2006_09_12) && !defined(_CMT_DLL_IMPORT)
36 # include "xsens_time.h"
37 #endif
38 
39 #ifndef _CMT_FILE_DEF_H_2007_01_24
40 # include "cmtf.h"
41 #endif
42 
43 #ifdef _CMT_STATIC_LIB
44 //namespace xsens {
45 #endif
46 
47 //////////////////////////////////////////////////////////////////////////////////////////
48 // Field message indices
49 #define CMT_IND_PREAMBLE 0
50 #define CMT_IND_BID 1
51 #define CMT_IND_MID 2
52 #define CMT_IND_LEN 3
53 #define CMT_IND_DATA0 4
54 #define CMT_IND_LENEXTH 4
55 #define CMT_IND_LENEXTL 5
56 #define CMT_IND_DATAEXT0 6
57 
58 #define CMT_PREAMBLE 0xFA
59 #define CMT_BID_MASTER 0xFF
60 #define CMT_BID_MT 0x01
61 #define CMT_EXTLENCODE 0xFF
62 
63 #define CMT_LEN_MSGHEADER 4
64 #define CMT_LEN_MSGEXTHEADER 6
65 #define CMT_LEN_MSGHEADERCS 5
66 #define CMT_LEN_MSGEXTHEADERCS 7
67 #define CMT_LEN_CHECKSUM 1
68 #define CMT_LEN_UNSIGSHORT 2
69 #define CMT_LEN_UNSIGINT 4
70 #define CMT_LEN_FLOAT 4
71 
72 // Maximum message/data length
73 #define CMT_MAXDATALEN 8192
74 #define CMT_MAXSHORTDATALEN 254
75 #define CMT_MAXMSGLEN (CMT_MAXDATALEN+7)
76 #define CMT_MAXSHORTMSGLEN (CMT_MAXSHORTDATALEN+5)
77 #define CMT_MAXGARBAGE (CMT_MAXMSGLEN+1)
78 
79 
80 // DID Type (high nibble)
81 #define CMT_DID_TYPEH_MASK 0x00F00000
82 #define CMT_DID_TYPEH_MT 0x00000000
83 #define CMT_DID_TYPEH_XM 0x00100000
84 #define CMT_DID_TYPEH_MTI_MTX 0x00300000
85 #define CMT_DID_TYPEH_MTIG 0x00500000
86 
87 // All Message identifiers
88 // WakeUp state messages
89 #define CMT_MID_WAKEUP 0x3E
90 #define CMT_MID_WAKEUPACK 0x3F
91 
92 // Config state messages
93 #define CMT_MID_REQDID 0x00
94 #define CMT_MID_DEVICEID 0x01
95 #define CMT_LEN_DEVICEID 4
96 #define CMT_MID_INITBUS 0x02
97 #define CMT_MID_INITBUSRESULTS 0x03
98 #define CMT_LEN_INITBUSRESULTS 4
99 #define CMT_MID_REQPERIOD 0x04
100 #define CMT_MID_REQPERIODACK 0x05
101 #define CMT_LEN_PERIOD 2
102 #define CMT_MID_SETPERIOD 0x04
103 #define CMT_MID_SETPERIODACK 0x05
104 // XbusMaster
105 #define CMT_MID_SETBID 0x06
106 #define CMT_MID_SETBIDACK 0x07
107 #define CMT_MID_AUTOSTART 0x06
108 #define CMT_MID_AUTOSTARTACK 0x07
109 #define CMT_MID_BUSPWR 0x08
110 #define CMT_LEN_BUSPWR 2
111 #define CMT_MID_BUSPWRACK 0x09
112 // End XbusMaster
113 #define CMT_MID_REQDATALENGTH 0x0A
114 #define CMT_MID_DATALENGTH 0x0B
115 #define CMT_LEN_DATALENGTH 2
116 #define CMT_MID_REQCONFIGURATION 0x0C
117 #define CMT_MID_CONFIGURATION 0x0D
118 #define CMT_LEN_CONFIGURATION 118
119 #define CMT_MID_RESTOREFACTORYDEF 0x0E
120 #define CMT_MID_RESTOREFACTORYDEFACK 0x0F
121 
122 #define CMT_MID_GOTOMEASUREMENT 0x10
123 #define CMT_MID_GOTOMEASUREMENTACK 0x11
124 #define CMT_MID_REQFWREV 0x12
125 #define CMT_MID_FIRMWAREREV 0x13
126 #define CMT_LEN_FIRMWAREREV 3
127 // XbusMaster
128 #define CMT_MID_REQBTDISABLE 0x14
129 #define CMT_MID_REQBTDISABLEACK 0x15
130 #define CMT_LEN_BTDISABLE 1
131 #define CMT_MID_DISABLEBT 0x14
132 #define CMT_MID_DISABLEBTACK 0x15
133 #define CMT_MID_REQOPMODE 0x16
134 #define CMT_MID_REQOPMODEACK 0x17
135 #define CMT_LEN_OPMODE 1
136 #define CMT_MID_SETOPMODE 0x16
137 #define CMT_MID_SETOPMODEACK 0x17
138 // End XbusMaster
139 #define CMT_MID_REQBAUDRATE 0x18
140 #define CMT_MID_REQBAUDRATEACK 0x19
141 #define CMT_LEN_BAUDRATE 1
142 #define CMT_MID_SETBAUDRATE 0x18
143 #define CMT_MID_SETBAUDRATEACK 0x19
144 // XbusMaster
145 #define CMT_MID_REQSYNCMODE 0x1A
146 #define CMT_MID_REQSYNCMODEACK 0x1B
147 #define CMT_LEN_SYNCMODE 1
148 #define CMT_MID_SETSYNCMODE 0x1A
149 #define CMT_MID_SETSYNCMODEACK 0x1B
150 // End XbusMaster
151 #define CMT_MID_REQPRODUCTCODE 0x1C
152 #define CMT_MID_PRODUCTCODE 0x1D
153 #define CMT_LEN_PRODUCTCODE 20
154 
155 // XbusMaster
156 #define CMT_MID_XMPWROFF 0x44
157 #define CMT_LEN_XMPWROFF 0
158 // End XbusMaster
159 
160 #define CMT_MID_REQOUTPUTMODE 0xD0
161 #define CMT_MID_REQOUTPUTMODEACK 0xD1
162 #define CMT_LEN_OUTPUTMODE 2
163 #define CMT_MID_SETOUTPUTMODE 0xD0
164 #define CMT_MID_SETOUTPUTMODEACK 0xD1
165 
166 #define CMT_MID_REQOUTPUTSETTINGS 0xD2
167 #define CMT_MID_REQOUTPUTSETTINGSACK 0xD3
168 #define CMT_LEN_OUTPUTSETTINGS 4
169 #define CMT_MID_SETOUTPUTSETTINGS 0xD2
170 #define CMT_MID_SETOUTPUTSETTINGSACK 0xD3
171 
172 #define CMT_MID_REQOUTPUTSKIPFACTOR 0xD4
173 #define CMT_MID_REQOUTPUTSKIPFACTORACK 0xD5
174 #define CMT_LEN_OUTPUTSKIPFACTOR 2
175 #define CMT_MID_SETOUTPUTSKIPFACTOR 0xD4
176 #define CMT_MID_SETOUTPUTSKIPFACTORACK 0xD5
177 
178 #define CMT_MID_REQSYNCINSETTINGS 0xD6
179 #define CMT_MID_REQSYNCINSETTINGSACK 0xD7
180 #define CMT_LEN_SYNCINMODE 2
181 #define CMT_LEN_SYNCINSKIPFACTOR 2
182 #define CMT_LEN_SYNCINOFFSET 4
183 #define CMT_MID_SETSYNCINSETTINGS 0xD6
184 #define CMT_MID_SETSYNCINSETTINGSACK 0xD7
185 
186 #define CMT_MID_REQSYNCOUTSETTINGS 0xD8
187 #define CMT_MID_REQSYNCOUTSETTINGSACK 0xD9
188 #define CMT_LEN_SYNCOUTMODE 2
189 #define CMT_LEN_SYNCOUTSKIPFACTOR 2
190 #define CMT_LEN_SYNCOUTOFFSET 4
191 #define CMT_LEN_SYNCOUTPULSEWIDTH 4
192 #define CMT_MID_SETSYNCOUTSETTINGS 0xD8
193 #define CMT_MID_SETSYNCOUTSETTINGSACK 0xD9
194 
195 #define CMT_MID_REQERRORMODE 0xDA
196 #define CMT_MID_REQERRORMODEACK 0xDB
197 #define CMT_LEN_ERRORMODE 2
198 #define CMT_MID_SETERRORMODE 0xDA
199 #define CMT_MID_SETERRORMODEACK 0xDB
200 
201 #define CMT_MID_REQTRANSMITDELAY 0xDC
202 #define CMT_MID_REQTRANSMITDELAYACK 0xDD
203 #define CMT_LEN_TRANSMITDELAY 2
204 #define CMT_MID_SETTRANSMITDELAY 0xDC
205 #define CMT_MID_SETTRANSMITDELAYACK 0xDD
206 
207 // Xbus Master
208 #define CMT_MID_REQXMERRORMODE 0x82
209 #define CMT_MID_REQXMERRORMODEACK 0x83
210 #define CMT_LEN_XMERRORMODE 2
211 #define CMT_MID_SETXMERRORMODE 0x82
212 #define CMT_MID_SETXMERRORMODEACK 0x83
213 
214 #define CMT_MID_REQBUFFERSIZE 0x84
215 #define CMT_MID_REQBUFFERSIZEACK 0x85
216 #define CMT_LEN_BUFFERSIZE 2
217 #define CMT_MID_SETBUFFERSIZE 0x84
218 #define CMT_MID_SETBUFFERSIZEACK 0x85
219 // End Xbus Master
220 
221 #define CMT_MID_REQHEADING 0x82
222 #define CMT_MID_REQHEADINGACK 0x83
223 #define CMT_LEN_HEADING 4
224 #define CMT_MID_SETHEADING 0x82
225 #define CMT_MID_SETHEADINGACK 0x83
226 
227 #define CMT_MID_REQMAGNETICDECLINATION 0x6A
228 #define CMT_MID_REQMAGNETICDECLINATIONACK 0x6B
229 #define CMT_LEN_MAGNETICDECLINATION 4
230 #define CMT_MID_SETMAGNETICDECLINATION 0x6A
231 #define CMT_MID_SETMAGNETICDECLINATIONACK 0x6B
232 
233 #define CMT_MID_REQLOCATIONID 0x84
234 #define CMT_MID_REQLOCATIONIDACK 0x85
235 #define CMT_LEN_LOCATIONID 2
236 #define CMT_MID_SETLOCATIONID 0x84
237 #define CMT_MID_SETLOCATIONIDACK 0x85
238 
239 #define CMT_MID_REQEXTOUTPUTMODE 0x86
240 #define CMT_MID_REQEXTOUTPUTMODEACK 0x87
241 #define CMT_LEN_EXTOUTPUTMODE 2
242 #define CMT_MID_SETEXTOUTPUTMODE 0x86
243 #define CMT_MID_SETEXTOUTPUTMODEACK 0x87
244 
245 // XbusMaster
246 #define CMT_MID_REQBATLEVEL 0x88
247 #define CMT_MID_BATLEVEL 0x89
248 // End XbusMaster
249 
250 #define CMT_MID_REQINITTRACKMODE 0x88
251 #define CMT_MID_REQINITTRACKMODEACK 0x89
252 #define CMT_LEN_INITTRACKMODE 2
253 #define CMT_MID_SETINITTRACKMODE 0x88
254 #define CMT_MID_SETINITTRACKMODEACK 0x89
255 
256 // obsolete
257 //#define CMT_MID_STOREFILTERSTATE 0x8A
258 //#define CMT_LEN_STOREFILTERSTATE 0
259 //#define CMT_MID_STOREFILTERSTATEACK 0x8B
260 // new definition
261 #define CMT_MID_STOREXKFSTATE 0x8A
262 #define CMT_LEN_STOREXKFSTATE 0
263 #define CMT_MID_STOREXKFSTATEACK 0x8B
264 
265 #define CMT_MID_REQUTCTIME 0x60
266 #define CMT_MID_UTCTIME 0x61
267 #define CMT_LEN_UTCTIME 12
268 
269 #define CMT_LEN_SCENARIOLABEL 20
270 #define CMT_LEN_SCENARIOFULL (1+1+CMT_LEN_SCENARIOLABEL)
271 #define CMT_MID_REQAVAILABLESCENARIOS 0x62
272 #define CMT_MID_AVAILABLESCENARIOS 0x63
273 #define CMT_LEN_AVAILABLESCENARIOS (CMT_MAX_SCENARIOS_IN_MT*CMT_LEN_SCENARIOFULL)
274 
275 #define CMT_MID_REQSCENARIO 0x64
276 #define CMT_MID_REQSCENARIOACK 0x65
277 #define CMT_LEN_REQSCENARIOACK 2
278 #define CMT_MID_SETSCENARIO 0x64
279 #define CMT_MID_SETSCENARIOACK 0x65
280 #define CMT_LEN_SETSCENARIO 1
281 
282 #define CMT_MID_REQGRAVITYMAGNITUDE 0x66
283 #define CMT_MID_REQGRAVITYMAGNITUDEACK 0x67
284 #define CMT_MID_SETGRAVITYMAGNITUDE 0x66
285 #define CMT_MID_SETGRAVITYMAGNITUDEACK 0x67
286 #define CMT_LEN_GRAVITYMAGNITUDE 4
287 
288 #define CMT_MID_REQGPSLEVERARM 0x68
289 #define CMT_MID_REQGPSLEVERARMACK 0x69
290 #define CMT_MID_SETGPSLEVERARM 0x68
291 #define CMT_MID_SETGPSLEVERARMACK 0x69
292 #define CMT_LEN_GPSLEVERARM 12
293 
294 // Measurement state
295 #define CMT_MID_GOTOCONFIG 0x30
296 #define CMT_MID_GOTOCONFIGACK 0x31
297 #define CMT_MID_BUSDATA 0x32
298 #define CMT_MID_MTDATA 0x32
299 
300 // Manual
301 #define CMT_MID_PREPAREDATA 0x32
302 #define CMT_MID_REQDATA 0x34
303 #define CMT_MID_REQDATAACK 0x35
304 
305 // MTData defines
306 // Length of data blocks in bytes
307 #define CMT_LEN_RAWDATA 20
308 #define CMT_LEN_CALIBDATA 36
309 #define CMT_LEN_CALIB_ACCDATA 12
310 #define CMT_LEN_CALIB_GYRDATA 12
311 #define CMT_LEN_CALIB_MAGDATA 12
312 #define CMT_LEN_ORIENT_QUATDATA 16
313 #define CMT_LEN_ORIENT_EULERDATA 12
314 #define CMT_LEN_ORIENT_MATRIXDATA 36
315 #define CMT_LEN_SAMPLECNT 2
316 #define CMT_LEN_TEMPDATA 4
317 
318 // Length of data blocks in floats
319 #define CMT_LEN_CALIBDATA_FLT 9
320 #define CMT_LEN_ORIENT_QUATDATA_FLT 4
321 #define CMT_LEN_ORIENT_EULERDATA_FLT 3
322 #define CMT_LEN_ORIENT_MATRIXDATA_FLT 9
323 
324 // Indices of fields in DATA field of MTData message in bytes
325 // use in combination with LEN_CALIB etc
326 // Un-calibrated raw data
327 #define CMT_IND_RAW_ACCX 0
328 #define CMT_IND_RAW_ACCY 2
329 #define CMT_IND_RAW_ACCZ 4
330 #define CMT_IND_RAW_GYRX 6
331 #define CMT_IND_RAW_GYRY 8
332 #define CMT_IND_RAW_GYRZ 10
333 #define CMT_IND_RAW_MAGX 12
334 #define CMT_IND_RAW_MAGY 14
335 #define CMT_IND_RAW_MAGZ 16
336 #define CMT_IND_RAW_TEMP 18
337 // Calibrated data
338 #define CMT_IND_CALIB_ACCX 0
339 #define CMT_IND_CALIB_ACCY 4
340 #define CMT_IND_CALIB_ACCZ 8
341 #define CMT_IND_CALIB_GYRX 12
342 #define CMT_IND_CALIB_GYRY 16
343 #define CMT_IND_CALIB_GYRZ 20
344 #define CMT_IND_CALIB_MAGX 24
345 #define CMT_IND_CALIB_MAGY 28
346 #define CMT_IND_CALIB_MAGZ 32
347 // Orientation data - quat
348 #define CMT_IND_ORIENT_Q0 0
349 #define CMT_IND_ORIENT_Q1 4
350 #define CMT_IND_ORIENT_Q2 8
351 #define CMT_IND_ORIENT_Q3 12
352 // Orientation data - euler
353 #define CMT_IND_ORIENT_ROLL 0
354 #define CMT_IND_ORIENT_PITCH 4
355 #define CMT_IND_ORIENT_YAW 8
356 // Orientation data - matrix
357 #define CMT_IND_ORIENT_A 0
358 #define CMT_IND_ORIENT_B 4
359 #define CMT_IND_ORIENT_C 8
360 #define CMT_IND_ORIENT_D 12
361 #define CMT_IND_ORIENT_E 16
362 #define CMT_IND_ORIENT_F 20
363 #define CMT_IND_ORIENT_G 24
364 #define CMT_IND_ORIENT_H 28
365 #define CMT_IND_ORIENT_I 32
366 // Orientation data - euler
367 #define CMT_IND_SAMPLECNTH 0
368 #define CMT_IND_SAMPLECNTL 1
369 
370 // Indices of fields in DATA field of MTData message
371 // Un-calibrated raw data
372 #define CMT_FLDNUM_RAW_ACCX 0
373 #define CMT_FLDNUM_RAW_ACCY 1
374 #define CMT_FLDNUM_RAW_ACCZ 2
375 #define CMT_FLDNUM_RAW_GYRX 3
376 #define CMT_FLDNUM_RAW_GYRY 4
377 #define CMT_FLDNUM_RAW_GYRZ 5
378 #define CMT_FLDNUM_RAW_MAGX 6
379 #define CMT_FLDNUM_RAW_MAGY 7
380 #define CMT_FLDNUM_RAW_MAGZ 8
381 #define CMT_FLDNUM_RAW_TEMP 9
382 // Calibrated data
383 #define CMT_FLDNUM_CALIB_ACCX 0
384 #define CMT_FLDNUM_CALIB_ACCY 1
385 #define CMT_FLDNUM_CALIB_ACCZ 2
386 #define CMT_FLDNUM_CALIB_GYRX 3
387 #define CMT_FLDNUM_CALIB_GYRY 4
388 #define CMT_FLDNUM_CALIB_GYRZ 5
389 #define CMT_FLDNUM_CALIB_MAGX 6
390 #define CMT_FLDNUM_CALIB_MAGY 7
391 #define CMT_FLDNUM_CALIB_MAGZ 8
392 // Orientation data - quat
393 #define CMT_FLDNUM_ORIENT_Q0 0
394 #define CMT_FLDNUM_ORIENT_Q1 1
395 #define CMT_FLDNUM_ORIENT_Q2 2
396 #define CMT_FLDNUM_ORIENT_Q3 3
397 // Orientation data - euler
398 #define CMT_FLDNUM_ORIENT_ROLL 0
399 #define CMT_FLDNUM_ORIENT_PITCH 1
400 #define CMT_FLDNUM_ORIENT_YAW 2
401 // Orientation data - matrix
402 #define CMT_FLDNUM_ORIENT_A 0
403 #define CMT_FLDNUM_ORIENT_B 1
404 #define CMT_FLDNUM_ORIENT_C 2
405 #define CMT_FLDNUM_ORIENT_D 3
406 #define CMT_FLDNUM_ORIENT_E 4
407 #define CMT_FLDNUM_ORIENT_F 5
408 #define CMT_FLDNUM_ORIENT_G 6
409 #define CMT_FLDNUM_ORIENT_H 7
410 #define CMT_FLDNUM_ORIENT_I 8
411 // Length
412 // Uncalibrated raw data
413 #define CMT_LEN_RAW_ACCX 2
414 #define CMT_LEN_RAW_ACCY 2
415 #define CMT_LEN_RAW_ACCZ 2
416 #define CMT_LEN_RAW_GYRX 2
417 #define CMT_LEN_RAW_GYRY 2
418 #define CMT_LEN_RAW_GYRZ 2
419 #define CMT_LEN_RAW_MAGX 2
420 #define CMT_LEN_RAW_MAGY 2
421 #define CMT_LEN_RAW_MAGZ 2
422 #define CMT_LEN_RAW_TEMP 2
423 // Calibrated data
424 #define CMT_LEN_CALIB_ACCX 4
425 #define CMT_LEN_CALIB_ACCY 4
426 #define CMT_LEN_CALIB_ACCZ 4
427 #define CMT_LEN_CALIB_GYRX 4
428 #define CMT_LEN_CALIB_GYRY 4
429 #define CMT_LEN_CALIB_GYRZ 4
430 #define CMT_LEN_CALIB_MAGX 4
431 #define CMT_LEN_CALIB_MAGY 4
432 #define CMT_LEN_CALIB_MAGZ 4
433 // Orientation data - quat
434 #define CMT_LEN_ORIENT_Q0 4
435 #define CMT_LEN_ORIENT_Q1 4
436 #define CMT_LEN_ORIENT_Q2 4
437 #define CMT_LEN_ORIENT_Q3 4
438 // Orientation data - euler
439 #define CMT_LEN_ORIENT_ROLL 4
440 #define CMT_LEN_ORIENT_PITCH 4
441 #define CMT_LEN_ORIENT_YAW 4
442 // Orientation data - matrix
443 #define CMT_LEN_ORIENT_A 4
444 #define CMT_LEN_ORIENT_B 4
445 #define CMT_LEN_ORIENT_C 4
446 #define CMT_LEN_ORIENT_D 4
447 #define CMT_LEN_ORIENT_E 4
448 #define CMT_LEN_ORIENT_F 4
449 #define CMT_LEN_ORIENT_G 4
450 #define CMT_LEN_ORIENT_H 4
451 #define CMT_LEN_ORIENT_I 4
452 
453 // Defines for getDataValue
454 #define CMT_VALUE_RAW_ACC 0
455 #define CMT_VALUE_RAW_GYR 1
456 #define CMT_VALUE_RAW_MAG 2
457 #define CMT_VALUE_RAW_TEMP 3
458 #define CMT_VALUE_CALIB_ACC 4
459 #define CMT_VALUE_CALIB_GYR 5
460 #define CMT_VALUE_CALIB_MAG 6
461 #define CMT_VALUE_ORIENT_QUAT 7
462 #define CMT_VALUE_ORIENT_EULER 8
463 #define CMT_VALUE_ORIENT_MATRIX 9
464 #define CMT_VALUE_SAMPLECNT 10
465 #define CMT_VALUE_TEMP 11
466 
467 #define CMT_INVALIDSETTINGVALUE 0xFFFFFFFF
468 
469 
470 // Valid in all states
471 #define CMT_MID_RESET 0x40
472 #define CMT_MID_RESETACK 0x41
473 #define CMT_MID_ERROR 0x42
474 //#define CMT_LEN_ERROR 1
475 // XbusMaster
476 #define CMT_MID_XMPWROFF 0x44
477 // End XbusMaster
478 
479 #define CMT_MID_REQFILTERSETTINGS 0xA0
480 #define CMT_MID_REQFILTERSETTINGSACK 0xA1
481 #define CMT_LEN_FILTERSETTINGS 4
482 #define CMT_MID_SETFILTERSETTINGS 0xA0
483 #define CMT_MID_SETFILTERSETTINGSACK 0xA1
484 #define CMT_MID_REQAMD 0xA2
485 #define CMT_MID_REQAMDACK 0xA3
486 #define CMT_LEN_AMD 2
487 #define CMT_MID_SETAMD 0xA2
488 #define CMT_MID_SETAMDACK 0xA3
489 #define CMT_MID_RESETORIENTATION 0xA4
490 #define CMT_MID_RESETORIENTATIONACK 0xA5
491 #define CMT_LEN_RESETORIENTATION 2
492 
493 #define CMT_MID_REQGPSSTATUS 0xA6
494 #define CMT_MID_GPSSTATUS 0xA7
495 #define CMT_LEN_GPSSTATUS (1+5*16)
496 
497 // Baudrate defines for SetBaudrate message
498 #define CMT_BAUDCODE_9K6 0x09
499 // #define CMT_BAUDCODE_14K4 0x08
500 #define CMT_BAUDCODE_19K2 0x07
501 // #define CMT_BAUDCODE_28K8 0x06
502 #define CMT_BAUDCODE_38K4 0x05
503 #define CMT_BAUDCODE_57K6 0x04
504 // #define CMT_BAUDCODE_76K8 0x03
505 #define CMT_BAUDCODE_115K2 0x02
506 #define CMT_BAUDCODE_230K4 0x01
507 #define CMT_BAUDCODE_460K8 0x00
508 #define CMT_BAUDCODE_921K6 0x80
509 
510 // Xbus protocol error codes (Error)
511 #define CMT_ERROR_NOBUSCOMM 0x01
512 #define CMT_ERROR_BUSNOTREADY 0x02
513 #define CMT_ERROR_PERIODINVALID 0x03
514 #define CMT_ERROR_MESSAGEINVALID 0x04
515 #define CMT_ERROR_INITOFBUSFAILED1 0x10
516 #define CMT_ERROR_INITOFBUSFAILED2 0x11
517 #define CMT_ERROR_INITOFBUSFAILED3 0x12
518 #define CMT_ERROR_SETBIDPROCFAILED1 0x14
519 #define CMT_ERROR_SETBIDPROCFAILED2 0x15
520 #define CMT_ERROR_MEASUREMENTFAILED1 0x18
521 #define CMT_ERROR_MEASUREMENTFAILED2 0x19
522 #define CMT_ERROR_MEASUREMENTFAILED3 0x1A
523 #define CMT_ERROR_MEASUREMENTFAILED4 0x1B
524 #define CMT_ERROR_MEASUREMENTFAILED5 0x1C
525 #define CMT_ERROR_MEASUREMENTFAILED6 0x1D
526 #define CMT_ERROR_TIMEROVERFLOW 0x1E
527 #define CMT_ERROR_BAUDRATEINVALID 0x20
528 #define CMT_ERROR_PARAMETERINVALID 0x21
529 #define CMT_ERROR_MEASUREMENTFAILED7 0x23
530 
531 // Error modes (SetErrorMode)
532 #define CMT_ERRORMODE_IGNORE 0x0000
533 #define CMT_ERRORMODE_INCSAMPLECNT 0x0001
534 #define CMT_ERRORMODE_INCSAMPLECNT_SENDERROR 0x0002
535 #define CMT_ERRORMODE_SENDERROR_GOTOCONFIG 0x0003
536 
537 // Configuration message defines
538 #define CMT_CONF_MASTERDID 0
539 #define CMT_CONF_PERIOD 4
540 #define CMT_CONF_OUTPUTSKIPFACTOR 6
541 #define CMT_CONF_SYNCIN_MODE 8
542 #define CMT_CONF_SYNCIN_SKIPFACTOR 10
543 #define CMT_CONF_SYNCIN_OFFSET 12
544 #define CMT_CONF_DATE 16
545 #define CMT_CONF_TIME 24
546 #define CMT_CONF_NUMDEVICES 96
547 // Configuration sensor block properties
548 #define CMT_CONF_DID 98
549 #define CMT_CONF_DATALENGTH 102
550 #define CMT_CONF_OUTPUTMODE 104
551 #define CMT_CONF_OUTPUTSETTINGS 106
552 #define CMT_CONF_BLOCKLEN 20
553 // To calculate the offset in data field for output mode of sensor #2 use
554 // CONF_OUTPUTMODE + 1*CONF_BLOCKLEN
555 #define CMT_CONF_MASTERDIDLEN 4
556 #define CMT_CONF_PERIODLEN 2
557 #define CMT_CONF_OUTPUTSKIPFACTORLEN 2
558 #define CMT_CONF_SYNCIN_MODELEN 2
559 #define CMT_CONF_SYNCIN_SKIPFACTORLEN 2
560 #define CMT_CONF_SYNCIN_OFFSETLEN 4
561 #define CMT_CONF_DATELEN 8
562 #define CMT_CONF_TIMELEN 8
563 #define CMT_CONF_RESERVED_CLIENTLEN 32
564 #define CMT_CONF_RESERVED_HOSTLEN 32
565 #define CMT_CONF_NUMDEVICESLEN 2
566 // Configuration sensor block properties
567 #define CMT_CONF_DIDLEN 4
568 #define CMT_CONF_DATALENGTHLEN 2
569 #define CMT_CONF_OUTPUTMODELEN 2
570 #define CMT_CONF_OUTPUTSETTINGSLEN 4
571 
572 // Clock frequency for offset & pulse width
573 #define CMT_SYNC_CLOCKFREQMHZ 29.4912
574 #define CMT_SYNC_CLOCK_NS_TO_TICKS (CMT_SYNC_CLOCKFREQMHZ * 1.0e-3)
575 #define CMT_SYNC_CLOCK_TICKS_TO_NS (1.0e3 / CMT_SYNC_CLOCKFREQMHZ)
576 
577 // SyncIn params
578 #define CMT_PARAM_SYNCIN_MODE 0x00
579 #define CMT_PARAM_SYNCIN_SKIPFACTOR 0x01
580 #define CMT_PARAM_SYNCIN_OFFSET 0x02
581 
582 // SyncIn mode
583 #define CMT_SYNCIN_DISABLED 0x0000
584 #define CMT_SYNCIN_EDGE_RISING 0x0001
585 #define CMT_SYNCIN_EDGE_FALLING 0x0002
586 #define CMT_SYNCIN_EDGE_BOTH 0x0003
587 #define CMT_SYNCIN_EDGE_MASK 0x0003
588 #define CMT_SYNCIN_TYPE_DOSAMPLING 0x0000
589 #define CMT_SYNCIN_TYPE_SENDLASTDATA 0x0004
590 #define CMT_SYNCIN_TYPE_CLOCK 0x0010
591 #define CMT_SYNCIN_TYPE_MASK 0x001C
592 
593 // SyncOut params
594 #define CMT_PARAM_SYNCOUT_MODE 0x00
595 #define CMT_PARAM_SYNCOUT_SKIPFACTOR 0x01
596 #define CMT_PARAM_SYNCOUT_OFFSET 0x02
597 #define CMT_PARAM_SYNCOUT_PULSEWIDTH 0x03
598 
599 // SyncOut mode
600 #define CMT_SYNCOUT_DISABLED 0x0000
601 #define CMT_SYNCOUT_TYPE_TOGGLE 0x0001
602 #define CMT_SYNCOUT_TYPE_PULSE 0x0002
603 #define CMT_SYNCOUT_POL_NEG 0x0000
604 #define CMT_SYNCOUT_POL_POS 0x0010
605 #define CMT_SYNCOUT_TYPE_MASK 0x000F
606 #define CMT_SYNCOUT_POL_MASK 0x0010
607 
608 // OutputModes
609 #define CMT_OUTPUTMODE_MT9 0x8000
610 #define CMT_OUTPUTMODE_XM 0x0000
611 #define CMT_OUTPUTMODE_RAW 0x4000
612 #define CMT_OUTPUTMODE_RAWGPSPRINT 0x1000
613 #define CMT_OUTPUTMODE_TEMP 0x0001
614 #define CMT_OUTPUTMODE_CALIB 0x0002
615 #define CMT_OUTPUTMODE_ORIENT 0x0004
616 #define CMT_OUTPUTMODE_AUXILIARY 0x0008
617 #define CMT_OUTPUTMODE_POSITION 0x0010
618 #define CMT_OUTPUTMODE_VELOCITY 0x0020
619 #define CMT_OUTPUTMODE_STATUS 0x0800
620 
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 (CMT_OUTPUTSETTINGS_ORIENTMODE_QUATERNION |\
769  CMT_OUTPUTSETTINGS_TIMESTAMP_SAMPLECNT)
770 
771 #define CMT_GOTO_CONFIG_TRIES 3 // 50
772 
773 #define CMT_MAX_DEVICES_PER_PORT 11
774 #define CMT_DEFAULT_SAMPLE_FREQUENCY 100
775 #define CMT_DEFAULT_PERIOD 1152
776 #define CMT_DEFAULT_SKIP 0
777 #define CMT_DEFAULT_FILTER_GAIN 1.0f
778 #define CMT_DEFAULT_FILTER_WEIGHTING 1.0f
779 #define CMT_SYNCOUT_DEFAULT_PULSE_WIDTH 1000000 // 1ms = 1M ns
780 
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  CMT_CONTROL_DCD = 0x0001, // pin 1: Carrier Detect
823  CMT_CONTROL_RD = 0x0002, // pin 2: Received Data
824  CMT_CONTROL_TD = 0x0004, // pin 3: Transmitted Data
825  CMT_CONTROL_DTR = 0x0008, // pin 4: Data Terminal Ready
826  CMT_CONTROL_GND = 0x0010, // pin 5: Common Ground
827  CMT_CONTROL_DSR = 0x0020, // pin 6: Data Set Ready
828  CMT_CONTROL_RTS = 0x0040, // pin 7: Request To Send
829  CMT_CONTROL_CTS = 0x0080, // pin 8: Clear To Send
830  CMT_CONTROL_RI = 0x0100 // pin 9: Ring Indicator
831 };
832 
833 // Reset orientation message type
840 };
841 
848 };
849 
850 //! The type of a Device Id
852 
853 /* different alignment commands for gcc / MSVS, the structure needs to be 2-byte aligned
854  because the deviceId field is 4 bytes long on offset 98.
855 */
856 #ifdef _MSC_VER
857  #pragma pack(push, 2)
858 #endif
859 //! Structure containing a full device configuration as returned by the ReqConfig message.
872  struct _devInfo {
879 
880 #ifndef _CMT_DLL_IMPORT
881  void readFromMessage(const void* message);
882 #endif
883 }
884 // different alignment commands for gcc / MSVS
885 #ifdef _MSC_VER
886  ;
887  #pragma pack(pop)
888 #else
889  /*! \cond NODOXYGEN */ __attribute__((__packed__)) /*! \endcond */;
890 #endif
891 
892 //////////////////////////////////////////////////////////////////////////////////////////
893 
894  //! An output mode bit-field
896  //! An output settings bit-field
898 
899  //! A structure for storing data formats
903 
904 #ifndef _CMT_DLL_IMPORT
905  //! default constructor, initializes to the given (default) MT settings
908  : m_outputMode(mode), m_outputSettings(settings) {}
909 #endif
910 };
911 
912  //! An MT timestamp (sample count)
914 
915 #define CMT_MAX_FILENAME_LENGTH 512
916 
917 #define CMT_DID_BROADCAST 0x80000000
918 #define CMT_DID_MASTER 0
919 
920 #ifdef _CMT_ADD_PRIVATE
921 # include "cmtprivate.h"
922 #endif
923 
924 //! A structure for storing the firmware version
925 struct CmtVersion {
929 };
930 
931 //! A structure for storing sync in settings
935  uint32_t m_offset; //!< Offset in ns
936 
937 #ifndef _CMT_DLL_IMPORT
938  //! default constructor, initializes to the given (default) MT settings
940  const uint16_t skip = 0,
941  const uint32_t offset = 0)
942  : m_mode(mode), m_skipFactor(skip), m_offset(offset) {}
943 #endif
944 };
945 
946 //! A structure for storing sync out settings
950  uint32_t m_offset; //!< Offset in ns
951  uint32_t m_pulseWidth; //!< Pulse width in ns
952 
953 #ifndef _CMT_DLL_IMPORT
954  //! default constructor, initializes to the given (default) MT settings
956  const uint16_t skip = 0,
957  const uint32_t offset = 0,
960  m_pulseWidth(width) {}
961 #endif
962 };
963 
964 //! A structure for storing UTC Time values
966 {
974  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 valid. when set to 0, the time is invalid and should be ignored.
975 };
976 
977 //! A structure for storing device modes
982 
983 #ifndef _CMT_DLL_IMPORT
984  //! default constructor, initializes to the given (default) MT settings
987  const uint16_t frequency = CMT_DEFAULT_SAMPLE_FREQUENCY) :
988  m_outputMode(mode), m_outputSettings(settings),
989  m_sampleFrequency(frequency) {}
990 
991  /*! \brief Compute the period and skip factor.
992 
993  This function computes the period and skipFactor fields from the stored
994  m_sampleFrequency field. The maximum error in the frequency is approximately
995  0.4%, which occurs at 510Hz (= actually 512 Hz). In general, the higher
996  frequencies are harder to set up exactly.
997  */
998  void getPeriodAndSkipFactor(uint16_t& period, uint16_t& skip) const;
999  /*! \brief Return the real sample frequency in Hz.
1000 
1001  This may be up to 2Hz different from the value that is set.
1002  */
1003  double getRealSampleFrequency(void) const;
1004  /*! \brief Compute the sample frequency from a period and skip factor.
1005 
1006  This function does the reverse of the getPeriodAndSkipFactor function, storing the
1007  value in the m_sampleFrequency field.
1008  */
1009  void setPeriodAndSkipFactor(uint16_t period, uint16_t skip);
1010 
1011  //! Check if all fields of the two structures are equal
1012  bool operator == (const CmtDeviceMode& dev) const;
1013 #endif
1014 };
1015 
1016 //! A structure for storing device modes using period and skip factor (new default)
1022 
1023 #ifndef _CMT_DLL_IMPORT
1024  //! default constructor, initializes to the given (default) MT settings
1027  const uint16_t period = CMT_DEFAULT_PERIOD,
1028  const uint16_t skip = CMT_DEFAULT_SKIP) :
1029  m_outputMode(mode), m_outputSettings(settings),
1030  m_period(period), m_skip(skip) {}
1031 
1032  /*! \brief Return the real sample frequency in Hz.
1033 
1034  This may be up to 2Hz different from the value that is set.
1035  */
1036  double getRealSampleFrequency(void) const;
1037  /*! \brief Return the sample frequency in Hz.
1038 
1039  This may be up to 2Hz different from the value that is set.
1040  */
1041  uint16_t getSampleFrequency(void) const;
1042  /*! \brief Compute the period and skip factor from a sample frequency.
1043 
1044  This function does the reverse of the getPeriodAndSkipFactor function, storing the
1045  value in the m_period and m_skip field.
1046  */
1048 
1049  //! Check if all fields of the two structures are equal
1050  bool operator == (const CmtDeviceMode2& dev) const;
1051 #endif
1052 };
1053 
1054 #define CMT_MAX_SCENARIOS_IN_MT 5
1055 #define CMT_MAX_SCENARIOS 254
1056 
1057 //! A structure for storing scenario information
1058 struct CmtScenario {
1059  uint8_t m_type; //!< The type of the scenario. When set to 255 in an operation, the 'current' scenario is used.
1060  uint8_t m_version; //!< The version of the scenario.
1061  char m_label[CMT_LEN_SCENARIOLABEL+1]; //!< The label of the scenario.
1062  //bool m_inSensor; //!< When set to true, the scenario is available in the sensor
1063  char m_filterType; //!< The type of filter this scenario is intended for '3': XKF-3, '6': XKF-6. \note The value is a character, so XKF-3 is '3', which is hex 0x33
1064 };
1065 
1066 #define CMT_MAX_OBJECTS 20
1067 
1069  CMT_CALLBACK_ONMEASUREMENTPREPARE = 0, //!< Callback function, called right before sending a GotoMeasurement message
1070  CMT_CALLBACK_ONMEASUREMENTSTART = 1, //!< Callback function, called right after successfully switching to Measurement mode
1071  CMT_CALLBACK_ONMEASUREMENTSTOP = 2, //!< Callback function, called right before switching from Measurement mode to Config mode
1072  CMT_CALLBACK_ONPOSTPROCESS = 3, //!< Callback function, called when a full data bundle is available and has been processed by the CMT. The first void* parameter supplied to this function can be handed as the bundle parameter in cmtData... functions to manipulate the newly received bundle.
1073  CMT_CALLBACK_ONBYTESRECEIVED = 4, //!< Callback function, called when bytes have been read from a port
1074  CMT_CALLBACK_ONMESSAGERECEIVED = 5, //!< Callback function, called when a full message has been received from a port
1075  CMT_CALLBACK_ONMESSAGESENT = 6 //!< Callback function, called when a full message has been sent by a port
1076 };
1077 
1082 };
1083 
1088 };
1089 
1090 //#ifdef _WIN32
1092 //#else
1093 // typedef __attribute__((cdecl)) XsensResultValue (* CmtCallbackFunction)(int32_t, CmtCallbackSelector, void*, void*);
1094 //#endif
1095 
1096 //! \brief Structure for storing information about a serial port
1097 struct CmtPortInfo {
1098  uint32_t m_baudrate; //!< The baudrate at which an Xsens device was detected
1099  uint32_t m_deviceId; //!< The device Id of the detected Xsens device
1100  uint8_t m_portNr; //!< The port number
1101  char m_portName[32]; //!< The port name
1102 
1104  { }
1105 #ifdef __cplusplus
1106 # ifdef _WIN32
1107  //! greater than operator, used for sorting the list
1108  bool operator > (const CmtPortInfo& p) const { return m_portNr > p.m_portNr; }
1109  //! less than operator, used for sorting the list
1110  bool operator < (const CmtPortInfo& p) const { return m_portNr < p.m_portNr; }
1111  //! equality operator, used for finding items in a list
1112  bool operator == (const CmtPortInfo& p) const { return m_portNr == p.m_portNr; }
1113  //! equality operator, used for finding items in a list
1114  bool operator == (const uint8_t port) const { return m_portNr == port; }
1115 # else // Linux
1116  //! greater than operator, used for sorting the list
1117  bool operator > (const CmtPortInfo& p) const { return strcmp(m_portName, p.m_portName) > 0; }
1118  //! less than operator, used for sorting the list
1119  bool operator < (const CmtPortInfo& p) const { return strcmp(m_portName, p.m_portName) < 0; }
1120  //! equality operator, used for finding items in a list
1121  bool operator == (const CmtPortInfo& p) const { return strcmp(m_portName, p.m_portName) == 0; }
1122  //! equality operator, used for finding items in a list
1123  bool operator == (const uint8_t port) const {
1124  MRPT_UNUSED_PARAM(port);
1125  return false;
1126  }
1127 # endif // ifdef _WIN32/Linux
1128 #endif
1129 };
1130 
1133 };
1134 struct CmtRawData {
1137 };
1152 };
1154 {
1156 
1158 };
1159 struct CmtVector {
1160  double m_data[3];
1161 };
1162 struct CmtCalData {
1164 };
1165 struct CmtQuat {
1166  double m_data[4];
1167 };
1168 struct CmtEuler {
1169  double m_roll; //!< The roll (rotation around x-axis / back-front-line)
1170  double m_pitch; //!< The pitch (rotation around y-axis / right-left-line)
1171  double m_yaw; //!< The yaw (rotation around z-axis / down-up-line)
1172 };
1173 struct CmtMatrix {
1174  double m_data[3][3];
1175 };
1176 
1177 #define CMT_MAX_SVINFO 16
1183 };
1186 };
1187 
1189 
1190 #define CMT_AUTO_SAVE_FRAMES 5000
1191 #define CMT_FILE_LAST_FRAME 0xFFFFFFFF
1192 
1193 #define CMT_BID_BROADCAST (const uint8_t)0x00
1194 #define CMT_BID_INVALID (const uint8_t)0xFE
1195 #define CMT_MID_REQEMTS (const uint8_t)0x90
1196 #define CMT_MID_EMTSDATA (const uint8_t)0x91
1197 #define CMT_EMTS_SIZE 1056
1198 
1199 #endif
void readFromMessage(const void *message)
Definition: cmt3.cpp:60
A structure for storing the firmware version.
Definition: cmtdef.h:925
int32_t m_height
Definition: cmtdef.h:1144
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:1063
uint16_t m_period
Definition: cmtdef.h:1020
bool operator==(const TPoint2D &p1, const TPoint2D &p2)
Exact comparison between 2D points.
uint32_t m_vacc
Definition: cmtdef.h:1149
CmtVector m_acc
Definition: cmtdef.h:1163
uint8_t m_type
The type of the scenario. When set to 255 in an operation, the &#39;current&#39; scenario is used...
Definition: cmtdef.h:1059
uint64_t CmtTimeStamp
Definition: cmtdef.h:1188
CmtShortVector m_mag
Definition: cmtdef.h:1135
uint8_t m_day
Definition: cmtdef.h:970
unsigned __int16 uint16_t
Definition: rptypes.h:46
#define CMT_SYNCOUT_DEFAULT_PULSE_WIDTH
Definition: cmtdef.h:779
A structure for storing data formats.
Definition: cmtdef.h:900
uint8_t m_version
The version of the scenario.
Definition: cmtdef.h:1060
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:974
CmtVector m_gyr
Definition: cmtdef.h:1163
uint16_t m_skipFactor
Definition: cmtdef.h:949
Structure for storing information about a serial port.
Definition: cmtdef.h:1097
uint32_t m_deviceId
The device Id of the detected Xsens device.
Definition: cmtdef.h:1099
uint32_t m_offset
Offset in ns.
Definition: cmtdef.h:950
uint32_t m_sacc
Definition: cmtdef.h:1150
A structure for storing sync out settings.
Definition: cmtdef.h:947
Callback function, called right before switching from Measurement mode to Config mode.
Definition: cmtdef.h:1071
int32_t m_veln
Definition: cmtdef.h:1145
uint8_t m_minor
Definition: cmtdef.h:927
uint16_t m_syncinMode
Definition: cmtdef.h:864
uint8_t m_reservedForClient[32]
Definition: cmtdef.h:870
GLintptr offset
Definition: glext.h:3780
int32_t m_latitude
Definition: cmtdef.h:1142
#define CMT_MAXMSGLEN
Definition: cmtdef.h:75
CmtControlLine
Definition: cmtdef.h:821
double getRealSampleFrequency(void) const
Return the real sample frequency in Hz.
Definition: cmt3.cpp:142
A structure for storing UTC Time values.
Definition: cmtdef.h:965
double m_pitch
The pitch (rotation around y-axis / right-left-line)
Definition: cmtdef.h:1170
Callback function, called when a full message has been received from a port.
Definition: cmtdef.h:1074
uint8_t m_month
Definition: cmtdef.h:969
uint8_t m_signalQuality
Definition: cmtdef.h:1181
uint8_t m_hour
Definition: cmtdef.h:971
A structure for storing sync in settings.
Definition: cmtdef.h:932
uint32_t m_pulseWidth
Pulse width in ns.
Definition: cmtdef.h:951
uint32_t m_offset
Offset in ns.
Definition: cmtdef.h:935
uint8_t m_signalStrength
Definition: cmtdef.h:1182
void getPeriodAndSkipFactor(uint16_t &period, uint16_t &skip) const
Compute the period and skip factor.
Definition: cmt3.cpp:88
GLenum GLsizei width
Definition: glext.h:3513
uint16_t m_year
Definition: cmtdef.h:968
CmtQueueMode
Definition: cmtdef.h:1078
uint16_t m_skipFactor
Definition: cmtdef.h:934
#define CMT_DEFAULT_SAMPLE_FREQUENCY
Definition: cmtdef.h:774
unsigned char uint8_t
Definition: rptypes.h:43
bool operator==(const CmtDeviceMode &dev) const
Check if all fields of the two structures are equal.
Definition: cmt3.cpp:135
int32_t m_vele
Definition: cmtdef.h:1146
Callback function, called when a full message has been sent by a port.
Definition: cmtdef.h:1075
Structure containing a full device configuration as returned by the ReqConfig message.
Definition: cmtdef.h:860
CmtXmSyncMode
Definition: cmtdef.h:842
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:985
uint32_t m_syncinOffset
Definition: cmtdef.h:866
#define CMT_DEFAULT_PERIOD
Definition: cmtdef.h:775
CmtOutputMode m_outputMode
Definition: cmtdef.h:979
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:939
#define MRPT_UNUSED_PARAM(a)
Can be used to avoid "not used parameters" warnings from the compiler.
uint16_t m_samplingPeriod
Definition: cmtdef.h:862
bool operator==(const CmtDeviceMode2 &dev) const
Check if all fields of the two structures are equal.
Definition: cmt3.cpp:191
XsensResultValue(__cdecl * CmtCallbackFunction)(int32_t, CmtCallbackSelector, void *, void *)
Definition: cmtdef.h:1091
uint16_t m_mode
Definition: cmtdef.h:948
struct CmtDeviceConfiguration::_devInfo m_deviceInfo[CMT_MAX_DEVICES_PER_PORT]
uint16_t m_numberOfDevices
Definition: cmtdef.h:871
XsensResultValue
Xsens return values.
Definition: xsens_std.h:30
CmtPortInfo()
Definition: cmtdef.h:1103
double m_data[4]
Definition: cmtdef.h:1166
double m_data[3][3]
Definition: cmtdef.h:1174
double m_roll
The roll (rotation around x-axis / back-front-line)
Definition: cmtdef.h:1169
uint16_t m_skip
Definition: cmtdef.h:1021
void setSampleFrequency(uint16_t freq)
Compute the period and skip factor from a sample frequency.
Definition: cmt3.cpp:160
uint32_t m_baudrate
The baudrate at which an Xsens device was detected.
Definition: cmtdef.h:1098
JHUFF_TBL long freq[]
Definition: jchuff.h:44
double getRealSampleFrequency(void) const
Return the real sample frequency in Hz.
Definition: cmt3.cpp:119
bool operator>(const CArray< T, N > &x, const CArray< T, N > &y)
Definition: CArray.h:289
uint16_t m_temp
Definition: cmtdef.h:1136
#define CMT_LEN_SCENARIOLABEL
Definition: cmtdef.h:269
uint8_t m_time[8]
Definition: cmtdef.h:868
uint16_t m_data[3]
Definition: cmtdef.h:1132
int32_t m_veld
Definition: cmtdef.h:1147
CmtOutputSettings m_outputSettings
Definition: cmtdef.h:980
double m_data[3]
Definition: cmtdef.h:1160
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:955
uint8_t m_minute
Definition: cmtdef.h:972
char m_label[CMT_LEN_SCENARIOLABEL+1]
The label of the scenario.
Definition: cmtdef.h:1061
uint8_t m_portNr
The port number.
Definition: cmtdef.h:1100
A structure for storing device modes using period and skip factor (new default)
Definition: cmtdef.h:1017
GLint mode
Definition: glext.h:5078
__int32 int32_t
Definition: rptypes.h:48
uint16_t m_sampleFrequency
Definition: cmtdef.h:981
unsigned __int64 uint64_t
Definition: rptypes.h:52
void setPeriodAndSkipFactor(uint16_t period, uint16_t skip)
Compute the sample frequency from a period and skip factor.
Definition: cmt3.cpp:128
CmtShortVector m_gyr
Definition: cmtdef.h:1135
Callback function, called right after successfully switching to Measurement mode. ...
Definition: cmtdef.h:1070
uint32_t m_itow
Definition: cmtdef.h:1141
uint8_t m_revision
Definition: cmtdef.h:928
#define CMT_DEFAULT_OUTPUT_SETTINGS
Definition: cmtdef.h:768
uint16_t m_data
Definition: cmtdef.h:1157
#define CMT_DEFAULT_SKIP
Definition: cmtdef.h:776
int32_t m_longitude
Definition: cmtdef.h:1143
uint32_t CmtOutputMode
An output mode bit-field.
Definition: cmtdef.h:895
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:1025
uint8_t m_pressureAge
Definition: cmtdef.h:1140
CmtResetMethod
Definition: cmtdef.h:834
CmtVector m_mag
Definition: cmtdef.h:1163
uint8_t m_second
Definition: cmtdef.h:973
uint32_t m_nano
Definition: cmtdef.h:967
Callback function, called right before sending a GotoMeasurement message.
Definition: cmtdef.h:1069
uint16_t m_mode
Definition: cmtdef.h:933
CmtCallbackSelector
Definition: cmtdef.h:1068
CmtOutputMode m_outputMode
Definition: cmtdef.h:901
bool operator<(const CPoint< DERIVEDCLASS > &a, const CPoint< DERIVEDCLASS > &b)
Used by STL algorithms.
Definition: CPoint.h:116
double m_yaw
The yaw (rotation around z-axis / down-up-line)
Definition: cmtdef.h:1171
uint8_t m_date[8]
Definition: cmtdef.h:867
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:906
CmtOutputSettings m_outputSettings
Definition: cmtdef.h:1019
CmtOutputSettings m_outputSettings
Definition: cmtdef.h:902
Callback function, called when bytes have been read from a port.
Definition: cmtdef.h:1073
uint16_t getSampleFrequency(void) const
Return the sample frequency in Hz.
Definition: cmt3.cpp:152
A structure for storing device modes.
Definition: cmtdef.h:978
uint32_t m_masterDeviceId
Definition: cmtdef.h:861
CmtOutputMode m_outputMode
Definition: cmtdef.h:1018
char m_portName[32]
The port name.
Definition: cmtdef.h:1101
CmtGpsSatelliteInfo m_svInfo[CMT_MAX_SVINFO]
Definition: cmtdef.h:1185
#define __attribute__(x)
Definition: rptypes.h:77
unsigned __int32 uint32_t
Definition: rptypes.h:49
#define CMT_DEFAULT_OUTPUT_MODE
Definition: cmtdef.h:767
#define CMT_MAX_DEVICES_PER_PORT
Definition: cmtdef.h:773
GLfloat GLfloat p
Definition: glext.h:5587
uint8_t m_navigationStatus
Definition: cmtdef.h:1180
uint32_t CmtDeviceId
The type of a Device Id.
Definition: cmtdef.h:851
uint8_t m_major
Definition: cmtdef.h:926
uint16_t CmtMtTimeStamp
An MT timestamp (sample count)
Definition: cmtdef.h:913
A structure for storing scenario information.
Definition: cmtdef.h:1058
uint8_t m_reservedForHost[32]
Definition: cmtdef.h:869
uint8_t m_data[CMT_MAXMSGLEN]
Definition: cmtdef.h:1086
Callback function, called when a full data bundle is available and has been processed by the CMT...
Definition: cmtdef.h:1072
uint16_t m_syncinSkipFactor
Definition: cmtdef.h:865
uint8_t m_portNr
Definition: cmtdef.h:1087
uint16_t m_pressure
Definition: cmtdef.h:1139
CmtShortVector m_acc
Definition: cmtdef.h:1135
uint64_t CmtOutputSettings
An output settings bit-field.
Definition: cmtdef.h:897
uint8_t m_gpsAge
Definition: cmtdef.h:1151
#define CMT_MAX_SVINFO
Definition: cmtdef.h:1177
int32_t m_size
Definition: cmtdef.h:1085
uint32_t m_hacc
Definition: cmtdef.h:1148
uint16_t m_outputSkipFactor
Definition: cmtdef.h:863



Page generated by Doxygen 1.8.14 for MRPT 1.5.7 Git: 5902e14cc Wed Apr 24 15:04:01 2019 +0200 at lun oct 28 01:39:17 CET 2019