xsens_imu
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
xsens::Cmt3 Class Reference

High-level communication class. More...

#include <cmt3.h>

Public Member Functions

 Cmt3 ()
 Default constructor, initializes all members to their default values. More...
 
 ~Cmt3 ()
 Destructor, de-initializes, frees memory allocated for buffers, etc. More...
 
XsensResultValue closePort (bool gotoConfigFirst=true)
 Close the communication port. More...
 
XsensResultValue getBatteryLevel (uint8_t &level)
 Get an Xbus Master's battery level. More...
 
XsensResultValue getBaudrate (uint32_t &baudrate)
 Get the baudrate used by a port. More...
 
XsensResultValue getBluetoothState (bool &enabled)
 Get the state of the bluetooth communication. More...
 
XsensResultValue getBusId (uint8_t &busId, const CmtDeviceId deviceId=CMT_DID_MASTER) const
 Retrieve the BusId of a device. More...
 
XsensResultValue getBusPowerState (bool &enabled)
 Get the state of the Xbus power. More...
 
Cmt2fgetCmt2f (void)
 Return a reference to the embedded Cmt2f (logfile) object. More...
 
Cmt2sgetCmt2s (void)
 Return a reference to the embedded Cmt2s (comm port) object. More...
 
XsensResultValue getConfiguration (CmtDeviceConfiguration &configuration)
 Get device configuration. More...
 
XsensResultValue getDataLength (uint32_t &length, const CmtDeviceId deviceId=CMT_DID_MASTER)
 Retrieve data size. More...
 
uint32_t getDeviceCount (void) const
 Retrieve total device count. More...
 
XsensResultValue getDeviceId (const uint8_t busId, CmtDeviceId &deviceId) const
 Retrieve the DeviceId of a device given its Bus ID. More...
 
XsensResultValue getDeviceMode (CmtDeviceMode &mode, const CmtDeviceId deviceId=CMT_DID_MASTER)
 Return device mode. More...
 
XsensResultValue getDeviceMode2 (CmtDeviceMode2 &mode, const CmtDeviceId deviceId=CMT_DID_MASTER)
 Return device mode2. More...
 
XsensResultValue getEMtsData (void *buffer, const CmtDeviceId deviceId=CMT_DID_MASTER)
 Retrieve the eMts data of the specified sensor(s). More...
 
XsensResultValue getErrorMode (uint16_t &mode, const CmtDeviceId deviceId=CMT_DID_MASTER)
 Return the error mode of the device. More...
 
XsensResultValue getFirmwareRevision (CmtVersion &revision, const CmtDeviceId deviceId=CMT_DID_MASTER)
 Return Firmware revision. More...
 
XsensResultValue getHeading (double &heading, const CmtDeviceId deviceId=CMT_DID_MASTER)
 Return the heading offset. More...
 
XsensResultValue getLastResult (void) const
 < More...
 
XsensResultValue getHwError (CmtDeviceId &did) const
 < More...
 
void clearHwError (void)
 
XsensResultValue getLatLonAlt (CmtVector &lla, const CmtDeviceId deviceId=CMT_DID_MASTER)
 Retrieve the last stored sensor position. More...
 
XsensResultValue getLocationId (uint16_t &locationId, const CmtDeviceId deviceId=CMT_DID_MASTER)
 Return the location ID of a sensor. More...
 
XsensResultValue getLogFileReadPosition (XsensFilePos &pos)
 Retrieve the read position of the log file. More...
 
XsensResultValue getLogFileSize (XsensFilePos &size)
 Retrieve the size of the open log file in bytes. More...
 
XsensResultValue getLogFileName (char *filename)
 Retrieve the name of the open log file or an empty string if no logfile is open. More...
 
XsensResultValue getLogFileName (wchar_t *filename)
 Retrieve the name of the open log file or an empty string if no logfile is open. More...
 
XsensResultValue getMagneticDeclination (double &declination, const CmtDeviceId deviceId=CMT_DID_MASTER)
 Return the stored magnetic declination. More...
 
CmtDeviceId getMasterId (void)
 
uint16_t getMtCount (void) const
 Return the device Id of the first device (master). More...
 
XsensResultValue getMtDeviceId (const uint8_t index, CmtDeviceId &deviceId) const
 
XsensResultValue getObjectAlignmentMatrix (CmtMatrix &matrix, const CmtDeviceId deviceId=CMT_DID_MASTER)
 Return the device Id of an MT device. More...
 
XsensResultValue getPortNr (uint16_t &port) const
 Return the port number that this object is connected to. More...
 
XsensResultValue getProductCode (char *productCode, const CmtDeviceId deviceId=CMT_DID_MASTER)
 Return product code. More...
 
XsensResultValue getProcessingFlags (uint16_t &processingFlags, const CmtDeviceId deviceId=CMT_DID_MASTER)
 Return the processing flags of a sensor. More...
 
uint16_t getSampleFrequency (void)
 Return current sample frequency. More...
 
XsensResultValue getSerialBaudrate (uint32_t &baudrate)
 Return the baud rate used for serial communication. More...
 
XsensResultValue getSyncInSettings (CmtSyncInSettings &settings)
 Retrieve the inbound synchronization settings of the master MT device. More...
 
XsensResultValue getSyncInMode (uint16_t &mode)
 Retrieve the inbound synchronization mode of an MT device. More...
 
XsensResultValue getSyncInSkipFactor (uint16_t &skipFactor)
 Retrieve the inbound synchronization skip factor of an MT device. More...
 
XsensResultValue getSyncInOffset (uint32_t &offset)
 Retrieve the inbound synchronization offset of an MT device. More...
 
XsensResultValue getSyncMode (uint8_t &mode)
 Retrieve the sync mode of the Xbus Master. More...
 
XsensResultValue getSyncOutSettings (CmtSyncOutSettings &settings)
 Retrieve the outbound synchronization settings of the master MT device. More...
 
XsensResultValue getSyncOutMode (uint16_t &mode)
 Retrieve the outbound synchronization mode of an MT device. More...
 
XsensResultValue getSyncOutPulseWidth (uint32_t &pulseWidth)
 Retrieve the outbound synchronization pulse width of an MT device. More...
 
XsensResultValue getSyncOutSkipFactor (uint16_t &skipFactor)
 Retrieve the outbound synchronization skip factor of an MT device. More...
 
XsensResultValue getSyncOutOffset (uint32_t &offset)
 Retrieve the outbound synchronization offset of an MT device. More...
 
uint32_t getTimeoutConfig (void) const
 Return the configuration mode timeout. More...
 
uint32_t getTimeoutMeasurement (void) const
 Return the measurement mode timeout. More...
 
XsensResultValue getTransmissionDelay (uint16_t &delay, const CmtDeviceId deviceId=CMT_DID_MASTER)
 Return the RS485 acknowledge transmission delay of the device. More...
 
XsensResultValue getUtcTime (CmtUtcTime &utc, const CmtDeviceId deviceId)
 Return the UTC time of the last received sample. More...
 
XsensResultValue getXmOutputMode (uint8_t &mode)
 Return the dual-output mode of the XM. More...
 
XsensResultValue gotoConfig (void)
 Place all connected devices into Configuration Mode. More...
 
XsensResultValue gotoMeasurement (void)
 Place all connected devices into Measurement Mode. More...
 
XsensResultValue initBus (void)
 Perform an initBus request. More...
 
bool isLogging (void) const
 < More...
 
bool isReadingFromFile (void) const
 < More...
 
bool isPortOpen (void) const
 < More...
 
bool isXm (void) const
 Return whether the main device is an Xbus Master or not. More...
 
XsensResultValue openPort (const char *portName, const uint32_t baudRate=CMT_DEFAULT_BAUD_RATE, uint32_t readBufSize=CMT_DEFAULT_READ_BUFFER_SIZE, uint32_t writeBufSize=CMT_DEFAULT_WRITE_BUFFER_SIZE)
 
XsensResultValue peekLogMessageId (uint8_t &messageId)
 Open a communication channel to the given COM port number. More...
 
XsensResultValue readDataPacket (Packet *pack, bool acceptOther=false)
 Retrieve a data message. More...
 
XsensResultValue requestData (Packet *pack, const uint8_t *data=0, const uint16_t count=0)
 
XsensResultValue reset (void)
 Request a data message and wait for it to arrive. More...
 
XsensResultValue resetOrientation (const CmtResetMethod method, const CmtDeviceId deviceId=CMT_DID_MASTER)
 Perform an orientation reset on a device. More...
 
XsensResultValue runSelfTest (uint16_t &result, const CmtDeviceId deviceId=CMT_DID_MASTER)
 Let the MT perform a self test. The status of the selftest can be viewed in the status byte. The function will always return immediately. More...
 
XsensResultValue setNoRotation (const uint16_t duration, const CmtDeviceId deviceId=CMT_DID_MASTER)
 Initiates the XKF3 'no rotation' update procedure. More...
 
XsensResultValue restoreFactoryDefaults (const CmtDeviceId deviceId=CMT_DID_MASTER)
 Restore the device to factory default settings. More...
 
XsensResultValue setBaudrate (const uint32_t baudrate, bool reconnect=true)
 Set the baudrate and possibly reconnect. More...
 
XsensResultValue setBluetoothState (const bool enabled)
 Set the Bluetooth state of the Xbus Master. More...
 
XsensResultValue setBusPowerState (const bool enabled)
 Switch the Xbus Master bus power on or off. More...
 
XsensResultValue setDeviceMode (const CmtDeviceMode &mode, bool force, const CmtDeviceId deviceId=CMT_DID_MASTER)
 Set the complete output mode of a device. More...
 
XsensResultValue setDeviceMode2 (const CmtDeviceMode2 &mode, bool force, const CmtDeviceId deviceId=CMT_DID_MASTER)
 Set the complete output mode2 of a device. More...
 
XsensResultValue setErrorMode (const uint16_t mode)
 Set the error mode of the device. More...
 
XsensResultValue setGotoConfigTries (const uint16_t tries)
 Set the number of times the gotoConfig function will attempt a gotoConfig before failing. More...
 
XsensResultValue setHeading (const double heading, const CmtDeviceId deviceId=CMT_DID_MASTER)
 Set the heading offset. More...
 
XsensResultValue setLatLonAlt (const CmtVector &lla, const CmtDeviceId deviceId=CMT_DID_MASTER)
 Set the current sensor position. More...
 
XsensResultValue setLocationId (uint16_t locationId, const CmtDeviceId deviceId=CMT_DID_MASTER)
 Set the location ID of a sensor. More...
 
XsensResultValue setMagneticDeclination (const double declination, const CmtDeviceId deviceId=CMT_DID_MASTER)
 Set the stored magnetic declination. More...
 
XsensResultValue setObjectAlignmentMatrix (const CmtMatrix &matrix, const CmtDeviceId deviceId=CMT_DID_MASTER)
 Set the currently used object alignment matrix. More...
 
XsensResultValue setProcessingFlags (uint16_t processingFlags, const CmtDeviceId deviceId=CMT_DID_MASTER)
 Set the processing flags of a sensor. More...
 
XsensResultValue setSyncInSettings (const CmtSyncInSettings &settings)
 Set the inbound synchronization settings of an MT device. More...
 
XsensResultValue setSyncInMode (const uint16_t mode)
 Set the inbound synchronization mode of an MT device. More...
 
XsensResultValue setSyncInSkipFactor (const uint16_t skipFactor)
 Set the inbound synchronization skip factor of an MT device. More...
 
XsensResultValue setSyncInOffset (const uint32_t offset)
 Set the inbound synchronization offset of an MT device. More...
 
XsensResultValue setSyncMode (const uint8_t mode)
 Set the sync mode of the Xbus Master. More...
 
XsensResultValue setSyncOutSettings (const CmtSyncOutSettings &settings)
 Set the outbound synchronization settings of an MT device. More...
 
XsensResultValue setSyncOutMode (const uint16_t mode)
 Set the outbound synchronization mode of an MT device. More...
 
XsensResultValue setSyncOutPulseWidth (const uint32_t pulseWidth)
 Set the outbound synchronization pulse width of an MT device. More...
 
XsensResultValue setSyncOutSkipFactor (const uint16_t skipFactor)
 Set the outbound synchronization skip factor of an MT device. More...
 
XsensResultValue setSyncOutOffset (const uint32_t offset)
 Set the outbound synchronization offset of an MT device. More...
 
XsensResultValue setTimeout (const uint32_t ms)
 
XsensResultValue setTimeoutConfig (const uint32_t timeout=CMT3_DEFAULT_TIMEOUT_CONF)
 Set the configuration mode timeout. More...
 
XsensResultValue setTimeoutMeasurement (const uint32_t timeout=CMT3_DEFAULT_TIMEOUT_MEAS)
 Set the measurement mode timeout. More...
 
XsensResultValue setTransmissionDelay (const uint16_t delay)
 Set the RS485 acknowledge transmission delay of the device. More...
 
XsensResultValue setXmOutputMode (const uint8_t mode)
 Set the dual-output mode of the XM. More...
 
XsensResultValue setXmPowerOff (void)
 Switch the connected Xbus Master. More...
 
XsensResultValue refreshCache (const bool file=false)
 Update device information stored on host PC. More...
 
XsensResultValue waitForDataMessage (Packet *pack)
 Wait for a data message to arrive. More...
 
XsensResultValue createLogFile (const char *filename, bool startLogging=false)
 Create a log file for incoming messages. More...
 
XsensResultValue createLogFile (const wchar_t *filename, bool startLogging=false)
 Create a log file for incoming messages. More...
 
XsensResultValue closeLogFile (bool del=false)
 Close an open log file. More...
 
bool isLogFileOpen (const char *filename) const
 Return whether or not(true or false) the supplied file is open. More...
 
bool isLogFileOpen (const wchar_t *filename) const
 Return whether or not(true or false) the supplied file is open. More...
 
XsensResultValue openLogFile (const char *filename)
 Open a log file for input. More...
 
XsensResultValue openLogFile (const wchar_t *filename)
 Open a log file for input. More...
 
XsensResultValue setDataSource (bool readFromFile)
 Set whether to read from comm port or file. More...
 
XsensResultValue setLogMode (bool active)
 Set the logging mode. More...
 
XsensResultValue resetLogFileReadPos (void)
 Restart reading from the start of the open log file. More...
 
XsensResultValue writeMessageToLogFile (const Message &msg)
 
XsensResultValue getAvailableScenarios (CmtScenario *scenarios, const CmtDeviceId deviceId=CMT_DID_MASTER)
 Write the specified message to the open log file. More...
 
XsensResultValue getScenario (uint8_t &scenarioType, uint8_t &scenarioVersion, const CmtDeviceId deviceId=CMT_DID_MASTER)
 Get the currently active scenario from a Motion Tracker. More...
 
XsensResultValue setScenario (const uint8_t scenarioType, const CmtDeviceId deviceId=CMT_DID_MASTER)
 Specify the scenario to use in the sensor. More...
 
XsensResultValue getGravityMagnitude (double &magnitude, const CmtDeviceId deviceId=CMT_DID_MASTER)
 Retrieve the currently used magnitude of the gravity vector. More...
 
XsensResultValue setGravityMagnitude (const double magnitude, const CmtDeviceId deviceId=CMT_DID_MASTER)
 Set the currently used magnitude of the gravity vector. More...
 
XsensResultValue getGpsLeverArm (CmtVector &arm, const CmtDeviceId deviceId=CMT_DID_MASTER)
 Get the currently used GPS lever arm. More...
 
XsensResultValue getGpsStatus (CmtGpsStatus &status, const CmtDeviceId deviceId=CMT_DID_MASTER)
 Request the status of the GPS satellites in orbit. More...
 
XsensResultValue setGpsLeverArm (const CmtVector &arm, const CmtDeviceId deviceId=CMT_DID_MASTER)
 Set the currently used GPS lever arm. More...
 
XsensResultValue storeXkfState (const CmtDeviceId deviceId=CMT_DID_MASTER)
 Store important components of the XKF filter state to non-volatile memory. More...
 

Public Attributes

bool m_useRtc
 Indicates if the RTC should be computed or not (to save CPU time). More...
 
void * m_eMtsData [CMT_MAX_DEVICES_PER_PORT]
 Cached eMTS data. More...
 
CmtDeviceConfiguration m_config
 Cached configuration data. More...
 

Protected Member Functions

 Cmt3 (const Cmt3 &ref)
 This object cannot be copied, so this function is not implemented. More...
 
void fillRtc (Packet *pack)
 Internal function to compute the RTC value. More...
 
uint8_t getBusIdInternal (const CmtDeviceId devId) const
 Find a device Id in the list and return its busId. More...
 

Protected Attributes

Cmt2s m_serial
 The (optional) CMT level 2 serial object that this class operates on. More...
 
Cmt2f m_logFile
 The (optional) CMT level 2 logfile object that this class operates on. More...
 
uint16_t m_period
 The sample period of the port. More...
 
uint16_t m_skip
 The skip factor of the port. More...
 
uint32_t m_rtcCount
 The long sample counter (normal counter wraps at 64k). More...
 
CmtMtTimeStamp m_rtcLastSc
 The last received sample counter, used to determine wrap-around. More...
 
xsens::TimeSync m_rtcSync
 Used for synchronizing MT timestamps to system timestamps. More...
 
bool m_rtcInitialized
 Indicates whether the RTC synchronization isinitialized. More...
 
uint32_t m_baudrate
 The baudrate that was last set to be used by the port. More...
 
uint32_t m_timeoutConf
 The config mode timeout. More...
 
uint32_t m_timeoutMeas
 The measurement mode timeout. More...
 
XsensResultValue m_lastResult
 The last result of an operation. More...
 
uint16_t m_firstItem
 The index of the first formatting item. More...
 
uint16_t m_gotoConfigTries
 The number of times a goto config is attempted before the function fails. More...
 
bool m_measuring
 Keeps track of whether the connected device is measuring or being configured. More...
 
bool m_detailedScan
 Automatically scan for device details during open. Default is true (recommended). More...
 
bool m_readFromFile
 Indicates whether to read from the log file or from the serial port. More...
 
bool m_logging
 Indicates whether to write all received messages to the logfile or not, automatically set to true by createLogFile. More...
 
XsensResultValue m_lastHwError
 Contains the last error reported by hardware. More...
 
CmtDeviceId m_lastHwErrorDeviceId
 Contains the Device ID of the device that caused the last hardware error. More...
 
uint32_t m_readBufSize
 Contains the size of the serial read buffer. More...
 
uint32_t m_writeBufSize
 Contains the size of the serial write buffer. More...
 

Detailed Description

High-level communication class.

The class uses CMT level 2, but does not inherit from it. If software needs to access the level 2 components, it needs to be done through the getCmt2s() and getCmt2f() functions.

All device identification is done through device Ids in CMT level 3.

Constructor & Destructor Documentation

xsens::Cmt3::Cmt3 ( const Cmt3 ref)
protected

This object cannot be copied, so this function is not implemented.

xsens::Cmt3::Cmt3 ( )

Default constructor, initializes all members to their default values.

xsens::Cmt3::~Cmt3 ( )

Destructor, de-initializes, frees memory allocated for buffers, etc.

Member Function Documentation

void xsens::Cmt3::clearHwError ( void  )
inline
XsensResultValue xsens::Cmt3::closeLogFile ( bool  del = false)

Close an open log file.

This function closes the logfile if it was open.

Parameters
delWhen 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 also
createLogFile isLogFileOpen openLogFile setLogMode
XsensResultValue xsens::Cmt3::closePort ( bool  gotoConfigFirst = true)

Close the communication port.

This function places the device in configuration mode and closes the communication port, ending all further communication with the device.

XsensResultValue xsens::Cmt3::createLogFile ( const char *  filename,
bool  startLogging = false 
)

Create a log file for incoming messages.

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.

Parameters
filenameThe name of the file to use as a log file. A fully qualified (local) path+filename is recommended.
startLoggingWhen 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 also
closeLogFile isLogFileOpen openLogFile setLogMode
Note
This function is available in configuration AND in measurement mode.
XsensResultValue xsens::Cmt3::createLogFile ( const wchar_t *  filename,
bool  startLogging = false 
)

Create a log file for incoming messages.

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.

Parameters
filenameThe name of the file to use as a log file. A fully qualified (local) path+filename is recommended.
startLoggingWhen 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 also
closeLogFile isLogFileOpen openLogFile setLogMode
Note
This function is available in configuration AND in measurement mode.
void xsens::Cmt3::fillRtc ( Packet pack)
protected

Internal function to compute the RTC value.

XsensResultValue xsens::Cmt3::getAvailableScenarios ( CmtScenario scenarios,
const CmtDeviceId  deviceId = CMT_DID_MASTER 
)

Write the specified message to the open log file.

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 also
createLogFile Retrieve a list of the available scenarios.

Use this function to retrieve a list of all scenarios available in a Motion Tracker. See the supplied documentation for more information about scenarios.

Parameters
scenariosA 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 also
getScenario setScenario
Note
This function is only available in configuration mode.
XsensResultValue xsens::Cmt3::getBatteryLevel ( uint8_t &  level)

Get an Xbus Master's battery level.

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.

XsensResultValue xsens::Cmt3::getBaudrate ( uint32_t &  baudrate)

Get the baudrate used by a port.

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 also
getSerialBaudrate setSerialBaudrate setBaudrate
XsensResultValue xsens::Cmt3::getBluetoothState ( bool &  enabled)

Get the state of the bluetooth communication.

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.
XsensResultValue xsens::Cmt3::getBusId ( uint8_t &  busId,
const CmtDeviceId  deviceId = CMT_DID_MASTER 
) const

Retrieve the BusId of a device.

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.

uint8_t xsens::Cmt3::getBusIdInternal ( const CmtDeviceId  devId) const
protected

Find a device Id in the list and return its busId.

CmtDeviceId 0= busId 0= broadcast. A CMT_BID_INVALID value is also possible and indicates that the devId was not found.

XsensResultValue xsens::Cmt3::getBusPowerState ( bool &  enabled)

Get the state of the Xbus power.

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 also
setBusPowerState
Note
This function is only valid in configuration mode.
Cmt2f * xsens::Cmt3::getCmt2f ( void  )

Return a reference to the embedded Cmt2f (logfile) object.

Any manipulation of the object should be done through Cmt3. Cmt3's integrity is not guaranteed if the Cmt2f object is manipulated directly.

See also
refreshCache
Cmt2s * xsens::Cmt3::getCmt2s ( void  )

Return a reference to the embedded Cmt2s (comm port) object.

Any manipulation of the object should be done through Cmt3. Cmt3's integrity is not guaranteed if the Cmt2s object is manipulated directly.

See also
refreshCache
XsensResultValue xsens::Cmt3::getConfiguration ( CmtDeviceConfiguration configuration)

Get device configuration.

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.
XsensResultValue xsens::Cmt3::getDataLength ( uint32_t &  length,
const CmtDeviceId  deviceId = CMT_DID_MASTER 
)

Retrieve data size.

This function retrieves the number of bytes that are in a data message as sent by the given device.

uint32_t xsens::Cmt3::getDeviceCount ( void  ) const

Retrieve total device count.

This function retrieves the total number of connected (master + slave) devices or 0 if not connected.

XsensResultValue xsens::Cmt3::getDeviceId ( const uint8_t  busId,
CmtDeviceId deviceId 
) const

Retrieve the DeviceId of a device given its Bus ID.

This function retrieves the DeviceId for the device with the given Bus ID. When no devices are connected, a 0 ID is supplied.

XsensResultValue xsens::Cmt3::getDeviceMode ( CmtDeviceMode mode,
const CmtDeviceId  deviceId = CMT_DID_MASTER 
)

Return device mode.

This function retrieves the output-related settings of the device, such as the sample rate and output settings.

See also
setDeviceMode
Note
This function actually reads the device mode from the cached configuration, so it is available in measurement mode.
See also
refreshCache
XsensResultValue xsens::Cmt3::getDeviceMode2 ( CmtDeviceMode2 mode,
const CmtDeviceId  deviceId = CMT_DID_MASTER 
)

Return device mode2.

This function retrieves the outputMode, outputSettings, period and outputSkipFactor of the device.

See also
setDeviceMode2
Note
This function actually reads the device mode from the cached configuration, so it is available in measurement mode.
See also
refreshCache
XsensResultValue xsens::Cmt3::getEMtsData ( void *  buffer,
const CmtDeviceId  deviceId = CMT_DID_MASTER 
)

Retrieve the eMts data of the specified sensor(s).

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.

XsensResultValue xsens::Cmt3::getErrorMode ( uint16_t &  mode,
const CmtDeviceId  deviceId = CMT_DID_MASTER 
)

Return the error mode of the device.

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 also
setErrorMode
Note
This function is only valid in configuration mode.
XsensResultValue xsens::Cmt3::getFirmwareRevision ( CmtVersion revision,
const CmtDeviceId  deviceId = CMT_DID_MASTER 
)

Return Firmware revision.

This function retrieves the firmware version that is currently installed in the device.

Note
This function is only valid in configuration mode.
XsensResultValue xsens::Cmt3::getGpsLeverArm ( CmtVector arm,
const CmtDeviceId  deviceId = CMT_DID_MASTER 
)

Get the currently used GPS lever arm.

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 also
setGpsLeverArm
Note
This function is only available in configuration mode.
This function is only available for MTi-G devices.
XsensResultValue xsens::Cmt3::getGpsStatus ( CmtGpsStatus status,
const CmtDeviceId  deviceId = CMT_DID_MASTER 
)

Request the status of the GPS satellites in orbit.

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.

XsensResultValue xsens::Cmt3::getGravityMagnitude ( double &  magnitude,
const CmtDeviceId  deviceId = CMT_DID_MASTER 
)

Retrieve the currently used magnitude of the gravity vector.

The magnitude of the gravity vector is used to determine absolute acceleration from measured acceleration.

See also
setGravityMagnitude
Note
This function is only available in configuration mode.
XsensResultValue xsens::Cmt3::getHeading ( double &  heading,
const CmtDeviceId  deviceId = CMT_DID_MASTER 
)

Return the heading offset.

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 also
setHeading getMagneticDeclination setMagneticDeclination
Note
This function is only valid in configuration mode.
XsensResultValue xsens::Cmt3::getHwError ( CmtDeviceId did) const
inline

<

Return the last Hardware error code.

This function returns the XsensResultValue of the last problem reported by hardware (if any). Hardware problems are all 'error' messages returned by a sensor.

Parameters
didIf any problems were found, the responsible device ID will be returned in this parameter.
See also
clearHwError
XsensResultValue xsens::Cmt3::getLastResult ( void  ) const
inline

<

Return the error code of the last user function call.

XsensResultValue xsens::Cmt3::getLatLonAlt ( CmtVector lla,
const CmtDeviceId  deviceId = CMT_DID_MASTER 
)

Retrieve the last stored sensor position.

This function retrieves the last stored position in latitude, longitude, altitude.

See also
setLatLonAlt
XsensResultValue xsens::Cmt3::getLocationId ( uint16_t &  locationId,
const CmtDeviceId  deviceId = CMT_DID_MASTER 
)

Return the location ID of a sensor.

This function retrieves the location ID stored in the device.

See also
setLocationId
Note
This function is only valid in configuration mode.
XsensResultValue xsens::Cmt3::getLogFileName ( char *  filename)

Retrieve the name of the open log file or an empty string if no logfile is open.

XsensResultValue xsens::Cmt3::getLogFileName ( wchar_t *  filename)

Retrieve the name of the open log file or an empty string if no logfile is open.

XsensResultValue xsens::Cmt3::getLogFileReadPosition ( XsensFilePos pos)

Retrieve the read position of the log file.

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 also
resetLogFileReadPos getCmt2f
XsensResultValue xsens::Cmt3::getLogFileSize ( XsensFilePos size)

Retrieve the size of the open log file in bytes.

XsensResultValue xsens::Cmt3::getMagneticDeclination ( double &  declination,
const CmtDeviceId  deviceId = CMT_DID_MASTER 
)

Return the stored magnetic declination.

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 also
getHeading setHeading setMagneticDeclination
Note
This function is only valid in configuration mode.
CmtDeviceId xsens::Cmt3::getMasterId ( void  )
uint16_t xsens::Cmt3::getMtCount ( void  ) const

Return the device Id of the first device (master).

Note
The deviceId is read from the cached configuration data, so it is also available in measurement mode. Retrieve number of MT devices.

This function will return the number of connected MT devices. Effectively, this returns the device count minus any Xbus Masters.

XsensResultValue xsens::Cmt3::getMtDeviceId ( const uint8_t  index,
CmtDeviceId deviceId 
) const
XsensResultValue xsens::Cmt3::getObjectAlignmentMatrix ( CmtMatrix matrix,
const CmtDeviceId  deviceId = CMT_DID_MASTER 
)

Return the device Id of an MT device.

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. Retrieve the last stored object alignment matrix.

Use this function to get the object matrix currently used as the sensor frame with respect to the reference frame. See the manual for more information on coordinate systems and object resets.

See also
setObjectAlignmentMatrix
XsensResultValue xsens::Cmt3::getPortNr ( uint16_t &  port) const

Return the port number that this object is connected to.

If CMT is reading from a log file, an error will be returned.

XsensResultValue xsens::Cmt3::getProcessingFlags ( uint16_t &  processingFlags,
const CmtDeviceId  deviceId = CMT_DID_MASTER 
)

Return the processing flags of a sensor.

This function retrieves the processing flags stored in the device.

See also
setProcessingFlags
Note
This function is only valid in configuration mode.
XsensResultValue xsens::Cmt3::getProductCode ( char *  productCode,
const CmtDeviceId  deviceId = CMT_DID_MASTER 
)

Return product code.

This function retrieves the product code of the given device.

Parameters
productCodeThe 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.
uint16_t xsens::Cmt3::getSampleFrequency ( void  )

Return current sample frequency.

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 also
setDeviceMode getDeviceMode
XsensResultValue xsens::Cmt3::getScenario ( uint8_t &  scenarioType,
uint8_t &  scenarioVersion,
const CmtDeviceId  deviceId = CMT_DID_MASTER 
)

Get the currently active scenario from a Motion Tracker.

This function retrieves the scenario currently used by the specified device when outputting orientation and/or position data.

See also
getAvailableScenarios setScenario
Note
This function is only available in configuration mode.
XsensResultValue xsens::Cmt3::getSerialBaudrate ( uint32_t &  baudrate)

Return the baud rate used for serial communication.

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 also
setSerialBaudrate setBaudrate getBaudrate
Note
This function is only valid in configuration mode.
XsensResultValue xsens::Cmt3::getSyncInMode ( uint16_t &  mode)

Retrieve the inbound synchronization mode of an MT device.

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 also
setSyncInMode setSyncInSettings getSyncInSettings getSyncInSkipFactor setSyncInSkipFactor getSyncInOffset setSyncInOffset getSyncOutSettings setSyncOutSettings getSyncMode setSyncMode
XsensResultValue xsens::Cmt3::getSyncInOffset ( uint32_t &  offset)

Retrieve the inbound synchronization offset of an MT device.

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 also
setSyncInOffset setSyncInSettings getSyncInSettings getSyncInSkipFactor setSyncInSkipFactor getSyncOutSettings setSyncOutSettings getSyncMode setSyncMode
XsensResultValue xsens::Cmt3::getSyncInSettings ( CmtSyncInSettings settings)

Retrieve the inbound synchronization settings of the master MT device.

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 also
setSyncInSettings getSyncOutSettings setSyncOutSettings getSyncMode setSyncMode
Note
This function is only valid in configuration mode.
XsensResultValue xsens::Cmt3::getSyncInSkipFactor ( uint16_t &  skipFactor)

Retrieve the inbound synchronization skip factor of an MT device.

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 also
setSyncInSkipFactor setSyncInSettings getSyncInSettings getSyncInOffset setSyncInOffset getSyncOutSettings setSyncOutSettings getSyncMode setSyncMode
XsensResultValue xsens::Cmt3::getSyncMode ( uint8_t &  mode)

Retrieve the sync mode of the Xbus Master.

This function requests the current synchronization mode used by the specified Xbus Master. This function is not valid for MT devices.

See also
setSyncMode getSyncInSettings setSyncInSettings getSyncOutSettings setSyncOutSettings
Note
This function is only valid in configuration mode.
XsensResultValue xsens::Cmt3::getSyncOutMode ( uint16_t &  mode)

Retrieve the outbound synchronization mode of an MT device.

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 also
setSyncOutMode setSyncOutSettings getSyncOutSettings getSyncOutPulseWidth setSyncOutPulseWidth getSyncOutSkipFactor setSyncOutSkipFactor getSyncOutOffset setSyncOutOffset getSyncInSettings setSyncInSettings getSyncMode setSyncMode
XsensResultValue xsens::Cmt3::getSyncOutOffset ( uint32_t &  offset)

Retrieve the outbound synchronization offset of an MT device.

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 also
setSyncOutOffset setSyncOutSettings getSyncOutSettings setSyncOutMode getSyncOutMode getSyncOutPulseWidth setSyncOutPulseWidth getSyncOutSkipFactor setSyncOutSkipFactor getSyncInSettings setSyncInSettings getSyncMode setSyncMode
XsensResultValue xsens::Cmt3::getSyncOutPulseWidth ( uint32_t &  pulseWidth)

Retrieve the outbound synchronization pulse width of an MT device.

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 also
setSyncOutPulseWidth setSyncOutSettings getSyncOutSettings setSyncOutMode getSyncOutMode getSyncOutSkipFactor setSyncOutSkipFactor getSyncOutOffset setSyncOutOffset getSyncInSettings setSyncInSettings getSyncMode setSyncMode
XsensResultValue xsens::Cmt3::getSyncOutSettings ( CmtSyncOutSettings settings)

Retrieve the outbound synchronization settings of the master MT device.

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 also
setSyncOutSettings getSyncInSettings setSyncInSettings getSyncMode setSyncMode
Note
This function is only valid in configuration mode.
XsensResultValue xsens::Cmt3::getSyncOutSkipFactor ( uint16_t &  skipFactor)

Retrieve the outbound synchronization skip factor of an MT device.

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 also
stSyncOutSkipFactor setSyncOutSettings getSyncOutSettings setSyncOutMode getSyncOutMode getSyncOutPulseWidth setSyncOutPulseWidth getSyncOutOffset setSyncOutOffset getSyncInSettings setSyncInSettings getSyncMode setSyncMode
uint32_t xsens::Cmt3::getTimeoutConfig ( void  ) const

Return the configuration mode timeout.

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 also
setTimeoutConfig getTimeoutMeasurement setTimeoutMeasurement
uint32_t xsens::Cmt3::getTimeoutMeasurement ( void  ) const

Return the measurement mode timeout.

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 also
setTimeoutMeasurement getTimeoutConfig setTimeoutConfig
XsensResultValue xsens::Cmt3::getTransmissionDelay ( uint16_t &  delay,
const CmtDeviceId  deviceId = CMT_DID_MASTER 
)

Return the RS485 acknowledge transmission delay of the device.

This function returns the RS485 acknowledge transmission delay of the device. The RS485 acknowledge transmission delay determines the minimal delay to response on request messages. See the low-level communication documentation for more details.

See also
setAckTransmissionDelay
Note
This function is only valid in configuration mode.
XsensResultValue xsens::Cmt3::getUtcTime ( CmtUtcTime utc,
const CmtDeviceId  deviceId 
)

Return the UTC time of the last received sample.

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.

XsensResultValue xsens::Cmt3::getXmOutputMode ( uint8_t &  mode)

Return the dual-output mode of the XM.

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 also
setXmOutputMode
XsensResultValue xsens::Cmt3::gotoConfig ( void  )

Place all connected devices into Configuration Mode.

This function places the sensors in configuration mode.

Note
This function has no effect when reading from a log file
XsensResultValue xsens::Cmt3::gotoMeasurement ( void  )

Place all connected devices into Measurement Mode.

This function places the sensors in measurement mode.

Note
This function has no effect when reading from a log file
XsensResultValue xsens::Cmt3::initBus ( void  )

Perform an initBus request.

See the low-level documentation for more information on the InitBus message.

See also
refreshCache setBusPowerState
bool xsens::Cmt3::isLogFileOpen ( const char *  filename) const

Return whether or not(true or false) the supplied file is open.

Check if the log file filename is open.

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.

Returns
true if the log file is open, false if it isn't
See also
closeLogFile createLogFile openLogFile setLogMode
Returns
true if the file is open
See also
isLogFileOpen(const wchar_t *)
bool xsens::Cmt3::isLogFileOpen ( const wchar_t *  filename) const

Return whether or not(true or false) the supplied file is open.

Check if the log file filename is open.

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.

Returns
true if the log file is open, false if it isn't
See also
closeLogFile createLogFile openLogFile setLogMode
Returns
true if the file is open
See also
isLogFileOpen(const char *)
bool xsens::Cmt3::isLogging ( void  ) const
inline

<

Return whether the Cmt3 object is writing to a log file or not

bool xsens::Cmt3::isPortOpen ( void  ) const
inline

<

Return whether the communication port is open or not.

bool xsens::Cmt3::isReadingFromFile ( void  ) const
inline

<

Return whether the Cmt3 object is reading from a log file or not

bool xsens::Cmt3::isXm ( void  ) const

Return whether the main device is an Xbus Master or not.

XsensResultValue xsens::Cmt3::openLogFile ( const char *  filename)

Open a log file for input.

This function opens the supplied log file for reading. The function will fail if a serial connection is currently open.

Parameters
filenameThe 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 also
closeLogFile createLogFile isLogFileOpen setLogMode
XsensResultValue xsens::Cmt3::openLogFile ( const wchar_t *  filename)

Open a log file for input.

This function opens the supplied log file for reading. The function will fail if a serial connection is currently open.

Parameters
filenameThe 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 also
closeLogFile createLogFile isLogFileOpen setLogMode
XsensResultValue xsens::Cmt3::openPort ( const char *  portName,
const uint32_t  baudRate = CMT_DEFAULT_BAUD_RATE,
uint32_t  readBufSize = CMT_DEFAULT_READ_BUFFER_SIZE,
uint32_t  writeBufSize = CMT_DEFAULT_WRITE_BUFFER_SIZE 
)
XsensResultValue xsens::Cmt3::peekLogMessageId ( uint8_t &  messageId)

Open a communication channel to the given COM port number.

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 also
gotoConfig closePort Peek(take a look) at the message ID of the next message.

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.
XsensResultValue xsens::Cmt3::readDataPacket ( Packet pack,
bool  acceptOther = false 
)

Retrieve a data message.

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.

XsensResultValue xsens::Cmt3::refreshCache ( const bool  file = false)

Update device information stored on host PC.

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.
XsensResultValue xsens::Cmt3::requestData ( Packet pack,
const uint8_t *  data = 0,
const uint16_t  count = 0 
)
XsensResultValue xsens::Cmt3::reset ( void  )

Request a data message and wait for it to arrive.

This function is only useful when the skip factor is set to 0xFFFF. Reset all connected sensors.

XsensResultValue xsens::Cmt3::resetLogFileReadPos ( void  )

Restart reading from the start of the open log file.

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 also
openLogFile
XsensResultValue xsens::Cmt3::resetOrientation ( const CmtResetMethod  method,
const CmtDeviceId  deviceId = CMT_DID_MASTER 
)

Perform an orientation reset on a device.

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.
XsensResultValue xsens::Cmt3::restoreFactoryDefaults ( const CmtDeviceId  deviceId = CMT_DID_MASTER)

Restore the device to factory default settings.

Restore the factory defaults of a device.

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.
XsensResultValue xsens::Cmt3::runSelfTest ( uint16_t &  result,
const CmtDeviceId  deviceId = CMT_DID_MASTER 
)

Let the MT perform a self test. The status of the selftest can be viewed in the status byte. The function will always return immediately.

Initiates the MT's selftest procudure.

XsensResultValue xsens::Cmt3::setBaudrate ( const uint32_t  baudrate,
bool  reconnect = true 
)

Set the baudrate and possibly reconnect.

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 also
getBaudrate setSerialBaudrate getSerialBaudrate
Note
This function is only available in configuration mode.
XsensResultValue xsens::Cmt3::setBluetoothState ( const bool  enabled)

Set the Bluetooth state of the Xbus Master.

This function sets the state of the bluetooth communication to on or off.

Note
This function is only available in configuration mode.
XsensResultValue xsens::Cmt3::setBusPowerState ( const bool  enabled)

Switch the Xbus Master bus power on or off.

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.
This function is only available in configuration mode.
See also
initBus refreshCache
XsensResultValue xsens::Cmt3::setDataSource ( bool  readFromFile)

Set whether to read from comm port or file.

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).

XsensResultValue xsens::Cmt3::setDeviceMode ( const CmtDeviceMode mode,
bool  force,
const CmtDeviceId  deviceId = CMT_DID_MASTER 
)

Set the complete output mode of a device.

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 also
getDeviceMode getDeviceMode2 setDeviceMode2
XsensResultValue xsens::Cmt3::setDeviceMode2 ( const CmtDeviceMode2 mode,
bool  force,
const CmtDeviceId  deviceId = CMT_DID_MASTER 
)

Set the complete output mode2 of a device.

This function updates the outputMode, outputSettings, period and outputSkipFactor 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 also
getDeviceMode2 getDeviceMode setDeviceMode
XsensResultValue xsens::Cmt3::setErrorMode ( const uint16_t  mode)

Set the error mode of the device.

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 also
getErrorMode
XsensResultValue xsens::Cmt3::setGotoConfigTries ( const uint16_t  tries)

Set the number of times the gotoConfig function will attempt a gotoConfig before failing.

This is especially useful when using RS485 communication or when for some reason the communication lines are not reliable.

XsensResultValue xsens::Cmt3::setGpsLeverArm ( const CmtVector arm,
const CmtDeviceId  deviceId = CMT_DID_MASTER 
)

Set the currently used GPS lever arm.

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 also
getGpsLeverArm
Note
This function is only available in configuration mode.
This function is only available for MTi-G devices.
XsensResultValue xsens::Cmt3::setGravityMagnitude ( const double  magnitude,
const CmtDeviceId  deviceId = CMT_DID_MASTER 
)

Set the currently used magnitude of the gravity vector.

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 http://www.abc.net.au/science/news/stories/s911917.htm and http://en.wikipedia.org/wiki/Earth%27s_gravity#Comparative_gravities_in_various_cities_around_the_world)

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 also
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.
XsensResultValue xsens::Cmt3::setHeading ( const double  heading,
const CmtDeviceId  deviceId = CMT_DID_MASTER 
)

Set the heading offset.

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 also
getHeading getMagneticDeclination setMagneticDeclination
XsensResultValue xsens::Cmt3::setLatLonAlt ( const CmtVector lla,
const CmtDeviceId  deviceId = CMT_DID_MASTER 
)

Set the current sensor position.

Use this function to set the current position in latitude, longitude, altitude.

See also
getLatLonAlt
XsensResultValue xsens::Cmt3::setLocationId ( uint16_t  locationId,
const CmtDeviceId  deviceId = CMT_DID_MASTER 
)

Set the location ID of a sensor.

This function sets the location ID stored in the device.

Note
This function is only available in configuration mode.
See also
getLocationId
XsensResultValue xsens::Cmt3::setLogMode ( bool  active)

Set the logging mode.

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.
XsensResultValue xsens::Cmt3::setMagneticDeclination ( const double  declination,
const CmtDeviceId  deviceId = CMT_DID_MASTER 
)

Set the stored magnetic declination.

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 also
getHeading setHeading getMagneticDeclination
XsensResultValue xsens::Cmt3::setNoRotation ( const uint16_t  duration,
const CmtDeviceId  deviceId = CMT_DID_MASTER 
)

Initiates the XKF3 'no rotation' update procedure.

This function Initiates the XKF3 'no rotation' update procedure. See the MT documentation for more information.

Note
Note that this message does not convey any status. Bits 3-4 of the MT status byte are used instead. Only valid in measurement mode.
XsensResultValue xsens::Cmt3::setObjectAlignmentMatrix ( const CmtMatrix matrix,
const CmtDeviceId  deviceId = CMT_DID_MASTER 
)

Set the currently used object alignment matrix.

Use this function to set the object matrix to be used as the sensor frame with respect to the reference frame. See the manual for more information on coordinate systems and object resets.

See also
getObjectAlignmentMatrix
XsensResultValue xsens::Cmt3::setProcessingFlags ( uint16_t  processingFlags,
const CmtDeviceId  deviceId = CMT_DID_MASTER 
)

Set the processing flags of a sensor.

This function sets the processing flags stored in the device.

Note
This function is only available in configuration mode.
See also
getProcessingFlags
XsensResultValue xsens::Cmt3::setScenario ( const uint8_t  scenarioType,
const CmtDeviceId  deviceId = CMT_DID_MASTER 
)

Specify the scenario to use in the sensor.

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 also
getAvailableScenarios getScenario
Note
This function is only available in configuration mode.
XsensResultValue xsens::Cmt3::setSyncInMode ( const uint16_t  mode)

Set the inbound synchronization mode of an MT device.

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 also
getSyncInMode setSyncInSettings getSyncInSettings getSyncInSkipFactor setSyncInSkipFactor getSyncInOffset setSyncInOffset getSyncOutSettings setSyncOutSettings getSyncMode setSyncMode
XsensResultValue xsens::Cmt3::setSyncInOffset ( const uint32_t  offset)

Set the inbound synchronization offset of an MT device.

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 also
getSyncInOffset setSyncInSettings getSyncInSettings getSyncInSkipFactor setSyncInSkipFactor getSyncOutSettings setSyncOutSettings getSyncMode setSyncMode
XsensResultValue xsens::Cmt3::setSyncInSettings ( const CmtSyncInSettings settings)

Set the inbound synchronization settings of an MT device.

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 also
getSyncInSettings getSyncOutSettings setSyncOutSettings getSyncMode setSyncMode
XsensResultValue xsens::Cmt3::setSyncInSkipFactor ( const uint16_t  skipFactor)

Set the inbound synchronization skip factor of an MT device.

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 also
getSyncInSkipFactor setSyncInSettings getSyncInSettings getSyncInOffset setSyncInOffset getSyncOutSettings setSyncOutSettings getSyncMode setSyncMode
XsensResultValue xsens::Cmt3::setSyncMode ( const uint8_t  mode)

Set the sync mode of the Xbus Master.

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 also
getSyncMode getSyncInSettings setSyncInSettings getSyncOutSettings setSyncOutSettings
XsensResultValue xsens::Cmt3::setSyncOutMode ( const uint16_t  mode)

Set the outbound synchronization mode of an MT device.

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 also
getSyncOutMode setSyncOutSettings getSyncOutSettings getSyncOutPulseWidth setSyncOutPulseWidth getSyncOutSkipFactor setSyncOutSkipFactor getSyncOutOffset setSyncOutOffset getSyncInSettings setSyncInSettings getSyncMode setSyncMode
XsensResultValue xsens::Cmt3::setSyncOutOffset ( const uint32_t  offset)

Set the outbound synchronization offset of an MT device.

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 also
getSyncOutOffset setSyncOutSettings getSyncOutSettings setSyncOutMode getSyncOutMode getSyncOutPulseWidth setSyncOutPulseWidth getSyncOutSkipFactor setSyncOutSkipFactor getSyncInSettings setSyncInSettings getSyncMode setSyncMode
XsensResultValue xsens::Cmt3::setSyncOutPulseWidth ( const uint32_t  pulseWidth)

Set the outbound synchronization pulse width of an MT device.

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 also
getSyncOutPulseWidth setSyncOutSettings getSyncOutSettings setSyncOutMode getSyncOutMode getSyncOutSkipFactor setSyncOutSkipFactor getSyncOutOffset setSyncOutOffset getSyncInSettings setSyncInSettings getSyncMode setSyncMode
XsensResultValue xsens::Cmt3::setSyncOutSettings ( const CmtSyncOutSettings settings)

Set the outbound synchronization settings of an MT device.

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 also
setSyncOutSettings getSyncInSettings setSyncInSettings getSyncMode setSyncMode
XsensResultValue xsens::Cmt3::setSyncOutSkipFactor ( const uint16_t  skipFactor)

Set the outbound synchronization skip factor of an MT device.

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 also
setSyncOutSkipFactor setSyncOutSettings getSyncOutSettings setSyncOutMode getSyncOutMode getSyncOutPulseWidth setSyncOutPulseWidth getSyncOutOffset setSyncOutOffset getSyncInSettings setSyncInSettings getSyncMode setSyncMode
XsensResultValue xsens::Cmt3::setTimeout ( const uint32_t  ms)
inline
XsensResultValue xsens::Cmt3::setTimeoutConfig ( const uint32_t  timeout = CMT3_DEFAULT_TIMEOUT_CONF)

Set the configuration mode timeout.

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 also
getTimeoutConfig getTimeoutMeasurement setTimeoutMeasurement setTimeout
XsensResultValue xsens::Cmt3::setTimeoutMeasurement ( const uint32_t  timeout = CMT3_DEFAULT_TIMEOUT_MEAS)

Set the measurement mode timeout.

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 also
getTimeoutMeasurement getTimeoutConfig setTimeoutConfig setTimeout
XsensResultValue xsens::Cmt3::setTransmissionDelay ( const uint16_t  delay)

Set the RS485 acknowledge transmission delay of the device.

This function sets the RS485 acknowledge transmission delay of the device. The RS485 acknowledge transmission delay determines the minimal delay to response on request messages. See the low-level communication documentation for more details.

See also
getAckTransmissionDelay
Note
This function is only available in configuration mode.
XsensResultValue xsens::Cmt3::setXmOutputMode ( const uint8_t  mode)

Set the dual-output mode of the XM.

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.
This function is only available in configuration mode.
See also
getXmDualOutputMode
XsensResultValue xsens::Cmt3::setXmPowerOff ( void  )

Switch the connected Xbus Master.

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 also
setBusPowerState
XsensResultValue xsens::Cmt3::storeXkfState ( const CmtDeviceId  deviceId = CMT_DID_MASTER)

Store important components of the XKF filter state to non-volatile memory.

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.
XsensResultValue xsens::Cmt3::waitForDataMessage ( Packet pack)

Wait for a data message to arrive.

The function waits for a data message to arrive or until a timeout occurs. The function will also accept error messages.

XsensResultValue xsens::Cmt3::writeMessageToLogFile ( const Message msg)

Member Data Documentation

uint32_t xsens::Cmt3::m_baudrate
protected

The baudrate that was last set to be used by the port.

CmtDeviceConfiguration xsens::Cmt3::m_config

Cached configuration data.

bool xsens::Cmt3::m_detailedScan
protected

Automatically scan for device details during open. Default is true (recommended).

void* xsens::Cmt3::m_eMtsData[CMT_MAX_DEVICES_PER_PORT]

Cached eMTS data.

uint16_t xsens::Cmt3::m_firstItem
protected

The index of the first formatting item.

uint16_t xsens::Cmt3::m_gotoConfigTries
protected

The number of times a goto config is attempted before the function fails.

XsensResultValue xsens::Cmt3::m_lastHwError
protected

Contains the last error reported by hardware.

CmtDeviceId xsens::Cmt3::m_lastHwErrorDeviceId
protected

Contains the Device ID of the device that caused the last hardware error.

XsensResultValue xsens::Cmt3::m_lastResult
mutableprotected

The last result of an operation.

Cmt2f xsens::Cmt3::m_logFile
protected

The (optional) CMT level 2 logfile object that this class operates on.

bool xsens::Cmt3::m_logging
protected

Indicates whether to write all received messages to the logfile or not, automatically set to true by createLogFile.

bool xsens::Cmt3::m_measuring
protected

Keeps track of whether the connected device is measuring or being configured.

uint16_t xsens::Cmt3::m_period
protected

The sample period of the port.

uint32_t xsens::Cmt3::m_readBufSize
protected

Contains the size of the serial read buffer.

bool xsens::Cmt3::m_readFromFile
protected

Indicates whether to read from the log file or from the serial port.

uint32_t xsens::Cmt3::m_rtcCount
protected

The long sample counter (normal counter wraps at 64k).

bool xsens::Cmt3::m_rtcInitialized
protected

Indicates whether the RTC synchronization isinitialized.

CmtMtTimeStamp xsens::Cmt3::m_rtcLastSc
protected

The last received sample counter, used to determine wrap-around.

xsens::TimeSync xsens::Cmt3::m_rtcSync
protected

Used for synchronizing MT timestamps to system timestamps.

Cmt2s xsens::Cmt3::m_serial
protected

The (optional) CMT level 2 serial object that this class operates on.

uint16_t xsens::Cmt3::m_skip
protected

The skip factor of the port.

uint32_t xsens::Cmt3::m_timeoutConf
protected

The config mode timeout.

uint32_t xsens::Cmt3::m_timeoutMeas
protected

The measurement mode timeout.

bool xsens::Cmt3::m_useRtc

Indicates if the RTC should be computed or not (to save CPU time).

uint32_t xsens::Cmt3::m_writeBufSize
protected

Contains the size of the serial write buffer.


The documentation for this class was generated from the following files: