Monado OpenXR Runtime
|
A fifo that also allows you to dynamically filter. More...
#include "xrt/xrt_defines.h"
Go to the source code of this file.
Functions | |
void | m_ff_vec3_f32_alloc (struct m_ff_vec3_f32 **ff_out, size_t num) |
Allocates a filter fifo tracking num samples and fills it with num samples at timepoint zero. More... | |
void | m_ff_vec3_f32_free (struct m_ff_vec3_f32 **ff_ptr) |
Frees the given filter fifo and all it's samples. More... | |
void | m_ff_vec3_f32_push (struct m_ff_vec3_f32 *ff, const struct xrt_vec3 *sample, uint64_t timestamp_ns) |
Pushes a sample at the given timepoint, pushing samples out of order yields unspecified behaviour, so samples must be pushed in time order. More... | |
void | m_ff_vec3_f32_get (struct m_ff_vec3_f32 *ff, size_t num, struct xrt_vec3 *out_sample, uint64_t *out_timestamp_ns) |
Return the sample at the index, zero means the last sample push, one second last and so on. More... | |
size_t | m_ff_vec3_f32_filter (struct m_ff_vec3_f32 *ff, uint64_t start_ns, uint64_t stop_ns, struct xrt_vec3 *out_average) |
Averages all samples in the fifo between the two timepoints, returns number of samples sampled, if no samples was found between the timpoints returns 0 and sets out_average to all zeros. More... | |
A fifo that also allows you to dynamically filter.
void m_ff_vec3_f32_alloc | ( | struct m_ff_vec3_f32 ** | ff_out, |
size_t | num | ||
) |
Allocates a filter fifo tracking num
samples and fills it with num
samples at timepoint zero.
References U_TYPED_CALLOC.
Referenced by m_imu_3dof_init().
size_t m_ff_vec3_f32_filter | ( | struct m_ff_vec3_f32 * | ff, |
uint64_t | start_ns, | ||
uint64_t | stop_ns, | ||
struct xrt_vec3 * | out_average | ||
) |
Averages all samples in the fifo between the two timepoints, returns number of samples sampled, if no samples was found between the timpoints returns 0 and sets out_average
to all zeros.
ff | Filter fifo to search in. |
start_ns | Timepoint furthest in the past, to start searching for samples. |
stop_ns | Timepoint closest in the past, or now, to stop searching for samples. |
out_average | Average of all samples in the given timeframe. |
References m_ff_vec3_f32::latest, m_ff_vec3_f32::num, m_ff_vec3_f32::samples, m_ff_vec3_f32::timestamps_ns, xrt_vec3::x, xrt_vec3::y, and xrt_vec3::z.
void m_ff_vec3_f32_free | ( | struct m_ff_vec3_f32 ** | ff_ptr | ) |
Frees the given filter fifo and all it's samples.
Referenced by m_imu_3dof_close().
void m_ff_vec3_f32_get | ( | struct m_ff_vec3_f32 * | ff, |
size_t | num, | ||
struct xrt_vec3 * | out_sample, | ||
uint64_t * | out_timestamp_ns | ||
) |
Return the sample at the index, zero means the last sample push, one second last and so on.
References m_ff_vec3_f32::latest, m_ff_vec3_f32::num, m_ff_vec3_f32::samples, and m_ff_vec3_f32::timestamps_ns.
void m_ff_vec3_f32_push | ( | struct m_ff_vec3_f32 * | ff, |
const struct xrt_vec3 * | sample, | ||
uint64_t | timestamp_ns | ||
) |
Pushes a sample at the given timepoint, pushing samples out of order yields unspecified behaviour, so samples must be pushed in time order.
References m_ff_vec3_f32::latest, m_ff_vec3_f32::num, sample, m_ff_vec3_f32::samples, and m_ff_vec3_f32::timestamps_ns.
Referenced by m_imu_3dof_update().