mtix00device.cpp
Go to the documentation of this file.
1 
2 // Copyright (c) 2003-2021 Xsens Technologies B.V. or subsidiaries worldwide.
3 // All rights reserved.
4 //
5 // Redistribution and use in source and binary forms, with or without modification,
6 // are permitted provided that the following conditions are met:
7 //
8 // 1. Redistributions of source code must retain the above copyright notice,
9 // this list of conditions, and the following disclaimer.
10 //
11 // 2. Redistributions in binary form must reproduce the above copyright notice,
12 // this list of conditions, and the following disclaimer in the documentation
13 // and/or other materials provided with the distribution.
14 //
15 // 3. Neither the names of the copyright holders nor the names of their contributors
16 // may be used to endorse or promote products derived from this software without
17 // specific prior written permission.
18 //
19 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
20 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
21 // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
22 // THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 // SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
24 // OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR
26 // TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.THE LAWS OF THE NETHERLANDS
28 // SHALL BE EXCLUSIVELY APPLICABLE AND ANY DISPUTES SHALL BE FINALLY SETTLED UNDER THE RULES
29 // OF ARBITRATION OF THE INTERNATIONAL CHAMBER OF COMMERCE IN THE HAGUE BY ONE OR MORE
30 // ARBITRATORS APPOINTED IN ACCORDANCE WITH SAID RULES.
31 //
32 
33 
34 // Copyright (c) 2003-2021 Xsens Technologies B.V. or subsidiaries worldwide.
35 // All rights reserved.
36 //
37 // Redistribution and use in source and binary forms, with or without modification,
38 // are permitted provided that the following conditions are met:
39 //
40 // 1. Redistributions of source code must retain the above copyright notice,
41 // this list of conditions, and the following disclaimer.
42 //
43 // 2. Redistributions in binary form must reproduce the above copyright notice,
44 // this list of conditions, and the following disclaimer in the documentation
45 // and/or other materials provided with the distribution.
46 //
47 // 3. Neither the names of the copyright holders nor the names of their contributors
48 // may be used to endorse or promote products derived from this software without
49 // specific prior written permission.
50 //
51 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
52 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
53 // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
54 // THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
55 // SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
56 // OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
57 // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR
58 // TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
59 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.THE LAWS OF THE NETHERLANDS
60 // SHALL BE EXCLUSIVELY APPLICABLE AND ANY DISPUTES SHALL BE FINALLY SETTLED UNDER THE RULES
61 // OF ARBITRATION OF THE INTERNATIONAL CHAMBER OF COMMERCE IN THE HAGUE BY ONE OR MORE
62 // ARBITRATORS APPOINTED IN ACCORDANCE WITH SAID RULES.
63 //
64 
65 #include "mtix00device.h"
66 #include <xstypes/xssensorranges.h>
67 #include <xstypes/xsdatapacket.h>
68 #include "replyobject.h"
69 #include "communicator.h"
70 #include "scenariomatchpred.h"
71 #include <xstypes/xsstatusflag.h>
73 
74 using namespace xsens;
75 
80  MtiBaseDeviceEx(comm)
81 {
82 }
83 
87 {
88 }
89 
91 {
93 
94  if (deviceId().isImu() || deviceId().isVru() || deviceId().isAhrs())
95  {
96  outputs.push_back(XSOT_PSONCMS);
97  outputs.push_back(XSOT_HCMTW);
98  outputs.push_back(XSOT_HEROT);
99  outputs.push_back(XSOT_PTCF);
100  outputs.push_back(XSOT_GPZDA);
101  }
102 
103  if (deviceId().isVru() || deviceId().isAhrs())
104  {
105  outputs.push_back(XSOT_TSS2);
106  outputs.push_back(XSOT_PHTRO);
107  outputs.push_back(XSOT_PRDID);
108  outputs.push_back(XSOT_EM1000);
109  outputs.push_back(XSOT_HEHDT);
110  }
111 
112  if (deviceId().isAhrs())
113  {
114  outputs.push_back(XSOT_HCHDM);
115  outputs.push_back(XSOT_HCHDG);
116  }
117 
118  return outputs;
119 }
120 
124 {
126  result.m_frequency = 0;
127  result.m_divedable = true;
128 
129  if (dataType == XDI_FreeAcceleration && deviceId().isImu())
130  return result;
131 
132  if ((dataType & XDI_FullTypeMask) == XDI_AccelerationHR || (dataType & XDI_FullTypeMask) == XDI_RateOfTurnHR)
133  {
134  result.m_frequency = 1000;
135  result.m_divedable = false;
136 
137  return result;
138  }
139 
140  auto baseFreq = [this](XsDataIdentifier dataType)
141  {
142  switch (dataType & XDI_TypeMask)
143  {
144  case XDI_None:
145  return 2000;
146  case XDI_TimestampGroup:
147  return XDI_MAX_FREQUENCY_VAL;
148 
149  case XDI_RawSensorGroup:
150  return 2000;
151  case XDI_AnalogInGroup:
152  return 2000;
153  case XDI_StatusGroup:
154  return 2000;
155 
157  return 400;
158  case XDI_PositionGroup:
159  return deviceId().isGnss() ? 400 : 0;
160  case XDI_VelocityGroup:
161  return deviceId().isGnss() ? 400 : 0;
163  return deviceId().isImu() ? 0 : 400;
165  return 400;
167  return 400;
168  case XDI_MagneticGroup:
169  return 100;
170  case XDI_PressureGroup:
171  return 50;
172 
173  case XDI_GnssGroup:
174  return deviceId().isGnss() ? 4 : 0;
175  default:
176  return 0;
177  }
178  };
179  result.m_frequency = baseFreq(dataType);
180 
181  if ((dataType & XDI_TypeMask) == XDI_TimestampGroup)
182  result.m_divedable = false;
183 
184  return result;
185 }
186 
188 {
190  | (deviceId().isImu() ? 0 : XSF_OrientationValid
193  )
194  | XSF_ClipAccX
195  | XSF_ClipAccY
196  | XSF_ClipAccZ
197  | XSF_ClipGyrX
198  | XSF_ClipGyrY
199  | XSF_ClipGyrZ
200  | XSF_ClipMagX
201  | XSF_ClipMagY
202  | XSF_ClipMagZ
203  //|XSF_Retransmitted
205  //|XSF_Interpolated
206  | XSF_SyncIn
207  | XSF_SyncOut
208  //|XSF_FilterMode
209  //|XSF_HaveGnssTimePulse
210  );
211 }
XSF_SyncIn
@ XSF_SyncIn
When set indicates a sync-in event has been triggered.
Definition: xsstatusflag.h:109
XDI_RateOfTurnHR
@ XDI_RateOfTurnHR
Rate of turn HR data.
Definition: xsdataidentifier.h:154
XSOT_PHTRO
@ XSOT_PHTRO
Proprietry NMEA string with Pitch and Roll.
Definition: xsstringoutputtype.h:78
XsDevice::deviceId
XsDeviceId const & deviceId() const
Return the device ID of the device.
Definition: xsdevice_def.cpp:742
XDI_PositionGroup
@ XDI_PositionGroup
Group for position related outputs.
Definition: xsdataidentifier.h:140
scenariomatchpred.h
XSOT_HCHDM
@ XSOT_HCHDM
NMEA string with Magnetic Heading.
Definition: xsstringoutputtype.h:75
XDI_AccelerationGroup
@ XDI_AccelerationGroup
Group for acceleration related outputs.
Definition: xsdataidentifier.h:129
XSOT_PRDID
@ XSOT_PRDID
Proprietry NMEA string with Pitch, Roll and Heading.
Definition: xsstringoutputtype.h:79
XDI_AngularVelocityGroup
@ XDI_AngularVelocityGroup
Group for angular velocity related outputs.
Definition: xsdataidentifier.h:151
MtiBaseDevice::BaseFrequencyResult::m_frequency
int m_frequency
A frequency value.
Definition: mtibasedevice.h:126
XSOT_TSS2
@ XSOT_TSS2
Proprietry string with Heading, Heave, Roll and Pitch.
Definition: xsstringoutputtype.h:77
XSF_ClipGyrZ
@ XSF_ClipGyrZ
Definition: xsstatusflag.h:101
XDI_None
@ XDI_None
Empty datatype.
Definition: xsdataidentifier.h:86
XDI_VelocityGroup
@ XDI_VelocityGroup
Group for velocity related outputs.
Definition: xsdataidentifier.h:189
xsstatusflag.h
XSF_ClippingDetected
@ XSF_ClippingDetected
When set Indicates clipping has occurred.
Definition: xsstatusflag.h:107
XSF_ClipMagZ
@ XSF_ClipMagZ
Definition: xsstatusflag.h:104
XSOT_HCHDG
@ XSOT_HCHDG
NMEA string with Heading and Magnetic Variation.
Definition: xsstringoutputtype.h:76
XSF_RepresentativeMotion
@ XSF_RepresentativeMotion
Indicates if the In-Run Compass Calibration is doing the representative motion analysis.
Definition: xsstatusflag.h:90
XDI_MagneticGroup
@ XDI_MagneticGroup
Group for magnetometer related outputs.
Definition: xsdataidentifier.h:172
MtiX00Device::getBaseFrequencyInternal
MtiBaseDevice::BaseFrequencyResult getBaseFrequencyInternal(XsDataIdentifier dataType=XDI_None) const override
Returns the base update rate (Hz) corresponding to the dataType.
Definition: mtix00device.cpp:123
XDI_FullTypeMask
@ XDI_FullTypeMask
Mask to get the type of data, without the data format.
Definition: xsdataidentifier.h:88
XSF_ClipAccX
@ XSF_ClipAccX
Definition: xsstatusflag.h:96
XSF_NoRotationMask
@ XSF_NoRotationMask
If all of these flags are set, the No Rotation algorithm is running.
Definition: xsstatusflag.h:85
XSF_ExternalClockSynced
@ XSF_ExternalClockSynced
Indicates whether the internal clock is synced with an external clock (Either GNNS or custom provided...
Definition: xsstatusflag.h:92
XSOT_PSONCMS
@ XSOT_PSONCMS
NMEA string with Xsens Compass Motion Sensor information.
Definition: xsstringoutputtype.h:81
XSF_OrientationValid
@ XSF_OrientationValid
Is set when the computed orientation is valid. The orientation may be invalid during startup or when ...
Definition: xsstatusflag.h:82
XSF_ClipMagX
@ XSF_ClipMagX
Definition: xsstatusflag.h:102
XsDataIdentifier
XsDataIdentifier
Defines the data identifiers.
Definition: xsdataidentifier.h:84
MtiX00Device::MtiX00Device
MtiX00Device(Communicator *comm)
Constructs a device.
Definition: mtix00device.cpp:79
XDI_RawSensorGroup
@ XDI_RawSensorGroup
Group for raw sensor data related outputs.
Definition: xsdataidentifier.h:156
Communicator
A base struct for a communication interface.
Definition: communicator.h:95
XDI_AnalogInGroup
@ XDI_AnalogInGroup
Group for analog in related outputs.
Definition: xsdataidentifier.h:168
uint32_t
unsigned int uint32_t
Definition: pstdint.h:485
MtiX00Device::supportedStatusFlags
uint32_t supportedStatusFlags() const override
Returns a bitmask with all the status flags supported by this device.
Definition: mtix00device.cpp:187
xssensorranges.h
XSOT_HEROT
@ XSOT_HEROT
NMEA string with Rate of Turn.
Definition: xsstringoutputtype.h:84
MtiX00Device::supportedStringOutputTypes
XsStringOutputTypeArray supportedStringOutputTypes() const override
Ask the device for its supported string output types.
Definition: mtix00device.cpp:90
XSF_ClipGyrX
@ XSF_ClipGyrX
Definition: xsstatusflag.h:99
XDI_TimestampGroup
@ XDI_TimestampGroup
Group for time stamp related outputs.
Definition: xsdataidentifier.h:105
XSOT_HEHDT
@ XSOT_HEHDT
NMEA string with True Heading.
Definition: xsstringoutputtype.h:83
XDI_GnssGroup
@ XDI_GnssGroup
Group for Gnss related outputs.
Definition: xsdataidentifier.h:146
replyobject.h
XDI_StatusGroup
@ XDI_StatusGroup
Group for status related outputs.
Definition: xsdataidentifier.h:192
xsdatapacket.h
XSF_ClipGyrY
@ XSF_ClipGyrY
Definition: xsstatusflag.h:100
XDI_MAX_FREQUENCY_VAL
#define XDI_MAX_FREQUENCY_VAL
Definition: xsdataidentifiervalue.h:69
XDI_FreeAcceleration
@ XDI_FreeAcceleration
Free acceleration output in m/s2.
Definition: xsdataidentifier.h:132
xsstringoutputtypearray.h
mtix00device.h
XSOT_PTCF
@ XSOT_PTCF
NMEA string with motion data.
Definition: xsstringoutputtype.h:86
XSF_ClipAccZ
@ XSF_ClipAccZ
Definition: xsstatusflag.h:98
XSF_SyncOut
@ XSF_SyncOut
When set Indicates a sync-out event has been generated.
Definition: xsstatusflag.h:110
MtiBaseDevice::BaseFrequencyResult::m_divedable
bool m_divedable
A divedable value.
Definition: mtibasedevice.h:127
XSF_ClipMagY
@ XSF_ClipMagY
Definition: xsstatusflag.h:103
XSOT_GPZDA
@ XSOT_GPZDA
NMEA string with date and time.
Definition: xsstringoutputtype.h:88
XSF_ClipAccY
@ XSF_ClipAccY
Definition: xsstatusflag.h:97
XSOT_EM1000
@ XSOT_EM1000
Binary format suitable for use with Simrad EM1000 mulitibeam sounders with Roll, Pitch,...
Definition: xsstringoutputtype.h:80
XDI_PressureGroup
@ XDI_PressureGroup
Group for pressure related outputs.
Definition: xsdataidentifier.h:126
XsStringOutputTypeArray
A list of XsStringOutputType values.
XDI_OrientationGroup
@ XDI_OrientationGroup
Group for orientation related outputs.
Definition: xsdataidentifier.h:117
XSOT_HCMTW
@ XSOT_HCMTW
NMEA string with (water) Temperature.
Definition: xsstringoutputtype.h:82
XDI_TemperatureGroup
@ XDI_TemperatureGroup
Group for temperature outputs.
Definition: xsdataidentifier.h:102
communicator.h
MtiBaseDevice::BaseFrequencyResult
A struct for base frequency result.
Definition: mtibasedevice.h:124
MtiX00Device::~MtiX00Device
virtual ~MtiX00Device()
Destroys a device.
Definition: mtix00device.cpp:86
xsens
Definition: threading.cpp:78
XDI_TypeMask
@ XDI_TypeMask
Mask for checking the group which a dataidentifier belongs to, Eg. XDI_TimestampGroup or XDI_Orientat...
Definition: xsdataidentifier.h:87
XDI_AccelerationHR
@ XDI_AccelerationHR
AccelerationHR output.
Definition: xsdataidentifier.h:133
MtiBaseDeviceEx
The internal base class for MTi devices.
Definition: mtibasedevice.h:161


xsens_mti_driver
Author(s):
autogenerated on Sun Sep 3 2023 02:43:20