37 \brief Packet type IDs from the vendor-defined protocol
38
39 If one of the packet type IDs defined here is registered after \ref WITMOTION_HEADER_BYTE in the data flow received from the sensor, the packet header is considered found and the remaining bytes are considered as body of the packet. See \ref util.h for decoder function reference.
43pidRTC = 0x50, ///< Real-Time-Clock: Year from 2000, Month, Day, Hour, Minute, Second (8-bit unsigned integers) + Millisecond (16-bit unsigned integer), representing time passed since last time set up in the \ref ridTimeYearMonth, \ref ridTimeDayHour, \ref ridTimeMinuteSecond and \ref ridTimeMilliseconds registers
44pidAcceleration = 0x51, ///< Linear accelerations + temperature/reserved field [X-Y-Z] (16-bit binary normalized quasi-floats)
50pidGPSCoordinates = 0x57, ///< GPS: longitude + latitude, if supported by hardware (32-bit binary normalized quasi-floats)
51pidGPSGroundSpeed = 0x58, ///< GPS: ground speed (32-bit binary normalized quasi-float) + altitude + angular velocity around vertical axis (16-bit binary normalized quasi-floats), if supported by hardware
52pidOrientation = 0x59, ///< Orientation defined as quaternion [X-Y-Z-W], when available from the sensor firmware (16-bit binary normalized quasi-floats)
57 \brief Packet ID set to retrieve descriptions via \ref witmotion_packet_descriptions.
58
59 Contains values referenced in \ref witmotion_packet_id enumeration to explicitly determine a set of currently supported packet IDs. The packet IDs not referenced here sould not be considered supported.
76 \brief Packet ID string set to store built-in descriptions for \ref message-enumerator.
77
78 Contains values referenced in \ref witmotion_packet_id enumeration with corresponding description strings used by \ref message-enumerator application.
99 uint8_t header_byte; ///< Header byte, set constantly to \ref WITMOTION_HEADER_BYTE
100 uint8_t id_byte; ///< Packet type ID, referring to \ref witmotion_packet_id, otherwise the packet is considered of unknown type.
101union
102 {
103 int8_t raw_signed[8];
104 uint8_t raw[8];
105 int16_t raw_cells[4];
106 int32_t raw_large[2];
107 }datastore; ///< 8-byte internal data storage array represented as C-style memory union. The stored data represented as `int8_t*`, `uint8_t*`, `int16_t*` or `int32_t*` array head pointer.
108 uint8_t crc; ///< Validation CRC for the packet. Calculated as an equivalent to the following operation: \f$ crc = \sum_{i=0}^{i < 10}\times\f$`reinterpret_cast<uint8_t*>(this) + i`
109 };
110
111/*!
112 * \brief List of configuration slots (registers) available for the library.
113 *
114 * List of configuration slots (registers) available for the library. The actual availability depends from the actual sensor and installation circuit.
115 * Please refer to the official documentation for detailed explanation.
119ridSaveSettings = 0x00, ///< Saves the settings uploaded in the current bringup session, or resets it to default (if supported). To make factory reset of the sensor, set `raw[0] = 0x01` in \ref witmotion_config_packet instance used.
120/*!
121 Sets the sensor to calibration mode. The value stored in \ref witmotion_config_packet.setting.`raw[0]` determines device selection:
122 - `0x00` - End calibration
123 - `0x01` - Accelerometer calibration
124 - `0x03` - Altitude reset (only for barometric altimeter)
131 Regulates sensor output. The value stored in \ref witmotion_config_packet.setting.`raw` determines packet ID selection to output from low to high bits by offset. `0` means disabling of the selected data packet output.
146 Regulates output frequency. **NOTE**: the maximum available frequency is determined internally by the available bandwidth obtained from \ref ridPortBaudRate.
147 The actual value stored in \ref witmotion_config_packet.setting.`raw[0]` can be determined from the following table. \ref witmotion_config_packet.setting.`raw[1]` is set to `0x00`. Also the table contains argument value for \ref witmotion_output_frequency helper function which is used by the controller applications.
148
149 |Frequency, Hz|Value |Argument|
150 |:------------|:----:|:------:|
151 |0 (shutdown) |`0x0D`| 0 |
152 |0 (single measurement)|`0x0C`| -1 |
153 |0.1 |`0x01`| -10 |
154 |0.5 |`0x02`| -2 |
155 | 1 |`0x03`| 1 |
156 | 2 |`0x04`| 2 |
157 | 5 |`0x05`| 5 |
158 |10 (default) |`0x06`| 10 |
159 |20 |`0x07`| 20 |
160 |50 |`0x08`| 50 |
161 |100 |`0x09`| 100 |
162 |125 |`0x0A`| 125 |
163 |200 |`0x0B`| 200 |
164 |Maximal available by hardware|`0x0C`|Not supported|
168 Regulates port baud rate. **NOTE**: the sensor has no possibility of hardware flow control and it cannot report to the system what baud rate should be explicitly used!
169 The actual value stored in \ref witmotion_config_packet.setting.`raw[0]` can be determined from the following table. \ref witmotion_config_packet.setting.`raw[1]` is set to `0x00`.
170 The \ref witmotion_baud_rate helper function argument is accepted as `QSerialPort::BaudRate` enumeration member, so only the speed inticated in that enumeration are explicitly supported.
178ridAccelerationBiasX = 0x05, ///< Sets acceleration zero point bias for X axis, refer to \ref acceleration-bias page for explanation.
179ridAccelerationBiasY = 0x06, ///< Sets acceleration zero point bias for Y axis, refer to \ref acceleration-bias page for explanation.
180ridAccelerationBiasZ = 0x07, ///< Sets acceleration zero point bias for Z axis, refer to \ref acceleration-bias page for explanation.
181ridAngularVelocityBiasX = 0x08, ///< Sets angular velocity zero point bias for X axis. NOT YET PROVEN AS WORKING
182ridAngularVelocityBiasY = 0x09, ///< Sets angular velocity zero point bias for Y axis. NOT YET PROVEN AS WORKING
183ridAngularVelocityBiasZ = 0x0A, ///< Sets angular velocity zero point bias for Z axis. NOT YET PROVEN AS WORKING
184ridMagnetometerBiasX = 0x0B, ///< Sets magnetometer zero point bias for X axis. **MAY BLOCK THE MEASUREMENTS**
185ridMagnetometerBiasY = 0x0C, ///< Sets magnetometer zero point bias for Y axis. **MAY BLOCK THE MEASUREMENTS**
186ridMagnetometerBiasZ = 0x0D, ///< Sets magnetometer zero point bias for Z axis. **MAY BLOCK THE MEASUREMENTS**
187/*!
188 Digital port D0 mode. The values are set only via \ref witmotion_config_packet.setting.`raw[0]` whilst \ref witmotion_config_packet.setting.`raw[1]` is set to 0. Please refer to the following table to determine the exact value needed.
196 Digital port D1 mode. The values are set only via \ref witmotion_config_packet.setting.`raw[0]` whilst \ref witmotion_config_packet.setting.`raw[1]` is set to 0. Please refer to the following table to determine the exact value needed.
202 \note If the external GPS receiver is used to obtain world time, and it is compatible with Witmotion serial protocol, the port D1 should be connected to its **TX** pin and turned into GPS receiver port by the special value `0x05` set for this register. The baud rate on which GPS receiver communicates with the sensor, is set via \ref ridGPSBaudRate register.
206 Digital port D2 mode. The values are set only via \ref witmotion_config_packet.setting.`raw[0]` whilst \ref witmotion_config_packet.setting.`raw[1]` is set to 0. Please refer to the following table to determine the exact value needed.
214 Digital port D3 mode. The values are set only via \ref witmotion_config_packet.setting.`raw[0]` whilst \ref witmotion_config_packet.setting.`raw[1]` is set to 0. Please refer to the following table to determine the exact value needed.
221ridPortPWMLevelD0 = 0x12, ///< Digital port D0 PWM high level pulse width, microseconds, 16-bit unsigned integer.
222ridPortPWMLevelD1 = 0x13, ///< Digital port D1 PWM high level pulse width, microseconds, 16-bit unsigned integer.
223ridPortPWMLevelD2 = 0x14, ///< Digital port D2 PWM high level pulse width, microseconds, 16-bit unsigned integer.
224ridPortPWMLevelD3 = 0x15, ///< Digital port D3 PWM high level pulse width, microseconds, 16-bit unsigned integer.
225ridPortPWMPeriodD0 = 0x16, ///< Digital port D0 PWM period length, microseconds, 16-bit unsigned integer.
226ridPortPWMPeriodD1 = 0x17, ///< Digital port D1 PWM period length, microseconds, 16-bit unsigned integer.
227ridPortPWMPeriodD2 = 0x18, ///< Digital port D2 PWM period length, microseconds, 16-bit unsigned integer.
228ridPortPWMPeriodD3 = 0x19, ///< Digital port D3 PWM period length, microseconds, 16-bit unsigned integer.
229ridIICAddress = 0x1A, ///< Sets up I2C address of the sensor. Default value is `0x50`, 7-bit unsigned integer in \ref witmotion_config_packet.setting.`raw[0]` whilst \ref witmotion_config_packet.setting.`raw[1]` is set to 0.
232 Regulates GPS receiver baud rate on port D1 (see \ref ridPortModeD1). The following table contains value set for \ref witmotion_config_packet.setting.`raw[0]` representing the different baud rates. \ref witmotion_config_packet.setting.`raw[1]` should be set to 0.
240 Regulates internal filter bandwidth according to \ref witmotion_config_packet.setting.`raw[0]` value. Please refer to the following table for details.
241 | Value |Bandwidth, Hz|
242 |:--------------:|------------:|
243 |`0x00` | 256 |
244 |`0x01` | 184 |
245 |`0x02` | 94 |
246 |`0x03` | 44 |
247 |`0x04` | 21 |
248 |`0x05` | 10 |
249 |`0x06` | 5 |
250
251 \ref witmotion_config_packet.setting.`raw[1]` should be set to 0. NOT YET PROVEN AS WORKING
268 Regulates accelerometer value range according to \ref witmotion_config_packet.setting.`raw[0]` value. Please refer to the following table for details.
269 | Value |Range, \f$ m/s^2 \f$|
270 |:--------------:|--------:|
271 |`0x00` |\f$ 2 \cdot g\f$|
272 |`0x01` |\f$ 4 \cdot g\f$|
273 |`0x02` |\f$ 8 \cdot g\f$|
274 |`0x03` |\f$ 16 \cdot g\f$|
275
276 Here \f$ g = 9.81 m/s^2 \f$. \ref witmotion_config_packet.setting.`raw[1]` should be set to 0. NOT YET PROVEN AS WORKING
279ridStandbyMode = 0x22, ///< Toggles dormant mode. \ref witmotion_config_packet.setting.`raw[0]` should be set to `0x01`, \ref witmotion_config_packet.setting.`raw[1]` to 0.
280ridInstallationDirection = 0x23, ///< Toggles on/off internal rotation transform for vertical installation. \ref witmotion_config_packet.setting.`raw[1]` should be set to 0, \ref witmotion_config_packet.setting.`raw[0]` being to `0x01` allows vertical installation, to `0x00` - horizontal installation.
281ridTransitionAlgorithm = 0x24, ///< Regulates whether 9-axis (`0x01` in \ref witmotion_config_packet.setting.`raw[0]`) or 6-axis (`0x00`) transition algorithm should be used. \ref witmotion_config_packet.setting.`raw[1]` should be set to 0.
282ridInstructionStart = 0x2D, ///< Instruction mode. `0x00` in \ref witmotion_config_packet.setting.`raw[0]` means starting instruction mode, `0x01` toggles it off whilst \ref witmotion_config_packet.setting.`raw[1]` is set explicitly to 0.
283
284ridTimeYearMonth = 0x30, ///< Sets RTC to the given year (\ref witmotion_config_packet.setting.`raw[0]`) and month (\ref witmotion_config_packet.setting.`raw[1]`). Year is a signed 8-bit integer with zero origin point set to 2000 year Gregorian calendar. Month is digitized to 1-12, unsigned 8-bit integer.
285ridTimeDayHour = 0x31, ///< Sets RTC to the given day of the month (\ref witmotion_config_packet.setting.`raw[0]`) and hour (\ref witmotion_config_packet.setting.`raw[1]`) in 24H system.
286ridTimeMinuteSecond = 0x32, ///< Sets RTC to the given minute (\ref witmotion_config_packet.setting.`raw[0]`) and second (\ref witmotion_config_packet.setting.`raw[1]`) in 24H system.
287ridTimeMilliseconds = 0x33, ///< Sets RTC to the given milliseconds exposed as 16-bit unsigned integer.
288ridSetAccelerationX = 0x34, ///< Sets up origin point or impostor value (needed when the measurement is forced for output by \ref ridOutputValueSet but not actually supported by the sensor) for acceleration on X axis. NOT YET PROVEN AS WORKING
289ridSetAccelerationY = 0x35, ///< Sets up origin point or impostor value (needed when the measurement is forced for output by \ref ridOutputValueSet but not actually supported by the sensor) for acceleration on Y axis. NOT YET PROVEN AS WORKING
290ridSetAccelerationZ = 0x36, ///< Sets up origin point or impostor value (needed when the measurement is forced for output by \ref ridOutputValueSet but not actually supported by the sensor) for acceleration on Z axis. NOT YET PROVEN AS WORKING
291ridSetAngularVelocityX = 0x37, ///< Sets up origin point or impostor value (needed when the measurement is forced for output by \ref ridOutputValueSet but not actually supported by the sensor) for angular velocity on X axis. NOT YET PROVEN AS WORKING
292ridSetAngularVelocityY = 0x38, ///< Sets up origin point or impostor value (needed when the measurement is forced for output by \ref ridOutputValueSet but not actually supported by the sensor) for angular velocity on Y axis. NOT YET PROVEN AS WORKING
293ridSetAngularVelocityZ = 0x39, ///< Sets up origin point or impostor value (needed when the measurement is forced for output by \ref ridOutputValueSet but not actually supported by the sensor) for angular velocity on Z axis. NOT YET PROVEN AS WORKING
294ridSetMagnetometerX = 0x3A, ///< Sets up origin point or impostor value (needed when the measurement is forced for output by \ref ridOutputValueSet but not actually supported by the sensor) for magnetometer on X axis. **MAY BLOCK THE MEASUREMENTS**
295ridSetMagnetometerY = 0x3B, ///< Sets up origin point or impostor value (needed when the measurement is forced for output by \ref ridOutputValueSet but not actually supported by the sensor) for magnetometer on Y axis. **MAY BLOCK THE MEASUREMENTS**
296ridSetMagnetometerZ = 0x3C, ///< Sets up origin point or impostor value (needed when the measurement is forced for output by \ref ridOutputValueSet but not actually supported by the sensor) for magnetometer on Z axis. **MAY BLOCK THE MEASUREMENTS**
297ridSetAngleRoll = 0x3D, ///< Sets up origin point or impostor value (needed when the measurement is forced for output by \ref ridOutputValueSet but not actually supported by the sensor) for Euler angle (roll) over X axis. NOT YET PROVEN AS WORKING
298ridSetAnglePitch = 0x3E, ///< Sets up origin point or impostor value (needed when the measurement is forced for output by \ref ridOutputValueSet but not actually supported by the sensor) for Euler angle (pitch) over Y axis. NOT YET PROVEN AS WORKING
299ridSetAngleYaw = 0x3F, ///< Sets up origin point or impostor value (needed when the measurement is forced for output by \ref ridOutputValueSet but not actually supported by the sensor) for Euler angle (yaw) over Z axis. NOT YET PROVEN AS WORKING
300ridSetTemperature = 0x40, ///< Sets up origin point or impostor value (needed when the corresponding spatial measurement is forced for output by \ref ridOutputValueSet but not actually supported by the sensor) for temperature. NOT YET PROVEN AS WORKING
305ridSetPressureLow = 0x45, ///< Sets up low part of initial value for 32-bit pressure measurement register. NOT YET PROVEN AS WORKING
306ridSetPressureHigh = 0x46, ///< Sets up high part of initial value for 32-bit pressure measurement register. NOT YET PROVEN AS WORKING
307ridSetAltitudeLow = 0x47, ///< Sets up low part of initial value for 32-bit altitude measurement register. NOT YET PROVEN AS WORKING
308ridSetAltitudeHigh = 0x48, ///< Sets up high part of initial value for 32-bit altitude measurement register. NOT YET PROVEN AS WORKING
309ridSetLongitudeLow = 0x49, ///< Sets up low part of initial value for 32-bit longitude measurement register. NOT YET PROVEN AS WORKING
310ridSetLongitudeHigh = 0x4A, ///< Sets up high part of initial value for 32-bit longitude measurement register. NOT YET PROVEN AS WORKING
311ridSetLatitudeLow = 0x4B, ///< Sets up low part of initial value for 32-bit latitude measurement register. NOT YET PROVEN AS WORKING
312ridSetLatitudeHigh = 0x4C, ///< Sets up high part of initial value for 32-bit latitude measurement register. NOT YET PROVEN AS WORKING
313ridSetGPSAltitude = 0x4D, ///< Sets up initial or impostor value (needed when the measurement is forced for output by \ref ridOutputValueSet but not actually supported by the sensor) for GPS altitude measurement. NOT YET PROVEN AS WORKING
314ridSetGPSYaw = 0x4E, ///< Sets up initial or impostor value (needed when the measurement is forced for output by \ref ridOutputValueSet but not actually supported by the sensor) for GPS orientation angle measurement. NOT YET PROVEN AS WORKING
315ridSetGPSGroundSpeedLow = 0x4F, ///< Sets up low part of initial value for 32-bit GPS ground speed measurement register. NOT YET PROVEN AS WORKING
316ridSetGPSGroundSpeedHigh = 0x50, ///< Sets up high part of initial value for 32-bit GPS ground speed measurement register. NOT YET PROVEN AS WORKING
317ridSetOrientationX = 0x51, ///< Sets up origin point or impostor value (needed when the measurement is forced for output by \ref ridOutputValueSet but not actually supported by the sensor) for orientation quaternion, X component. NOT YET PROVEN AS WORKING
318ridSetOrientationY = 0x52, ///< Sets up origin point or impostor value (needed when the measurement is forced for output by \ref ridOutputValueSet but not actually supported by the sensor) for orientation quaternion, Y component. NOT YET PROVEN AS WORKING
319ridSetOrientationZ = 0x53, ///< Sets up origin point or impostor value (needed when the measurement is forced for output by \ref ridOutputValueSet but not actually supported by the sensor) for orientation quaternion, Z component. NOT YET PROVEN AS WORKING
320ridSetOrientationW = 0x54, ///< Sets up origin point or impostor value (needed when the measurement is forced for output by \ref ridOutputValueSet but not actually supported by the sensor) for orientation quaternion, W component. NOT YET PROVEN AS WORKING
321
322ridGyroscopeAutoCalibrate = 0x63, ///< Toggles on/off automatic precalibration of the gyroscope. \ref witmotion_config_packet.setting.`raw[1]` should be set to 0. `0x01` in \ref witmotion_config_packet.setting.`raw[0]` turns gyroscope automatic precalibration **OFF**. To turn it **ON** the value should be `0x00`.
323
324ridUnlockConfiguration = 0x69 ///< "Magic" vendor-defined value for configuration unlock packet `0xFF 0xAA 0x69 0x88 0xB5`.
332 uint8_t header_byte; ///< Header byte, set constantly to \ref WITMOTION_CONFIG_HEADER
333 uint8_t key_byte; ///< Packet type, constantly set to \ref WITMOTION_CONFIG_KEY
334 uint8_t address_byte; ///< Configuration slot address, refers to the registered values in \ref witmotion_config_register_id
335union
336 {
337 uint8_t raw[2];
338 uint16_t bin;
339 }setting; ///< 2-byte internal data storage array represented as C-style memory union. The values should be formulated byte-by-byte referring to the actual sensor's documentation.
340 };
341
342/*!
343 \brief Abstract base class to program convenience classes for the sensors.
344
345 This class allows the developer to write handler functions for multithreaded polling timer control, sensor configuration request and data decoding event.
346 It also provides predefined signals to allow the end user to react on actual data acquisition and error occurence events.
347 The common use case for this class is to provide a base interface for the family of sensors supporting the same protocol. Please refer to \ref QBaseSerialWitmotionSensorReader class for actual implementation of the currently supported UART-based protocol.
352virtualvoidReadData() = 0; ///< Protected abstract slot to be implemented in the derived class. The common usage is as a callback for the polling timer thread.
354virtualvoidSendConfig(constwitmotion_config_packet& packet) = 0; ///< Public abstract slot to be implemented in the derived class. \param packet accepts the \ref witmotion_config_packet object for being sent to the sensor configuration registers.
355virtualvoidRunPoll() = 0; ///< Public abstract slot to be implemented in the derived class. The common use is to start the polling timer thread for the sensors after Qt event loop is started.
357voidAcquired(constwitmotion_datapacket& packet); ///< Signal function to be emitted when the data packet is acquired by the polling thread or process. Can only be redefined, not overridden in the class hierarchy.
358voidError(const QString& description); ///< Signal function to be emitted when the internal error reported in the polling thread or process. Can only be redefined, not overridden in the class hierarchy.