[][src]Function k4a_sys::k4a_device_get_imu_sample

pub unsafe extern "C" fn k4a_device_get_imu_sample(
    device_handle: k4a_device_t,
    imu_sample: *mut k4a_imu_sample_t,
    timeout_in_ms: i32
) -> k4a_wait_result_t

Reads an IMU sample.

\param device_handle Handle obtained by k4a_device_open().

\param imu_sample Pointer to the location for the API to write the IMU sample.

\param timeout_in_ms Specifies 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.

\relates k4a_device_t

\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.

\remarks Upon successfully reading a sample this function will return success and populate \p imu_sample. If a sample is not available in the configured \p timeout_in_ms, then the API will return ::K4A_WAIT_RESULT_TIMEOUT.

\remarks 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.

\remarks 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().

\remarks 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.

\remarks 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.

\xmlonly k4a.h (include k4a/k4a.h) k4a.lib k4a.dll \endxmlonly