Go to the documentation of this file.
80 using namespace xsens;
121 XsSize count = rcv.getDataSize() >> 2;
122 for (
XsSize row = 0; row < count; row++)
124 uint16_t dataId, freq;
125 dataId = rcv.getDataShort(row * 4);
126 freq = rcv.getDataShort(2 + row * 4);
150 snd.setBusId(
busId());
151 snd.setDataByte((uint8_t)frame);
152 for (
XsSize i = 0; i < 4; ++i)
153 snd.setDataFloat((
float)quat[i], (uint16_t)(1 + i *
sizeof(
float)));
163 snd.setDataByte(frame);
166 for (
XsSize i = 0; i < 4; ++i)
167 quat[i] = rcv.getDataFloat(1 + i * 4);
207 snd.setBusId(
busId());
220 for (
size_t i = 0; i <
s.size(); ++i)
226 const uint8_t line =
syncLine(setting);
227 snd.setDataByte(line, offset + 1);
229 snd.setDataByte(setting.
m_polarity, offset + 2);
233 snd.setDataShort((uint16_t)(setting.
m_pulseWidth / timeResolution), offset + 8);
239 value = (uint16_t)(int16_t)(setting.
m_offset / (int) timeResolution);
240 snd.setDataShort(value, offset + 10);
255 const uint8_t* emtsBuffer = rcv.getDataBuffer();
265 for (
XsSize i = 0; i < 10; ++i)
267 uint16_t tmp_pulseWidth;
277 memcpy((
void*) &ss.
m_skipFirst, (
void const*) &buffer[offset + 4],
sizeof(uint16_t));
278 memcpy((
void*) &ss.
m_skipFactor, (
void const*) &buffer[offset + 6],
sizeof(uint16_t));
279 memcpy((
void*) &tmp_pulseWidth, (
void const*) &buffer[offset + 8],
sizeof(uint16_t));
282 memcpy((
void*) &ss.
m_clockPeriod, (
void const*) &buffer[offset + 10],
sizeof(uint16_t));
286 memcpy((
void*) &tmp_offset, (
void const*) &buffer[offset + 10],
sizeof(int16_t));
304 bool groupCheck = ((dataType &
XDI_TypeMask) == dataType);
305 for (XsOutputConfigurationArray::const_iterator i = configurations.begin(); i != configurations.end(); ++i)
310 if (dataType == i->m_dataIdentifier)
315 else if (groupCheck && (dataType == (i->m_dataIdentifier &
XDI_TypeMask)))
320 result = i->m_frequency;
352 std::vector<int> updateRates;
355 if (baseFreq.m_frequency == 0)
358 if (!baseFreq.m_divedable)
360 updateRates.push_back(baseFreq.m_frequency);
364 for (
int skip = 0; skip <= baseFreq.m_frequency; ++skip)
366 int freq =
calcFrequency(baseFreq.m_frequency, (uint16_t) skip);
367 if (freq * (skip + 1) == baseFreq.m_frequency)
368 updateRates.push_back(freq);
385 uint8_t bid = (uint8_t)
busId();
390 snd.setDataDouble(lla[0], 0);
391 snd.setDataDouble(lla[1], 8);
392 snd.setDataDouble(lla[2], 16);
402 uint8_t bid = (uint8_t)
busId();
413 time.
m_nano = rcv.getDataLong(0);
414 time.
m_year = rcv.getDataShort(4);
415 time.
m_month = rcv.getDataByte(6);
416 time.
m_day = rcv.getDataByte(7);
417 time.
m_hour = rcv.getDataByte(8);
419 time.
m_second = rcv.getDataByte(10);
420 time.
m_valid = rcv.getDataByte(11);
430 uint8_t bid = (uint8_t)
busId();
435 snd.setDataLong(time.
m_nano, 0);
436 snd.setDataShort(time.
m_year, 4);
437 snd.setDataByte(time.
m_month, 6);
438 snd.setDataByte(time.
m_day, 7);
439 snd.setDataByte(time.
m_hour, 8);
442 snd.setDataByte(time.
m_valid, 11);
474 return rcv.getDataShort();
492 bool removesPort =
false;
494 comm->
portInfo().getVidPid(vid, pid);
522 return static_cast<uint8_t
>(mk4Line);
530 return static_cast<uint8_t
>(gmtLine);
552 snd.setBusId(
busId());
570 bool enabled =
false;
573 snd.setBusId(
busId());
577 enabled = (rcv.getDataByte(1) != 0);
596 snd.setBusId(
busId());
603 result.
m_status = rcv.getDataByte(6);
618 snd.setBusId(
busId());
#define XS_LEN_ALIGNMENTROTATION
@ XSLGMT_ClockIn
External clock sync XSL_ClockIn.
struct XsSyncSettingArray XsSyncSettingArray
@ XSF_SampleAndSend
Sample a sample and send the MT Data message.
XsResultValue setOutputConfigurationInternal(XsOutputConfigurationArray &o) override
Set the output configuration for this device.
struct XsOutputConfiguration XsOutputConfiguration
struct XsTimeInfo XsTimeInfo
A class that represents a matrix of real numbers.
XsDeviceId const & deviceId() const
Return the device ID of the device.
A class that represents a vector of real numbers.
uint8_t m_dimension
The dimension of the In-Run Compass Calibration.
@ XMID_SetAlignmentRotation
XsMatrix alignmentRotationMatrix(XsAlignmentFrame frame) const override
Retrieve the alignment rotation matrix to rotate S to the chosen frame S'.
virtual XsPortInfo portInfo() const =0
bool setSyncSettings(const XsSyncSettingArray &s) override
Set the synchronization settings of the device.
int m_frequency
A frequency value.
uint8_t m_hour
The hour (if time is valid)
Contains the result of the representative motion processed by ICC.
virtual XsDeviceState deviceState() const
Return the state of this device.
void fetchAvailableHardwareScenarios() override
Fetches available hardware scenarios.
SyncLineMk4 xslToXsl4(XsSyncLine line)
Translate an XsSyncLine into a Mk4-specififc SyncLineMk4.
XsOutputConfigurationArray m_outputConfiguration
A devices output configuration.
int16_t m_utcOffset
Offset to UTC time in minutes. This value can be added to the stored time to get UTC time.
SyncLineGmt xslToXslgmt(XsSyncLine line)
Translate an XsSyncLine into a SyncLineGmt.
virtual XsSyncLine syncSettingsLine(const uint8_t *buff, XsSize offset) const
Returns the sync settings line for a generic mti device.
XsSyncFunction m_function
@ XSF_ClockBiasEstimation
Do a clock bias estimation on trigger.
virtual bool setStringOutputMode(uint16_t type, uint16_t period, uint16_t skipFactor)
Sets the string output mode for this device.
XsSyncPolarity m_polarity
bool startRepresentativeMotion() override
Starts the representative motion.
int updateRateForDataIdentifier(XsDataIdentifier dataType) const override
Returns the currently configured update rate for the supplied dataType.
uint8_t m_status
The status of the In-Run Compass Calibration.
@ XSP_None
Don't generate or react to trigger level changes.
struct XsVersion XsVersion
XsIccRepMotionResult stopRepresentativeMotion() override
Stops the representative motion.
bool setNoRotation(uint16_t duration)
Set the no rotation period to duration.
XsOutputConfigurationArray outputConfiguration() const
Returns the currently configured output of the device.
struct XsOutputConfigurationArray XsOutputConfigurationArray
@ XIC_StopRepMotion
Indicate to ICC the end of representative motion.
bool setAlignmentRotationQuaternion(XsAlignmentFrame frame, const XsQuaternion &quat) override
Set an arbitrary alignment rotation matrix Use to rotate either L to the chosen frame L' or S to the ...
bool setRs485TransmissionDelay(uint16_t delay)
Set the transmission delay used for RS485 transmissions.
virtual XsResultValue setOutputConfigurationInternal(XsOutputConfigurationArray &config)
bool setInitialPositionLLA(const XsVector &lla)
Sets the 'Latitude Longitude Altitude' setting of the device to the given vector.
virtual bool hasIccSupport() const
A class that implements a quaternion.
uint8_t m_valid
Validity indicator.
@ XMID_ReqAlignmentRotation
virtual int calculateUpdateRate(XsDataIdentifier dataType) const
Communicator XSNOEXPORT * communicator() const
@ XDI_FullTypeMask
Mask to get the type of data, without the data format.
An abstract struct of MT device.
XsResultValue
Xsens result values.
bool resetRemovesPort() const override
virtual int busId() const
The bus ID for this device.
A list of XsOutputConfiguration values.
uint8_t m_second
The second (if time is valid)
bool setUtcTime(const XsTimeInfo &time)
Sets the 'UTC Time' setting of the device to the given time.
XsSyncPolarity
Signal polarity.
uint8_t m_day
The day of the month (if date is valid)
A structure for storing all xsens sync settings.
XsDataIdentifier
Defines the data identifiers.
bool setHeadingOffset(double offset)
Set the 'heading offset' setting of the device.
XsSyncSettingArray syncSettings() const override
Get all the current synchronization settings of the device.
A base struct for a communication interface.
@ XIC_StoreResults
Update the stored magnetometer calibration using the ICC estimated calibration values.
@ XEM_IncreasePacketCounterAndSendError
Increase packet counter when an error occurs, resulting in gaps in the packet counter and send an exp...
Macros and types for use in the Xsens communication protocol and Xsens Device API classes.
virtual XsVersion firmwareVersion() const
Return the firmware version.
struct XsQuaternion XsQuaternion
virtual void fetchAvailableHardwareScenarios()
Fetches available hardware scenarios.
#define XS_BID_BROADCAST
The bus broadcast bus identifier (all devices)
virtual bool deviceUsesOnBoardFiltering()
SyncLineGmt
Synchronization line identifiers for the generic motion tracker (GMT) devices, only to be used direct...
XsSyncLine xslgmtToXsl(SyncLineGmt mk4Line)
Translate an SyncLineGmt into a generic XsSyncLine.
uint32_t m_nano
Nanosecond part of the time.
@ XSL4_ClockIn
External clock sync XSL_ClockIn.
bool setErrorMode(XsErrorMode errorMode) override
Sets the error mode of the device.
virtual int calculateUpdateRateImp(XsDataIdentifier dataType, const XsOutputConfigurationArray &configurations) const
virtual XsSyncSettingArray syncSettingsFromBuffer(const uint8_t *buffer) const
Create an XsSyncSttingsArray from the given buffer of sync configuration data.
size_t XsSize
XsSize must be unsigned number!
XsTimeInfo utcTime() const
Gets the 'UTC Time' setting of the device.
bool representativeMotionState() override
@ XMID_ReqOutputConfiguration
bool setNoRotation(uint16_t duration)
Set the no rotation period to duration.
std::vector< int > supportedUpdateRates(XsDataIdentifier dataType=XDI_None) const override
Ask the device for its supported update rates for the given dataType.
XsFilterProfileArray m_hardwareFilterProfiles
A vector of hardware filter profiles.
XsQuaternion alignmentRotationQuaternion(XsAlignmentFrame frame) const override
Retrieve the alignment rotation quaternion.
Structure for storing a single message.
uint16_t rs485TransmissionDelay() const
Returns the transmission delay used for RS485 transmissions.
@ XIC_StartRepMotion
Indicate to ICC the start of representative motion.
Contains an Xsens device ID and provides operations for determining the type of device.
uint8_t m_month
The month (if date is valid)
XsErrorMode errorMode() const override
Returns the error mode of the device.
static unsigned int syncSettingsTimeResolutionInMicroSeconds(XsDeviceId const &deviceId)
uint16_t m_year
The year (if date is valid)
uint8_t m_minute
The minute (if time is valid)
virtual uint8_t syncLine(const XsSyncSetting &setting) const
Returns the sync line for a generic mti device.
XsSyncLine xsl4ToXsl(SyncLineMk4 mk4Line)
Translate an SyncLineMk4 into a generic XsSyncLine.
virtual BaseFrequencyResult getBaseFrequencyInternal(XsDataIdentifier dataType=XDI_None) const
An internal function that gets the base frequency.
bool setAlignmentRotationMatrix(XsAlignmentFrame frame, const XsMatrix &matrix) override
Set an arbitrary alignment rotation matrix Use to rotate either L to the chosen frame L' or S to the ...
int getBaseFrequency(XsDataIdentifier dataType=XDI_None) const override
XsSyncLine
Synchronization line identifiers.
XsErrorMode
Error modes for use in XsDevice::setErrorMode.
@ XIC_RepMotionState
Retrieve the current state of the representative motion.
A list of XsSyncSetting values.
float m_ddtAccuracy
The ddtAccuracy of the In-Run Compass Calibration.
@ XDI_OrientationGroup
Group for orientation related outputs.
bool doTransaction(const XsMessage &snd) const
#define XS_BID_INVALID
An invalid bus identifier.
XsSyncFunction
Actions to be taken on input triggers.
@ XSL4_GnssClockIn
GNSS clock sync XSL_GnssClockIn.
bool storeIccResults() override
Stores the ICC results.
@ XMID_SetSyncConfiguration
static int calcFrequency(int baseFrequency, uint16_t skipFactor)
Calculates the frequency.
@ XDI_TypeMask
Mask for checking the group which a dataidentifier belongs to, Eg. XDI_TimestampGroup or XDI_Orientat...
XsAlignmentFrame
Alignment frame.
SyncLineMk4
Synchronization line identifiers for the Mk4 devices, only to be used directly in Xbus messages.
A structure for storing Time values.
MtiBaseDevice(Communicator *comm)
Constructs a device.