Main MRPT website > C++ reference for MRPT 1.5.7
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-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 _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 /*! \brief High-level communication class.
30 
31  The class uses CMT level 2, but does not inherit from it. If software needs to access
32  the level 2 components, it needs to be done through the getCmt2s() and getCmt2f() functions.
33 
34  All device identification is done through device Ids in CMT level 3.
35 */
36 class Cmt3 {
37 //// data & structures ////
38 protected:
39  Cmt2s m_serial; //!< The (optional) CMT level 2 serial object that this class operates on.
40  Cmt2f m_logFile; //!< The (optional) CMT level 2 logfile object that this class operates on.
41  double m_rtcMsPerSample; //!< ms per sample = 1000 / sample frequency.
42  //double m_sampleFrequency; //!< The sample frequency of the port, computed from sampling period and output skip factor.
43  uint16_t m_period; //!< The sample period of the port.
44  uint16_t m_skip; //!< The skip factor of the port.
45  TimeStamp m_rtcStart; //!< The start of the RTC counter, the time of arrival of sample 0.
46  uint32_t m_rtcCount; //!< The long sample counter (normal counter wraps at 64k).
47  CmtMtTimeStamp m_rtcLastSc; //!< The last received sample counter, used to determine wrap-around.
48  uint32_t m_baudrate; //!< The baudrate that was last set to be used by the port.
49  uint32_t m_timeoutConf; //!< The config mode timeout.
50  uint32_t m_timeoutMeas; //!< The measurement mode timeout.
51  mutable XsensResultValue m_lastResult; //!< The last result of an operation.
52  uint16_t m_firstItem; //!< The index of the first formatting item.
53  uint16_t m_gotoConfigTries; //!< The number of times a goto config is attempted before the function fails.
54  bool m_measuring; //!< Keeps track of whether the connected device is measuring or being configured.
55  bool m_detailedScan; //!< Automatically scan for device details during open. Default is true (recommended).
56  bool m_readFromFile; //!< Indicates whether to read from the log file or from the serial port.
57  bool m_rtcInitialized; //!< Indicates if the rtc is initialised or not.
58  bool m_logging; //!< Indicates whether to write all received messages to the logfile or not, automatically set to true by createLogFile.
59  XsensResultValue m_lastHwError; //!< Contains the last error reported by hardware.
60  CmtDeviceId m_lastHwErrorDeviceId; //!< Contains the Device ID of the device that caused the last hardware error.
61 
62 public:
63  bool m_useRtc; //!< Indicates if the RTC should be computed or not (to save CPU time).
64  void* m_eMtsData[CMT_MAX_DEVICES_PER_PORT]; //!< Cached eMTS data.
65 
66 protected:
67  CmtDeviceConfiguration m_config; //!< The configuration of the connected devices.
68 
69 //// functions ///////////////////////////////////////////////////////////////////////////////////
70 protected:
71  Cmt3(const Cmt3& ref); //!< This object cannot be copied, so this function is not implemented.
72  void fillRtc(Packet* pack); //!< Internal function to compute the RTC value.
73  uint8_t getBusIdInternal(const CmtDeviceId devId) const; //!< \brief Find a device Id in the list and return its busId. \details CmtDeviceId 0= busId 0= broadcast. A CMT_BID_INVALID value is also possible and indicates that the devId was not found.
74 
75 public:
76 
77  Cmt3(); //!< Default constructor, initializes all members to their default values.
78  ~Cmt3(); //!< Destructor, de-initializes, frees memory allocated for buffers, etc.
79 
80  XsensResultValue closePort(bool gotoConfigFirst=true); //!< \brief Close the communication port. \details This function places the device in configuration mode and closes the communication port, ending all further communication with the device.
81  XsensResultValue getBatteryLevel(uint8_t& level); //!< \brief Get an Xbus Master's battery level. \details The battery level is a value between 0 and 255 that indicates the voltage of the batteries. The scale is not linear and the values should not be used as an absolute voltage. The amount of time remaining for measurement given any battery level greatly depends on the type of batteries used, the number of sensors attached to the Xbus Master and the used output options.
82  XsensResultValue getBaudrate (uint32_t& baudrate); //!< \brief Get the baudrate used by a port. \details This function returns the baud rate at which the port is currently connected. The function will return an error when no port is connected. \see getSerialBaudrate setSerialBaudrate setBaudrate
83  XsensResultValue getBluetoothState(bool& enabled); //!< \brief Get the state of the bluetooth communication. \details This function tells whether the Bluetooth connection of the Xbus Master is on (1) or off (0). \note This function is only valid in configuration mode.
84  XsensResultValue getBusId (uint8_t& busId, const CmtDeviceId deviceId = CMT_DID_MASTER) const; //!< \brief Retrieve the BusId of a device. \details The function checks its internal list for a match of deviceId. If it is found, the corresponding BusId is returned in busId. Otherwise, a 0 is placed in busId and XRV_NOTFOUND result is returned.
85  XsensResultValue getBusPowerState(bool& enabled); //!< \brief Get the state of the Xbus power. \details This function tells whether the Xbus of the connected Xbus Master is currently switched on (1) or not (0). When it is switched off, the attached MT devices have no power and communication with them is not possible. Before going to measurement mode, use setBusPowerState to restore power. \see setBusPowerState \note This function is only valid in configuration mode.
86 
87  Cmt2f* getCmt2f(void); //!< \brief Return a reference to the embedded Cmt2f (logfile) object. \details Any manipulation of the object should be done through Cmt3. Cmt3's integrity is not guaranteed if the Cmt2f object is manipulated directly. \see refreshCache
88  Cmt2s* getCmt2s(void); //!< \brief Return a reference to the embedded Cmt2s (comm port) object. \details Any manipulation of the object should be done through Cmt3. Cmt3's integrity is not guaranteed if the Cmt2s object is manipulated directly. \see refreshCache
89 
90  XsensResultValue getConfiguration(CmtDeviceConfiguration& configuration); //!< \brief Get device configuration. \details This function retrieves the complete device configuration of a single device. \note This information is cached by Cmt3, so it is available in measurement mode.
91  XsensResultValue getDataLength(uint32_t& length, const CmtDeviceId deviceId = CMT_DID_MASTER); //!< \brief Retrieve data size. \details This function retrieves the number of bytes that are in a data message as sent by the given device.
92  uint32_t getDeviceCount(void) const; //!< \brief Retrieve total device count. \details This function retrieves the total number of connected (master + slave) devices or 0 if not connected.
93  XsensResultValue getDeviceId(const uint8_t busId, CmtDeviceId& deviceId) const; //!< \brief Retrieve the DeviceId of a device given its Bus ID. \details This function retrieves the DeviceId for the device with the given Bus ID. When no devices are connected, a 0 ID is supplied.
94  XsensResultValue getDeviceMode(CmtDeviceMode& mode, const CmtDeviceId deviceId = CMT_DID_MASTER); //!< \brief Return device mode. \details This function retrieves the output-related settings of the device, such as the sample rate and output settings. \see setDeviceMode \note This function actually reads the device mode from the cached configuration, so it is available in measurement mode. \see refreshCache
95  XsensResultValue getDeviceMode2(CmtDeviceMode2& mode, const CmtDeviceId deviceId = CMT_DID_MASTER); //!< \brief Return device mode2. \details This function retrieves the output-related settings of the device, such as the period, skip factor and output settings. \see setDeviceMode \note This function actually reads the device mode from the cached configuration, so it is available in measurement mode. \see refreshCache
96  XsensResultValue getEMtsData(void* buffer, const CmtDeviceId deviceId = CMT_DID_MASTER); //!< \brief Retrieve the eMts data of the specified sensor(s). \details This function can be used to read proprietary data from one or more Motion Trackers. This data is required by higher level functions in combination with Configuration data to convert Raw data into Calibrated and Orientation data. The eMTs data is quite large, but it is cached. The first request should be done in configuration mode, but following requests can be done in measurement mode. When requesting eMTS data for a single sensor, the buffer should be at least CMT_EMTS_SIZE bytes long. When using CMT_DID_BROADCAST, the eMTS data of all connected sensors is placed into the buffer sequentially. In the latter case, the buffer should be able to hold at least sensorcount * CMT_EMTS_SIZE bytes.
97  XsensResultValue getErrorMode(uint16_t& mode, const CmtDeviceId deviceId = CMT_DID_MASTER); //!< \brief Return the error mode of the device. \details This function returns the error mode of the device. The error mode determines how the device handles errors. See the low-level communication documentation for more details. \see setErrorMode \note This function is only valid in configuration mode.
98  XsensResultValue getFirmwareRevision(CmtVersion& revision, const CmtDeviceId deviceId = CMT_DID_MASTER);//!< \brief Return Firmware revision. \details This function retrieves the firmware version that is currently installed in the device. \note This function is only valid in configuration mode.
99  XsensResultValue getHeading(double& heading, const CmtDeviceId deviceId = CMT_DID_MASTER); //!< \brief Return the heading offset. \details This function retrieves the heading offset in radians used by the device. The valid range is -pi to +pi. The heading offset is used as a final correction on the output orientation. \see setHeading getMagneticDeclination setMagneticDeclination \note This function is only valid in configuration mode.
100 
101  XsensResultValue getLastResult(void) const //!< \brief Return the error code of the last user function call.
102  { return m_lastResult; }
103  XsensResultValue getHwError(CmtDeviceId& did) const //!< \brief Return the last Hardware error code. \details This function returns the XsensResultValue of the last problem reported by hardware (if any). Hardware problems are all 'error' messages returned by a sensor. \param did If any problems were found, the responsible device ID will be returned in this parameter. \see clearHwError
104  { did = m_lastHwErrorDeviceId; return m_lastHwError; }
105  void clearHwError(void) //!< \brief Reset the hardware error code. \details Use this function to reset the hardware error code reported by getHwError. \see getHwError
107 
108  XsensResultValue getLocationId (uint16_t& locationId, const CmtDeviceId deviceId = CMT_DID_MASTER); //!< \brief Return the location ID of a sensor. \details This function retrieves the location ID stored in the device. \see setLocationId \note This function is only valid in configuration mode.
109  XsensResultValue getLogFileReadPosition(CmtFilePos& pos); //!< \brief Retrieve the read position of the log file. \details This function will return the current read position in the open log file in bytes from the start. \note The read and write positions of log files are completely independent of each other. \remarks To change the read position, either use resetLogFileReadPos or manipulate the log file through getCmt2f. \see resetLogFileReadPos getCmt2f
110 
111  XsensResultValue getLogFileSize(CmtFilePos& size); //!< \brief Retrieve the size of the open log file in bytes.
112  XsensResultValue getLogFileName(char* filename); //!< \brief Retrieve the name of the open log file or an empty string if no logfile is open
113  XsensResultValue getLogFileName(wchar_t* filename); //!< \brief Retrieve the name of the open log file or an empty string if no logfile is open
114  XsensResultValue getMagneticDeclination(double& declination, const CmtDeviceId deviceId = CMT_DID_MASTER); //!< \brief Return the stored magnetic declination. \details This function retrieves the stored local magnetic declination in radians. The valid range is -pi to +pi. The magnetic declination is used in the sensor fusion process to determine the output orientation. \see getHeading setHeading setMagneticDeclination \note This function is only valid in configuration mode.
115  CmtDeviceId getMasterId(void); //! \brief Return the device Id of the first device (master). \details \note The deviceId is read from the cached configuration data, so it is also available in measurement mode.
116 
117  uint16_t getMtCount(void) const; //!< \brief Retrieve number of MT devices. \details This function will return the number of connected MT devices. Effectively, this returns the device count minus any Xbus Masters.
118  XsensResultValue getMtDeviceId(const uint8_t index, CmtDeviceId& deviceId) const; //! \brief Return the device Id of an MT device. \details This function returns the ID of the index'th MT (non-Xbus Master) device connected to this object. \note The deviceId is read from the cached configuration data, so it is also available in measurement mode.
119  XsensResultValue getPortNr(uint8_t& port) const; //!< \brief Return the port number that this object is connected to. \details If CMT is reading from a log file, an error will be returned.
120  XsensResultValue getProductCode(char* productCode, const CmtDeviceId deviceId = CMT_DID_MASTER);//!< \brief Return product code. \details This function retrieves the product code of the given device. \param productCode The buffer that will store the product code. This buffer should be at least 20 bytes. \remarks The product code is NOT necessarily NULL-terminated. If it is less than 20 characters it will be, but if the product code is 20 characters it won't be. The recommended method is to create a buffer that is 21 bytes long and set the last byte to 0 before calling this function. \note This function is only valid in configuration mode.
121  uint16_t getSampleFrequency(void); //!< \brief Return current sample frequency. \details This function determines the sample frequency of the device from the cached sample rate and skip factor and returns it. For devices connected to an Xbus Master, the values used by the Xbus Master are returned. \see setDeviceMode getDeviceMode
122  XsensResultValue getSerialBaudrate(uint32_t& baudrate); //!< \brief Return the baud rate used for serial communication. \details This function retrieves the baud rate that is used when the device is connected by a serial connection. In most cases this is the same as getBaudrate, but when an Xbus Master is connected by a Bluetooth connection, it doesn't have to be. \see setSerialBaudrate setBaudrate getBaudrate \note This function is only valid in configuration mode.
123  XsensResultValue getSyncInSettings(CmtSyncInSettings& settings); //!< \brief Retrieve the inbound synchronization settings of the master MT device. \details This function retrieves the current inbound synchronization settings of the master MT device (sync mode, skip factor and offset). This function does not work for Xbus Masters and should not be used for sensors connected to an Xbus Master. \see setSyncInSettings getSyncOutSettings setSyncOutSettings getSyncMode setSyncMode \note This function is only valid in configuration mode.
124  XsensResultValue getSyncInMode(uint16_t& mode); //!< \brief Retrieve the inbound synchronization mode of an MT device. \details This function retrieves the current inbound synchronization mode of the MT device. This function does not work for Xbus Masters and should not be used for sensors connected to an Xbus Master. \see setSyncInMode setSyncInSettings getSyncInSettings getSyncInSkipFactor setSyncInSkipFactor getSyncInOffset setSyncInOffset getSyncOutSettings setSyncOutSettings getSyncMode setSyncMode
125  XsensResultValue getSyncInSkipFactor(uint16_t& skipFactor); //!< \brief Retrieve the inbound synchronization skip factor of an MT device. \details This function retrieves the current inbound synchronization skip factor of the MT device. This function does not work for Xbus Masters and should not be used for sensors connected to an Xbus Master. \see setSyncInSkipFactor setSyncInSettings getSyncInSettings getSyncInOffset setSyncInOffset getSyncOutSettings setSyncOutSettings getSyncMode setSyncMode
126  XsensResultValue getSyncInOffset(uint32_t& offset); //!< \brief Retrieve the inbound synchronization offset of an MT device. \details This function retrieves the current inbound synchronization offset of the MT device. This function does not work for Xbus Masters and should not be used for sensors connected to an Xbus Master. \see setSyncInOffset setSyncInSettings getSyncInSettings getSyncInSkipFactor setSyncInSkipFactor getSyncOutSettings setSyncOutSettings getSyncMode setSyncMode
127  XsensResultValue getSyncMode(uint8_t& mode); //!< \brief Retrieve the sync mode of the Xbus Master. \details This function requests the current synchronization mode used by the specified Xbus Master. This function is not valid for MT devices. \see setSyncMode getSyncInSettings setSyncInSettings getSyncOutSettings setSyncOutSettings \note This function is only valid in configuration mode.
128  XsensResultValue getSyncOutSettings(CmtSyncOutSettings& settings); //!< \brief Retrieve the outbound synchronization settings of the master MT device. \details This function retrieves the current outbound synchronization settings of the MT device (sync mode, skip factor, offset and pulse width). This function does not work for Xbus Masters and should not be used for sensors connected to an Xbus Master. \see setSyncOutSettings getSyncInSettings setSyncInSettings getSyncMode setSyncMode \note This function is only valid in configuration mode.
129  XsensResultValue getSyncOutMode(uint16_t& mode); //!< \brief Retrieve the outbound synchronization mode of an MT device. \details This function retrieves the current outbound synchronization mode of the MT device. This function does not work for Xbus Masters and should not be used for sensors connected to an Xbus Master. \see setSyncOutMode setSyncOutSettings getSyncOutSettings getSyncOutPulseWidth setSyncOutPulseWidth getSyncOutSkipFactor setSyncOutSkipFactor getSyncOutOffset setSyncOutOffset getSyncInSettings setSyncInSettings getSyncMode setSyncMode
130  XsensResultValue getSyncOutPulseWidth(uint32_t& pulseWidth); //!< \brief Retrieve the outbound synchronization pulse width of an MT device. \details This function retrieves the current outbound synchronization pulse width of the MT device. This function does not work for Xbus Masters and should not be used for sensors connected to an Xbus Master. \see setSyncOutPulseWidth setSyncOutSettings getSyncOutSettings setSyncOutMode getSyncOutMode getSyncOutSkipFactor setSyncOutSkipFactor getSyncOutOffset setSyncOutOffset getSyncInSettings setSyncInSettings getSyncMode setSyncMode
131  XsensResultValue getSyncOutSkipFactor(uint16_t& skipFactor); //!< \brief Retrieve the outbound synchronization skip factor of an MT device. \details This function retrieves the current outbound synchronization skip factor of the MT device. This function does not work for Xbus Masters and should not be used for sensors connected to an Xbus Master. \see stSyncOutSkipFactor setSyncOutSettings getSyncOutSettings setSyncOutMode getSyncOutMode getSyncOutPulseWidth setSyncOutPulseWidth getSyncOutOffset setSyncOutOffset getSyncInSettings setSyncInSettings getSyncMode setSyncMode
132  XsensResultValue getSyncOutOffset(uint32_t& offset); //!< \brief Retrieve the outbound synchronization offset of an MT device. \details This function retrieves the current outbound synchronization offset of the MT device. This function does not work for Xbus Masters and should not be used for sensors connected to an Xbus Master. \see setSyncOutOffset setSyncOutSettings getSyncOutSettings setSyncOutMode getSyncOutMode getSyncOutPulseWidth setSyncOutPulseWidth getSyncOutSkipFactor setSyncOutSkipFactor getSyncInSettings setSyncInSettings getSyncMode setSyncMode
133  uint32_t getTimeoutConfig(void) const; //!< \brief Return the configuration mode timeout. \details When in config mode, the system uses a different message timeout than in measurement mode, since configuration messages can take longer to process than measurement mode messages. This function can be used to determine the current config mode timeout in ms. \see setTimeoutConfig getTimeoutMeasurement setTimeoutMeasurement
134  uint32_t getTimeoutMeasurement(void) const; //!< \brief Return the measurement mode timeout. \details When in measurement mode, the system uses a different message timeout than in config mode, since measurement mode messages should be faster to process than config mode messages. This function can be used to determine the current measurement mode timeout in ms. \see setTimeoutMeasurement getTimeoutConfig setTimeoutConfig
135  XsensResultValue getUtcTime(CmtUtcTime& utc, const CmtDeviceId deviceId); //!< \brief Return the UTC time of the last received sample. \details This function is only valid for MTi-G sensors. In measurement mode it will retrieve the UTC time of the last received sample. In Config mode, it will retrieve the most recent UTC time. In config mode, the time returned will be requested diectly from the GPS subsystem, with several layers of messaging between the original source and the host. In measurement mode, the UTC time is requested from the GPS subsystem periodically and estimated (with a very high precision) for the remaining samples. So in config mode, the time will probably jitter more than in measurement mode.
136  XsensResultValue getXmOutputMode(uint8_t& mode); //!< \brief Return the dual-output mode of the XM. \details This function retrieves the dual mode output mode of the Xbus Master. The dual output mode of the Xbus Master defines whether it will send data on the serial connection (at the same baud rate as the bluetooth connection) when it is connected via Bluetooth. When set to 0, the serial communication is disabled, data is sent over the serial bus. \note When dual-mode is enabled, the Xbus Master will NOT receive command messages on the serial bus. \see setXmOutputMode
137  XsensResultValue gotoConfig(void); //!< \brief Place all connected devices into Configuration Mode. \details This function places the sensors in configuration mode. \note This function has no effect when reading from a log file
138  XsensResultValue gotoMeasurement(void); //!< \brief Place all connected devices into Measurement Mode. \details This function places the sensors in measurement mode. \note This function has no effect when reading from a log file
139  XsensResultValue initBus(void); //!< \brief Perform an initBus request. \details See the low-level documentation for more information on the InitBus message. \see refreshCache setBusPowerState
140  bool isLogging(void) const //!< \brief Return whether the Cmt3 object is writing to a log file or not
141  { return m_logging; }
142  bool isPortOpen(void) const //!< \brief Return whether the communication port is open or not.
143  { return (m_serial.isOpen()); }
144  bool isXm(void) const; //!< \brief Return whether the main device is an Xbus Master or not.
145 
146  XsensResultValue openPort(const char *portName, const uint32_t baudRate = CMT_DEFAULT_BAUD_RATE); //! \brief Open a communication channel to the given COM port number. \details This function is first passed through to the Cmt2s object. Then, the device settings are retrieved and stored locally. This function automatically places the device(s) in config mode, using gotoConfig. \see gotoConfig closePort
147 #ifdef _WIN32
148  XsensResultValue openPort(const uint32_t portNumber, const uint32_t baudRate = CMT_DEFAULT_BAUD_RATE); //! \brief Open a communication channel to the given COM port number. \details This function is first passed through to the Cmt2s object. Then, the device settings are retrieved and stored locally. This function automatically places the device(s) in config mode, using gotoConfig. \see gotoConfig closePort
149 #endif
150  XsensResultValue peekLogMessageId(uint8_t& messageId); //!< \brief Peek(take a look) at the message ID of the next message. \details This function can only be used when reading from a log file. It will find the next message in the file and place its message ID in the messageId parameter. Afterwards, the read position of the file will be restored. \remarks This function is mostly useful when dealing with a file that has more than just data messages. By using the peek function, it is possible to decide whether a readDataPacket should be called or for example getBatteryLevel or getGpsStatus. When the peek function is not used and for example getBatteryLevel is called, all messages between the current read position and the first battery level message in the file will be skipped. An alternative would be to get the read position, call the desired function (get battery level) and restore the read position, but then the moment at which the (battery level, UTC time, satellite info, etc) data becomes available will not be known.
151  XsensResultValue readDataPacket (Packet* pack, bool acceptOther = false); //!< \brief Retrieve a data message. \details This function will attempt to read a data message from the open port or from the log file, depending on the system state. When acceptOther is set to true, the first received message will be returned. If a data message is successfully read, XRV_OK will be returned. If another message is read, XRV_OTHER will be returned and the received message will be placed in the Packet. Otherwise, an appropriate error will be returned.
152  XsensResultValue requestData (Packet* pack); //!\brief Request a data message and wait for it to arrive. \details This function is only useful when the skip factor is set to 0xFFFF.
153  XsensResultValue reset(void); //!< \brief Reset all connected sensors.
154  XsensResultValue resetOrientation(const CmtResetMethod method, const CmtDeviceId deviceId = CMT_DID_MASTER); //!< \brief Perform an orientation reset on a device. \details This function performs an orientation reset. See the MT documentation for more information about Orientation resets. \note If you wish to save the setting to the device, perform the CMT_RESETORIENTATION_STORE operation while in Config mode after having performed the appropriate orientation reset in measurement mode.
155  XsensResultValue restoreFactoryDefaults(const CmtDeviceId deviceId = CMT_DID_MASTER); //!< \brief Restore the device to factory default settings. \details This function completely restores the selected device to the default settings (115k2 baud rate, 100Hz sample frequency, factory defined scenarios). \note This function is only available in configuration mode.
156  XsensResultValue setBaudrate (const uint32_t baudrate, bool reconnect = true); //!< \brief Set the baudrate and possibly reconnect. \details Use this function to change the baudrate of the device. This actually tries to change the baud rate of the current connection. When reconnect is set to true, the device receives a Reset message and the port is reopened at the new baudrate. Otherwise, make sure to perform a Reset manually, since the new baudrate will not be set until a Reset has been performed. \note To change the baudrate of the serial connection while connected via Bluetooth, use setSerialBaudrate. \see getBaudrate setSerialBaudrate getSerialBaudrate \note This function is only available in configuration mode.
157  XsensResultValue setBluetoothState(const bool enabled); //!< \brief Set the Bluetooth state of the Xbus Master. \details This function sets the state of the bluetooth communication to on or off. \note This function is only available in configuration mode.
158  XsensResultValue setBusPowerState(const bool enabled); //!< \brief Switch the Xbus Master bus power on or off. \details Use this function to switch the Xbus Master Xbus power on or off. \remarks This function can be used to save a lot of power when not measuring, while still keeping a connection to the system. However, there is a relatively long startup time when restoring power as the sensors are reinitialized. \note You will need to perform an initBus and possibly a refreshCache call after switching the power back on with this function. \note This function is only available in configuration mode. \see initBus refreshCache
159  XsensResultValue setDeviceMode (const CmtDeviceMode& mode, bool force, const CmtDeviceId deviceId = CMT_DID_MASTER); //!< \brief Set the complete output mode of a device. \details This function updates the complete output mode of the specified device. It only updates values that are different than those reported by the device unless force is set to true. The function will automatically update only the part of the device mode that is relevant for the device. So it is possible to configure all devices, including an Xbus Master with the same mode (only the Xbus Master will update its period, while the Motion Trackers will update their output mode and settings). \note This function is only available in configuration mode. \see getDeviceMode getDeviceMode2 setDeviceMode2
160  XsensResultValue setDeviceMode2 (const CmtDeviceMode2& mode, bool force, const CmtDeviceId deviceId = CMT_DID_MASTER); //!< \brief Set the complete output mode2 of a device. \details This function updates the complete output mode of the specified device. It only updates values that are different than those reported by the device unless force is set to true. The function will automatically update only the part of the device mode that is relevant for the device. So it is possible to configure all devices, including an Xbus Master with the same mode (only the Xbus Master will update its period, while the Motion Trackers will update their output mode and settings). \note This function is only available in configuration mode. \see getDeviceMode2 getDeviceMode setDeviceMode
161  XsensResultValue setErrorMode(const uint16_t mode); //!< \brief Set the error mode of the device. \details This function sets the error mode of the device. The error mode determines how the device handles errors. See the low-level communication documentation for more details. \note This function is only available in configuration mode. \see getErrorMode
162  XsensResultValue setGotoConfigTries(const uint16_t tries); //!< \brief Set the number of times the gotoConfig function will attempt a gotoConfig before failing. \details This is especially useful when using RS485 communication or when for some reason the communication lines are not reliable.
163  XsensResultValue setHeading (const double heading, const CmtDeviceId deviceId = CMT_DID_MASTER); //!< \brief Set the heading offset. \details This function sets the heading offset in radians used by the device. The valid range is -pi to +pi. The heading offset is used as a final correction on the output orientation. \note This function is only available in configuration mode. \see getHeading getMagneticDeclination setMagneticDeclination
164  XsensResultValue setLocationId (uint16_t locationId, const CmtDeviceId deviceId = CMT_DID_MASTER); //!< \brief Set the location ID of a sensor. \details This function sets the location ID stored in the device. \note This function is only available in configuration mode. \see getLocationId
165  XsensResultValue setMagneticDeclination(const double declination, const CmtDeviceId deviceId = CMT_DID_MASTER); //!< \brief Set the stored magnetic declination. \details This function sets the stored local magnetic declination in radians. The valid range is -pi to +pi. The magnetic declination is used in the sensor fusion process to determine the output orientation. \note This function is only available in configuration mode. \see getHeading setHeading getMagneticDeclination
166  XsensResultValue setSyncInSettings(const CmtSyncInSettings& settings); //!< \brief Set the inbound synchronization settings of an MT device. \details This function sets the current inbound synchronization settings of the MT device (sync mode, skip factor and offset). This function does not work for Xbus Masters and should not be used for sensors connected to an Xbus Master. \note This function is only available in configuration mode. \see getSyncInSettings getSyncOutSettings setSyncOutSettings getSyncMode setSyncMode
167  XsensResultValue setSyncInMode (const uint16_t mode); //!< \brief Set the inbound synchronization mode of an MT device. \details This function sets the current inbound synchronization mode of the MT device. This function does not work for Xbus Masters and should not be used for sensors connected to an Xbus Master. \see getSyncInMode setSyncInSettings getSyncInSettings getSyncInSkipFactor setSyncInSkipFactor getSyncInOffset setSyncInOffset getSyncOutSettings setSyncOutSettings getSyncMode setSyncMode
168  XsensResultValue setSyncInSkipFactor (const uint16_t skipFactor); //!< \brief Set the inbound synchronization skip factor of an MT device. \details This function sets the current inbound synchronization skip factor of the MT device. This function does not work for Xbus Masters and should not be used for sensors connected to an Xbus Master. \see getSyncInSkipFactor setSyncInSettings getSyncInSettings getSyncInOffset setSyncInOffset getSyncOutSettings setSyncOutSettings getSyncMode setSyncMode
169  XsensResultValue setSyncInOffset (const uint32_t offset); //!< \brief Set the inbound synchronization offset of an MT device. \details This function sets the current inbound synchronization offset of the MT device. This function does not work for Xbus Masters and should not be used for sensors connected to an Xbus Master. \see getSyncInOffset setSyncInSettings getSyncInSettings getSyncInSkipFactor setSyncInSkipFactor getSyncOutSettings setSyncOutSettings getSyncMode setSyncMode
170  XsensResultValue setSyncMode(const uint8_t mode); //!< \brief Set the sync mode of the Xbus Master. \details This function sets the current synchronization mode used by the specified Xbus Master. This function is not valid for MT devices. \note This function is only available in configuration mode. \see getSyncMode getSyncInSettings setSyncInSettings getSyncOutSettings setSyncOutSettings
171  XsensResultValue setSyncOutSettings(const CmtSyncOutSettings& settings); //!< \brief Set the outbound synchronization settings of an MT device. \details This function sets the current outbound synchronization settings of the MT device (sync mode, skip factor, offset and pulse width). This function does not work for Xbus Masters and should not be used for sensors connected to an Xbus Master. \note This function is only available in configuration mode. \see setSyncOutSettings getSyncInSettings setSyncInSettings getSyncMode setSyncMode
172  XsensResultValue setSyncOutMode (const uint16_t mode); //!< \brief Set the outbound synchronization mode of an MT device. \details This function sets the current outbound synchronization mode of the MT device. This function does not work for Xbus Masters and should not be used for sensors connected to an Xbus Master. \see getSyncOutMode setSyncOutSettings getSyncOutSettings getSyncOutPulseWidth setSyncOutPulseWidth getSyncOutSkipFactor setSyncOutSkipFactor getSyncOutOffset setSyncOutOffset getSyncInSettings setSyncInSettings getSyncMode setSyncMode
173  XsensResultValue setSyncOutPulseWidth (const uint32_t pulseWidth); //!< \brief Set the outbound synchronization pulse width of an MT device. \details This function sets the current outbound synchronization pulse width of the MT device. This function does not work for Xbus Masters and should not be used for sensors connected to an Xbus Master. \see getSyncOutPulseWidth setSyncOutSettings getSyncOutSettings setSyncOutMode getSyncOutMode getSyncOutSkipFactor setSyncOutSkipFactor getSyncOutOffset setSyncOutOffset getSyncInSettings setSyncInSettings getSyncMode setSyncMode
174  XsensResultValue setSyncOutSkipFactor (const uint16_t skipFactor); //!< \brief Set the outbound synchronization skip factor of an MT device. \details This function sets the current outbound synchronization skip factor of the MT device. This function does not work for Xbus Masters and should not be used for sensors connected to an Xbus Master. \see setSyncOutSkipFactor setSyncOutSettings getSyncOutSettings setSyncOutMode getSyncOutMode getSyncOutPulseWidth setSyncOutPulseWidth getSyncOutOffset setSyncOutOffset getSyncInSettings setSyncInSettings getSyncMode setSyncMode
175  XsensResultValue setSyncOutOffset (const uint32_t offset); //!< \brief Set the outbound synchronization offset of an MT device. \details This function sets the current outbound synchronization offset of the MT device. This function does not work for Xbus Masters and should not be used for sensors connected to an Xbus Master. \see getSyncOutOffset setSyncOutSettings getSyncOutSettings setSyncOutMode getSyncOutMode getSyncOutPulseWidth setSyncOutPulseWidth getSyncOutSkipFactor setSyncOutSkipFactor getSyncInSettings setSyncInSettings getSyncMode setSyncMode
176  XsensResultValue setTimeout (const uint32_t ms) //!< \brief Set the default timeout value to use in blocking operations on the communication port.
177  { return (m_lastResult = m_serial.setTimeout(ms)); }
178  XsensResultValue setTimeoutConfig (const uint32_t timeout = CMT3_DEFAULT_TIMEOUT_CONF); //!< \brief Set the configuration mode timeout. \details When in config mode, the system uses a different message timeout than in measurement mode, since configuration messages can take longer to process than measurement mode messages. This function can be used to set the config mode timeout in ms. \note This function is only available in configuration mode. \see getTimeoutConfig getTimeoutMeasurement setTimeoutMeasurement setTimeout
179  XsensResultValue setTimeoutMeasurement (const uint32_t timeout = CMT3_DEFAULT_TIMEOUT_MEAS); //!< \brief Set the measurement mode timeout. \details When in measurement mode, the system uses a different message timeout than in config mode, since measurement mode messages should be faster to process than config mode messages. This function can be used to set the measurement mode timeout in ms. \note This function is only available in configuration mode. \see getTimeoutMeasurement getTimeoutConfig setTimeoutConfig setTimeout
180  XsensResultValue setXmOutputMode(const uint8_t mode); //!< \brief Set the dual-output mode of the XM. \details This function sets the dual mode output mode of the Xbus Master. The dual output mode of the Xbus Master defines whether it will send data on the serial connection (at the same baud rate as the bluetooth connection) when it is connected via Bluetooth. When set to 0, the serial communication is disabled, data is sent over the serial bus. \note When dual-mode is enabled, the Xbus Master will NOT receive commands on the serial bus. \note This function is only available in configuration mode. \see getXmDualOutputMode
181  XsensResultValue setXmPowerOff(void); //!< \brief Switch the connected Xbus Master. \details This function tell the connected Xbus Master to power down. This differs from setBusPowerState, because this function actually powers down the Xbus Master itself, while setBusPowerState only powers down the bus controlled by the Xbus Master. After This function is called, the Xbus Master must be manually switched on to make it operational again. \see setBusPowerState
182  XsensResultValue refreshCache(const bool file = false); //!< Update device information stored on host PC. \details Some device information is cached on the host PC for faster access. The Cmt3 automatically tries to keep the cache up to date. But when unexpected things happen, such as custom messages that change the settings, or a power-cycle, then the user may need to tell Cmt3 to update its cache. When both a file and a port are open, the file parameter can be used to indicate what data source to read from (true is file, false is port). \note This function is only available in configuration mode.
183  XsensResultValue waitForDataMessage(Packet* pack); //!< \brief Wait for a data message to arrive. \details The function waits for a data message to arrive or until a timeout occurs. The function will also accept error messages.
184  XsensResultValue createLogFile(const char* filename,bool startLogging = false); //!< \brief Create a log file for incoming messages. \details This function creates a log file for recording incoming messages. The Cmt3 object must be connected to a communication port or the function will fail. \param filename The name of the file to use as a log file. A fully qualified (local) path+filename is recommended. \param startLogging When set to true (default), Cmt3 will immediately start logging incoming messages to the file, otherwise setLogMode must be called first before logging is started. \remarks If a writable file of the same name already exists in the target location, it will be overwritten without warning. \see closeLogFile isLogFileOpen openLogFile setLogMode \note This function is available in configuration AND in measurement mode.
185  XsensResultValue createLogFile(const wchar_t* filename,bool startLogging = false); //!< \brief Create a log file for incoming messages. \details This function creates a log file for recording incoming messages. The Cmt3 object must be connected to a communication port or the function will fail. \param filename The name of the file to use as a log file. A fully qualified (local) path+filename is recommended. \param startLogging When set to true (default), Cmt3 will immediately start logging incoming messages to the file, otherwise setLogMode must be called first before logging is started. \remarks If a writable file of the same name already exists in the target location, it will be overwritten without warning. \see closeLogFile isLogFileOpen openLogFile setLogMode \note This function is available in configuration AND in measurement mode.
186  XsensResultValue closeLogFile(bool del=false); //!< \brief Close an open log file. \details This function closes the logfile if it was open. \param del When set to true, the file will be deleted after closing if it is not read-only. This is mostly useful for temporary log-files. \see createLogFile isLogFileOpen openLogFile setLogMode
187  bool isLogFileOpen(const char* filename) const; //!< \brief Return whether or not(true or false) the supplied file is open. \details When the filename parameter is NULL or empty "", the function will simply return whether a log file is open. Otherwise, the supplied name will be checked against the name of the open log file as well. \return true if the log file is open, false if it isn't \see closeLogFile createLogFile openLogFile setLogMode
188  bool isLogFileOpen(const wchar_t* filename) const; //!< \brief Return whether or not(true or false) the supplied file is open. \details When the filename parameter is NULL or empty "", the function will simply return whether a log file is open. Otherwise, the supplied name will be checked against the name of the open log file as well. \return true if the log file is open, false if it isn't \see closeLogFile createLogFile openLogFile setLogMode
189  XsensResultValue openLogFile(const char* filename); //!< \brief Open a log file for input. \details This function opens the supplied log file for reading. The function will fail if a serial connection is currently open. \param filename The name of the file to open. It is recommended to use a fully qualified path+filename. \note This function is only available in configuration mode. \see closeLogFile createLogFile isLogFileOpen setLogMode
190  XsensResultValue openLogFile(const wchar_t* filename); //!< \brief Open a log file for input. \details This function opens the supplied log file for reading. The function will fail if a serial connection is currently open. \param filename The name of the file to open. It is recommended to use a fully qualified path+filename. \note This function is only available in configuration mode. \see closeLogFile createLogFile isLogFileOpen setLogMode
191  XsensResultValue setDataSource(bool readFromFile); //!< \brief Set whether to read from comm port or file. \details While it is not possible to open a port or file while the other is open, it is possible to create a log file while a port is open. In some rare cases it may be required to log data and read it back while the port remains open and then continue logging in the same file. This is not recommended. Instead, log to a file, close it and then open it in another Cmt3 object. However, if you must do this, then this function can be used to specify that you want to switch between reading from the log file (true) or port (false).
192  XsensResultValue setLogMode(bool active); //!< \brief Set the logging mode. \details This function sets the logging mode to enabled (true) or disabled (false). When enabled, all received messages are logged to the file. \remarks Some information that is cached on the host PC will generate faked messages in the log file. Eg. getConfiguration and some others.
193  XsensResultValue resetLogFileReadPos(void); //!< \brief Restart reading from the start of the open log file. \details This function resets the read position to the start of the open log file. Only the read position is affected, the write position remains the same. \see openLogFile
194  XsensResultValue writeMessageToLogFile(const Message& msg); //! \brief Write the specified message to the open log file. \details This function can be used to add custom messages to a log file. \note A typical log file will only contain acknowledge messages, not request messages. \see createLogFile
195  XsensResultValue getAvailableScenarios(CmtScenario* scenarios, const CmtDeviceId deviceId = CMT_DID_MASTER); //!< \brief Retrieve a list of the available scenarios. \details Use this function to retrieve a list of all scenarios available in a Motion Tracker. See the supplied documentation for more information about scenarios. \param scenarios A buffer for storing the available scenarios. The supplied buffer should be able to contain at least 6 scenarios, but for future devices a larger buffer is advised. Use CMT_MAX_SCENARIOS_IN_MT+1. The list is terminated by a scenario that has type 0. \remarks The type of any of the returned scenarios can be safely supplied to the setScenario function. \see getScenario setScenario \note This function is only available in configuration mode.
196  XsensResultValue getScenario(uint8_t& scenarioType, uint8_t& scenarioVersion, const CmtDeviceId deviceId = CMT_DID_MASTER); //!< \brief Get the currently active scenario from a Motion Tracker. \details This function retrieves the scenario currently used by the specified device when outputting orientation and/or position data. \see getAvailableScenarios setScenario \note This function is only available in configuration mode.
197  XsensResultValue setScenario(const uint8_t scenarioType, const CmtDeviceId deviceId = CMT_DID_MASTER); //!< \brief Specify the scenario to use in the sensor. \details This function specifies the scenario that the sensor should use for converting raw data into orientation and/or position data. This must be one of the scenarios in the list supplied by getAvailableScenarios. \see getAvailableScenarios getScenario \note This function is only available in configuration mode.
198  XsensResultValue getGravityMagnitude(double& magnitude, const CmtDeviceId deviceId = CMT_DID_MASTER); //!< \brief Retrieve the currently used magnitude of the gravity vector. \details The magnitude of the gravity vector is used to determine absolute acceleration from measured acceleration. \see setGravityMagnitude \note This function is only available in configuration mode.
199  XsensResultValue setGravityMagnitude(const double magnitude, const CmtDeviceId deviceId = CMT_DID_MASTER); //!< \brief Set the currently used magnitude of the gravity vector. \details The magnitude of the gravity vector is used to determine absolute acceleration from measured acceleration. Use this function to set tit to a custom value in m/s2. The default value of 9.812687357684514m/s2 should be fine for most places on earth, but in some cases the gravity may be drastically different from standard Earth gravity (eg. space, deep subterranean/submarine, polar regions, gravitational anomalies. See also <A HREF="http://www.abc.net.au/science/news/stories/s911917.htm">http://www.abc.net.au/science/news/stories/s911917.htm</A> and <A 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>) \note Correct orientation output cannot be guaranteed when an incorrect value is supplied for the gravity. Changing this value is at your own risk. \see getGravityMagnitude \remarks In future versions, the MTi-G may be able to estimate the local gravity magnitude on its own. \note This function is only available in configuration mode.
200  XsensResultValue getGpsLeverArm(CmtVector& arm, const CmtDeviceId deviceId = CMT_DID_MASTER); //!< \brief Get the currently used GPS lever arm. \details Use this function to retrieve the vector currently used as the GPS lever arm in meters. The GPS lever arm is the relative position of the GPS antenna to the MTi-G unit. The arm is specified in the object coordinate system. See the manual for more information on coordinate systems, alignment resets and the lever arm. \see setGpsLeverArm \note This function is only available in configuration mode. \note This function is only available for MTi-G devices.
201  XsensResultValue getGpsStatus(CmtGpsStatus& status, const CmtDeviceId deviceId = CMT_DID_MASTER); //!< \brief Request the status of the GPS satellites in orbit. \details This function requests the GPS satellite status information from the GPS subsystem. In config mode, this information is requested from the GPS subsystem immediately, which can cause a relatively long delay (250ms) before a reply is received. In measurement mode, the satellite status is regularly polled internally and the latest status is returned immediately when this function is called.
202  XsensResultValue setGpsLeverArm(const CmtVector& arm, const CmtDeviceId deviceId = CMT_DID_MASTER); //!< \brief Set the currently used GPS lever arm. \details Use this function to set the vector currently used as the GPS lever arm. The GPS lever arm is the relative position of the GPS antenna to the MTi-G unit. The arm is specified in the object coordinate system and in meters. See the manual for more information on coordinate systems, alignment resets and the lever arm. \see getGpsLeverArm \note This function is only available in configuration mode. \note This function is only available for MTi-G devices.
203  XsensResultValue storeXkfState(const CmtDeviceId deviceId = CMT_DID_MASTER); //!< \brief Store important components of the XKF filter state to non-volatile memory. \details This function allows you to store some critical components of the internal XKF filter state to non-volatile memory. The stored settings will be used to initialize the filter whenever the sensor is switched to Measurement mode. \note This function is only available in Config mode.
204 };
205 
206 } // end of xsens namespace
207 
208 #endif // _CMT3_H_2006_04_14
void fillRtc(Packet *pack)
Internal function to compute the RTC value.
Definition: cmt3.cpp:360
XsensResultValue initBus(void)
Perform an initBus request.
Definition: cmt3.cpp:1523
High-level communication class.
Definition: cmt3.h:36
A structure for storing the firmware version.
Definition: cmtdef.h:925
Operation was performed successfully.
Definition: xsens_std.h:32
CmtDeviceId getMasterId(void)
Definition: cmt3.cpp:972
XsensResultValue getSyncOutSkipFactor(uint16_t &skipFactor)
Retrieve the outbound synchronization skip factor of an MT device.
Definition: cmt3.cpp:1344
XsensResultValue getSyncMode(uint8_t &mode)
Retrieve the sync mode of the Xbus Master.
Definition: cmt3.cpp:1220
XsensResultValue getMagneticDeclination(double &declination, const CmtDeviceId deviceId=CMT_DID_MASTER)
Return the stored magnetic declination.
Definition: cmt3.cpp:960
XsensResultValue getPortNr(uint8_t &port) const
Return the device Id of an MT device.
Definition: cmt3.cpp:1007
double m_rtcMsPerSample
ms per sample = 1000 / sample frequency.
Definition: cmt3.h:41
XsensResultValue setSyncOutSkipFactor(const uint16_t skipFactor)
Set the outbound synchronization skip factor of an MT device.
Definition: cmt3.cpp:2433
uint16_t m_firstItem
The index of the first formatting item.
Definition: cmt3.h:52
uint16_t m_skip
The skip factor of the port.
Definition: cmt3.h:44
__int64 CmtFilePos
Definition: cmtf.h:24
TimeStamp m_rtcStart
The start of the RTC counter, the time of arrival of sample 0.
Definition: cmt3.h:45
unsigned __int16 uint16_t
Definition: rptypes.h:46
Mid-level serial communication class.
Definition: cmt2.h:37
XsensResultValue setBusPowerState(const bool enabled)
Switch the Xbus Master bus power on or off.
Definition: cmt3.cpp:1936
uint32_t getDeviceCount(void) const
Retrieve total device count.
Definition: cmt3.cpp:562
XsensResultValue getGpsLeverArm(CmtVector &arm, const CmtDeviceId deviceId=CMT_DID_MASTER)
Get the currently used GPS lever arm.
Definition: cmt3.cpp:2944
XsensResultValue openPort(const char *portName, const uint32_t baudRate=CMT_DEFAULT_BAUD_RATE)
Definition: cmt3.cpp:1541
XsensResultValue setSyncOutPulseWidth(const uint32_t pulseWidth)
Set the outbound synchronization pulse width of an MT device.
Definition: cmt3.cpp:2404
XsensResultValue getGpsStatus(CmtGpsStatus &status, const CmtDeviceId deviceId=CMT_DID_MASTER)
Request the status of the GPS satellites in orbit.
Definition: cmt3.cpp:2956
bool m_readFromFile
Indicates whether to read from the log file or from the serial port.
Definition: cmt3.h:56
XsensResultValue refreshCache(const bool file=false)
Update device information stored on host PC.
Definition: cmt3.cpp:2529
XsensResultValue getSyncOutPulseWidth(uint32_t &pulseWidth)
Retrieve the outbound synchronization pulse width of an MT device.
Definition: cmt3.cpp:1316
XsensResultValue getBatteryLevel(uint8_t &level)
Get an Xbus Master&#39;s battery level.
Definition: cmt3.cpp:401
Cmt2f * getCmt2f(void)
Return a reference to the embedded Cmt2f (logfile) object.
Definition: cmt3.cpp:491
GLuint buffer
Definition: glext.h:3775
XsensResultValue getLogFileReadPosition(CmtFilePos &pos)
Retrieve the read position of the log file.
Definition: cmt3.cpp:902
XsensResultValue getDeviceId(const uint8_t busId, CmtDeviceId &deviceId) const
Retrieve the DeviceId of a device given its Bus ID.
Definition: cmt3.cpp:577
GLenum GLint ref
Definition: glext.h:3888
XsensResultValue setDeviceMode(const CmtDeviceMode &mode, bool force, const CmtDeviceId deviceId=CMT_DID_MASTER)
Set the complete output mode of a device.
Definition: cmt3.cpp:1948
XsensResultValue readDataPacket(Packet *pack, bool acceptOther=false)
Retrieve a data message.
Definition: cmt3.cpp:1672
bool m_logging
Indicates whether to write all received messages to the logfile or not, automatically set to true by ...
Definition: cmt3.h:58
A structure for storing sync out settings.
Definition: cmtdef.h:947
XsensResultValue getDeviceMode(CmtDeviceMode &mode, const CmtDeviceId deviceId=CMT_DID_MASTER)
Return device mode.
Definition: cmt3.cpp:595
uint32_t m_rtcCount
The long sample counter (normal counter wraps at 64k).
Definition: cmt3.h:46
XsensResultValue restoreFactoryDefaults(const CmtDeviceId deviceId=CMT_DID_MASTER)
Restore the device to factory default settings.
Definition: cmt3.cpp:1809
GLintptr offset
Definition: glext.h:3780
XsensResultValue resetLogFileReadPos(void)
Restart reading from the start of the open log file.
Definition: cmt3.cpp:2854
XsensResultValue setSyncInMode(const uint16_t mode)
Set the inbound synchronization mode of an MT device.
Definition: cmt3.cpp:2215
XsensResultValue getLocationId(uint16_t &locationId, const CmtDeviceId deviceId=CMT_DID_MASTER)
Return the location ID of a sensor.
Definition: cmt3.cpp:890
bool m_rtcInitialized
Indicates if the rtc is initialised or not.
Definition: cmt3.h:57
#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:2723
uint16_t m_gotoConfigTries
The number of times a goto config is attempted before the function fails.
Definition: cmt3.h:53
XsensResultValue gotoMeasurement(void)
Place all connected devices into Measurement Mode.
Definition: cmt3.cpp:1499
XsensResultValue setTimeout(const uint32_t ms)
Definition: cmt3.h:176
A structure for storing UTC Time values.
Definition: cmtdef.h:965
XsensResultValue reset(void)
Request a data message and wait for it to arrive.
Definition: cmt3.cpp:1777
XsensResultValue getSyncInOffset(uint32_t &offset)
Retrieve the inbound synchronization offset of an MT device.
Definition: cmt3.cpp:1192
XsensResultValue getMtDeviceId(const uint8_t index, CmtDeviceId &deviceId) const
Definition: cmt3.cpp:994
A structure for storing sync in settings.
Definition: cmtdef.h:932
XsensResultValue getSyncInSettings(CmtSyncInSettings &settings)
Retrieve the inbound synchronization settings of the master MT device.
Definition: cmt3.cpp:1094
XsensResultValue writeMessageToLogFile(const Message &msg)
Definition: cmt3.cpp:2863
XsensResultValue setErrorMode(const uint16_t mode)
Set the error mode of the device.
Definition: cmt3.cpp:2090
uint16_t getMtCount(void) const
Return the device Id of the first device (master).
Definition: cmt3.cpp:983
XsensResultValue setXmPowerOff(void)
Switch the connected Xbus Master.
Definition: cmt3.cpp:2151
XsensResultValue setDeviceMode2(const CmtDeviceMode2 &mode, bool force, const CmtDeviceId deviceId=CMT_DID_MASTER)
Set the complete output mode2 of a device.
Definition: cmt3.cpp:1963
XsensResultValue getConfiguration(CmtDeviceConfiguration &configuration)
Get device configuration.
Definition: cmt3.cpp:504
XsensResultValue getSyncOutSettings(CmtSyncOutSettings &settings)
Retrieve the outbound synchronization settings of the master MT device.
Definition: cmt3.cpp:1232
XsensResultValue getHeading(double &heading, const CmtDeviceId deviceId=CMT_DID_MASTER)
Return the heading offset.
Definition: cmt3.cpp:878
bool isXm(void) const
Return whether the main device is an Xbus Master or not.
Definition: cmt3.cpp:1534
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:2708
void clearHwError(void)
Definition: cmt3.h:105
unsigned char uint8_t
Definition: rptypes.h:43
Cmt2s * getCmt2s(void)
Return a reference to the embedded Cmt2s (comm port) object.
Definition: cmt3.cpp:497
XsensResultValue setBaudrate(const uint32_t baudrate, bool reconnect=true)
Set the baudrate and possibly reconnect.
Definition: cmt3.cpp:1835
XsensResultValue getAvailableScenarios(CmtScenario *scenarios, const CmtDeviceId deviceId=CMT_DID_MASTER)
Write the specified message to the open log file.
Definition: cmt3.cpp:2875
XsensResultValue getBusId(uint8_t &busId, const CmtDeviceId deviceId=CMT_DID_MASTER) const
Retrieve the BusId of a device.
Definition: cmt3.cpp:438
Cmt3()
Default constructor, initializes all members to their default values.
Definition: cmt3.cpp:307
XsensResultValue setDataSource(bool readFromFile)
Set whether to read from comm port or file.
Definition: cmt3.cpp:2811
XsensResultValue setSyncOutSettings(const CmtSyncOutSettings &settings)
Set the outbound synchronization settings of an MT device.
Definition: cmt3.cpp:2316
XsensResultValue setMagneticDeclination(const double declination, const CmtDeviceId deviceId=CMT_DID_MASTER)
Set the stored magnetic declination.
Definition: cmt3.cpp:2140
uint8_t getBusIdInternal(const CmtDeviceId devId) const
Find a device Id in the list and return its busId.
Definition: cmt3.cpp:459
Structure containing a full device configuration as returned by the ReqConfig message.
Definition: cmtdef.h:860
XsensResultValue setGpsLeverArm(const CmtVector &arm, const CmtDeviceId deviceId=CMT_DID_MASTER)
Set the currently used GPS lever arm.
Definition: cmt3.cpp:2972
XsensResultValue setXmOutputMode(const uint8_t mode)
Set the dual-output mode of the XM.
Definition: cmt3.cpp:2516
XsensResultValue requestData(Packet *pack)
Definition: cmt3.cpp:1763
#define CMT_DID_MASTER
Definition: cmtdef.h:918
The mid-level file communication class.
Definition: cmt2.h:165
uint32_t m_baudrate
The baudrate that was last set to be used by the port.
Definition: cmt3.h:48
XsensResultValue getLogFileName(char *filename)
Retrieve the name of the open log file or an empty string if no logfile is open.
Definition: cmt3.cpp:934
XsensResultValue openLogFile(const char *filename)
Open a log file for input.
Definition: cmt3.cpp:2761
GLuint index
Definition: glext.h:3891
bool isLogging(void) const
<
Definition: cmt3.h:140
XsensResultValue getErrorMode(uint16_t &mode, const CmtDeviceId deviceId=CMT_DID_MASTER)
Return the error mode of the device.
Definition: cmt3.cpp:792
XsensResultValue setGravityMagnitude(const double magnitude, const CmtDeviceId deviceId=CMT_DID_MASTER)
Set the currently used magnitude of the gravity vector.
Definition: cmt3.cpp:2935
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:2904
XsensResultValue
Xsens return values.
Definition: xsens_std.h:30
XsensResultValue createLogFile(const char *filename, bool startLogging=false)
Create a log file for incoming messages.
Definition: cmt3.cpp:2644
CmtDeviceId m_lastHwErrorDeviceId
Contains the Device ID of the device that caused the last hardware error.
Definition: cmt3.h:60
uint32_t m_timeoutMeas
The measurement mode timeout.
Definition: cmt3.h:50
Cmt2s m_serial
The (optional) CMT level 2 serial object that this class operates on.
Definition: cmt3.h:39
XsensResultValue getUtcTime(CmtUtcTime &utc, const CmtDeviceId deviceId)
Return the UTC time of the last received sample.
Definition: cmt3.cpp:1409
XsensResultValue getSyncInMode(uint16_t &mode)
Retrieve the inbound synchronization mode of an MT device.
Definition: cmt3.cpp:1142
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:2461
XsensResultValue getSerialBaudrate(uint32_t &baudrate)
Return the baud rate used for serial communication.
Definition: cmt3.cpp:1045
XsensResultValue storeXkfState(const CmtDeviceId deviceId=CMT_DID_MASTER)
Store important components of the XKF filter state to non-volatile memory.
Definition: cmt3.cpp:3007
uint32_t getTimeoutConfig(void) const
Return the configuration mode timeout.
Definition: cmt3.cpp:1396
~Cmt3()
Destructor, de-initializes, frees memory allocated for buffers, etc.
Definition: cmt3.cpp:329
XsensResultValue getProductCode(char *productCode, const CmtDeviceId deviceId=CMT_DID_MASTER)
Return product code.
Definition: cmt3.cpp:1017
XsensResultValue getDataLength(uint32_t &length, const CmtDeviceId deviceId=CMT_DID_MASTER)
Retrieve data size.
Definition: cmt3.cpp:550
XsensResultValue setTimeoutMeasurement(const uint32_t timeout=CMT3_DEFAULT_TIMEOUT_MEAS)
Set the measurement mode timeout.
Definition: cmt3.cpp:2503
XsensResultValue getHwError(CmtDeviceId &did) const
<
Definition: cmt3.h:103
uint32_t m_timeoutConf
The config mode timeout.
Definition: cmt3.h:49
XsensResultValue getSyncOutMode(uint16_t &mode)
Retrieve the outbound synchronization mode of an MT device.
Definition: cmt3.cpp:1291
A structure for storing device modes using period and skip factor (new default)
Definition: cmtdef.h:1017
GLint mode
Definition: glext.h:5078
#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:637
XsensResultValue setLocationId(uint16_t locationId, const CmtDeviceId deviceId=CMT_DID_MASTER)
Set the location ID of a sensor.
Definition: cmt3.cpp:2129
bool m_measuring
Keeps track of whether the connected device is measuring or being configured.
Definition: cmt3.h:54
XsensResultValue setTimeoutConfig(const uint32_t timeout=CMT3_DEFAULT_TIMEOUT_CONF)
Set the configuration mode timeout.
Definition: cmt3.cpp:2490
XsensResultValue setSyncInSettings(const CmtSyncInSettings &settings)
Set the inbound synchronization settings of an MT device.
Definition: cmt3.cpp:2165
CmtMtTimeStamp m_rtcLastSc
The last received sample counter, used to determine wrap-around.
Definition: cmt3.h:47
XsensResultValue setTimeout(const uint32_t ms=CMT2_DEFAULT_TIMEOUT)
Set the default timeout value to use in blocking operations.
Definition: cmt2.cpp:349
XsensResultValue m_lastResult
The last result of an operation.
Definition: cmt3.h:51
bool isOpen(void) const
Return whether the communication port is open or not.
Definition: cmt2.h:106
bool m_useRtc
Indicates if the RTC should be computed or not (to save CPU time).
Definition: cmt3.h:63
bool isPortOpen(void) const
<
Definition: cmt3.h:142
XsensResultValue m_lastHwError
Contains the last error reported by hardware.
Definition: cmt3.h:59
XsensResultValue setSyncInSkipFactor(const uint16_t skipFactor)
Set the inbound synchronization skip factor of an MT device.
Definition: cmt3.cpp:2243
GLuint GLsizei GLsizei * length
Definition: glext.h:3900
XsensResultValue setSyncMode(const uint8_t mode)
Set the sync mode of the Xbus Master.
Definition: cmt3.cpp:2302
GLint level
Definition: glext.h:3545
uint32_t getTimeoutMeasurement(void) const
Return the measurement mode timeout.
Definition: cmt3.cpp:1402
uint16_t getSampleFrequency(void)
Return current sample frequency.
Definition: cmt3.cpp:1033
XsensResultValue setBluetoothState(const bool enabled)
Set the Bluetooth state of the Xbus Master.
Definition: cmt3.cpp:1924
_u8 status
Definition: rplidar_cmd.h:21
CmtResetMethod
Definition: cmtdef.h:834
XsensResultValue waitForDataMessage(Packet *pack)
Wait for a data message to arrive.
Definition: cmt3.cpp:2604
XsensResultValue getDeviceMode2(CmtDeviceMode2 &mode, const CmtDeviceId deviceId=CMT_DID_MASTER)
Return device mode2.
Definition: cmt3.cpp:613
XsensResultValue setLogMode(bool active)
Set the logging mode.
Definition: cmt3.cpp:2842
The namespace of all Xsens software since 2006.
Definition: cmt1.cpp:92
XsensResultValue peekLogMessageId(uint8_t &messageId)
Open a communication channel to the given COM port number.
Definition: cmt3.cpp:1646
CmtDeviceConfiguration m_config
The configuration of the connected devices.
Definition: cmt3.h:67
XsensResultValue resetOrientation(const CmtResetMethod method, const CmtDeviceId deviceId=CMT_DID_MASTER)
Perform an orientation reset on a device.
Definition: cmt3.cpp:1798
XsensResultValue getFirmwareRevision(CmtVersion &revision, const CmtDeviceId deviceId=CMT_DID_MASTER)
Return Firmware revision.
Definition: cmt3.cpp:862
XsensResultValue getSyncInSkipFactor(uint16_t &skipFactor)
Retrieve the inbound synchronization skip factor of an MT device.
Definition: cmt3.cpp:1167
XsensResultValue getLogFileSize(CmtFilePos &size)
Retrieve the size of the open log file in bytes.
Definition: cmt3.cpp:918
XsensResultValue getBluetoothState(bool &enabled)
Get the state of the bluetooth communication.
Definition: cmt3.cpp:426
XsensResultValue closePort(bool gotoConfigFirst=true)
Close the communication port.
Definition: cmt3.cpp:341
XsensResultValue setScenario(const uint8_t scenarioType, const CmtDeviceId deviceId=CMT_DID_MASTER)
Specify the scenario to use in the sensor.
Definition: cmt3.cpp:2915
GLsizeiptr size
Definition: glext.h:3779
void * m_eMtsData[CMT_MAX_DEVICES_PER_PORT]
Cached eMTS data.
Definition: cmt3.h:64
XsensResultValue getBusPowerState(bool &enabled)
Get the state of the Xbus power.
Definition: cmt3.cpp:480
bool m_detailedScan
Automatically scan for device details during open. Default is true (recommended). ...
Definition: cmt3.h:55
A structure for storing device modes.
Definition: cmtdef.h:978
unsigned __int32 uint32_t
Definition: rptypes.h:49
XsensResultValue setSyncInOffset(const uint32_t offset)
Set the inbound synchronization offset of an MT device.
Definition: cmt3.cpp:2271
XsensResultValue getLastResult(void) const
<
Definition: cmt3.h:101
XsensResultValue getBaudrate(uint32_t &baudrate)
Get the baudrate used by a port.
Definition: cmt3.cpp:413
#define CMT_MAX_DEVICES_PER_PORT
Definition: cmtdef.h:773
#define deviceId
Definition: CIMUXSens.cpp:41
uint32_t CmtDeviceId
The type of a Device Id.
Definition: cmtdef.h:851
XsensResultValue setHeading(const double heading, const CmtDeviceId deviceId=CMT_DID_MASTER)
Set the heading offset.
Definition: cmt3.cpp:2118
XsensResultValue setSyncOutMode(const uint16_t mode)
Set the outbound synchronization mode of an MT device.
Definition: cmt3.cpp:2376
uint16_t CmtMtTimeStamp
An MT timestamp (sample count)
Definition: cmtdef.h:913
A structure for storing scenario information.
Definition: cmtdef.h:1058
XsensResultValue getXmOutputMode(uint8_t &mode)
Return the dual-output mode of the XM.
Definition: cmt3.cpp:1433
XsensResultValue gotoConfig(void)
Place all connected devices into Configuration Mode.
Definition: cmt3.cpp:1445
Class for storing a single message.
Definition: cmtmessage.h:76
uint16_t m_period
The sample period of the port.
Definition: cmt3.h:43
#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:2107
Cmt2f m_logFile
The (optional) CMT level 2 logfile object that this class operates on.
Definition: cmt3.h:40
XsensResultValue getGravityMagnitude(double &magnitude, const CmtDeviceId deviceId=CMT_DID_MASTER)
Retrieve the currently used magnitude of the gravity vector.
Definition: cmt3.cpp:2925
XsensResultValue getSyncOutOffset(uint32_t &offset)
Retrieve the outbound synchronization offset of an MT device.
Definition: cmt3.cpp:1369



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