Witmotion IMU Library  1.3.1~dev_4684448
Open source UART communication library for sensor devices manufactured by WitMotion Shenzhen Co.,Ltd
witmotion Namespace Reference

Main namespace of Witmotion UART connection library. More...

Classes

struct  witmotion_datapacket
 Generic structure respresenting the standard 11-byte datapacket defined in Witmotion protocol. More...
 
struct  witmotion_config_packet
 Generic structure respresenting the standard 5-byte configuration command defined in Witmotion protocol. More...
 
class  QAbstractWitmotionSensorReader
 Abstract base class to program convenience classes for the sensors. More...
 
class  witmotion_typed_packets
 
class  witmotion_typed_bytecounts
 
class  QBaseSerialWitmotionSensorReader
 
class  QAbstractWitmotionSensorController
 
class  QGeneralSensorController
 

Enumerations

enum  witmotion_packet_id {
  pidRTC = 0x50 ,
  pidAcceleration = 0x51 ,
  pidAngularVelocity = 0x52 ,
  pidAngles = 0x53 ,
  pidMagnetometer = 0x54 ,
  pidDataPortStatus = 0x55 ,
  pidAltimeter = 0x56 ,
  pidGPSCoordinates = 0x57 ,
  pidGPSGroundSpeed = 0x58 ,
  pidOrientation = 0x59 ,
  pidGPSAccuracy = 0x5A
}
 Packet type IDs from the vendor-defined protocol. More...
 
enum  witmotion_config_register_id {
  ridSaveSettings = 0x00 ,
  ridCalibrate = 0x01 ,
  ridOutputValueSet = 0x02 ,
  ridOutputFrequency = 0x03 ,
  ridPortBaudRate = 0x04 ,
  ridAccelerationBiasX = 0x05 ,
  ridAccelerationBiasY = 0x06 ,
  ridAccelerationBiasZ = 0x07 ,
  ridAngularVelocityBiasX = 0x08 ,
  ridAngularVelocityBiasY = 0x09 ,
  ridAngularVelocityBiasZ = 0x0A ,
  ridMagnetometerBiasX = 0x0B ,
  ridMagnetometerBiasY = 0x0C ,
  ridMagnetometerBiasZ = 0x0D ,
  ridPortModeD0 = 0x0E ,
  ridPortModeD1 = 0x0F ,
  ridPortModeD2 = 0x10 ,
  ridPortModeD3 = 0x11 ,
  ridPortPWMLevelD0 = 0x12 ,
  ridPortPWMLevelD1 = 0x13 ,
  ridPortPWMLevelD2 = 0x14 ,
  ridPortPWMLevelD3 = 0x15 ,
  ridPortPWMPeriodD0 = 0x16 ,
  ridPortPWMPeriodD1 = 0x17 ,
  ridPortPWMPeriodD2 = 0x18 ,
  ridPortPWMPeriodD3 = 0x19 ,
  ridIICAddress = 0x1A ,
  ridLED = 0x1B ,
  ridGPSBaudRate = 0x1C ,
  ridFilterBandwidth = 0x1F ,
  ridGyroscopeRange = 0x20 ,
  ridAccelerometerRange = 0x21 ,
  ridStandbyMode = 0x22 ,
  ridInstallationDirection = 0x23 ,
  ridTransitionAlgorithm = 0x24 ,
  ridInstructionStart = 0x2D ,
  ridTimeYearMonth = 0x30 ,
  ridTimeDayHour = 0x31 ,
  ridTimeMinuteSecond = 0x32 ,
  ridTimeMilliseconds = 0x33 ,
  ridSetAccelerationX = 0x34 ,
  ridSetAccelerationY = 0x35 ,
  ridSetAccelerationZ = 0x36 ,
  ridSetAngularVelocityX = 0x37 ,
  ridSetAngularVelocityY = 0x38 ,
  ridSetAngularVelocityZ = 0x39 ,
  ridSetMagnetometerX = 0x3A ,
  ridSetMagnetometerY = 0x3B ,
  ridSetMagnetometerZ = 0x3C ,
  ridSetAngleRoll = 0x3D ,
  ridSetAnglePitch = 0x3E ,
  ridSetAngleYaw = 0x3F ,
  ridSetTemperature = 0x40 ,
  ridSetPortStatusD0 = 0x41 ,
  ridSetPortStatusD1 = 0x42 ,
  ridSetPortStatusD2 = 0x43 ,
  ridSetPortStatusD3 = 0x44 ,
  ridSetPressureLow = 0x45 ,
  ridSetPressureHigh = 0x46 ,
  ridSetAltitudeLow = 0x47 ,
  ridSetAltitudeHigh = 0x48 ,
  ridSetLongitudeLow = 0x49 ,
  ridSetLongitudeHigh = 0x4A ,
  ridSetLatitudeLow = 0x4B ,
  ridSetLatitudeHigh = 0x4C ,
  ridSetGPSAltitude = 0x4D ,
  ridSetGPSYaw = 0x4E ,
  ridSetGPSGroundSpeedLow = 0x4F ,
  ridSetGPSGroundSpeedHigh = 0x50 ,
  ridSetOrientationX = 0x51 ,
  ridSetOrientationY = 0x52 ,
  ridSetOrientationZ = 0x53 ,
  ridSetOrientationW = 0x54 ,
  ridGyroscopeAutoCalibrate = 0x63 ,
  ridUnlockConfiguration = 0x69
}
 List of configuration slots (registers) available for the library. More...
 

Functions

uint8_t witmotion_output_frequency (const int hertz)
 Converts the frequency value in Hertz to subsequent Witmotion opcode. More...
 
uint8_t witmotion_baud_rate (const QSerialPort::BaudRate rate)
 
bool id_registered (const size_t id)
 
float decode_acceleration (const int16_t *value)
 
float decode_angular_velocity (const int16_t *value)
 
float decode_angle (const int16_t *value)
 
float decode_temperature (const int16_t *value)
 
float decode_orientation (const int16_t *value)
 
void decode_gps_coord (const int32_t *value, double &deg, double &min)
 
void decode_realtime_clock (const witmotion_datapacket &packet, uint8_t &year, uint8_t &month, uint8_t &day, uint8_t &hour, uint8_t &minute, uint8_t &second, uint16_t &millisecond)
 
void decode_accelerations (const witmotion_datapacket &packet, float &x, float &y, float &z, float &t)
 
void decode_angular_velocities (const witmotion_datapacket &packet, float &x, float &y, float &z, float &t)
 
void decode_angles (const witmotion_datapacket &packet, float &roll, float &pitch, float &yaw, float &t)
 
void decode_magnetometer (const witmotion_datapacket &packet, float &x, float &y, float &z, float &t)
 
void decode_altimeter (const witmotion_datapacket &packet, double &pressure, double &height)
 
void decode_gps (const witmotion_datapacket &packet, double &longitude_deg, double &longitude_min, double &latitude_deg, double &latitude_min)
 
void decode_gps_ground_speed (const witmotion_datapacket &packet, float &altitude, float &angular_velocity, double &ground_speed)
 
void decode_orientation (const witmotion_datapacket &packet, float &x, float &y, float &z, float &w)
 
void decode_gps_accuracy (const witmotion_datapacket &packet, size_t &satellites, float &local_accuracy, float &horizontal_accuracy, float &vertical_accuracy)
 
template<typename T >
variance (const std::vector< T > &array)
 
static const std::string library_version ()
 

Variables

static const uint8_t WITMOTION_HEADER_BYTE = 0x55
 Packet header byte value (vendor protocol-specific)
 
static const uint8_t WITMOTION_CONFIG_HEADER = 0xFF
 Configuration header byte value (vendor protocol-specific)
 
static const uint8_t WITMOTION_CONFIG_KEY = 0xAA
 Configuration marker key byte value (vendor protocol-specific)
 
static const std::set< size_t > witmotion_registered_ids
 Packet ID set to retrieve descriptions via witmotion_packet_descriptions. More...
 
static const std::map< uint8_t, std::string > witmotion_packet_descriptions
 Packet ID string set to store built-in descriptions for message-enumerator. More...
 

Detailed Description

Upper level namespace containing all the declared constants, parameters, classes, functions.

Note
It is strictly NOT RECOMMENDED to use this namespace implicitly through using namespace directive.

Enumeration Type Documentation

◆ witmotion_config_register_id

List of configuration slots (registers) available for the library. The actual availability depends from the actual sensor and installation circuit. Please refer to the official documentation for detailed explanation.

Enumerator
ridSaveSettings 

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 witmotion_config_packet instance used.

ridCalibrate 

Sets the sensor to calibration mode.

The value stored in witmotion_config_packet::setting.raw[0] determines device selection:

  • 0x00 - End calibration
  • 0x01 - Accelerometer calibration
  • 0x03 - Altitude reset (only for barometric altimeter)
  • 0x04 - Yaw [Z] Euler angle origin point reset
  • 0x07 - Magnetometer calibration
  • 0x08 - Angle reference reset
ridOutputValueSet 

Regulates sensor output.

The value stored in 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.

raw[0] offset Packet type raw[1] offset Packet type
0 pidRTC 0 pidGPSGroundSpeed
1 pidAcceleration 1 pidOrientation
2 pidAngularVelocity 2 pidGPSAccuracy
3 pidAngles 3 Reserved
4 pidMagnetometer 4 Reserved
5 pidDataPortStatus 5 Reserved
6 pidAltimeter 6 Reserved
7 pidGPSCoordinates 7 Reserved
ridOutputFrequency 

Regulates output frequency.

NOTE: the maximum available frequency is determined internally by the available bandwidth obtained from ridPortBaudRate. The actual value stored in witmotion_config_packet::setting.raw[0] can be determined from the following table. witmotion_config_packet::setting.raw[1] is set to 0x00. Also the table contains argument value for witmotion_output_frequency helper function which is used by the controller applications.

Frequency, Hz Value Argument
0 (shutdown) 0x0D 0
0 (single measurement) 0x0C -1
0.1 0x01 -10
0.5 0x02 -2
1 0x03 1
2 0x04 2
5 0x05 5
10 (default) 0x06 10
20 0x07 20
50 0x08 50
100 0x09 100
125 0x0A 125
200 0x0B 200
Maximal available by hardware 0x0C Not supported
ridPortBaudRate 

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! The actual value stored in witmotion_config_packet::setting.raw[0] can be determined from the following table. witmotion_config_packet::setting.raw[1] is set to 0x00. The witmotion_baud_rate helper function argument is accepted as QSerialPort::BaudRate enumeration member, so only the speed inticated in that enumeration are explicitly supported.

Rate, baud 1200/1400 4800 9600 19200 38400 57600 115200
Value 0x00 0x01 0x02 0x03 0x04 0x05 0x06

This parameter also implicitly sets ridOutputFrequency to the maximal feasible value for the available bandwidth.

ridAccelerationBiasX 

Sets acceleration zero point bias for X axis, refer to Acceleration bias calculation page for explanation.

ridAccelerationBiasY 

Sets acceleration zero point bias for Y axis, refer to Acceleration bias calculation page for explanation.

ridAccelerationBiasZ 

Sets acceleration zero point bias for Z axis, refer to Acceleration bias calculation page for explanation.

ridAngularVelocityBiasX 

Sets angular velocity zero point bias for X axis. NOT YET PROVEN AS WORKING.

ridAngularVelocityBiasY 

Sets angular velocity zero point bias for Y axis. NOT YET PROVEN AS WORKING.

ridAngularVelocityBiasZ 

Sets angular velocity zero point bias for Z axis. NOT YET PROVEN AS WORKING.

ridMagnetometerBiasX 

Sets magnetometer zero point bias for X axis. MAY BLOCK THE MEASUREMENTS

ridMagnetometerBiasY 

Sets magnetometer zero point bias for Y axis. MAY BLOCK THE MEASUREMENTS

ridMagnetometerBiasZ 

Sets magnetometer zero point bias for Z axis. MAY BLOCK THE MEASUREMENTS

ridPortModeD0 

Digital port D0 mode.

The values are set only via witmotion_config_packet::setting.raw[0] whilst witmotion_config_packet::setting.raw[1] is set to 0. Please refer to the following table to determine the exact value needed.

Description Analog input (default) Digital input Digital output (high) Digital output (low) PWM output
Value 0x00 0x01 0x02 0x03 0x04
ridPortModeD1 

Digital port D1 mode.

The values are set only via witmotion_config_packet::setting.raw[0] whilst witmotion_config_packet::setting.raw[1] is set to 0. Please refer to the following table to determine the exact value needed.

Description Analog input (default) Digital input Digital output (high) Digital output (low) PWM output
Value 0x00 0x01 0x02 0x03 0x04
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 ridGPSBaudRate register.
ridPortModeD2 

Digital port D2 mode.

The values are set only via witmotion_config_packet::setting.raw[0] whilst witmotion_config_packet::setting.raw[1] is set to 0. Please refer to the following table to determine the exact value needed.

Description Analog input (default) Digital input Digital output (high) Digital output (low) PWM output
Value 0x00 0x01 0x02 0x03 0x04
ridPortModeD3 

Digital port D3 mode.

The values are set only via witmotion_config_packet::setting.raw[0] whilst witmotion_config_packet::setting.raw[1] is set to 0. Please refer to the following table to determine the exact value needed.

Description Analog input (default) Digital input Digital output (high) Digital output (low) PWM output
Value 0x00 0x01 0x02 0x03 0x04
ridPortPWMLevelD0 

Digital port D0 PWM high level pulse width, microseconds, 16-bit unsigned integer.

ridPortPWMLevelD1 

Digital port D1 PWM high level pulse width, microseconds, 16-bit unsigned integer.

ridPortPWMLevelD2 

Digital port D2 PWM high level pulse width, microseconds, 16-bit unsigned integer.

ridPortPWMLevelD3 

Digital port D3 PWM high level pulse width, microseconds, 16-bit unsigned integer.

ridPortPWMPeriodD0 

Digital port D0 PWM period length, microseconds, 16-bit unsigned integer.

ridPortPWMPeriodD1 

Digital port D1 PWM period length, microseconds, 16-bit unsigned integer.

ridPortPWMPeriodD2 

Digital port D2 PWM period length, microseconds, 16-bit unsigned integer.

ridPortPWMPeriodD3 

Digital port D3 PWM period length, microseconds, 16-bit unsigned integer.

ridIICAddress 

Sets up I2C address of the sensor. Default value is 0x50, 7-bit unsigned integer in witmotion_config_packet::setting.raw[0] whilst witmotion_config_packet::setting.raw[1] is set to 0.

ridLED 

Toggles on/off LED indication (for enclosed sensors only).

ridGPSBaudRate 

Regulates GPS receiver baud rate on port D1 (see ridPortModeD1).

The following table contains value set for witmotion_config_packet::setting.raw[0] representing the different baud rates. witmotion_config_packet::setting.raw[1] should be set to 0.

Rate, baud 1200/1400 4800 9600 19200 38400 57600 115200 230400 460800 921600
Value 0x00 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 0x09
Note
Baud rates over 256000 baud should not be considered standard.
ridFilterBandwidth 

Regulates internal filter bandwidth according to witmotion_config_packet::setting.

raw[0] value. Please refer to the following table for details.

Value Bandwidth, Hz
0x00 256
0x01 184
0x02 94
0x03 44
0x04 21
0x05 10
0x06 5

witmotion_config_packet::setting.raw[1] should be set to 0. NOT YET PROVEN AS WORKING

ridGyroscopeRange 

Regulates gyroscope value range according to witmotion_config_packet::setting.

raw[0] value. Please refer to the following table for details.

Value Range, \( deg/s \)
0x00 250
0x01 500
0x02 1000
0x03 2000

witmotion_config_packet::setting.raw[1] should be set to 0. NOT YET PROVEN AS WORKING

ridAccelerometerRange 

Regulates accelerometer value range according to witmotion_config_packet::setting.

raw[0] value. Please refer to the following table for details.

Value Range, \( m/s^2 \)
0x00 \( 2 \cdot g\)
0x01 \( 4 \cdot g\)
0x02 \( 8 \cdot g\)
0x03 \( 16 \cdot g\)

Here \( g = 9.81 m/s^2 \). witmotion_config_packet::setting.raw[1] should be set to 0. NOT YET PROVEN AS WORKING

ridStandbyMode 

Toggles dormant mode. witmotion_config_packet::setting.raw[0] should be set to 0x01, witmotion_config_packet::setting.raw[1] to 0.

ridInstallationDirection 

Toggles on/off internal rotation transform for vertical installation. witmotion_config_packet::setting.raw[1] should be set to 0, witmotion_config_packet::setting.raw[0] being to 0x01 allows vertical installation, to 0x00 - horizontal installation.

ridTransitionAlgorithm 

Regulates whether 9-axis (0x01 in witmotion_config_packet::setting.raw[0]) or 6-axis (0x00) transition algorithm should be used. witmotion_config_packet::setting.raw[1] should be set to 0.

ridInstructionStart 

Instruction mode. 0x00 in witmotion_config_packet::setting.raw[0] means starting instruction mode, 0x01 toggles it off whilst witmotion_config_packet::setting.raw[1] is set explicitly to 0.

ridTimeYearMonth 

Sets RTC to the given year (witmotion_config_packet::setting.raw[0]) and month (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.

ridTimeDayHour 

Sets RTC to the given day of the month (witmotion_config_packet::setting.raw[0]) and hour (witmotion_config_packet::setting.raw[1]) in 24H system.

ridTimeMinuteSecond 

Sets RTC to the given minute (witmotion_config_packet::setting.raw[0]) and second (witmotion_config_packet::setting.raw[1]) in 24H system.

ridTimeMilliseconds 

Sets RTC to the given milliseconds exposed as 16-bit unsigned integer.

ridSetAccelerationX 

Sets up origin point or impostor value (needed when the measurement is forced for output by ridOutputValueSet but not actually supported by the sensor) for acceleration on X axis. NOT YET PROVEN AS WORKING.

ridSetAccelerationY 

Sets up origin point or impostor value (needed when the measurement is forced for output by ridOutputValueSet but not actually supported by the sensor) for acceleration on Y axis. NOT YET PROVEN AS WORKING.

ridSetAccelerationZ 

Sets up origin point or impostor value (needed when the measurement is forced for output by ridOutputValueSet but not actually supported by the sensor) for acceleration on Z axis. NOT YET PROVEN AS WORKING.

ridSetAngularVelocityX 

Sets up origin point or impostor value (needed when the measurement is forced for output by ridOutputValueSet but not actually supported by the sensor) for angular velocity on X axis. NOT YET PROVEN AS WORKING.

ridSetAngularVelocityY 

Sets up origin point or impostor value (needed when the measurement is forced for output by ridOutputValueSet but not actually supported by the sensor) for angular velocity on Y axis. NOT YET PROVEN AS WORKING.

ridSetAngularVelocityZ 

Sets up origin point or impostor value (needed when the measurement is forced for output by ridOutputValueSet but not actually supported by the sensor) for angular velocity on Z axis. NOT YET PROVEN AS WORKING.

ridSetMagnetometerX 

Sets up origin point or impostor value (needed when the measurement is forced for output by ridOutputValueSet but not actually supported by the sensor) for magnetometer on X axis. MAY BLOCK THE MEASUREMENTS

ridSetMagnetometerY 

Sets up origin point or impostor value (needed when the measurement is forced for output by ridOutputValueSet but not actually supported by the sensor) for magnetometer on Y axis. MAY BLOCK THE MEASUREMENTS

ridSetMagnetometerZ 

Sets up origin point or impostor value (needed when the measurement is forced for output by ridOutputValueSet but not actually supported by the sensor) for magnetometer on Z axis. MAY BLOCK THE MEASUREMENTS

ridSetAngleRoll 

Sets up origin point or impostor value (needed when the measurement is forced for output by ridOutputValueSet but not actually supported by the sensor) for Euler angle (roll) over X axis. NOT YET PROVEN AS WORKING.

ridSetAnglePitch 

Sets up origin point or impostor value (needed when the measurement is forced for output by ridOutputValueSet but not actually supported by the sensor) for Euler angle (pitch) over Y axis. NOT YET PROVEN AS WORKING.

ridSetAngleYaw 

Sets up origin point or impostor value (needed when the measurement is forced for output by ridOutputValueSet but not actually supported by the sensor) for Euler angle (yaw) over Z axis. NOT YET PROVEN AS WORKING.

ridSetTemperature 

Sets up origin point or impostor value (needed when the corresponding spatial measurement is forced for output by ridOutputValueSet but not actually supported by the sensor) for temperature. NOT YET PROVEN AS WORKING.

ridSetPortStatusD0 

Action unknown, not yet documented by Witmotion.

ridSetPortStatusD1 

Action unknown, not yet documented by Witmotion.

ridSetPortStatusD2 

Action unknown, not yet documented by Witmotion.

ridSetPortStatusD3 

Action unknown, not yet documented by Witmotion.

ridSetPressureLow 

Sets up low part of initial value for 32-bit pressure measurement register. NOT YET PROVEN AS WORKING.

ridSetPressureHigh 

Sets up high part of initial value for 32-bit pressure measurement register. NOT YET PROVEN AS WORKING.

ridSetAltitudeLow 

Sets up low part of initial value for 32-bit altitude measurement register. NOT YET PROVEN AS WORKING.

ridSetAltitudeHigh 

Sets up high part of initial value for 32-bit altitude measurement register. NOT YET PROVEN AS WORKING.

ridSetLongitudeLow 

Sets up low part of initial value for 32-bit longitude measurement register. NOT YET PROVEN AS WORKING.

ridSetLongitudeHigh 

Sets up high part of initial value for 32-bit longitude measurement register. NOT YET PROVEN AS WORKING.

ridSetLatitudeLow 

Sets up low part of initial value for 32-bit latitude measurement register. NOT YET PROVEN AS WORKING.

ridSetLatitudeHigh 

Sets up high part of initial value for 32-bit latitude measurement register. NOT YET PROVEN AS WORKING.

ridSetGPSAltitude 

Sets up initial or impostor value (needed when the measurement is forced for output by ridOutputValueSet but not actually supported by the sensor) for GPS altitude measurement. NOT YET PROVEN AS WORKING.

ridSetGPSYaw 

Sets up initial or impostor value (needed when the measurement is forced for output by ridOutputValueSet but not actually supported by the sensor) for GPS orientation angle measurement. NOT YET PROVEN AS WORKING.

ridSetGPSGroundSpeedLow 

Sets up low part of initial value for 32-bit GPS ground speed measurement register. NOT YET PROVEN AS WORKING.

ridSetGPSGroundSpeedHigh 

Sets up high part of initial value for 32-bit GPS ground speed measurement register. NOT YET PROVEN AS WORKING.

ridSetOrientationX 

Sets up origin point or impostor value (needed when the measurement is forced for output by ridOutputValueSet but not actually supported by the sensor) for orientation quaternion, X component. NOT YET PROVEN AS WORKING.

ridSetOrientationY 

Sets up origin point or impostor value (needed when the measurement is forced for output by ridOutputValueSet but not actually supported by the sensor) for orientation quaternion, Y component. NOT YET PROVEN AS WORKING.

ridSetOrientationZ 

Sets up origin point or impostor value (needed when the measurement is forced for output by ridOutputValueSet but not actually supported by the sensor) for orientation quaternion, Z component. NOT YET PROVEN AS WORKING.

ridSetOrientationW 

Sets up origin point or impostor value (needed when the measurement is forced for output by ridOutputValueSet but not actually supported by the sensor) for orientation quaternion, W component. NOT YET PROVEN AS WORKING.

ridGyroscopeAutoCalibrate 

Toggles on/off automatic precalibration of the gyroscope. witmotion_config_packet::setting.raw[1] should be set to 0. 0x01 in witmotion_config_packet::setting.raw[0] turns gyroscope automatic precalibration OFF. To turn it ON the value should be 0x00.

ridUnlockConfiguration 

"Magic" vendor-defined value for configuration unlock packet 0xFF 0xAA 0x69 0x88 0xB5.

◆ witmotion_packet_id

If one of the packet type IDs defined here is registered after 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 util.h for decoder function reference.

Enumerator
pidRTC 

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 ridTimeYearMonth, ridTimeDayHour, ridTimeMinuteSecond and ridTimeMilliseconds registers.

pidAcceleration 

Linear accelerations + temperature/reserved field [X-Y-Z] (16-bit binary normalized quasi-floats)

pidAngularVelocity 

Angular velocities + temperature/reserved field [Roll-Pitch-Yaw] (16-bit binary normalized quasi-floats)

pidAngles 

Euler angles + temperature/reserved field [Roll-Pitch-Yaw] (16-bit binary normalized quasi-floats)

pidMagnetometer 

Magnetic field tensity + temperature/reserved field [world X-Y-Z] (16-bit binary normalized quasi-floats)

pidDataPortStatus 

Data port status packet, vendor-defined value.

pidAltimeter 

Altimeter + Barometer output (32-bit binary normalized quasi-floats)

pidGPSCoordinates 

GPS: longitude + latitude, if supported by hardware (32-bit binary normalized quasi-floats)

pidGPSGroundSpeed 

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.

pidOrientation 

Orientation defined as quaternion [X-Y-Z-W], when available from the sensor firmware (16-bit binary normalized quasi-floats)

pidGPSAccuracy 

GPS: visible satellites + variance vector [East-North-Up] (16-bit binary normalized quasi-floats)

Function Documentation

◆ witmotion_output_frequency()

uint8_t witmotion::witmotion_output_frequency ( const int  hertz)

Special values for the hertz argument are:

Value Description
0 Shuts down the measurements but does not turn the device into dormant mode
-1 Orders the single-shot measurement, then shutdown
-2 1 measurement in 2 seconds
-10 1 measurement in 10 seconds
Parameters
hertz- frequency in Hertz, or a special value as it is described above
Returns
Witmotion opcode value as a byte, 0x06 (10 Hz) by default is the argument is inacceptable

Variable Documentation

◆ witmotion_packet_descriptions

const std::map<uint8_t, std::string> witmotion::witmotion_packet_descriptions
static
Initial value:
= {
{0x50, "Real Time Clock"},
{0x51, "Accelerations"},
{0x52, "Angular velocities"},
{0x53, "Spatial orientation (Euler angles)"},
{0x54, "Magnetometer/Magnetic orientation"},
{0x55, "Data ports (D0-D3) status"},
{0x56, "Barometry/Altimeter"},
{0x57, "GPS Coordinates"},
{0x58, "GPS Ground Speed"},
{0x59, "Spatial orientation (Quaternion)"},
{0x5A, "GPS accuracy estimation"}
}

Contains values referenced in witmotion_packet_id enumeration with corresponding description strings used by message-enumerator application.

◆ witmotion_registered_ids

const std::set<size_t> witmotion::witmotion_registered_ids
static
Initial value:
= {
0x50,
0x51,
0x52,
0x53,
0x54,
0x55,
0x56,
0x57,
0x58,
0x59,
0x5A
}

Contains values referenced in 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.