Defines the IMU sensor.
Functions | |
DW_API_PUBLIC dwStatus | dwSensorIMU_popFrame (dwIMUFrame *const frame, dwSensorHandle_t const sensor) |
Returns the earliest IMU frame previously processed from previous IMU sensor packets. 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 received IMU sensor raw data/packets. 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... | |
DW_API_PUBLIC dwStatus dwSensorIMU_popFrame | ( | dwIMUFrame *const | frame, |
dwSensorHandle_t const | sensor | ||
) |
Returns the earliest IMU frame previously processed from previous IMU sensor packets.
This function returns only the first single decoded IMU frame from cached IMU frames(and removes it from cache). If no frames are available in queue, DW_NOT_AVAILABLE is returned and no IMU frame is returned.
This function should only be called after sensor is started. From above descriptions, this function requires previous callings to function dwSensorIMU_readFrame or dwSensorIMU_processRawData returns success otherwise this function will return DW_NOT_AVAILABLE.
This function is a synchronous function. Customers have to wait till the polling of IMU frame queue is finished.
[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_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.
[out] | frame | Pointer to an IMU frame New 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 *const | data, |
size_t const | size, | ||
dwSensorHandle_t const | sensor | ||
) |
Decodes IMU frames from received IMU sensor raw data/packets.
Any processed messages can be picked up using dwSensorIMU_readFrame() or dwSensorIMU_popFrame() function.
This API function will achieve functionality of this software unit:
This API function will push specified IMU sensor packet into its internal IMU decoders. Since internal IMU decoder will return once an IMU frame is decoded, or no IMU frames could be decoded from remaining bytes from specified IMU sensor packet, thus this API function will keep driving the decoder to return as many IMU frames as possible, until decoder could return no new IMU frames. All decoded IMU frames are cached internally and could be accessed by dwSensorIMU_readFrame() or dwSensorIMU_popFrame(). Based on sensor configuration value 'output-timestamp=', decoded IMU frames would be modified in their hostTimestamp field values accordingly.
This function should only be called after sensor is started, and with raw IMU sensor packet(s) returned from dwSensor_readRawData. After this raw sensor packet is processed by this function, user should also call dwSensor_returnRawData to return the memory block to SAL.
This function is a synchronous function. Customers have to wait till the raw IMU sensor data is processed.
[in] | data | Undecoded imu data. Non-null pointer |
[in] | size | Size in bytes of the raw data. Range: (0, INT_MAX]. Note 0 will result in DW_NOT_READY return value. |
[in] | sensor | Sensor handle of the sensor previously created with 'dwSAL_createSensor()'. |
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.
[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 *const | frame, |
dwTime_t const | timeoutUs, | ||
dwSensorHandle_t const | sensor | ||
) |
Reads the next IMU frame from the sensor within a given timeout.
This API function will achieve two functionalities of this software unit:
This API function will firstly check if there are already decoded IMU frames available, if there are decoded IMU frames then this API function returns the first decoded IMU frame then return; otherwise it will read IMU sensor packet then decode it and return first decoded IMU frames, or return DW_TIME_OUT if no IMU frames could be decoded till timeout is detected.
This function could only be called after an IMU sensor is instantiated, started and is running.
[out] | frame | A pointer to an IMU frame structure to be filled with new data. |
[in] | timeoutUs | Timeout, in us, to wait for a new message. Range: [0, INT_MAX] Special values:
|
[in] | sensor | Sensor handle of the IMU sensor previously created with dwSAL_createSensor(). |
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.
[out] | frame | A pointer to an IMU frame New structure to be filled with new data. |
[in] | timeoutUs | 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(). |