Monado OpenXR Runtime
t_dead_reckoning.h
Go to the documentation of this file.
1// Copyright 2021-2024, Collabora, Ltd.
2// Copyright 2025, Beyley Cardellio
3// SPDX-License-Identifier: BSL-1.0
4/*!
5 * @file
6 * @brief SLAM tracking code.
7 * @author Mateo de Mayo <mateo.demayo@collabora.com>
8 * @author Beyley Cardellio <ep1cm1n10n123@gmail.com>
9 * @ingroup aux_tracking
10 */
11
12#include "xrt/xrt_defines.h"
13
14#include "util/u_logging.h"
15#include "util/u_time.h"
16
17#include "math/m_filter_fifo.h"
18
19
20#ifdef __cplusplus
21extern "C" {
22#endif
23
24/*!
25 * Apply dead reckoning to a base relation using IMU data from filter fifos. The filter fifos should be exclusively
26 * locked and unmodified during the runtime of this function.
27 *
28 * @param gyro_ff The gyro filter fifo.
29 * @param accel_ff The accelerometer filter fifo. Can be NULL to only use gyro.
30 * @param gravity_correction Gravity correction to apply to accelerometer data. Can be NULL if
31 * accel_ff is NULL.
32 * @param when_ns The timestamp to predict to.
33 * @param base_rel The base relation to start dead reckoning from.
34 * @param base_rel_ts The timestamp of the base relation.
35 * @param out_relation The predicted relation output.
36 */
37void
39 struct m_ff_vec3_f32 *accel_ff,
40 const struct xrt_vec3 *gravity_correction,
41 timepoint_ns when_ns,
42 const struct xrt_space_relation *base_rel,
43 timepoint_ns base_rel_ts,
44 struct xrt_space_relation *out_relation);
45
46#ifdef __cplusplus
47}
48#endif
int64_t timepoint_ns
Integer timestamp type.
Definition: u_time.h:77
A fifo that also lets you dynamically filter.
Definition: m_filter_fifo.c:23
A relation with two spaces, includes velocity and acceleration.
Definition: xrt_defines.h:670
A 3 element vector with single floats.
Definition: xrt_defines.h:289
void t_apply_dead_reckoning(struct m_ff_vec3_f32 *gyro_ff, struct m_ff_vec3_f32 *accel_ff, const struct xrt_vec3 *gravity_correction, timepoint_ns when_ns, const struct xrt_space_relation *base_rel, timepoint_ns base_rel_ts, struct xrt_space_relation *out_relation)
Apply dead reckoning to a base relation using IMU data from filter fifos.
Definition: t_dead_reckoning.c:27
Basic logging functionality.
Time-keeping: a clock that is steady, convertible to system time, and ideally high-resolution.
Common defines and enums for XRT.