Azure Kinect Sensor SDK  refs/heads/master
Documentation for https://github.com/Microsoft/Azure-Kinect-Sensor-SDK

◆ k4a_device_get_imu_sample()

k4a_wait_result_t k4a_device_get_imu_sample ( k4a_device_t  device_handle,
k4a_imu_sample_t imu_sample,
int32_t  timeout_in_ms 
)
related

Reads an IMU sample.

Parameters
device_handleHandle obtained by k4a_device_open().
imu_samplePointer to the location for the API to write the IMU sample.
timeout_in_msSpecifies the time in milliseconds the function should block waiting for the sample. If set to 0, the function will return without blocking. Passing a value of K4A_WAIT_INFINITE will block indefinitely until data is available, the device is disconnected, or another error occurs.
Returns
K4A_WAIT_RESULT_SUCCEEDED if a sample is returned. If a sample is not available before the timeout elapses, the function will return K4A_WAIT_RESULT_TIMEOUT. All other failures will return K4A_WAIT_RESULT_FAILED.
Remarks
Gets the next sample in the streamed sequence of IMU samples from the device. If a new sample is not currently available, this function will block until the timeout is reached. The API will buffer at least two camera capture intervals worth of samples before dropping the oldest sample. Callers needing to capture all data need to ensure they read the data as fast as the data is being produced on average.
Upon successfully reading a sample this function will return success and populate imu_sample. If a sample is not available in the configured timeout_in_ms, then the API will return K4A_WAIT_RESULT_TIMEOUT.
This function needs to be called while the device is in a running state; after k4a_device_start_imu() is called and before k4a_device_stop_imu() is called.
This function returns an error when an internal problem is encountered; such as loss of the USB connection, inability to allocate enough memory, and other unexpected issues. Any error returned by this function signals the end of streaming data, and caller should stop the stream using k4a_device_stop_imu().
If this function is waiting for data (non-zero timeout) when k4a_device_stop_imu() or k4a_device_close() is called on another thread, this function will return an error.
The memory the IMU sample is written to is allocated and owned by the caller, so there is no need to call an Azure Kinect API to free or release the sample.