Monado OpenXR Runtime
t_dead_reckoning.c File Reference

SLAM tracking code. More...

#include "xrt/xrt_defines.h"
#include "util/u_logging.h"
#include "util/u_time.h"
#include "math/m_filter_fifo.h"
#include "math/m_vec3.h"
#include "math/m_predict.h"
#include "math/m_api.h"
#include "t_dead_reckoning.h"
Include dependency graph for t_dead_reckoning.c:

Functions

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

Detailed Description

Function Documentation

◆ t_apply_dead_reckoning()

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.

The filter fifos should be exclusively locked and unmodified during the runtime of this function.

Parameters
gyro_ffThe gyro filter fifo.
accel_ffThe accelerometer filter fifo. Can be NULL to only use gyro.
gravity_correctionGravity correction to apply to accelerometer data. Can be NULL if accel_ff is NULL.
when_nsThe timestamp to predict to.
base_relThe base relation to start dead reckoning from.
base_rel_tsThe timestamp of the base relation.
out_relationThe predicted relation output.
Todo:
Instead of using same a and g values, do an interpolated sample like this: