MRPT  1.9.9
cmt3.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 _CMT3_H_2006_04_14
11 #define _CMT3_H_2006_04_14
12 
13 #ifndef _CMT_MONOLITHIC
14 #include "cmt2.h"
15 #include "cmtpacket.h"
16 #endif
17 
18 namespace xsens
19 {
20 //////////////////////////////////////////////////////////////////////////////////////////
21 //////////////////////////////////// Support classes
22 ///////////////////////////////////////
23 //////////////////////////////////////////////////////////////////////////////////////////
24 
25 //////////////////////////////////////////////////////////////////////////////////////////
26 ///////////////////////////////////////// Cmt3
27 ////////////////////////////////////////////
28 //////////////////////////////////////////////////////////////////////////////////////////
29 
30 /*! \brief High-level communication class.
31 
32  The class uses CMT level 2, but does not inherit from it. If software needs
33  to access
34  the level 2 components, it needs to be done through the getCmt2s() and
35  getCmt2f() functions.
36 
37  All device identification is done through device Ids in CMT level 3.
38 */
39 class Cmt3
40 {
41  //// data & structures ////
42  protected:
43  /** The (optional) CMT level 2 serial object that this class operates on. */
45  /** The (optional) CMT level 2 logfile object that this class operates on.
46  */
48  /** ms per sample = 1000 / sample frequency. */
50  // double m_sampleFrequency; //!< The sample frequency of the port,
51  // computed from sampling period and output skip factor.
52  /** The sample period of the port. */
54  /** The skip factor of the port. */
56  /** The start of the RTC counter, the time of arrival of sample 0. */
58  /** The long sample counter (normal counter wraps at 64k). */
60  /** The last received sample counter, used to determine wrap-around. */
62  /** The baudrate that was last set to be used by the port. */
64  /** The config mode timeout. */
66  /** The measurement mode timeout. */
68  /** The last result of an operation. */
70  /** The index of the first formatting item. */
72  /** The number of times a goto config is attempted before the function
73  * fails. */
75  /** Keeps track of whether the connected device is measuring or being
76  * configured. */
78  /** Automatically scan for device details during open. Default is true
79  * (recommended). */
81  /** Indicates whether to read from the log file or from the serial port. */
83  /** Indicates if the rtc is initialised or not. */
85  /** Indicates whether to write all received messages to the logfile or not,
86  * automatically set to true by createLogFile. */
87  bool m_logging;
88  /** Contains the last error reported by hardware. */
90  /** Contains the Device ID of the device that caused the last hardware
91  * error. */
93 
94  public:
95  /** Indicates if the RTC should be computed or not (to save CPU time). */
96  bool m_useRtc;
97  /** Cached eMTS data. */
99 
100  protected:
101  /** The configuration of the connected devices. */
103 
104  //// functions
105  //////////////////////////////////////////////////////////////////////////////////////
106  protected:
107  /** This object cannot be copied, so this function is not implemented. */
108  Cmt3(const Cmt3& ref);
109  /** Internal function to compute the RTC value. */
110  void fillRtc(Packet* pack);
111  /** \brief Find a device Id in the list and return its busId. \details
112  * CmtDeviceId 0= busId 0= broadcast. A CMT_BID_INVALID value is also
113  * possible and indicates that the devId was not found. */
114  uint8_t getBusIdInternal(const CmtDeviceId devId) const;
115 
116  public:
117  /** Default constructor, initializes all members to their default values. */
118  Cmt3();
119  /** Destructor, de-initializes, frees memory allocated for buffers, etc. */
120  ~Cmt3();
121 
122  /** \brief Close the communication port. \details This function places the
123  * device in configuration mode and closes the communication port, ending
124  * all further communication with the device. */
125  XsensResultValue closePort(bool gotoConfigFirst = true);
126  /** \brief Get an Xbus Master's battery level. \details The battery level is
127  * a value between 0 and 255 that indicates the voltage of the batteries.
128  * The scale is not linear and the values should not be used as an absolute
129  * voltage. The amount of time remaining for measurement given any battery
130  * level greatly depends on the type of batteries used, the number of
131  * sensors attached to the Xbus Master and the used output options. */
133  /** \brief Get the baudrate used by a port. \details This function returns
134  * the baud rate at which the port is currently connected. The function will
135  * return an error when no port is connected. \see getSerialBaudrate
136  * setSerialBaudrate setBaudrate */
138  /** \brief Get the state of the bluetooth communication. \details This
139  * function tells whether the Bluetooth connection of the Xbus Master is on
140  * (1) or off (0). \note This function is only valid in configuration mode.
141  */
142  XsensResultValue getBluetoothState(bool& enabled);
143  /** \brief Retrieve the BusId of a device. \details The function checks its
144  * internal list for a match of deviceId. If it is found, the corresponding
145  * BusId is returned in busId. Otherwise, a 0 is placed in busId and
146  * XRV_NOTFOUND result is returned. */
148  uint8_t& busId, const CmtDeviceId deviceId = CMT_DID_MASTER) const;
149  /** \brief Get the state of the Xbus power. \details This function tells
150  * whether the Xbus of the connected Xbus Master is currently switched on
151  * (1) or not (0). When it is switched off, the attached MT devices have no
152  * power and communication with them is not possible. Before going to
153  * measurement mode, use setBusPowerState to restore power. \see
154  * setBusPowerState \note This function is only valid in configuration mode.
155  */
156  XsensResultValue getBusPowerState(bool& enabled);
157 
158  /** \brief Return a reference to the embedded Cmt2f (logfile) object.
159  * \details Any manipulation of the object should be done through Cmt3.
160  * Cmt3's integrity is not guaranteed if the Cmt2f object is manipulated
161  * directly. \see refreshCache */
162  Cmt2f* getCmt2f(void);
163  /** \brief Return a reference to the embedded Cmt2s (comm port) object.
164  * \details Any manipulation of the object should be done through Cmt3.
165  * Cmt3's integrity is not guaranteed if the Cmt2s object is manipulated
166  * directly. \see refreshCache */
167  Cmt2s* getCmt2s(void);
168 
169  /** \brief Get device configuration. \details This function retrieves the
170  * complete device configuration of a single device. \note This information
171  * is cached by Cmt3, so it is available in measurement mode. */
173  /** \brief Retrieve data size. \details This function retrieves the number
174  * of bytes that are in a data message as sent by the given device. */
177  /** \brief Retrieve total device count. \details This function retrieves the
178  * total number of connected (master + slave) devices or 0 if not connected.
179  */
180  uint32_t getDeviceCount(void) const;
181  /** \brief Retrieve the DeviceId of a device given its Bus ID. \details This
182  * function retrieves the DeviceId for the device with the given Bus ID.
183  * When no devices are connected, a 0 ID is supplied. */
185  const uint8_t busId, CmtDeviceId& deviceId) const;
186  /** \brief Return device mode. \details This function retrieves the
187  * output-related settings of the device, such as the sample rate and output
188  * settings. \see setDeviceMode \note This function actually reads the
189  * device mode from the cached configuration, so it is available in
190  * measurement mode. \see refreshCache */
193  /** \brief Return device mode2. \details This function retrieves the
194  * output-related settings of the device, such as the period, skip factor
195  * and output settings. \see setDeviceMode \note This function actually
196  * reads the device mode from the cached configuration, so it is available
197  * in measurement mode. \see refreshCache */
200  /** \brief Retrieve the eMts data of the specified sensor(s). \details This
201  * function can be used to read proprietary data from one or more Motion
202  * Trackers. This data is required by higher level functions in combination
203  * with Configuration data to convert Raw data into Calibrated and
204  * Orientation data. The eMTs data is quite large, but it is cached. The
205  * first request should be done in configuration mode, but following
206  * requests can be done in measurement mode. When requesting eMTS data for a
207  * single sensor, the buffer should be at least CMT_EMTS_SIZE bytes long.
208  * When using CMT_DID_BROADCAST, the eMTS data of all connected sensors is
209  * placed into the buffer sequentially. In the latter case, the buffer
210  * should be able to hold at least sensorcount * CMT_EMTS_SIZE bytes. */
212  void* buffer, const CmtDeviceId deviceId = CMT_DID_MASTER);
213  /** \brief Return the error mode of the device. \details This function
214  * returns the error mode of the device. The error mode determines how the
215  * device handles errors. See the low-level communication documentation for
216  * more details. \see setErrorMode \note This function is only valid in
217  * configuration mode. */
220  /** \brief Return Firmware revision. \details This function retrieves the
221  * firmware version that is currently installed in the device. \note This
222  * function is only valid in configuration mode. */
224  CmtVersion& revision, const CmtDeviceId deviceId = CMT_DID_MASTER);
225  /** \brief Return the heading offset. \details This function retrieves the
226  * heading offset in radians used by the device. The valid range is -pi to
227  * +pi. The heading offset is used as a final correction on the output
228  * orientation. \see setHeading getMagneticDeclination
229  * setMagneticDeclination \note This function is only valid in configuration
230  * mode. */
232  double& heading, const CmtDeviceId deviceId = CMT_DID_MASTER);
233 
234  /** \brief Return the error code of the last user function call. */
236  /** \brief Return the last Hardware error code. \details This function
237  * returns the XsensResultValue of the last problem reported by hardware (if
238  * any). Hardware problems are all 'error' messages returned by a sensor.
239  * \param did If any problems were found, the responsible device ID will be
240  * returned in this parameter. \see clearHwError */
242  {
243  did = m_lastHwErrorDeviceId;
244  return m_lastHwError;
245  }
246  /** \brief Reset the hardware error code. \details Use this function to
247  * reset the hardware error code reported by getHwError. \see getHwError */
248  void clearHwError(void)
249  {
252  }
253 
254  /** \brief Return the location ID of a sensor. \details This function
255  * retrieves the location ID stored in the device. \see setLocationId \note
256  * This function is only valid in configuration mode. */
258  uint16_t& locationId, const CmtDeviceId deviceId = CMT_DID_MASTER);
259  /** \brief Retrieve the read position of the log file. \details This
260  * function will return the current read position in the open log file in
261  * bytes from the start. \note The read and write positions of log files are
262  * completely independent of each other. \remarks To change the read
263  * position, either use resetLogFileReadPos or manipulate the log file
264  * through getCmt2f. \see resetLogFileReadPos getCmt2f */
266 
267  /** \brief Retrieve the size of the open log file in bytes. */
269  /** \brief Retrieve the name of the open log file or an empty string if no
270  * logfile is open */
271  XsensResultValue getLogFileName(char* filename);
272  /** \brief Retrieve the name of the open log file or an empty string if no
273  * logfile is open */
274  XsensResultValue getLogFileName(wchar_t* filename);
275  /** \brief Return the stored magnetic declination. \details This function
276  * retrieves the stored local magnetic declination in radians. The valid
277  * range is -pi to +pi. The magnetic declination is used in the sensor
278  * fusion process to determine the output orientation. \see getHeading
279  * setHeading setMagneticDeclination \note This function is only valid in
280  * configuration mode. */
282  double& declination, const CmtDeviceId deviceId = CMT_DID_MASTER);
283  CmtDeviceId getMasterId(void); //! \brief Return the device Id of the first
284  //! device (master). \details \note The
285  //! deviceId is read from the cached
286  //! configuration data, so it is also
287  //! available in measurement mode.
288 
289  /** \brief Retrieve number of MT devices. \details This function will return
290  * the number of connected MT devices. Effectively, this returns the device
291  * count minus any Xbus Masters. */
292  uint16_t getMtCount(void) const;
294  const; //! \brief Return the device Id of an MT device. \details This
295  //! function returns the ID of the index'th MT (non-Xbus Master)
296  //! device connected to this object. \note The deviceId is read
297  //! from the cached configuration data, so it is also available
298  //! in measurement mode.
299  /** \brief Return the port number that this object is connected to. \details
300  * If CMT is reading from a log file, an error will be returned. */
301  XsensResultValue getPortNr(uint8_t& port) const;
302  /** \brief Return product code. \details This function retrieves the product
303  * code of the given device. \param productCode The buffer that will store
304  * the product code. This buffer should be at least 20 bytes. \remarks The
305  * product code is NOT necessarily NULL-terminated. If it is less than 20
306  * characters it will be, but if the product code is 20 characters it won't
307  * be. The recommended method is to create a buffer that is 21 bytes long
308  * and set the last byte to 0 before calling this function. \note This
309  * function is only valid in configuration mode. */
311  char* productCode, const CmtDeviceId deviceId = CMT_DID_MASTER);
312  /** \brief Return current sample frequency. \details This function
313  * determines the sample frequency of the device from the cached sample rate
314  * and skip factor and returns it. For devices connected to an Xbus Master,
315  * the values used by the Xbus Master are returned. \see setDeviceMode
316  * getDeviceMode */
318  /** \brief Return the baud rate used for serial communication. \details This
319  * function retrieves the baud rate that is used when the device is
320  * connected by a serial connection. In most cases this is the same as
321  * getBaudrate, but when an Xbus Master is connected by a Bluetooth
322  * connection, it doesn't have to be. \see setSerialBaudrate setBaudrate
323  * getBaudrate \note This function is only valid in configuration mode. */
325  /** \brief Retrieve the inbound synchronization settings of the master MT
326  * device. \details This function retrieves the current inbound
327  * synchronization settings of the master MT device (sync mode, skip factor
328  * and offset). This function does not work for Xbus Masters and should not
329  * be used for sensors connected to an Xbus Master. \see setSyncInSettings
330  * getSyncOutSettings setSyncOutSettings getSyncMode setSyncMode \note This
331  * function is only valid in configuration mode. */
333  /** \brief Retrieve the inbound synchronization mode of an MT device.
334  * \details This function retrieves the current inbound synchronization mode
335  * of the MT device. This function does not work for Xbus Masters and should
336  * not be used for sensors connected to an Xbus Master. \see setSyncInMode
337  * setSyncInSettings getSyncInSettings getSyncInSkipFactor
338  * setSyncInSkipFactor getSyncInOffset setSyncInOffset getSyncOutSettings
339  * setSyncOutSettings getSyncMode setSyncMode */
341  /** \brief Retrieve the inbound synchronization skip factor of an MT device.
342  * \details This function retrieves the current inbound synchronization skip
343  * factor of the MT device. This function does not work for Xbus Masters and
344  * should not be used for sensors connected to an Xbus Master. \see
345  * setSyncInSkipFactor setSyncInSettings getSyncInSettings getSyncInOffset
346  * setSyncInOffset getSyncOutSettings setSyncOutSettings getSyncMode
347  * setSyncMode */
349  /** \brief Retrieve the inbound synchronization offset of an MT device.
350  * \details This function retrieves the current inbound synchronization
351  * offset of the MT device. This function does not work for Xbus Masters and
352  * should not be used for sensors connected to an Xbus Master. \see
353  * setSyncInOffset setSyncInSettings getSyncInSettings getSyncInSkipFactor
354  * setSyncInSkipFactor getSyncOutSettings setSyncOutSettings getSyncMode
355  * setSyncMode */
357  /** \brief Retrieve the sync mode of the Xbus Master. \details This function
358  * requests the current synchronization mode used by the specified Xbus
359  * Master. This function is not valid for MT devices. \see setSyncMode
360  * getSyncInSettings setSyncInSettings getSyncOutSettings setSyncOutSettings
361  * \note This function is only valid in configuration mode. */
363  /** \brief Retrieve the outbound synchronization settings of the master MT
364  * device. \details This function retrieves the current outbound
365  * synchronization settings of the MT device (sync mode, skip factor, offset
366  * and pulse width). This function does not work for Xbus Masters and should
367  * not be used for sensors connected to an Xbus Master. \see
368  * setSyncOutSettings getSyncInSettings setSyncInSettings getSyncMode
369  * setSyncMode \note This function is only valid in configuration mode. */
371  /** \brief Retrieve the outbound synchronization mode of an MT device.
372  * \details This function retrieves the current outbound synchronization
373  * mode of the MT device. This function does not work for Xbus Masters and
374  * should not be used for sensors connected to an Xbus Master. \see
375  * setSyncOutMode setSyncOutSettings getSyncOutSettings getSyncOutPulseWidth
376  * setSyncOutPulseWidth getSyncOutSkipFactor setSyncOutSkipFactor
377  * getSyncOutOffset setSyncOutOffset getSyncInSettings setSyncInSettings
378  * getSyncMode setSyncMode */
380  /** \brief Retrieve the outbound synchronization pulse width of an MT
381  * device. \details This function retrieves the current outbound
382  * synchronization pulse width of the MT device. This function does not work
383  * for Xbus Masters and should not be used for sensors connected to an Xbus
384  * Master. \see setSyncOutPulseWidth setSyncOutSettings getSyncOutSettings
385  * setSyncOutMode getSyncOutMode getSyncOutSkipFactor setSyncOutSkipFactor
386  * getSyncOutOffset setSyncOutOffset getSyncInSettings setSyncInSettings
387  * getSyncMode setSyncMode */
389  /** \brief Retrieve the outbound synchronization skip factor of an MT
390  * device. \details This function retrieves the current outbound
391  * synchronization skip factor of the MT device. This function does not work
392  * for Xbus Masters and should not be used for sensors connected to an Xbus
393  * Master. \see stSyncOutSkipFactor setSyncOutSettings getSyncOutSettings
394  * setSyncOutMode getSyncOutMode getSyncOutPulseWidth setSyncOutPulseWidth
395  * getSyncOutOffset setSyncOutOffset getSyncInSettings setSyncInSettings
396  * getSyncMode setSyncMode */
398  /** \brief Retrieve the outbound synchronization offset of an MT device.
399  * \details This function retrieves the current outbound synchronization
400  * offset of the MT device. This function does not work for Xbus Masters and
401  * should not be used for sensors connected to an Xbus Master. \see
402  * setSyncOutOffset setSyncOutSettings getSyncOutSettings setSyncOutMode
403  * getSyncOutMode getSyncOutPulseWidth setSyncOutPulseWidth
404  * getSyncOutSkipFactor setSyncOutSkipFactor getSyncInSettings
405  * setSyncInSettings getSyncMode setSyncMode */
407  /** \brief Return the configuration mode timeout. \details When in config
408  * mode, the system uses a different message timeout than in measurement
409  * mode, since configuration messages can take longer to process than
410  * measurement mode messages. This function can be used to determine the
411  * current config mode timeout in ms. \see setTimeoutConfig
412  * getTimeoutMeasurement setTimeoutMeasurement */
413  uint32_t getTimeoutConfig(void) const;
414  /** \brief Return the measurement mode timeout. \details When in measurement
415  * mode, the system uses a different message timeout than in config mode,
416  * since measurement mode messages should be faster to process than config
417  * mode messages. This function can be used to determine the current
418  * measurement mode timeout in ms. \see setTimeoutMeasurement
419  * getTimeoutConfig setTimeoutConfig */
420  uint32_t getTimeoutMeasurement(void) const;
421  /** \brief Return the UTC time of the last received sample. \details This
422  * function is only valid for MTi-G sensors. In measurement mode it will
423  * retrieve the UTC time of the last received sample. In Config mode, it
424  * will retrieve the most recent UTC time. In config mode, the time returned
425  * will be requested diectly from the GPS subsystem, with several layers of
426  * messaging between the original source and the host. In measurement mode,
427  * the UTC time is requested from the GPS subsystem periodically and
428  * estimated (with a very high precision) for the remaining samples. So in
429  * config mode, the time will probably jitter more than in measurement mode.
430  */
432  /** \brief Return the dual-output mode of the XM. \details This function
433  * retrieves the dual mode output mode of the Xbus Master. The dual output
434  * mode of the Xbus Master defines whether it will send data on the serial
435  * connection (at the same baud rate as the bluetooth connection) when it is
436  * connected via Bluetooth. When set to 0, the serial communication is
437  * disabled, data is sent over the serial bus. \note When dual-mode is
438  * enabled, the Xbus Master will NOT receive command messages on the serial
439  * bus. \see setXmOutputMode */
441  /** \brief Place all connected devices into Configuration Mode. \details
442  * This function places the sensors in configuration mode. \note This
443  * function has no effect when reading from a log file */
445  /** \brief Place all connected devices into Measurement Mode. \details This
446  * function places the sensors in measurement mode. \note This function has
447  * no effect when reading from a log file */
449  /** \brief Perform an initBus request. \details See the low-level
450  * documentation for more information on the InitBus message. \see
451  * refreshCache setBusPowerState */
453  /** \brief Return whether the Cmt3 object is writing to a log file or not */
454  bool isLogging(void) const { return m_logging; }
455  /** \brief Return whether the communication port is open or not. */
456  bool isPortOpen(void) const { return (m_serial.isOpen()); }
457  /** \brief Return whether the main device is an Xbus Master or not. */
458  bool isXm(void) const;
459 
461  const char* portName,
462  const uint32_t baudRate =
463  CMT_DEFAULT_BAUD_RATE); //! \brief Open a communication channel to
464 //! the given COM port number. \details
465 //! This function is first passed through
466 //! to the Cmt2s object. Then, the device
467 //! settings are retrieved and stored
468 //! locally. This function automatically
469 //! places the device(s) in config mode,
470 //! using gotoConfig. \see gotoConfig
471 //! closePort
472 #ifdef _WIN32
474  const uint32_t portNumber,
475  const uint32_t baudRate =
476  CMT_DEFAULT_BAUD_RATE); //! \brief Open a communication channel to
477 //! the given COM port number. \details
478 //! This function is first passed through
479 //! to the Cmt2s object. Then, the device
480 //! settings are retrieved and stored
481 //! locally. This function automatically
482 //! places the device(s) in config mode,
483 //! using gotoConfig. \see gotoConfig
484 //! closePort
485 #endif
486  /** \brief Peek(take a look) at the message ID of the next message. \details
487  * This function can only be used when reading from a log file. It will find
488  * the next message in the file and place its message ID in the messageId
489  * parameter. Afterwards, the read position of the file will be restored.
490  * \remarks This function is mostly useful when dealing with a file that has
491  * more than just data messages. By using the peek function, it is possible
492  * to decide whether a readDataPacket should be called or for example
493  * getBatteryLevel or getGpsStatus. When the peek function is not used and
494  * for example getBatteryLevel is called, all messages between the current
495  * read position and the first battery level message in the file will be
496  * skipped. An alternative would be to get the read position, call the
497  * desired function (get battery level) and restore the read position, but
498  * then the moment at which the (battery level, UTC time, satellite info,
499  * etc) data becomes available will not be known. */
501  /** \brief Retrieve a data message. \details This function will attempt to
502  * read a data message from the open port or from the log file, depending on
503  * the system state. When acceptOther is set to true, the first received
504  * message will be returned. If a data message is successfully read, XRV_OK
505  * will be returned. If another message is read, XRV_OTHER will be returned
506  * and the received message will be placed in the Packet. Otherwise, an
507  * appropriate error will be returned. */
508  XsensResultValue readDataPacket(Packet* pack, bool acceptOther = false);
509  XsensResultValue requestData(Packet* pack); //!\brief Request a data
510  //! message and wait for it to
511  //! arrive. \details This
512  //! function is only useful when
513  //! the skip factor is set to
514  //! 0xFFFF.
515  /** \brief Reset all connected sensors. */
516  XsensResultValue reset(void);
517  /** \brief Perform an orientation reset on a device. \details This function
518  * performs an orientation reset. See the MT documentation for more
519  * information about Orientation resets. \note If you wish to save the
520  * setting to the device, perform the CMT_RESETORIENTATION_STORE operation
521  * while in Config mode after having performed the appropriate orientation
522  * reset in measurement mode. */
524  const CmtResetMethod method,
526  /** \brief Restore the device to factory default settings. \details This
527  * function completely restores the selected device to the default settings
528  * (115k2 baud rate, 100Hz sample frequency, factory defined scenarios).
529  * \note This function is only available in configuration mode. */
532  /** \brief Set the baudrate and possibly reconnect. \details Use this
533  * function to change the baudrate of the device. This actually tries to
534  * change the baud rate of the current connection. When reconnect is set to
535  * true, the device receives a Reset message and the port is reopened at the
536  * new baudrate. Otherwise, make sure to perform a Reset manually, since the
537  * new baudrate will not be set until a Reset has been performed. \note To
538  * change the baudrate of the serial connection while connected via
539  * Bluetooth, use setSerialBaudrate. \see getBaudrate setSerialBaudrate
540  * getSerialBaudrate \note This function is only available in configuration
541  * mode. */
543  const uint32_t baudrate, bool reconnect = true);
544  /** \brief Set the Bluetooth state of the Xbus Master. \details This
545  * function sets the state of the bluetooth communication to on or off.
546  * \note This function is only available in configuration mode. */
547  XsensResultValue setBluetoothState(const bool enabled);
548  /** \brief Switch the Xbus Master bus power on or off. \details Use this
549  * function to switch the Xbus Master Xbus power on or off. \remarks This
550  * function can be used to save a lot of power when not measuring, while
551  * still keeping a connection to the system. However, there is a relatively
552  * long startup time when restoring power as the sensors are reinitialized.
553  * \note You will need to perform an initBus and possibly a refreshCache
554  * call after switching the power back on with this function. \note This
555  * function is only available in configuration mode. \see initBus
556  * refreshCache */
557  XsensResultValue setBusPowerState(const bool enabled);
558  /** \brief Set the complete output mode of a device. \details This function
559  * updates the complete output mode of the specified device. It only updates
560  * values that are different than those reported by the device unless force
561  * is set to true. The function will automatically update only the part of
562  * the device mode that is relevant for the device. So it is possible to
563  * configure all devices, including an Xbus Master with the same mode (only
564  * the Xbus Master will update its period, while the Motion Trackers will
565  * update their output mode and settings). \note This function is only
566  * available in configuration mode. \see getDeviceMode getDeviceMode2
567  * setDeviceMode2 */
569  const CmtDeviceMode& mode, bool force,
571  /** \brief Set the complete output mode2 of a device. \details This function
572  * updates the complete output mode of the specified device. It only updates
573  * values that are different than those reported by the device unless force
574  * is set to true. The function will automatically update only the part of
575  * the device mode that is relevant for the device. So it is possible to
576  * configure all devices, including an Xbus Master with the same mode (only
577  * the Xbus Master will update its period, while the Motion Trackers will
578  * update their output mode and settings). \note This function is only
579  * available in configuration mode. \see getDeviceMode2 getDeviceMode
580  * setDeviceMode */
582  const CmtDeviceMode2& mode, bool force,
584  /** \brief Set the error mode of the device. \details This function sets the
585  * error mode of the device. The error mode determines how the device
586  * handles errors. See the low-level communication documentation for more
587  * details. \note This function is only available in configuration mode.
588  * \see getErrorMode */
590  /** \brief Set the number of times the gotoConfig function will attempt a
591  * gotoConfig before failing. \details This is especially useful when using
592  * RS485 communication or when for some reason the communication lines are
593  * not reliable. */
595  /** \brief Set the heading offset. \details This function sets the heading
596  * offset in radians used by the device. The valid range is -pi to +pi. The
597  * heading offset is used as a final correction on the output orientation.
598  * \note This function is only available in configuration mode. \see
599  * getHeading getMagneticDeclination setMagneticDeclination */
601  const double heading, const CmtDeviceId deviceId = CMT_DID_MASTER);
602  /** \brief Set the location ID of a sensor. \details This function sets the
603  * location ID stored in the device. \note This function is only available
604  * in configuration mode. \see getLocationId */
606  uint16_t locationId, const CmtDeviceId deviceId = CMT_DID_MASTER);
607  /** \brief Set the stored magnetic declination. \details This function sets
608  * the stored local magnetic declination in radians. The valid range is -pi
609  * to +pi. The magnetic declination is used in the sensor fusion process to
610  * determine the output orientation. \note This function is only available
611  * in configuration mode. \see getHeading setHeading getMagneticDeclination
612  */
614  const double declination, const CmtDeviceId deviceId = CMT_DID_MASTER);
615  /** \brief Set the inbound synchronization settings of an MT device.
616  * \details This function sets the current inbound synchronization settings
617  * of the MT device (sync mode, skip factor and offset). This function does
618  * not work for Xbus Masters and should not be used for sensors connected to
619  * an Xbus Master. \note This function is only available in configuration
620  * mode. \see getSyncInSettings getSyncOutSettings setSyncOutSettings
621  * getSyncMode setSyncMode */
623  /** \brief Set the inbound synchronization mode of an MT device. \details
624  * This function sets the current inbound synchronization mode of the MT
625  * device. This function does not work for Xbus Masters and should not be
626  * used for sensors connected to an Xbus Master. \see getSyncInMode
627  * setSyncInSettings getSyncInSettings getSyncInSkipFactor
628  * setSyncInSkipFactor getSyncInOffset setSyncInOffset getSyncOutSettings
629  * setSyncOutSettings getSyncMode setSyncMode */
631  /** \brief Set the inbound synchronization skip factor of an MT device.
632  * \details This function sets the current inbound synchronization skip
633  * factor of the MT device. This function does not work for Xbus Masters and
634  * should not be used for sensors connected to an Xbus Master. \see
635  * getSyncInSkipFactor setSyncInSettings getSyncInSettings getSyncInOffset
636  * setSyncInOffset getSyncOutSettings setSyncOutSettings getSyncMode
637  * setSyncMode */
639  /** \brief Set the inbound synchronization offset of an MT device. \details
640  * This function sets the current inbound synchronization offset of the MT
641  * device. This function does not work for Xbus Masters and should not be
642  * used for sensors connected to an Xbus Master. \see getSyncInOffset
643  * setSyncInSettings getSyncInSettings getSyncInSkipFactor
644  * setSyncInSkipFactor getSyncOutSettings setSyncOutSettings getSyncMode
645  * setSyncMode */
647  /** \brief Set the sync mode of the Xbus Master. \details This function sets
648  * the current synchronization mode used by the specified Xbus Master. This
649  * function is not valid for MT devices. \note This function is only
650  * available in configuration mode. \see getSyncMode getSyncInSettings
651  * setSyncInSettings getSyncOutSettings setSyncOutSettings */
653  /** \brief Set the outbound synchronization settings of an MT device.
654  * \details This function sets the current outbound synchronization settings
655  * of the MT device (sync mode, skip factor, offset and pulse width). This
656  * function does not work for Xbus Masters and should not be used for
657  * sensors connected to an Xbus Master. \note This function is only
658  * available in configuration mode. \see setSyncOutSettings
659  * getSyncInSettings setSyncInSettings getSyncMode setSyncMode */
661  /** \brief Set the outbound synchronization mode of an MT device. \details
662  * This function sets the current outbound synchronization mode of the MT
663  * device. This function does not work for Xbus Masters and should not be
664  * used for sensors connected to an Xbus Master. \see getSyncOutMode
665  * setSyncOutSettings getSyncOutSettings getSyncOutPulseWidth
666  * setSyncOutPulseWidth getSyncOutSkipFactor setSyncOutSkipFactor
667  * getSyncOutOffset setSyncOutOffset getSyncInSettings setSyncInSettings
668  * getSyncMode setSyncMode */
670  /** \brief Set the outbound synchronization pulse width of an MT device.
671  * \details This function sets the current outbound synchronization pulse
672  * width of the MT device. This function does not work for Xbus Masters and
673  * should not be used for sensors connected to an Xbus Master. \see
674  * getSyncOutPulseWidth setSyncOutSettings getSyncOutSettings setSyncOutMode
675  * getSyncOutMode getSyncOutSkipFactor setSyncOutSkipFactor getSyncOutOffset
676  * setSyncOutOffset getSyncInSettings setSyncInSettings getSyncMode
677  * setSyncMode */
679  /** \brief Set the outbound synchronization skip factor of an MT device.
680  * \details This function sets the current outbound synchronization skip
681  * factor of the MT device. This function does not work for Xbus Masters and
682  * should not be used for sensors connected to an Xbus Master. \see
683  * setSyncOutSkipFactor setSyncOutSettings getSyncOutSettings setSyncOutMode
684  * getSyncOutMode getSyncOutPulseWidth setSyncOutPulseWidth getSyncOutOffset
685  * setSyncOutOffset getSyncInSettings setSyncInSettings getSyncMode
686  * setSyncMode */
688  /** \brief Set the outbound synchronization offset of an MT device. \details
689  * This function sets the current outbound synchronization offset of the MT
690  * device. This function does not work for Xbus Masters and should not be
691  * used for sensors connected to an Xbus Master. \see getSyncOutOffset
692  * setSyncOutSettings getSyncOutSettings setSyncOutMode getSyncOutMode
693  * getSyncOutPulseWidth setSyncOutPulseWidth getSyncOutSkipFactor
694  * setSyncOutSkipFactor getSyncInSettings setSyncInSettings getSyncMode
695  * setSyncMode */
697  /** \brief Set the default timeout value to use in blocking operations on
698  * the communication port. */
700  {
701  return (m_lastResult = m_serial.setTimeout(ms));
702  }
703  /** \brief Set the configuration mode timeout. \details When in config mode,
704  * the system uses a different message timeout than in measurement mode,
705  * since configuration messages can take longer to process than measurement
706  * mode messages. This function can be used to set the config mode timeout
707  * in ms. \note This function is only available in configuration mode. \see
708  * getTimeoutConfig getTimeoutMeasurement setTimeoutMeasurement setTimeout
709  */
711  const uint32_t timeout = CMT3_DEFAULT_TIMEOUT_CONF);
712  /** \brief Set the measurement mode timeout. \details When in measurement
713  * mode, the system uses a different message timeout than in config mode,
714  * since measurement mode messages should be faster to process than config
715  * mode messages. This function can be used to set the measurement mode
716  * timeout in ms. \note This function is only available in configuration
717  * mode. \see getTimeoutMeasurement getTimeoutConfig setTimeoutConfig
718  * setTimeout */
720  const uint32_t timeout = CMT3_DEFAULT_TIMEOUT_MEAS);
721  /** \brief Set the dual-output mode of the XM. \details This function sets
722  * the dual mode output mode of the Xbus Master. The dual output mode of the
723  * Xbus Master defines whether it will send data on the serial connection
724  * (at the same baud rate as the bluetooth connection) when it is connected
725  * via Bluetooth. When set to 0, the serial communication is disabled, data
726  * is sent over the serial bus. \note When dual-mode is enabled, the Xbus
727  * Master will NOT receive commands on the serial bus. \note This function
728  * is only available in configuration mode. \see getXmDualOutputMode */
730  /** \brief Switch the connected Xbus Master. \details This function tell the
731  * connected Xbus Master to power down. This differs from setBusPowerState,
732  * because this function actually powers down the Xbus Master itself, while
733  * setBusPowerState only powers down the bus controlled by the Xbus Master.
734  * After This function is called, the Xbus Master must be manually switched
735  * on to make it operational again. \see setBusPowerState */
737  /** Update device information stored on host PC. \details Some device
738  * information is cached on the host PC for faster access. The Cmt3
739  * automatically tries to keep the cache up to date. But when unexpected
740  * things happen, such as custom messages that change the settings, or a
741  * power-cycle, then the user may need to tell Cmt3 to update its cache.
742  * When both a file and a port are open, the file parameter can be used to
743  * indicate what data source to read from (true is file, false is port).
744  * \note This function is only available in configuration mode. */
745  XsensResultValue refreshCache(const bool file = false);
746  /** \brief Wait for a data message to arrive. \details The function waits
747  * for a data message to arrive or until a timeout occurs. The function will
748  * also accept error messages. */
750  /** \brief Create a log file for incoming messages. \details This function
751  * creates a log file for recording incoming messages. The Cmt3 object must
752  * be connected to a communication port or the function will fail. \param
753  * filename The name of the file to use as a log file. A fully qualified
754  * (local) path+filename is recommended. \param startLogging When set to
755  * true (default), Cmt3 will immediately start logging incoming messages to
756  * the file, otherwise setLogMode must be called first before logging is
757  * started. \remarks If a writable file of the same name already exists in
758  * the target location, it will be overwritten without warning. \see
759  * closeLogFile isLogFileOpen openLogFile setLogMode \note This function is
760  * available in configuration AND in measurement mode. */
762  const char* filename, bool startLogging = false);
763  /** \brief Create a log file for incoming messages. \details This function
764  * creates a log file for recording incoming messages. The Cmt3 object must
765  * be connected to a communication port or the function will fail. \param
766  * filename The name of the file to use as a log file. A fully qualified
767  * (local) path+filename is recommended. \param startLogging When set to
768  * true (default), Cmt3 will immediately start logging incoming messages to
769  * the file, otherwise setLogMode must be called first before logging is
770  * started. \remarks If a writable file of the same name already exists in
771  * the target location, it will be overwritten without warning. \see
772  * closeLogFile isLogFileOpen openLogFile setLogMode \note This function is
773  * available in configuration AND in measurement mode. */
775  const wchar_t* filename, bool startLogging = false);
776  /** \brief Close an open log file. \details This function closes the logfile
777  * if it was open. \param del When set to true, the file will be deleted
778  * after closing if it is not read-only. This is mostly useful for temporary
779  * log-files. \see createLogFile isLogFileOpen openLogFile setLogMode */
780  XsensResultValue closeLogFile(bool del = false);
781  /** \brief Return whether or not(true or false) the supplied file is open.
782  * \details When the filename parameter is nullptr or empty "", the function
783  * will simply return whether a log file is open. Otherwise, the supplied
784  * name will be checked against the name of the open log file as well.
785  * \return true if the log file is open, false if it isn't \see closeLogFile
786  * createLogFile openLogFile setLogMode */
787  bool isLogFileOpen(const char* filename) const;
788  /** \brief Return whether or not(true or false) the supplied file is open.
789  * \details When the filename parameter is nullptr or empty "", the function
790  * will simply return whether a log file is open. Otherwise, the supplied
791  * name will be checked against the name of the open log file as well.
792  * \return true if the log file is open, false if it isn't \see closeLogFile
793  * createLogFile openLogFile setLogMode */
794  bool isLogFileOpen(const wchar_t* filename) const;
795  /** \brief Open a log file for input. \details This function opens the
796  * supplied log file for reading. The function will fail if a serial
797  * connection is currently open. \param filename The name of the file to
798  * open. It is recommended to use a fully qualified path+filename. \note
799  * This function is only available in configuration mode. \see closeLogFile
800  * createLogFile isLogFileOpen setLogMode */
801  XsensResultValue openLogFile(const char* filename);
802  /** \brief Open a log file for input. \details This function opens the
803  * supplied log file for reading. The function will fail if a serial
804  * connection is currently open. \param filename The name of the file to
805  * open. It is recommended to use a fully qualified path+filename. \note
806  * This function is only available in configuration mode. \see closeLogFile
807  * createLogFile isLogFileOpen setLogMode */
808  XsensResultValue openLogFile(const wchar_t* filename);
809  /** \brief Set whether to read from comm port or file. \details While it is
810  * not possible to open a port or file while the other is open, it is
811  * possible to create a log file while a port is open. In some rare cases it
812  * may be required to log data and read it back while the port remains open
813  * and then continue logging in the same file. This is not recommended.
814  * Instead, log to a file, close it and then open it in another Cmt3 object.
815  * However, if you must do this, then this function can be used to specify
816  * that you want to switch between reading from the log file (true) or port
817  * (false). */
818  XsensResultValue setDataSource(bool readFromFile);
819  /** \brief Set the logging mode. \details This function sets the logging
820  * mode to enabled (true) or disabled (false). When enabled, all received
821  * messages are logged to the file. \remarks Some information that is cached
822  * on the host PC will generate faked messages in the log file. Eg.
823  * getConfiguration and some others. */
824  XsensResultValue setLogMode(bool active);
825  /** \brief Restart reading from the start of the open log file. \details
826  * This function resets the read position to the start of the open log file.
827  * Only the read position is affected, the write position remains the same.
828  * \see openLogFile */
831  const Message& msg); //! \brief Write the specified message to the open
832  //! log file. \details This function can be used
833  //! to add custom messages to a log file. \note A
834  //! typical log file will only contain acknowledge
835  //! messages, not request messages. \see
836  //! createLogFile
837  /** \brief Retrieve a list of the available scenarios. \details Use this
838  * function to retrieve a list of all scenarios available in a Motion
839  * Tracker. See the supplied documentation for more information about
840  * scenarios. \param scenarios A buffer for storing the available scenarios.
841  * The supplied buffer should be able to contain at least 6 scenarios, but
842  * for future devices a larger buffer is advised. Use
843  * CMT_MAX_SCENARIOS_IN_MT+1. The list is terminated by a scenario that has
844  * type 0. \remarks The type of any of the returned scenarios can be safely
845  * supplied to the setScenario function. \see getScenario setScenario \note
846  * This function is only available in configuration mode. */
848  CmtScenario* scenarios, const CmtDeviceId deviceId = CMT_DID_MASTER);
849  /** \brief Get the currently active scenario from a Motion Tracker. \details
850  * This function retrieves the scenario currently used by the specified
851  * device when outputting orientation and/or position data. \see
852  * getAvailableScenarios setScenario \note This function is only available
853  * in configuration mode. */
855  uint8_t& scenarioType, uint8_t& scenarioVersion,
857  /** \brief Specify the scenario to use in the sensor. \details This function
858  * specifies the scenario that the sensor should use for converting raw data
859  * into orientation and/or position data. This must be one of the scenarios
860  * in the list supplied by getAvailableScenarios. \see getAvailableScenarios
861  * getScenario \note This function is only available in configuration mode.
862  */
864  const uint8_t scenarioType,
866  /** \brief Retrieve the currently used magnitude of the gravity vector.
867  * \details The magnitude of the gravity vector is used to determine
868  * absolute acceleration from measured acceleration. \see
869  * setGravityMagnitude \note This function is only available in
870  * configuration mode. */
872  double& magnitude, const CmtDeviceId deviceId = CMT_DID_MASTER);
873  /** \brief Set the currently used magnitude of the gravity vector. \details
874  * The magnitude of the gravity vector is used to determine absolute
875  * acceleration from measured acceleration. Use this function to set tit to
876  * a custom value in m/s2. The default value of 9.812687357684514m/s2 should
877  * be fine for most places on earth, but in some cases the gravity may be
878  * drastically different from standard Earth gravity (eg. space, deep
879  * subterranean/submarine, polar regions, gravitational anomalies. See also
880  * <A
881  * HREF="http://www.abc.net.au/science/news/stories/s911917.htm">http://www.abc.net.au/science/news/stories/s911917.htm</A>
882  * and <A
883  * HREF="http://en.wikipedia.org/wiki/Earth%27s_gravity#Comparative_gravities_in_various_cities_around_the_world">http://en.wikipedia.org/wiki/Earth%27s_gravity#Comparative_gravities_in_various_cities_around_the_world</A>)
884  * \note Correct orientation output cannot be guaranteed when an incorrect
885  * value is supplied for the gravity. Changing this value is at your own
886  * risk. \see getGravityMagnitude \remarks In future versions, the MTi-G may
887  * be able to estimate the local gravity magnitude on its own. \note This
888  * function is only available in configuration mode. */
890  const double magnitude, const CmtDeviceId deviceId = CMT_DID_MASTER);
891  /** \brief Get the currently used GPS lever arm. \details Use this function
892  * to retrieve the vector currently used as the GPS lever arm in meters. The
893  * GPS lever arm is the relative position of the GPS antenna to the MTi-G
894  * unit. The arm is specified in the object coordinate system. See the
895  * manual for more information on coordinate systems, alignment resets and
896  * the lever arm. \see setGpsLeverArm \note This function is only available
897  * in configuration mode. \note This function is only available for MTi-G
898  * devices. */
901  /** \brief Request the status of the GPS satellites in orbit. \details This
902  * function requests the GPS satellite status information from the GPS
903  * subsystem. In config mode, this information is requested from the GPS
904  * subsystem immediately, which can cause a relatively long delay (250ms)
905  * before a reply is received. In measurement mode, the satellite status is
906  * regularly polled internally and the latest status is returned immediately
907  * when this function is called. */
910  /** \brief Set the currently used GPS lever arm. \details Use this function
911  * to set the vector currently used as the GPS lever arm. The GPS lever arm
912  * is the relative position of the GPS antenna to the MTi-G unit. The arm is
913  * specified in the object coordinate system and in meters. See the manual
914  * for more information on coordinate systems, alignment resets and the
915  * lever arm. \see getGpsLeverArm \note This function is only available in
916  * configuration mode. \note This function is only available for MTi-G
917  * devices. */
919  const CmtVector& arm, const CmtDeviceId deviceId = CMT_DID_MASTER);
920  /** \brief Store important components of the XKF filter state to
921  * non-volatile memory. \details This function allows you to store some
922  * critical components of the internal XKF filter state to non-volatile
923  * memory. The stored settings will be used to initialize the filter
924  * whenever the sensor is switched to Measurement mode. \note This function
925  * is only available in Config mode. */
927 };
928 
929 } // end of xsens namespace
930 
931 #endif // _CMT3_H_2006_04_14
void fillRtc(Packet *pack)
Internal function to compute the RTC value.
Definition: cmt3.cpp:377
XsensResultValue initBus(void)
Perform an initBus request.
Definition: cmt3.cpp:1545
High-level communication class.
Definition: cmt3.h:39
A structure for storing the firmware version.
Definition: cmtdef.h:936
Operation was performed successfully.
Definition: xsens_std.h:34
CmtDeviceId getMasterId(void)
Definition: cmt3.cpp:1002
XsensResultValue getSyncOutSkipFactor(uint16_t &skipFactor)
Retrieve the outbound synchronization skip factor of an MT device.
Definition: cmt3.cpp:1369
XsensResultValue getSyncMode(uint8_t &mode)
Retrieve the sync mode of the Xbus Master.
Definition: cmt3.cpp:1248
XsensResultValue getMagneticDeclination(double &declination, const CmtDeviceId deviceId=CMT_DID_MASTER)
Return the stored magnetic declination.
Definition: cmt3.cpp:989
XsensResultValue getPortNr(uint8_t &port) const
Return the device Id of an MT device.
Definition: cmt3.cpp:1038
double m_rtcMsPerSample
ms per sample = 1000 / sample frequency.
Definition: cmt3.h:49
XsensResultValue setSyncOutSkipFactor(const uint16_t skipFactor)
Set the outbound synchronization skip factor of an MT device.
Definition: cmt3.cpp:2504
uint16_t m_firstItem
The index of the first formatting item.
Definition: cmt3.h:71
uint16_t m_skip
The skip factor of the port.
Definition: cmt3.h:55
__int64 CmtFilePos
Definition: cmtf.h:25
TimeStamp m_rtcStart
The start of the RTC counter, the time of arrival of sample 0.
Definition: cmt3.h:57
unsigned __int16 uint16_t
Definition: rptypes.h:44
Mid-level serial communication class.
Definition: cmt2.h:41
XsensResultValue setBusPowerState(const bool enabled)
Switch the Xbus Master bus power on or off.
Definition: cmt3.cpp:1989
uint32_t getDeviceCount(void) const
Retrieve total device count.
Definition: cmt3.cpp:582
XsensResultValue getGpsLeverArm(CmtVector &arm, const CmtDeviceId deviceId=CMT_DID_MASTER)
Get the currently used GPS lever arm.
Definition: cmt3.cpp:3025
XsensResultValue openPort(const char *portName, const uint32_t baudRate=CMT_DEFAULT_BAUD_RATE)
Definition: cmt3.cpp:1566
XsensResultValue setSyncOutPulseWidth(const uint32_t pulseWidth)
Set the outbound synchronization pulse width of an MT device.
Definition: cmt3.cpp:2477
XsensResultValue getGpsStatus(CmtGpsStatus &status, const CmtDeviceId deviceId=CMT_DID_MASTER)
Request the status of the GPS satellites in orbit.
Definition: cmt3.cpp:3038
bool m_readFromFile
Indicates whether to read from the log file or from the serial port.
Definition: cmt3.h:82
XsensResultValue refreshCache(const bool file=false)
Update device information stored on host PC.
Definition: cmt3.cpp:2594
XsensResultValue getSyncOutPulseWidth(uint32_t &pulseWidth)
Retrieve the outbound synchronization pulse width of an MT device.
Definition: cmt3.cpp:1341
XsensResultValue getBatteryLevel(uint8_t &level)
Get an Xbus Master&#39;s battery level.
Definition: cmt3.cpp:420
Cmt2f * getCmt2f(void)
Return a reference to the embedded Cmt2f (logfile) object.
Definition: cmt3.cpp:510
GLuint buffer
Definition: glext.h:3917
XsensResultValue getLogFileReadPosition(CmtFilePos &pos)
Retrieve the read position of the log file.
Definition: cmt3.cpp:931
XsensResultValue getDeviceId(const uint8_t busId, CmtDeviceId &deviceId) const
Retrieve the DeviceId of a device given its Bus ID.
Definition: cmt3.cpp:597
GLenum GLint ref
Definition: glext.h:4050
XsensResultValue setDeviceMode(const CmtDeviceMode &mode, bool force, const CmtDeviceId deviceId=CMT_DID_MASTER)
Set the complete output mode of a device.
Definition: cmt3.cpp:2001
XsensResultValue readDataPacket(Packet *pack, bool acceptOther=false)
Retrieve a data message.
Definition: cmt3.cpp:1712
bool m_logging
Indicates whether to write all received messages to the logfile or not, automatically set to true by ...
Definition: cmt3.h:87
A structure for storing sync out settings.
Definition: cmtdef.h:963
XsensResultValue getDeviceMode(CmtDeviceMode &mode, const CmtDeviceId deviceId=CMT_DID_MASTER)
Return device mode.
Definition: cmt3.cpp:616
uint32_t m_rtcCount
The long sample counter (normal counter wraps at 64k).
Definition: cmt3.h:59
XsensResultValue restoreFactoryDefaults(const CmtDeviceId deviceId=CMT_DID_MASTER)
Restore the device to factory default settings.
Definition: cmt3.cpp:1862
GLintptr offset
Definition: glext.h:3925
XsensResultValue resetLogFileReadPos(void)
Restart reading from the start of the open log file.
Definition: cmt3.cpp:2924
XsensResultValue setSyncInMode(const uint16_t mode)
Set the inbound synchronization mode of an MT device.
Definition: cmt3.cpp:2294
XsensResultValue getLocationId(uint16_t &locationId, const CmtDeviceId deviceId=CMT_DID_MASTER)
Return the location ID of a sensor.
Definition: cmt3.cpp:918
bool m_rtcInitialized
Indicates if the rtc is initialised or not.
Definition: cmt3.h:84
#define CMT_DEFAULT_BAUD_RATE
The default baud rate of the Cmt1s serial communication.
Definition: cmtdef.h:798
bool isLogFileOpen(const char *filename) const
Return whether or not(true or false) the supplied file is open.
Definition: cmt3.cpp:2797
uint16_t m_gotoConfigTries
The number of times a goto config is attempted before the function fails.
Definition: cmt3.h:74
XsensResultValue gotoMeasurement(void)
Place all connected devices into Measurement Mode.
Definition: cmt3.cpp:1520
XsensResultValue setTimeout(const uint32_t ms)
Set the default timeout value to use in blocking operations on the communication port.
Definition: cmt3.h:699
A structure for storing UTC Time values.
Definition: cmtdef.h:988
XsensResultValue reset(void)
Request a data.
Definition: cmt3.cpp:1829
XsensResultValue getSyncInOffset(uint32_t &offset)
Retrieve the inbound synchronization offset of an MT device.
Definition: cmt3.cpp:1221
XsensResultValue getMtDeviceId(const uint8_t index, CmtDeviceId &deviceId) const
Definition: cmt3.cpp:1024
A structure for storing sync in settings.
Definition: cmtdef.h:944
XsensResultValue getSyncInSettings(CmtSyncInSettings &settings)
Retrieve the inbound synchronization settings of the master MT device.
Definition: cmt3.cpp:1127
XsensResultValue writeMessageToLogFile(const Message &msg)
Definition: cmt3.cpp:2933
XsensResultValue setErrorMode(const uint16_t mode)
Set the error mode of the device.
Definition: cmt3.cpp:2162
uint16_t getMtCount(void) const
Return the device Id of the first.
Definition: cmt3.cpp:1013
XsensResultValue setXmPowerOff(void)
Switch the connected Xbus Master.
Definition: cmt3.cpp:2230
XsensResultValue setDeviceMode2(const CmtDeviceMode2 &mode, bool force, const CmtDeviceId deviceId=CMT_DID_MASTER)
Set the complete output mode2 of a device.
Definition: cmt3.cpp:2020
XsensResultValue getConfiguration(CmtDeviceConfiguration &configuration)
Get device configuration.
Definition: cmt3.cpp:515
XsensResultValue getSyncOutSettings(CmtSyncOutSettings &settings)
Retrieve the outbound synchronization settings of the master MT device.
Definition: cmt3.cpp:1260
XsensResultValue getHeading(double &heading, const CmtDeviceId deviceId=CMT_DID_MASTER)
Return the heading offset.
Definition: cmt3.cpp:906
bool isXm(void) const
Return whether the main device is an Xbus Master or not.
Definition: cmt3.cpp:1558
A structure containing MT data + timestamp and formatting information.
Definition: cmtpacket.h:24
XsensResultValue closeLogFile(bool del=false)
Close an open log file.
Definition: cmt3.cpp:2783
void clearHwError(void)
Reset the hardware error code.
Definition: cmt3.h:248
unsigned char uint8_t
Definition: rptypes.h:41
Cmt2s * getCmt2s(void)
Return a reference to the embedded Cmt2s (comm port) object.
Definition: cmt3.cpp:512
XsensResultValue setBaudrate(const uint32_t baudrate, bool reconnect=true)
Set the baudrate and possibly reconnect.
Definition: cmt3.cpp:1888
XsensResultValue getAvailableScenarios(CmtScenario *scenarios, const CmtDeviceId deviceId=CMT_DID_MASTER)
Write the specified message to the open.
Definition: cmt3.cpp:2944
XsensResultValue getBusId(uint8_t &busId, const CmtDeviceId deviceId=CMT_DID_MASTER) const
Retrieve the BusId of a device.
Definition: cmt3.cpp:457
Cmt3()
Default constructor, initializes all members to their default values.
Definition: cmt3.cpp:325
XsensResultValue setDataSource(bool readFromFile)
Set whether to read from comm port or file.
Definition: cmt3.cpp:2881
XsensResultValue setSyncOutSettings(const CmtSyncOutSettings &settings)
Set the outbound synchronization settings of an MT device.
Definition: cmt3.cpp:2389
XsensResultValue setMagneticDeclination(const double declination, const CmtDeviceId deviceId=CMT_DID_MASTER)
Set the stored magnetic declination.
Definition: cmt3.cpp:2216
uint8_t getBusIdInternal(const CmtDeviceId devId) const
Find a device Id in the list and return its busId.
Definition: cmt3.cpp:479
Structure containing a full device configuration as returned by the ReqConfig message.
Definition: cmtdef.h:865
XsensResultValue setGpsLeverArm(const CmtVector &arm, const CmtDeviceId deviceId=CMT_DID_MASTER)
Set the currently used GPS lever arm.
Definition: cmt3.cpp:3055
XsensResultValue setXmOutputMode(const uint8_t mode)
Set the dual-output mode of the XM.
Definition: cmt3.cpp:2581
XsensResultValue requestData(Packet *pack)
Definition: cmt3.cpp:1816
#define CMT_DID_MASTER
Definition: cmtdef.h:929
The mid-level file communication class.
Definition: cmt2.h:193
uint32_t m_baudrate
The baudrate that was last set to be used by the port.
Definition: cmt3.h:63
XsensResultValue getLogFileName(char *filename)
Retrieve the name of the open log file or an empty string if no logfile is open.
Definition: cmt3.cpp:964
XsensResultValue openLogFile(const char *filename)
Open a log file for input.
Definition: cmt3.cpp:2835
GLuint index
Definition: glext.h:4054
bool isLogging(void) const
Return whether the Cmt3 object is writing to a log file or not.
Definition: cmt3.h:454
XsensResultValue getErrorMode(uint16_t &mode, const CmtDeviceId deviceId=CMT_DID_MASTER)
Return the error mode of the device.
Definition: cmt3.cpp:819
XsensResultValue setGravityMagnitude(const double magnitude, const CmtDeviceId deviceId=CMT_DID_MASTER)
Set the currently used magnitude of the gravity vector.
Definition: cmt3.cpp:3013
XsensResultValue getScenario(uint8_t &scenarioType, uint8_t &scenarioVersion, const CmtDeviceId deviceId=CMT_DID_MASTER)
Get the currently active scenario from a Motion Tracker.
Definition: cmt3.cpp:2979
XsensResultValue
Xsens return values.
Definition: xsens_std.h:31
XsensResultValue createLogFile(const char *filename, bool startLogging=false)
Create a log file for incoming messages.
Definition: cmt3.cpp:2717
CmtDeviceId m_lastHwErrorDeviceId
Contains the Device ID of the device that caused the last hardware error.
Definition: cmt3.h:92
uint32_t m_timeoutMeas
The measurement mode timeout.
Definition: cmt3.h:67
Cmt2s m_serial
The (optional) CMT level 2 serial object that this class operates on.
Definition: cmt3.h:44
XsensResultValue getUtcTime(CmtUtcTime &utc, const CmtDeviceId deviceId)
Return the UTC time of the last received sample.
Definition: cmt3.cpp:1424
XsensResultValue getSyncInMode(uint16_t &mode)
Retrieve the inbound synchronization mode of an MT device.
Definition: cmt3.cpp:1173
uint64_t TimeStamp
A real-time timestamp (ms)
Definition: xsens_time.h:24
XsensResultValue setSyncOutOffset(const uint32_t offset)
Set the outbound synchronization offset of an MT device.
Definition: cmt3.cpp:2530
XsensResultValue getSerialBaudrate(uint32_t &baudrate)
Return the baud rate used for serial communication.
Definition: cmt3.cpp:1078
XsensResultValue storeXkfState(const CmtDeviceId deviceId=CMT_DID_MASTER)
Store important components of the XKF filter state to non-volatile memory.
Definition: cmt3.cpp:3093
uint32_t getTimeoutConfig(void) const
Return the configuration mode timeout.
Definition: cmt3.cpp:1419
~Cmt3()
Destructor, de-initializes, frees memory allocated for buffers, etc.
Definition: cmt3.cpp:347
XsensResultValue getProductCode(char *productCode, const CmtDeviceId deviceId=CMT_DID_MASTER)
Return product code.
Definition: cmt3.cpp:1049
XsensResultValue getDataLength(uint32_t &length, const CmtDeviceId deviceId=CMT_DID_MASTER)
Retrieve data size.
Definition: cmt3.cpp:569
XsensResultValue setTimeoutMeasurement(const uint32_t timeout=CMT3_DEFAULT_TIMEOUT_MEAS)
Set the measurement mode timeout.
Definition: cmt3.cpp:2569
XsensResultValue getHwError(CmtDeviceId &did) const
Return the last Hardware error code.
Definition: cmt3.h:241
uint32_t m_timeoutConf
The config mode timeout.
Definition: cmt3.h:65
XsensResultValue getSyncOutMode(uint16_t &mode)
Retrieve the outbound synchronization mode of an MT device.
Definition: cmt3.cpp:1317
A structure for storing device modes using period and skip factor (new default)
Definition: cmtdef.h:1051
GLint mode
Definition: glext.h:5669
#define CMT3_DEFAULT_TIMEOUT_MEAS
The default timeout value for L3 data reading.
Definition: cmtdef.h:809
XsensResultValue getEMtsData(void *buffer, const CmtDeviceId deviceId=CMT_DID_MASTER)
Retrieve the eMts data of the specified sensor(s).
Definition: cmt3.cpp:658
XsensResultValue setLocationId(uint16_t locationId, const CmtDeviceId deviceId=CMT_DID_MASTER)
Set the location ID of a sensor.
Definition: cmt3.cpp:2203
bool m_measuring
Keeps track of whether the connected device is measuring or being configured.
Definition: cmt3.h:77
XsensResultValue setTimeoutConfig(const uint32_t timeout=CMT3_DEFAULT_TIMEOUT_CONF)
Set the configuration mode timeout.
Definition: cmt3.cpp:2557
XsensResultValue setSyncInSettings(const CmtSyncInSettings &settings)
Set the inbound synchronization settings of an MT device.
Definition: cmt3.cpp:2243
CmtMtTimeStamp m_rtcLastSc
The last received sample counter, used to determine wrap-around.
Definition: cmt3.h:61
XsensResultValue setTimeout(const uint32_t ms=CMT2_DEFAULT_TIMEOUT)
Set the default timeout value to use in blocking operations.
Definition: cmt2.cpp:370
XsensResultValue m_lastResult
The last result of an operation.
Definition: cmt3.h:69
bool isOpen(void) const
Return whether the communication port is open or not.
Definition: cmt2.h:120
bool m_useRtc
Indicates if the RTC should be computed or not (to save CPU time).
Definition: cmt3.h:96
bool isPortOpen(void) const
Return whether the communication port is open or not.
Definition: cmt3.h:456
XsensResultValue m_lastHwError
Contains the last error reported by hardware.
Definition: cmt3.h:89
XsensResultValue setSyncInSkipFactor(const uint16_t skipFactor)
Set the inbound synchronization skip factor of an MT device.
Definition: cmt3.cpp:2320
GLuint GLsizei GLsizei * length
Definition: glext.h:4064
XsensResultValue setSyncMode(const uint8_t mode)
Set the sync mode of the Xbus Master.
Definition: cmt3.cpp:2375
GLint level
Definition: glext.h:3600
uint32_t getTimeoutMeasurement(void) const
Return the measurement mode timeout.
Definition: cmt3.cpp:1421
uint16_t getSampleFrequency(void)
Return current sample frequency.
Definition: cmt3.cpp:1066
XsensResultValue setBluetoothState(const bool enabled)
Set the Bluetooth state of the Xbus Master.
Definition: cmt3.cpp:1976
_u8 status
Definition: rplidar_cmd.h:19
CmtResetMethod
Definition: cmtdef.h:835
XsensResultValue waitForDataMessage(Packet *pack)
Wait for a data message to arrive.
Definition: cmt3.cpp:2674
XsensResultValue getDeviceMode2(CmtDeviceMode2 &mode, const CmtDeviceId deviceId=CMT_DID_MASTER)
Return device mode2.
Definition: cmt3.cpp:636
XsensResultValue setLogMode(bool active)
Set the logging mode.
Definition: cmt3.cpp:2912
The namespace of all Xsens software since 2006.
Definition: cmt1.cpp:95
XsensResultValue peekLogMessageId(uint8_t &messageId)
Open a communication channel to.
Definition: cmt3.cpp:1686
CmtDeviceConfiguration m_config
The configuration of the connected devices.
Definition: cmt3.h:102
XsensResultValue resetOrientation(const CmtResetMethod method, const CmtDeviceId deviceId=CMT_DID_MASTER)
Perform an orientation reset on a device.
Definition: cmt3.cpp:1848
XsensResultValue getFirmwareRevision(CmtVersion &revision, const CmtDeviceId deviceId=CMT_DID_MASTER)
Return Firmware revision.
Definition: cmt3.cpp:889
XsensResultValue getSyncInSkipFactor(uint16_t &skipFactor)
Retrieve the inbound synchronization skip factor of an MT device.
Definition: cmt3.cpp:1197
XsensResultValue getLogFileSize(CmtFilePos &size)
Retrieve the size of the open log file in bytes.
Definition: cmt3.cpp:947
XsensResultValue getBluetoothState(bool &enabled)
Get the state of the bluetooth communication.
Definition: cmt3.cpp:444
XsensResultValue closePort(bool gotoConfigFirst=true)
Close the communication port.
Definition: cmt3.cpp:359
XsensResultValue setScenario(const uint8_t scenarioType, const CmtDeviceId deviceId=CMT_DID_MASTER)
Specify the scenario to use in the sensor.
Definition: cmt3.cpp:2991
GLsizeiptr size
Definition: glext.h:3923
void * m_eMtsData[CMT_MAX_DEVICES_PER_PORT]
Cached eMTS data.
Definition: cmt3.h:98
XsensResultValue getBusPowerState(bool &enabled)
Get the state of the Xbus power.
Definition: cmt3.cpp:497
bool m_detailedScan
Automatically scan for device details during open.
Definition: cmt3.h:80
A structure for storing device modes.
Definition: cmtdef.h:1004
unsigned __int32 uint32_t
Definition: rptypes.h:47
XsensResultValue setSyncInOffset(const uint32_t offset)
Set the inbound synchronization offset of an MT device.
Definition: cmt3.cpp:2346
XsensResultValue getLastResult(void) const
Return the error code of the last user function call.
Definition: cmt3.h:235
XsensResultValue getBaudrate(uint32_t &baudrate)
Get the baudrate used by a port.
Definition: cmt3.cpp:432
#define CMT_MAX_DEVICES_PER_PORT
Definition: cmtdef.h:774
#define deviceId
Definition: CIMUXSens.cpp:40
uint32_t CmtDeviceId
The type of a Device Id.
Definition: cmtdef.h:854
XsensResultValue setHeading(const double heading, const CmtDeviceId deviceId=CMT_DID_MASTER)
Set the heading offset.
Definition: cmt3.cpp:2191
XsensResultValue setSyncOutMode(const uint16_t mode)
Set the outbound synchronization mode of an MT device.
Definition: cmt3.cpp:2451
uint16_t CmtMtTimeStamp
An MT timestamp (sample count)
Definition: cmtdef.h:924
A structure for storing scenario information.
Definition: cmtdef.h:1099
XsensResultValue getXmOutputMode(uint8_t &mode)
Return the dual-output mode of the XM.
Definition: cmt3.cpp:1448
XsensResultValue gotoConfig(void)
Place all connected devices into Configuration Mode.
Definition: cmt3.cpp:1460
Class for storing a single message.
Definition: cmtmessage.h:83
uint16_t m_period
The sample period of the port.
Definition: cmt3.h:53
#define CMT3_DEFAULT_TIMEOUT_CONF
The default timeout value for L3 configuration settings.
Definition: cmtdef.h:811
XsensResultValue setGotoConfigTries(const uint16_t tries)
Set the number of times the gotoConfig function will attempt a gotoConfig before failing.
Definition: cmt3.cpp:2180
Cmt2f m_logFile
The (optional) CMT level 2 logfile object that this class operates on.
Definition: cmt3.h:47
XsensResultValue getGravityMagnitude(double &magnitude, const CmtDeviceId deviceId=CMT_DID_MASTER)
Retrieve the currently used magnitude of the gravity vector.
Definition: cmt3.cpp:3002
XsensResultValue getSyncOutOffset(uint32_t &offset)
Retrieve the outbound synchronization offset of an MT device.
Definition: cmt3.cpp:1393



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