Defines the IMU sensor.
Data Structures | |
| struct | dwIMUFrame |
| An IMU frame containing sensor readings from the IMU sensor. More... | |
Enumerations | |
| enum | dwIMUFlags { DW_IMU_HEADING = 1U << 1, DW_IMU_ROLL = 1U << 2, DW_IMU_PITCH = 1U << 3, DW_IMU_YAW = 1U << 4, DW_IMU_QUATERNION_X = 1U << 5, DW_IMU_QUATERNION_Y = 1U << 6, DW_IMU_QUATERNION_Z = 1U << 7, DW_IMU_QUATERNION_W = 1U << 8, DW_IMU_ROLL_RATE = 1U << 9, DW_IMU_PITCH_RATE = 1U << 10, DW_IMU_YAW_RATE = 1U << 11, DW_IMU_ACCELERATION_X = 1U << 12, DW_IMU_ACCELERATION_Y = 1U << 13, DW_IMU_ACCELERATION_Z = 1U << 14, DW_IMU_MAGNETOMETER_X = 1U << 15, DW_IMU_MAGNETOMETER_Y = 1U << 16, DW_IMU_MAGNETOMETER_Z = 1U << 17 } |
| Each flag shows if that value is valid in this IMU frame. More... | |
| enum | dwIMUHeadingType { DW_IMU_HEADING_TRUE = 0, DW_IMU_HEADING_MAGNETIC = 1 } |
| Types of the heading degree. More... | |
Functions | |
| DW_API_PUBLIC dwStatus | dwSensorIMU_popFrame (dwIMUFrame *frame, dwSensorHandle_t sensor) |
| Returns any IMU data previously processed through the raw data stream. More... | |
| DW_API_PUBLIC dwStatus | dwSensorIMU_processRawData (uint8_t const *data, size_t size, dwSensorHandle_t sensor) |
| Reads the IMU frame from raw data. More... | |
| DW_API_PUBLIC dwStatus | dwSensorIMU_readFrame (dwIMUFrame *frame, dwTime_t timeout_us, dwSensorHandle_t sensor) |
| Reads the next IMU frame from the sensor within a given timeout. More... | |
| struct dwIMUFrame |
| Data Fields | ||
|---|---|---|
| float64_t | acceleration[3] | Acceleration in X, Y, and Z directions [m/s^2]. |
| uint32_t | flags | The flags to show which values are valid in this IMU frame. |
| float64_t | heading | Heading of the IMU measured in respect to the ENU system [degrees], i.e., compass. |
| dwIMUHeadingType | headingType | Type of the heading information. |
| float64_t | magnetometer[3] | Measurement of the magnetometer unit in X, Y, and Z directions [utesla]. |
| float64_t | orientation[3] | Roll, pitch, and yaw angle of the orientation returned by the IMU [degree]. |
| dwQuaterniond | orientationQuaternion | Quaternion representation (x, y, z, w) of the orientation returned by the IMU. |
| dwTime_t | timestamp_us | Timestamp for the current message. Indicates when it's first received [usec]. |
| float64_t | turnrate[3] | Roll, pitch, and yaw turn rate (i.e., gyroscope)[rad/s]. |
| enum dwIMUFlags |
Each flag shows if that value is valid in this IMU frame.
| Enumerator | |
|---|---|
| DW_IMU_HEADING | Value of dwIMUFrame.heading is valid. |
| DW_IMU_ROLL | Value of dwIMUFrame.orientation[0] is valid. |
| DW_IMU_PITCH | Value of dwIMUFrame.orientation[1] is valid. |
| DW_IMU_YAW | Value of dwIMUFrame.orientation[2] is valid. |
| DW_IMU_QUATERNION_X | |
| DW_IMU_QUATERNION_Y | !< Value of dwIMUFrame.orientationQuaternion.x is valid. |
| DW_IMU_QUATERNION_Z | !< Value of dwIMUFrame.orientationQuaternion.y is valid. |
| DW_IMU_QUATERNION_W | !< Value of dwIMUFrame.orientationQuaternion.z is valid. |
| DW_IMU_ROLL_RATE | !< Value of dwIMUFrame.orientationQuaternion.w is valid. Value of dwIMUFrame.turnrate[0] is valid. |
| DW_IMU_PITCH_RATE | Value of dwIMUFrame.turnrate[1] is valid. |
| DW_IMU_YAW_RATE | Value of dwIMUFrame.turnrate[2] is valid. |
| DW_IMU_ACCELERATION_X | Value of dwIMUFrame.acceleration[0] is valid. |
| DW_IMU_ACCELERATION_Y | Value of dwIMUFrame.acceleration[1] is valid. |
| DW_IMU_ACCELERATION_Z | Value of dwIMUFrame.acceleration[2] is valid. |
| DW_IMU_MAGNETOMETER_X | Value of dwIMUFrame.magnetometer[0] is valid. |
| DW_IMU_MAGNETOMETER_Y | Value of dwIMUFrame.magnetometer[1] is valid. |
| DW_IMU_MAGNETOMETER_Z | Value of dwIMUFrame.magnetometer[2] is valid. |
| enum dwIMUHeadingType |
Types of the heading degree.
| Enumerator | |
|---|---|
| DW_IMU_HEADING_TRUE | True heading. 'dwIMUFrame.heading' points towards true north. |
| DW_IMU_HEADING_MAGNETIC | Magnetic heading. 'dwIMUFrame.heading' points towards magnetic north. |
| DW_API_PUBLIC dwStatus dwSensorIMU_popFrame | ( | dwIMUFrame * | frame, |
| dwSensorHandle_t | sensor | ||
| ) |
Returns any IMU data previously processed through the raw data stream.
This happens on the CPU thread where the function is called, incurring an additional load on that thread.
| [out] | frame | Pointer to an IMU frame structure to be filled with new data. |
| [in] | sensor | Sensor handle of the sensor previously created with 'dwSAL_createSensor()'. |
| DW_API_PUBLIC dwStatus dwSensorIMU_processRawData | ( | uint8_t const * | data, |
| size_t | size, | ||
| dwSensorHandle_t | sensor | ||
| ) |
Reads the IMU frame from raw data.
Any processed messages can be picked up using the dwSensorIMU_readFrame() method. This happens on the CPU thread where the function is called, incurring an additional load on that thread.
| [in] | data | Undecoded imu data. |
| [in] | size | Size in bytes of the raw data. |
| [in] | sensor | Sensor handle of the sensor previously created with 'dwSAL_createSensor()'. |
| DW_API_PUBLIC dwStatus dwSensorIMU_readFrame | ( | dwIMUFrame * | frame, |
| dwTime_t | timeout_us, | ||
| dwSensorHandle_t | sensor | ||
| ) |
Reads the next IMU frame from the sensor within a given timeout.
The method blocks until either a new valid frame is received from the sensor or the given timeout is exceeded.
| [out] | frame | A pointer to an IMU frame structure to be filled with new data. |
| [in] | timeout_us | Timeout, in us, to wait for a new message. Special values: DW_TIMEOUT_INFINITE - to wait infinitely. Zero - means polling of internal queue. |
| [in] | sensor | Sensor handle of the IMU sensor previously created with dwSAL_createSensor(). |