DriveWorks SDK Reference
5.16.65 Release
For Test and Development only

Detailed Description

Defines the IMU sensor.

Functions

DW_API_PUBLIC dwStatus dwSensorIMU_popFrame (dwIMUFrame *const frame, dwSensorHandle_t const sensor)
 Returns any IMU data previously processed through the raw data stream. More...
 
DW_API_PUBLIC dwStatus dwSensorIMU_popFrameNew (dwIMUFrameNew *const frame, dwSensorHandle_t const sensor)
 Returns any IMU Frame New previously processed through the raw data stream. More...
 
DW_API_PUBLIC dwStatus dwSensorIMU_processRawData (uint8_t const *const data, size_t const size, dwSensorHandle_t const sensor)
 Decodes IMU frames from raw data. More...
 
DW_API_PUBLIC dwStatus dwSensorIMU_processRawDataNew (uint8_t const *const data, size_t const size, dwSensorHandle_t const sensor)
 Reads the IMU frame New from raw data. More...
 
DW_API_PUBLIC dwStatus dwSensorIMU_readFrame (dwIMUFrame *const frame, dwTime_t const timeoutUs, dwSensorHandle_t const sensor)
 Reads the next IMU frame from the sensor within a given timeout. More...
 
DW_API_PUBLIC dwStatus dwSensorIMU_readFrameNew (dwIMUFrameNew *const frame, dwTime_t const timeoutUs, dwSensorHandle_t const sensor)
 Reads the next IMU frame New from the sensor within a given timeout. More...
 

Function Documentation

◆ dwSensorIMU_popFrame()

DW_API_PUBLIC dwStatus dwSensorIMU_popFrame ( dwIMUFrame *const  frame,
dwSensorHandle_t const  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.

Internally this API function will

  • Poll the internal IMU frame queue, and return the frame in queue head, and return DW_SUCCESS
  • If IMU frame queue is empty, return DW_NOT_AVAILABLE.
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_popFrameNew()

DW_API_PUBLIC dwStatus dwSensorIMU_popFrameNew ( dwIMUFrameNew *const  frame,
dwSensorHandle_t const  sensor 
)

Returns any IMU Frame New 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.

Parameters
[out]framePointer to an IMU frame New 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_processRawData()

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

Decodes IMU frames from raw data.

Any processed messages can be picked up using the dwSensorIMU_readFrame() or dwSensorIMU_popFrame() function. This happens on the CPU thread where the function is called, incurring an additional load on that thread.

Internally this API function will

  • Push the raw data block data to its internal decoder instance. If it failed to push this data block to internal decoder, errors will be returned.
  • After the decoder accepted the raw data block, decoder will decode this raw data block into one or more IMU frames, and these decoded IMU frames will be enqueued into an internal IMU frame queue.
  • If one or more IMU frames are successfully decoded, return DW_SUCCESS. Otherwise return DW_NOT_READY.
Parameters
[in]dataUndecoded imu data.
[in]sizeSize in bytes of the raw 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_READY - if more data needs to be passed in (loop while it returns 'DW_NOT_READY').
DW_SUCCESS
Note
It's possible that raw IMU data block data will be decoded into one or more IMU frames. All these decoded IMU frames will be stored into internal IMU frame queue and could be accessed via dwSensorIMU_readFrame() or dwSensorIMU_popFrame().

◆ dwSensorIMU_processRawDataNew()

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

Reads the IMU frame New from raw data.

Any processed messages can be picked up using the dwSensorIMU_readFrameNew() method. This happens on the CPU thread where the function is called, incurring an additional load on that thread.

Parameters
[in]dataUndecoded imu data.
[in]sizeSize in bytes of the raw 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_READY - if more data needs to be passed in (loop while it returns 'DW_NOT_READY').
DW_SUCCESS

◆ dwSensorIMU_readFrame()

DW_API_PUBLIC dwStatus dwSensorIMU_readFrame ( dwIMUFrame *const  frame,
dwTime_t const  timeoutUs,
dwSensorHandle_t const  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.

Internally this API function will

  • If there are already decoded IMU frames available in its internal IMU frame queue, this API function directly returns the first IMU frame from this internal IMU frame queue and return DW_SUCCESS. It'll not turn to sensors for raw IMU data blocks in this case.
  • Otherwise, this API function reads a raw sensor output data block from sensor. Timeout is detected in this step. DW_TIME_OUT is returned in case of timeout
  • If raw sensor output data block is successfully retrieved, this raw sensor data block will be decoded by its underlying decoder instance, one or more decoded IMU frames will be generated/decoded, and they will be enqueued into an internal IMU frame queue
  • Finally this function will return the FIRST decoded IMU frame(a.k.a dequeue operation) from the internal IMU frame queue with return status DW_SUCCESS
  • If no frames are decoded from this piece of raw IMU data block, DW_NOT_AVAILABLE will be returned
Parameters
[out]frameA pointer to an IMU frame structure to be filled with new data.
[in]timeoutUsTimeout, in us, to wait for a new message. Special values: DW_TIMEOUT_INFINITE - to wait infinitely. 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_END_OF_STREAM - if end of stream reached (virtual sensor only).
DW_SAL_SENSOR_ERROR - if there was an i/o or bus error.
DW_SUCCESS
Note
This function will block until a frame is decoded or timeout is detected, if timeoutUs is specified as non-zero values.

◆ dwSensorIMU_readFrameNew()

DW_API_PUBLIC dwStatus dwSensorIMU_readFrameNew ( dwIMUFrameNew *const  frame,
dwTime_t const  timeoutUs,
dwSensorHandle_t const  sensor 
)

Reads the next IMU frame New 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 New structure to be filled with new data.
[in]timeoutUsTimeout, in us, to wait for a new message. Special values: DW_TIMEOUT_INFINITE - to wait infinitely. 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_END_OF_STREAM - if end of stream reached (virtual sensor only).
DW_SAL_SENSOR_ERROR - if there was an i/o or bus error.
DW_SUCCESS