Monado OpenXR Runtime
xrt::auxiliary::tracking::slam::TrackerSlam Struct Reference

Main implementation of xrt_tracked_slam. More...

Inheritance diagram for xrt::auxiliary::tracking::slam::TrackerSlam:
Collaboration diagram for xrt::auxiliary::tracking::slam::TrackerSlam:

Data Structures

struct  Features
 Tracker feature tracking info. More...
 

Data Fields

struct xrt_tracked_slam base = {}
 
struct xrt_frame_node node = {}
 Will be called on destruction. More...
 
struct t_vit_bundle vit
 VIT system function pointers. More...
 
struct vit_tracker_extension_set exts
 VIT tracker supported extensions. More...
 
struct vit_tracker * tracker
 Pointer to the tracker created by the loaded VIT system;. More...
 
struct xrt_slam_sinks sinks = {}
 Pointers to the sinks below. More...
 
struct xrt_frame_sink cam_sinks [XRT_TRACKING_MAX_SLAM_CAMS]
 Sends camera frames to the SLAM system. More...
 
struct xrt_imu_sink imu_sink = {}
 Sends imu samples to the SLAM system. More...
 
struct xrt_pose_sink gt_sink = {}
 Register groundtruth trajectory for stats. More...
 
struct xrt_hand_masks_sink hand_masks_sink = {}
 Register latest masks to ignore. More...
 
bool submit
 Whether to submit data pushed to sinks to the SLAM tracker. More...
 
uint32_t cam_count
 Number of cameras used for tracking. More...
 
struct u_var_button reset_state_btn
 Reset tracker state button. More...
 
enum u_logging_level log_level
 Logging level for the SLAM tracker, set by SLAM_LOG var. More...
 
struct xrt_slam_sinkseuroc_recorder
 EuRoC dataset recording sinks. More...
 
struct openvr_tracker * ovr_tracker
 OpenVR lighthouse tracker. More...
 
timepoint_ns last_imu_ts
 Last received IMU sample timestamp. More...
 
vector< timepoint_nslast_cam_ts
 Last received image timestamp per cam. More...
 
struct xrt_hand_masks_sample last_hand_masks
 Last received hand masks info. More...
 
Mutex last_hand_masks_mutex
 Mutex for last_hand_masks. More...
 
t_slam_prediction_type pred_type
 Type of prediction to use. More...
 
u_var_combo pred_combo
 UI combo box to select pred_type. More...
 
RelationHistory slam_rels {}
 A history of relations produced purely from external SLAM tracker data. More...
 
int dbg_pred_every = 1
 Skip X SLAM poses so that you get tracked mostly by the prediction algo. More...
 
int dbg_pred_counter = 0
 SLAM pose counter for prediction debugging. More...
 
struct os_mutex lock_ff
 Lock for gyro_ff and accel_ff. More...
 
struct m_ff_vec3_f32gyro_ff
 Last gyroscope samples. More...
 
struct m_ff_vec3_f32accel_ff
 Last accelerometer samples. More...
 
vector< u_sink_debugui_sink
 Sink to display frames in UI of each camera. More...
 
xrt_vec3 gravity_correction {0, 0, -MATH_GRAVITY_M_S2}
 Used to correct accelerometer measurements when integrating into the prediction. More...
 
struct xrt_space_relation last_rel = XRT_SPACE_RELATION_ZERO
 Last reported/tracked pose. More...
 
timepoint_ns last_ts
 Last reported/tracked pose timestamp. More...
 
struct {
   bool   use_moving_average_filter = false
 
   double   window = 66
 Time window in ms take the average on. More...
 
   struct m_ff_vec3_f32 *   pos_ff
 
   struct m_ff_vec3_f32 *   rot_ff
 Predicted positions fifo. More...
 
   bool   use_exponential_smoothing_filter = false
 Predicted rotations fifo (only xyz components, w is inferred) More...
 
   float   alpha = 0.1
 How much should we lerp towards the target value on each update. More...
 
   struct xrt_space_relation   last = XRT_SPACE_RELATION_ZERO
 Last filtered relation. More...
 
   struct xrt_space_relation   target = XRT_SPACE_RELATION_ZERO
 Target relation. More...
 
   bool   use_one_euro_filter = false
 
   m_filter_euro_vec3   pos_oe
 One euro position filter. More...
 
   m_filter_euro_quat   rot_oe
 One euro rotation filter. More...
 
   const float   min_cutoff = M_PI
 Default minimum cutoff frequency. More...
 
   const float   min_dcutoff = 1
 Default minimum cutoff frequency for the derivative. More...
 
   const float   beta = 0.16
 Default speed coefficient. More...
 
filter
 Filters are used to smooth out the resulting trajectory. More...
 
TimingWriterslam_times_writer
 Timestamps of the pipeline for performance analysis. More...
 
FeaturesWriterslam_features_writer
 Feature tracking information for analysis. More...
 
TrajectoryWriterslam_traj_writer
 Estimated poses from the SLAM system. More...
 
TrajectoryWriterpred_traj_writer
 Predicted poses. More...
 
TrajectoryWriterfilt_traj_writer
 Predicted and filtered poses. More...
 
struct {
   bool   enabled = false
 Whether the timing extension is enabled. More...
 
   float   dur_ms [UI_TIMING_POSE_COUNT]
 Timing durations in ms. More...
 
   int   idx = 0
 Index of latest entry in dur_ms. More...
 
   u_var_combo   start_ts
 UI combo box to select initial timing measurement. More...
 
   u_var_combo   end_ts
 UI combo box to select final timing measurement. More...
 
   int   start_ts_idx
 Selected initial timing measurement in start_ts. More...
 
   int   end_ts_idx
 Selected final timing measurement in end_ts. More...
 
   struct u_var_timing   ui
 Realtime UI for tracker durations. More...
 
   vector< string >   columns
 Column names of the measured timestamps. More...
 
   string   joined_columns
 Column names as a null separated string. More...
 
   struct u_var_button   enable_btn
 Toggle tracker timing reports. More...
 
timing
 Tracker timing info for performance evaluation. More...
 
struct xrt::auxiliary::tracking::slam::TrackerSlam::Features features
 
struct {
   Trajectory *   trajectory
 Empty if we've not received groundtruth. More...
 
   xrt_pose   origin
 First ground truth pose. More...
 
   float   diffs_mm [UI_GTDIFF_POSE_COUNT]
 Positional error wrt ground truth. More...
 
   int   diff_idx = 0
 Index of last error in diffs_mm. More...
 
   struct u_var_timing   diff_ui
 Realtime UI for positional error. More...
 
   bool   override_tracking = false
 Force the tracker to report gt poses instead. More...
 
gt
 Ground truth related fields. More...
 
- Data Fields inherited from xrt_tracked_slam
void(* get_tracked_pose )(struct xrt_tracked_slam *, timepoint_ns when_ns, struct xrt_space_relation *out_relation)
 Called by the owning xrt_device to get the last estimated pose of the SLAM tracker. More...
 
- Data Fields inherited from xrt_frame_node
struct xrt_frame_nodenext
 
void(* break_apart )(struct xrt_frame_node *node)
 Called first in when the graph is being destroyed, remove any references frames and other objects and stop threads. More...
 
void(* destroy )(struct xrt_frame_node *node)
 Do the actual freeing of the objects. More...
 
- Data Fields inherited from xrt_frame_sink
void(* push_frame )(struct xrt_frame_sink *sink, struct xrt_frame *frame)
 Push a frame into the sink. More...
 
- Data Fields inherited from xrt_imu_sink
void(* push_imu )(struct xrt_imu_sink *, struct xrt_imu_sample *sample)
 Push an IMU sample into the sink. More...
 
- Data Fields inherited from xrt_pose_sink
void(* push_pose )(struct xrt_pose_sink *, struct xrt_pose_sample *sample)
 

Additional Inherited Members

- Public Member Functions inherited from xrt_tracked_slam
int t_slam_create (struct xrt_frame_context *xfctx, struct t_slam_tracker_config *config, struct xrt_tracked_slam **out_xts, struct xrt_slam_sinks **out_sink)
 
int t_slam_start (struct xrt_tracked_slam *xts)
 
- Public Member Functions inherited from xrt_frame_sink
void u_sink_create_format_converter (struct xrt_frame_context *xfctx, enum xrt_format f, struct xrt_frame_sink *downstream, struct xrt_frame_sink **out_xfs)
 
void u_sink_create_to_r8g8b8_or_l8 (struct xrt_frame_context *xfctx, struct xrt_frame_sink *downstream, struct xrt_frame_sink **out_xfs)
 
void u_sink_create_to_r8g8b8_bayer_or_l8 (struct xrt_frame_context *xfctx, struct xrt_frame_sink *downstream, struct xrt_frame_sink **out_xfs)
 
void u_sink_create_to_rgb_yuv_yuyv_uyvy_or_l8 (struct xrt_frame_context *xfctx, struct xrt_frame_sink *downstream, struct xrt_frame_sink **out_xfs)
 
void u_sink_create_to_yuv_yuyv_uyvy_or_l8 (struct xrt_frame_context *xfctx, struct xrt_frame_sink *downstream, struct xrt_frame_sink **out_xfs)
 
void u_sink_create_to_yuv_or_yuyv (struct xrt_frame_context *xfctx, struct xrt_frame_sink *downstream, struct xrt_frame_sink **out_xfs)
 
void u_sink_create_to_r8g8b8_r8g8b8a8_r8g8b8x8_or_l8 (struct xrt_frame_context *xfctx, struct xrt_frame_sink *downstream, struct xrt_frame_sink **out_xfs)
 
void u_sink_deinterleaver_create (struct xrt_frame_context *xfctx, struct xrt_frame_sink *downstream, struct xrt_frame_sink **out_xfs)
 
bool u_sink_queue_create (struct xrt_frame_context *xfctx, uint64_t max_size, struct xrt_frame_sink *downstream, struct xrt_frame_sink **out_xfs)
 
bool u_sink_simple_queue_create (struct xrt_frame_context *xfctx, struct xrt_frame_sink *downstream, struct xrt_frame_sink **out_xfs)
 
void u_sink_quirk_create (struct xrt_frame_context *xfctx, struct xrt_frame_sink *downstream, struct u_sink_quirk_params *params, struct xrt_frame_sink **out_xfs)
 
void u_sink_split_create (struct xrt_frame_context *xfctx, struct xrt_frame_sink *left, struct xrt_frame_sink *right, struct xrt_frame_sink **out_xfs)
 
- Public Member Functions inherited from xrt_imu_sink
void u_imu_sink_split_create (struct xrt_frame_context *xfctx, struct xrt_imu_sink *downstream_one, struct xrt_imu_sink *downstream_two, struct xrt_imu_sink **out_imu_sink)
 
void u_imu_sink_force_monotonic_create (struct xrt_frame_context *xfctx, struct xrt_imu_sink *downstream, struct xrt_imu_sink **out_imu_sink)
 
- Static Public Member Functions inherited from xrt_tracked_slam
static void xrt_tracked_slam_get_tracked_pose (struct xrt_tracked_slam *slam, timepoint_ns when_ns, struct xrt_space_relation *out_relation)
 
- Static Public Member Functions inherited from xrt_frame_sink
static void xrt_sink_push_frame (struct xrt_frame_sink *sink, struct xrt_frame *frame)
 Push a frame into the sink. More...
 
- Static Public Member Functions inherited from xrt_imu_sink
static void xrt_sink_push_imu (struct xrt_imu_sink *sink, struct xrt_imu_sample *sample)
 
- Static Public Member Functions inherited from xrt_pose_sink
static void xrt_sink_push_pose (struct xrt_pose_sink *sink, struct xrt_pose_sample *sample)
 

Detailed Description

Main implementation of xrt_tracked_slam.

This is an adapter class for SLAM tracking that wraps an external SLAM implementation.

Field Documentation

◆ accel_ff

struct m_ff_vec3_f32* xrt::auxiliary::tracking::slam::TrackerSlam::accel_ff

Last accelerometer samples.

◆ alpha

float xrt::auxiliary::tracking::slam::TrackerSlam::alpha = 0.1

How much should we lerp towards the target value on each update.

◆ beta

const float xrt::auxiliary::tracking::slam::TrackerSlam::beta = 0.16

Default speed coefficient.

◆ cam_count

uint32_t xrt::auxiliary::tracking::slam::TrackerSlam::cam_count

Number of cameras used for tracking.

◆ cam_sinks

struct xrt_frame_sink xrt::auxiliary::tracking::slam::TrackerSlam::cam_sinks[XRT_TRACKING_MAX_SLAM_CAMS]

Sends camera frames to the SLAM system.

◆ columns

vector<string> xrt::auxiliary::tracking::slam::TrackerSlam::columns

Column names of the measured timestamps.

◆ dbg_pred_counter

int xrt::auxiliary::tracking::slam::TrackerSlam::dbg_pred_counter = 0

SLAM pose counter for prediction debugging.

◆ dbg_pred_every

int xrt::auxiliary::tracking::slam::TrackerSlam::dbg_pred_every = 1

Skip X SLAM poses so that you get tracked mostly by the prediction algo.

◆ diff_idx

int xrt::auxiliary::tracking::slam::TrackerSlam::diff_idx = 0

Index of last error in diffs_mm.

◆ diff_ui

struct u_var_timing xrt::auxiliary::tracking::slam::TrackerSlam::diff_ui

Realtime UI for positional error.

◆ diffs_mm

float xrt::auxiliary::tracking::slam::TrackerSlam::diffs_mm[UI_GTDIFF_POSE_COUNT]

Positional error wrt ground truth.

◆ dur_ms

float xrt::auxiliary::tracking::slam::TrackerSlam::dur_ms[UI_TIMING_POSE_COUNT]

Timing durations in ms.

◆ enable_btn

struct u_var_button xrt::auxiliary::tracking::slam::TrackerSlam::enable_btn

Toggle tracker timing reports.

◆ enabled

bool xrt::auxiliary::tracking::slam::TrackerSlam::enabled = false

Whether the timing extension is enabled.

Referenced by xrt::auxiliary::tracking::slam::timing_ui_push().

◆ end_ts

u_var_combo xrt::auxiliary::tracking::slam::TrackerSlam::end_ts

UI combo box to select final timing measurement.

◆ end_ts_idx

int xrt::auxiliary::tracking::slam::TrackerSlam::end_ts_idx

Selected final timing measurement in end_ts.

◆ euroc_recorder

struct xrt_slam_sinks* xrt::auxiliary::tracking::slam::TrackerSlam::euroc_recorder

EuRoC dataset recording sinks.

◆ exts

struct vit_tracker_extension_set xrt::auxiliary::tracking::slam::TrackerSlam::exts

VIT tracker supported extensions.

◆ filt_traj_writer

TrajectoryWriter* xrt::auxiliary::tracking::slam::TrackerSlam::filt_traj_writer

Predicted and filtered poses.

◆ 

struct { ... } xrt::auxiliary::tracking::slam::TrackerSlam::filter

Filters are used to smooth out the resulting trajectory.

◆ gravity_correction

xrt_vec3 xrt::auxiliary::tracking::slam::TrackerSlam::gravity_correction {0, 0, -MATH_GRAVITY_M_S2}

Used to correct accelerometer measurements when integrating into the prediction.

Todo:
Should be automatically computed instead of required to be filled manually through the UI.

◆ 

struct { ... } xrt::auxiliary::tracking::slam::TrackerSlam::gt

Ground truth related fields.

◆ gt_sink

struct xrt_pose_sink xrt::auxiliary::tracking::slam::TrackerSlam::gt_sink = {}

Register groundtruth trajectory for stats.

◆ gyro_ff

struct m_ff_vec3_f32* xrt::auxiliary::tracking::slam::TrackerSlam::gyro_ff

Last gyroscope samples.

Referenced by xrt::auxiliary::tracking::slam::predict_pose_from_imu().

◆ hand_masks_sink

struct xrt_hand_masks_sink xrt::auxiliary::tracking::slam::TrackerSlam::hand_masks_sink = {}

Register latest masks to ignore.

◆ idx

int xrt::auxiliary::tracking::slam::TrackerSlam::idx = 0

Index of latest entry in dur_ms.

◆ imu_sink

struct xrt_imu_sink xrt::auxiliary::tracking::slam::TrackerSlam::imu_sink = {}

Sends imu samples to the SLAM system.

◆ joined_columns

string xrt::auxiliary::tracking::slam::TrackerSlam::joined_columns

Column names as a null separated string.

◆ last

struct xrt_space_relation xrt::auxiliary::tracking::slam::TrackerSlam::last = XRT_SPACE_RELATION_ZERO

Last filtered relation.

◆ last_cam_ts

vector<timepoint_ns> xrt::auxiliary::tracking::slam::TrackerSlam::last_cam_ts

Last received image timestamp per cam.

◆ last_hand_masks

struct xrt_hand_masks_sample xrt::auxiliary::tracking::slam::TrackerSlam::last_hand_masks

Last received hand masks info.

◆ last_hand_masks_mutex

Mutex xrt::auxiliary::tracking::slam::TrackerSlam::last_hand_masks_mutex

Mutex for last_hand_masks.

◆ last_imu_ts

timepoint_ns xrt::auxiliary::tracking::slam::TrackerSlam::last_imu_ts

Last received IMU sample timestamp.

◆ last_rel

struct xrt_space_relation xrt::auxiliary::tracking::slam::TrackerSlam::last_rel = XRT_SPACE_RELATION_ZERO

Last reported/tracked pose.

◆ last_ts

timepoint_ns xrt::auxiliary::tracking::slam::TrackerSlam::last_ts

Last reported/tracked pose timestamp.

◆ lock_ff

struct os_mutex xrt::auxiliary::tracking::slam::TrackerSlam::lock_ff

Lock for gyro_ff and accel_ff.

Referenced by xrt::auxiliary::tracking::slam::predict_pose_from_imu().

◆ log_level

enum u_logging_level xrt::auxiliary::tracking::slam::TrackerSlam::log_level

Logging level for the SLAM tracker, set by SLAM_LOG var.

◆ min_cutoff

const float xrt::auxiliary::tracking::slam::TrackerSlam::min_cutoff = M_PI

Default minimum cutoff frequency.

◆ min_dcutoff

const float xrt::auxiliary::tracking::slam::TrackerSlam::min_dcutoff = 1

Default minimum cutoff frequency for the derivative.

◆ node

struct xrt_frame_node xrt::auxiliary::tracking::slam::TrackerSlam::node = {}

Will be called on destruction.

◆ origin

xrt_pose xrt::auxiliary::tracking::slam::TrackerSlam::origin

First ground truth pose.

◆ override_tracking

bool xrt::auxiliary::tracking::slam::TrackerSlam::override_tracking = false

Force the tracker to report gt poses instead.

◆ ovr_tracker

struct openvr_tracker* xrt::auxiliary::tracking::slam::TrackerSlam::ovr_tracker

OpenVR lighthouse tracker.

◆ pos_oe

m_filter_euro_vec3 xrt::auxiliary::tracking::slam::TrackerSlam::pos_oe

One euro position filter.

◆ pred_combo

u_var_combo xrt::auxiliary::tracking::slam::TrackerSlam::pred_combo

UI combo box to select pred_type.

◆ pred_traj_writer

TrajectoryWriter* xrt::auxiliary::tracking::slam::TrackerSlam::pred_traj_writer

Predicted poses.

◆ pred_type

t_slam_prediction_type xrt::auxiliary::tracking::slam::TrackerSlam::pred_type

Type of prediction to use.

◆ reset_state_btn

struct u_var_button xrt::auxiliary::tracking::slam::TrackerSlam::reset_state_btn

Reset tracker state button.

◆ rot_ff

struct m_ff_vec3_f32* xrt::auxiliary::tracking::slam::TrackerSlam::rot_ff

Predicted positions fifo.

◆ rot_oe

m_filter_euro_quat xrt::auxiliary::tracking::slam::TrackerSlam::rot_oe

One euro rotation filter.

◆ sinks

struct xrt_slam_sinks xrt::auxiliary::tracking::slam::TrackerSlam::sinks = {}

Pointers to the sinks below.

◆ slam_features_writer

FeaturesWriter* xrt::auxiliary::tracking::slam::TrackerSlam::slam_features_writer

Feature tracking information for analysis.

◆ slam_rels

RelationHistory xrt::auxiliary::tracking::slam::TrackerSlam::slam_rels {}

A history of relations produced purely from external SLAM tracker data.

◆ slam_times_writer

TimingWriter* xrt::auxiliary::tracking::slam::TrackerSlam::slam_times_writer

Timestamps of the pipeline for performance analysis.

◆ slam_traj_writer

TrajectoryWriter* xrt::auxiliary::tracking::slam::TrackerSlam::slam_traj_writer

Estimated poses from the SLAM system.

◆ start_ts

u_var_combo xrt::auxiliary::tracking::slam::TrackerSlam::start_ts

UI combo box to select initial timing measurement.

◆ start_ts_idx

int xrt::auxiliary::tracking::slam::TrackerSlam::start_ts_idx

Selected initial timing measurement in start_ts.

◆ submit

bool xrt::auxiliary::tracking::slam::TrackerSlam::submit

Whether to submit data pushed to sinks to the SLAM tracker.

◆ target

struct xrt_space_relation xrt::auxiliary::tracking::slam::TrackerSlam::target = XRT_SPACE_RELATION_ZERO

Target relation.

◆ 

struct { ... } xrt::auxiliary::tracking::slam::TrackerSlam::timing

Tracker timing info for performance evaluation.

Referenced by xrt::auxiliary::tracking::slam::timing_ui_push().

◆ tracker

struct vit_tracker* xrt::auxiliary::tracking::slam::TrackerSlam::tracker

Pointer to the tracker created by the loaded VIT system;.

Referenced by xrt::auxiliary::tracking::slam::flush_poses().

◆ trajectory

Trajectory* xrt::auxiliary::tracking::slam::TrackerSlam::trajectory

Empty if we've not received groundtruth.

◆ ui

struct u_var_timing xrt::auxiliary::tracking::slam::TrackerSlam::ui

Realtime UI for tracker durations.

◆ ui_sink

vector<u_sink_debug> xrt::auxiliary::tracking::slam::TrackerSlam::ui_sink

Sink to display frames in UI of each camera.

◆ use_exponential_smoothing_filter

bool xrt::auxiliary::tracking::slam::TrackerSlam::use_exponential_smoothing_filter = false

Predicted rotations fifo (only xyz components, w is inferred)

◆ vit

struct t_vit_bundle xrt::auxiliary::tracking::slam::TrackerSlam::vit

◆ window

double xrt::auxiliary::tracking::slam::TrackerSlam::window = 66

Time window in ms take the average on.

Increasing it smooths out the tracking at the cost of adding delay.


The documentation for this struct was generated from the following file: