DriveWorks SDK Reference

| 0.6.67 Release

Detailed Description

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 = 1 << 1,
  DW_IMU_ROLL = 1 << 2,
  DW_IMU_PITCH = 1 << 3,
  DW_IMU_YAW = 1 << 4,
  DW_IMU_QUATERNION_X = 1 << 5,
  DW_IMU_QUATERNION_Y = 1 << 6,
  DW_IMU_QUATERNION_Z = 1 << 7,
  DW_IMU_QUATERNION_W = 1 << 8,
  DW_IMU_ROLL_RATE = 1 << 9,
  DW_IMU_PITCH_RATE = 1 << 10,
  DW_IMU_YAW_RATE = 1 << 11,
  DW_IMU_ACCELERATION_X = 1 << 12,
  DW_IMU_ACCELERATION_Y = 1 << 13,
  DW_IMU_ACCELERATION_Z = 1 << 14,
  DW_IMU_MAGNETOMETER_X = 1 << 15,
  DW_IMU_MAGNETOMETER_Y = 1 << 16,
  DW_IMU_MAGNETOMETER_Z = 1 << 17
}
 Each flag shows if that value is valid in this IMU frame. More...
 
enum  dwIMUHeadingType {
  DW_IMU_HEADING_TRUE = 0,
  DW_IMU_HEADING_MAGNECTIC = 1
}
 Types of the heading degree. More...
 

Functions

DW_API_PUBLIC dwStatus dwSensorIMU_popMessage (dwIMUFrame *frame, dwSensorHandle_t sensor)
 Returns any IMU data previously processed through the raw data stream. More...
 
DW_API_PUBLIC dwStatus dwSensorIMU_processRaw (const uint8_t *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...
 

Data Structure Documentation

◆ dwIMUFrame

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].
float64_t orientationQuaternion[4] 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].

Enumeration Type Documentation

◆ dwIMUFlags

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[0] is valid.

DW_IMU_QUATERNION_Z 

!< Value of dwIMUFrame.orientationQuaternion[1] is valid.

DW_IMU_QUATERNION_W 

!< Value of dwIMUFrame.orientationQuaternion[2] is valid.

DW_IMU_ROLL_RATE 

!< Value of dwIMUFrame.orientationQuaternion[3] 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.

Definition at line 60 of file IMU.h.

◆ dwIMUHeadingType

Types of the heading degree.

Enumerator
DW_IMU_HEADING_TRUE 

True heading.

dwIMUFrame.heading points towards true north.

DW_IMU_HEADING_MAGNECTIC 

Magnectic heading.

dwIMUFrame.heading points towards magnetic north.

Definition at line 88 of file IMU.h.

Function Documentation

◆ dwSensorIMU_popMessage()

DW_API_PUBLIC dwStatus dwSensorIMU_popMessage ( 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 on additional load on that thread.

Parameters
[out]framePointer to an IMU frame structure to be filled with new data.
[in]sensorSensor handle of the sensor previously created with dwSAL_createSensor().
Returns
DW_INVALID_HANDLE - if given sensor handle is invalid.
DW_INVALID_ARGUMENTS - if given arguments are invalid.
DW_NOT_AVAILABLE - if no more data is available
DW_SUCCESS

◆ dwSensorIMU_processRaw()

DW_API_PUBLIC dwStatus dwSensorIMU_processRaw ( const uint8_t *  data,
size_t  size,
dwSensorHandle_t  sensor 
)

Reads the IMU frame from raw data.

Any processed messages can be picked up using the dwSensorIMU_popMessage() method.

Parameters
[in]dataPointer to the raw data, which can be processed by the IMU module.
[in]sizeThe size of the raw data, in bytes.
[in]sensorSensor handle of the IMU sensor previously created with dwSAL_createSensor().
Returns
DW_INVALID_HANDLE - if given sensor handle is invalid
DW_INVALID_ARGUMENTS - if given arguments are invalid
DW_NOT_READY - if more data needs to be passed in
DW_SUCCESS

◆ dwSensorIMU_readFrame()

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.

Parameters
[out]frameA pointer to an IMU frame structure to be filled with new data.
[in]timeout_usTimeout, in us, to wait for a new message. Special values: DW_TIMEOUT_INFINITE - to wait infinitly. Zero - means polling of internal queue.
[in]sensorSensor handle of the IMU sensor previously created with dwSAL_createSensor().
Returns
DW_INVALID_HANDLE - if given sensor handle is invalid
DW_INVALID_ARGUMENTS - if given arguments are invalid
DW_TIME_OUT - if operation has timeout
DW_NOT_AVAILABLE - if sensor has not been started or data is not available in polling mode.
DW_SAL_SENSOR_ERROR - if there was an i/o or bus error.
DW_SUCCESS