mtdevice.h
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 #ifndef MTDEVICE_H
66 #define MTDEVICE_H
67 
68 #include "xsdevice_def.h"
69 #include <xstypes/xsstringarray.h>
71 #include <xstypes/xsintarray.h>
72 
73 struct XsFilterProfile;
74 
75 namespace xsens
76 {
77 class Emts5Public;
78 }
79 
84 class MtDevice : public XsDeviceEx
85 {
86 public:
87  virtual ~MtDevice();
88 
89  bool initialize() override;
90 
91  bool isMotionTracker() const override;
92  int updateRateForDataIdentifier(XsDataIdentifier dataType) const override;
93  virtual int getBaseFrequency(XsDataIdentifier dataType = XDI_None) const;
94 
95  uint16_t stringOutputType() const override;
96  uint16_t stringSamplePeriod() const override;
97  uint16_t stringSkipFactor() const override;
98 
99  XsDeviceOptionFlag deviceOptionFlags() const override;
100 
101  XsUbloxGnssPlatform ubloxGnssPlatform() const override;
103 
104  XsIntArray gnssReceiverSettings() const override;
106 
108 
109  double headingOffset() const;
110 
111  virtual bool canDoOrientationResetInFirmware(XsResetMethod method);
112  virtual bool scheduleOrientationReset(XsResetMethod method);
113  virtual bool storeAlignmentMatrix();
114 
115  virtual bool setLocationId(int id);
116  int locationId() const;
117 
118  XsString productCode() const;
119 
120  XsBaudRate serialBaudRate() const override;
121 
122  bool reinitialize();
123 
124  XsFilterProfile onboardFilterProfile() const override;
125  bool setOnboardFilterProfile(int profileType) override;
126  bool setOnboardFilterProfile(XsString const& profileType) override;
127 
128  XsVersion hardwareVersion() const;
129 
131 
132  bool resetLogFileReadPosition() override;
133 
134  bool restoreFactoryDefaults();
135 
136  double accelerometerRange() const;
137  double gyroscopeRange() const;
138 
139  void writeDeviceSettingsToFile() override;
140 
141  bool setNoRotation(uint16_t duration);
142 
143  XsVector initialPositionLLA() const override;
144  bool setInitialPositionLLA(const XsVector& lla) override;
145 
146  XsErrorMode errorMode() const;
148 
149  uint16_t rs485TransmissionDelay() const;
150  bool setRs485TransmissionDelay(uint16_t delay);
151 
153 
154  bool requestData();
155  bool storeFilterState() override;
156 
157  static int calcFrequency(int baseFrequency, uint16_t skipFactor);
158 
159  bool messageLooksSane(const XsMessage& msg) const override;
160  uint32_t supportedStatusFlags() const override;
161 
162 protected:
163  explicit MtDevice(XsDeviceId const& id);
164  explicit MtDevice(Communicator* comm);
165  explicit MtDevice(XsDevice*, const XsDeviceId&);
166 
167  virtual void updateFilterProfiles();
168 
170  virtual void fetchAvailableHardwareScenarios();
171 
172  static XsString stripProductCode(const XsString& code);
173 
174  uint32_t syncTicksToUs(uint32_t ticks) const;
175  uint32_t usToSyncTicks(uint32_t us) const;
176 
179 
182 };
183 
184 #ifndef XDA_PRIVATE_BUILD
185 
189 struct MtDeviceEx : public MtDevice
190 {
191 protected:
192 
194  explicit MtDeviceEx(Communicator* comm) : MtDevice(comm) {}
195 
197  explicit MtDeviceEx(XsDevice* master, const XsDeviceId& childDeviceId) : MtDevice(master, childDeviceId) {}
198 };
199 #else
200 #include "mtdeviceex.h"
201 #endif
202 
203 #endif
MtDevice::readFilterProfilesFromDevice
XsFilterProfileArray readFilterProfilesFromDevice() const
Request the filter profiles headers from the hardware device and returns a vector with the found prof...
Definition: mtdevice.cpp:443
MtDevice::errorMode
XsErrorMode errorMode() const
Definition: mtdevice.cpp:754
MtDevice::setErrorMode
bool setErrorMode(XsErrorMode errorMode)
Set the error mode of the device.
Definition: mtdevice.cpp:769
XsVector
A class that represents a vector of real numbers.
Definition: xsvector.h:113
MtDevice::accelerometerRange
double accelerometerRange() const
Definition: mtdevice.cpp:668
msg
msg
xsfilterprofilearray.h
MtDevice::setLocationId
virtual bool setLocationId(int id)
Set the location ID of the device.
Definition: mtdevice.cpp:387
MtDevice::deviceOptionFlags
XsDeviceOptionFlag deviceOptionFlags() const override
Returns the device option flags.
Definition: mtdevice.cpp:216
MtDevice::~MtDevice
virtual ~MtDevice()
Destroys the MtDevice.
Definition: mtdevice.cpp:104
MtDevice::stripProductCode
static XsString stripProductCode(const XsString &code)
Helper function to strip the hardware type from the product code.
Definition: mtdevice.cpp:895
XsDevice::master
virtual XsDevice * master() const
Return the master device of this device.
Definition: xsdevice_def.cpp:332
MtDevice::m_hardwareFilterProfile
XsFilterProfile m_hardwareFilterProfile
A hardware filter profile.
Definition: mtdevice.h:181
XsFilterProfileArray
A list of XsFilterProfile values.
MtDevice::storeAlignmentMatrix
virtual bool storeAlignmentMatrix()
Store the current alignment matrix in the device.
Definition: mtdevice.cpp:364
XDI_None
@ XDI_None
Empty datatype.
Definition: xsdataidentifier.h:86
MtDevice::canDoOrientationResetInFirmware
virtual bool canDoOrientationResetInFirmware(XsResetMethod method)
Checks if this device can do orientation reset in firmware.
Definition: mtdevice.cpp:298
MtDevice::stringSkipFactor
uint16_t stringSkipFactor() const override
Returns the skipfactor for string output.
Definition: mtdevice.cpp:205
MtDeviceEx::MtDeviceEx
MtDeviceEx(Communicator *comm)
Construct a device using comm for communication.
Definition: mtdevice.h:194
XsDeviceEx
An abstract internal struct of a device.
Definition: xsdevice_public.h:78
MtDevice::productCode
XsString productCode() const
Return the product code of the device.
Definition: mtdevice.cpp:497
XsIntArray
A list of XsInt values.
MtDevice::runSelfTest
XsSelfTestResult runSelfTest()
Run a self test.
Definition: mtdevice.cpp:823
MtDevice::updateRateForDataIdentifier
int updateRateForDataIdentifier(XsDataIdentifier dataType) const override
Returns the currently configured update rate for the supplied dataType.
Definition: mtdevice.cpp:176
MtDevice::setInitialPositionLLA
bool setInitialPositionLLA(const XsVector &lla) override
Set the current sensor position.
Definition: mtdevice.cpp:706
MtDevice::headingOffset
double headingOffset() const
The heading offset set for this device.
Definition: mtdevice.cpp:374
XsSelfTestResult
Contains the results of a self-test performed by an Xsens device.
Definition: xsselftestresult.h:105
MtDevice::hardwareVersion
XsVersion hardwareVersion() const
Return the hardware version of the device.
Definition: mtdevice.cpp:424
xsstringarray.h
MtDevice::updateFilterProfiles
virtual void updateFilterProfiles()
Updates the scenarios.
Definition: mtdevice.cpp:141
MtDevice::setRs485TransmissionDelay
bool setRs485TransmissionDelay(uint16_t delay)
Set the RS485 acknowledge transmission delay of the device.
Definition: mtdevice.cpp:798
MtDevice::restoreFactoryDefaults
bool restoreFactoryDefaults()
Restore to factory default settings.
Definition: mtdevice.cpp:526
MtDevice::setOnboardFilterProfile
bool setOnboardFilterProfile(int profileType) override
Sets the filter profile to use for computing orientations on the device.
Definition: mtdevice.cpp:600
MtDevice::gnssReceiverSettings
XsIntArray gnssReceiverSettings() const override
Gets some GNSS receiver settings.
Definition: mtdevice.cpp:248
MtDevice::syncTicksToUs
uint32_t syncTicksToUs(uint32_t ticks) const
Convert mt sync ticks to microseconds.
Definition: mtdevice.cpp:739
MtDeviceEx
An abstract struct of MT device.
Definition: mtdevice.h:189
MtDevice::stringSamplePeriod
uint16_t stringSamplePeriod() const override
Returns the sample period for string output.
Definition: mtdevice.cpp:194
MtDevice::onboardFilterProfile
XsFilterProfile onboardFilterProfile() const override
Gets the filter profile in use by the device for computing orientations.
Definition: mtdevice.cpp:536
XsOutputConfigurationArray
A list of XsOutputConfiguration values.
MtDevice::initialize
bool initialize() override
Initialize the Mt device using the supplied filter profiles.
Definition: mtdevice.cpp:120
XsDataIdentifier
XsDataIdentifier
Defines the data identifiers.
Definition: xsdataidentifier.h:84
XsFilterProfile
Contains information about an available filter profile.
Definition: xsfilterprofile.h:92
Communicator
A base struct for a communication interface.
Definition: communicator.h:95
XsBaudRate
enum XsBaudRate XsBaudRate
Communication speed.
Definition: xsbaud.h:81
uint32_t
unsigned int uint32_t
Definition: pstdint.h:485
MtDevice::availableOnboardFilterProfiles
XsFilterProfileArray availableOnboardFilterProfiles() const override
Return the list of filter profiles available on the device.
Definition: mtdevice.cpp:435
MtDevice::rs485TransmissionDelay
uint16_t rs485TransmissionDelay() const
Return the RS485 acknowledge transmission delay of the device.
Definition: mtdevice.cpp:784
MtDevice::fetchAvailableHardwareScenarios
virtual void fetchAvailableHardwareScenarios()
Fetches available hardware scenarios.
Definition: mtdevice.cpp:480
MtDevice::MtDevice
MtDevice(XsDeviceId const &id)
Constructs a standalone MtDevice with device Id id.
Definition: mtdevice.cpp:83
MtDevice
MT device base class.
Definition: mtdevice.h:84
MtDevice::writeDeviceSettingsToFile
void writeDeviceSettingsToFile() override
Write the emts of the device to the open logfile.
Definition: mtdevice.cpp:684
xsdevice_def.h
XsResetMethod
XsResetMethod
Orientation reset type.
Definition: xsresetmethod.h:74
XsVersion
A class to store version information.
Definition: xsversion.h:95
XsUbloxGnssPlatform
XsUbloxGnssPlatform
Used to select u-blox GNSS chip platform.
Definition: xsubloxgnssplatform.h:72
MtDevice::setNoRotation
bool setNoRotation(uint16_t duration)
Set the no rotation period to duration.
Definition: mtdevice.cpp:691
MtDevice::messageLooksSane
bool messageLooksSane(const XsMessage &msg) const override
Checks for the sanity of a message.
Definition: mtdevice.cpp:112
MtDevice::supportedStatusFlags
uint32_t supportedStatusFlags() const override
Returns a bitmask with all the status flags supported by this device.
Definition: mtdevice.cpp:885
MtDevice::getBaseFrequency
virtual int getBaseFrequency(XsDataIdentifier dataType=XDI_None) const
Returns the base update rate (Hz) corresponding to the dataType. Returns 0 if no update rate is avail...
Definition: mtdevice.cpp:913
MtDevice::m_hardwareFilterProfiles
XsFilterProfileArray m_hardwareFilterProfiles
A vector of hardware filter profiles.
Definition: mtdevice.h:178
XsMessage
Structure for storing a single message.
Definition: xsmessage.h:202
MtDevice::requestData
bool requestData()
Request data from the motion tracker.
Definition: mtdevice.cpp:812
XsDeviceId
Contains an Xsens device ID and provides operations for determining the type of device.
Definition: xsdeviceid.h:192
MtDeviceEx::MtDeviceEx
MtDeviceEx(XsDevice *master, const XsDeviceId &childDeviceId)
Construct a device with device id childDeviceId for master master.
Definition: mtdevice.h:197
MtDevice::scheduleOrientationReset
virtual bool scheduleOrientationReset(XsResetMethod method)
Definition: mtdevice.cpp:318
MtDevice::usToSyncTicks
uint32_t usToSyncTicks(uint32_t us) const
Convert microseconds to mt sync ticks.
Definition: mtdevice.cpp:746
MtDevice::isMotionTracker
bool isMotionTracker() const override
Definition: mtdevice.cpp:169
MtDevice::setGnssReceiverSettings
bool setGnssReceiverSettings(const XsIntArray &gnssReceiverSettings) override
Sets some GNSS receiver settings.
Definition: mtdevice.cpp:266
XsErrorMode
XsErrorMode
Error modes for use in XsDevice::setErrorMode.
Definition: xserrormode.h:74
MtDevice::stringOutputType
uint16_t stringOutputType() const override
Returns the string output type.
Definition: mtdevice.cpp:183
MtDevice::gyroscopeRange
double gyroscopeRange() const
Definition: mtdevice.cpp:676
MtDevice::initialPositionLLA
XsVector initialPositionLLA() const override
Definition: mtdevice.cpp:724
MtDevice::ubloxGnssPlatform
XsUbloxGnssPlatform ubloxGnssPlatform() const override
Returns the device GNSS platform for u-blox GNSS receivers.
Definition: mtdevice.cpp:226
XsString
A 0-terminated managed string of characters.
XsDevice
Definition: xsdevice_def.h:164
MtDevice::calcFrequency
static int calcFrequency(int baseFrequency, uint16_t skipFactor)
Calculates the frequency.
Definition: mtdevice.cpp:854
MtDevice::locationId
int locationId() const
Get the location ID of the device.
Definition: mtdevice.cpp:398
xsens
Definition: threading.cpp:78
MtDevice::reinitialize
bool reinitialize()
Reinitialize the XsDevice.
Definition: mtdevice.cpp:514
MtDevice::outputConfiguration
XsOutputConfigurationArray outputConfiguration() const override
Returns the currently configured output of the device.
Definition: mtdevice.cpp:289
MtDevice::resetLogFileReadPosition
bool resetLogFileReadPosition() override
Set the read position of the open log file to the start of the file.
Definition: mtdevice.cpp:873
XsDeviceOptionFlag
XsDeviceOptionFlag
Used to enable or disable some device options.
Definition: xsdeviceoptionflag.h:75
MtDevice::setUbloxGnssPlatform
bool setUbloxGnssPlatform(XsUbloxGnssPlatform ubloxGnssPlatform) override
Set the device GNSS platform for u-blox GNSS receivers.
Definition: mtdevice.cpp:236
MtDevice::serialBaudRate
XsBaudRate serialBaudRate() const override
The baud rate configured for cabled connection.
Definition: mtdevice.cpp:411
xsintarray.h
MtDevice::storeFilterState
bool storeFilterState() override
Store orientation filter state in the device.
Definition: mtdevice.cpp:836


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