Witmotion IMU Library
1.3.1~dev_4684448
Open source UART communication library for sensor devices manufactured by WitMotion Shenzhen Co.,Ltd
|
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 |
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 °, 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 > | |
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... | |
Upper level namespace containing all the declared constants, parameters, classes, functions.
using namespace
directive. 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 | |||||||||||||||||||||||||||||||||||||||||||||
ridCalibrate | Sets the sensor to calibration mode. The value stored in witmotion_config_packet::setting.
| |||||||||||||||||||||||||||||||||||||||||||||
ridOutputValueSet | Regulates sensor output. The value stored in witmotion_config_packet::setting.
| |||||||||||||||||||||||||||||||||||||||||||||
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.
| |||||||||||||||||||||||||||||||||||||||||||||
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.
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.
| |||||||||||||||||||||||||||||||||||||||||||||
ridPortModeD1 | Digital port D1 mode. The values are set only via witmotion_config_packet::setting.
| |||||||||||||||||||||||||||||||||||||||||||||
ridPortModeD2 | Digital port D2 mode. The values are set only via witmotion_config_packet::setting.
| |||||||||||||||||||||||||||||||||||||||||||||
ridPortModeD3 | Digital port D3 mode. The values are set only via witmotion_config_packet::setting.
| |||||||||||||||||||||||||||||||||||||||||||||
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 | |||||||||||||||||||||||||||||||||||||||||||||
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.
| |||||||||||||||||||||||||||||||||||||||||||||
ridFilterBandwidth | Regulates internal filter bandwidth according to witmotion_config_packet::setting.
witmotion_config_packet::setting. | |||||||||||||||||||||||||||||||||||||||||||||
ridGyroscopeRange | Regulates gyroscope value range according to witmotion_config_packet::setting.
witmotion_config_packet::setting. | |||||||||||||||||||||||||||||||||||||||||||||
ridAccelerometerRange | Regulates accelerometer value range according to witmotion_config_packet::setting.
Here \( g = 9.81 m/s^2 \). witmotion_config_packet::setting. | |||||||||||||||||||||||||||||||||||||||||||||
ridStandbyMode | Toggles dormant mode. witmotion_config_packet::setting. | |||||||||||||||||||||||||||||||||||||||||||||
ridInstallationDirection | Toggles on/off internal rotation transform for vertical installation. witmotion_config_packet::setting. | |||||||||||||||||||||||||||||||||||||||||||||
ridTransitionAlgorithm | Regulates whether 9-axis ( | |||||||||||||||||||||||||||||||||||||||||||||
ridInstructionStart | Instruction mode. | |||||||||||||||||||||||||||||||||||||||||||||
ridTimeYearMonth | Sets RTC to the given year (witmotion_config_packet::setting. | |||||||||||||||||||||||||||||||||||||||||||||
ridTimeDayHour | Sets RTC to the given day of the month (witmotion_config_packet::setting. | |||||||||||||||||||||||||||||||||||||||||||||
ridTimeMinuteSecond | Sets RTC to the given minute (witmotion_config_packet::setting. | |||||||||||||||||||||||||||||||||||||||||||||
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. | |||||||||||||||||||||||||||||||||||||||||||||
ridUnlockConfiguration | "Magic" vendor-defined value for configuration unlock packet |
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) |
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 |
hertz | - frequency in Hertz, or a special value as it is described above |
0x06
(10 Hz) by default is the argument is inacceptable
|
static |
Contains values referenced in witmotion_packet_id enumeration with corresponding description strings used by message-enumerator application.
|
static |
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.