Monado OpenXR Runtime
rift_s_tracker.c File Reference

Driver code for Oculus Rift S headsets. More...

#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <time.h>
#include <assert.h>
#include "math/m_api.h"
#include "math/m_clock_tracking.h"
#include "math/m_space.h"
#include "math/m_vec3.h"
#include "os/os_time.h"
#include "util/u_debug.h"
#include "util/u_device.h"
#include "util/u_sink.h"
#include "util/u_trace_marker.h"
#include "util/u_var.h"
#include "xrt/xrt_config_build.h"
#include "xrt/xrt_config_drivers.h"
#include "xrt/xrt_device.h"
#include "rift_s.h"
#include "rift_s_interface.h"
#include "rift_s_util.h"
#include "rift_s_tracker.h"
Include dependency graph for rift_s_tracker.c:

Macros

#define UPPER_32BITS(x)   ((x)&0xffffffff00000000ULL)
 

Functions

static void rift_s_tracker_get_tracked_pose_imu (struct xrt_device *xdev, enum xrt_input_name name, int64_t at_timestamp_ns, struct xrt_space_relation *out_relation)
 Specifies whether the user wants to use a SLAM tracker. More...
 
static void rift_s_tracker_switch_method_cb (void *t_ptr)
 
XRT_MAYBE_UNUSED void rift_s_fill_slam_imu_calibration (struct rift_s_tracker *t, struct rift_s_hmd_config *hmd_config)
 
static void rift_s_fill_slam_cameras_calibration (struct rift_s_tracker *t, struct rift_s_hmd_config *hmd_config)
 Extended camera calibration for SLAM. More...
 
static void rift_s_fill_slam_calibration (struct rift_s_tracker *t, struct rift_s_hmd_config *hmd_config)
 
static struct xrt_slam_sinksrift_s_create_slam_tracker (struct rift_s_tracker *t, struct xrt_frame_context *xfctx)
 
static int rift_s_create_hand_tracker (struct rift_s_tracker *t, struct xrt_frame_context *xfctx, struct xrt_hand_masks_sink *masks_sink, struct xrt_slam_sinks **out_sinks, struct xrt_device **out_device)
 
void rift_s_tracker_add_debug_ui (struct rift_s_tracker *t, void *root)
 
struct rift_s_trackerrift_s_tracker_create (struct xrt_tracking_origin *origin, struct xrt_frame_context *xfctx, struct rift_s_hmd_config *hmd_config)
 Procedure to setup trackers: 3dof, SLAM and hand tracking. More...
 
void rift_s_tracker_destroy (struct rift_s_tracker *t)
 
struct xrt_slam_sinksrift_s_tracker_get_slam_sinks (struct rift_s_tracker *t)
 
struct xrt_devicerift_s_tracker_get_hand_tracking_device (struct rift_s_tracker *t)
 
void rift_s_tracker_clock_update (struct rift_s_tracker *t, uint64_t device_timestamp_ns, timepoint_ns local_timestamp_ns)
 
static void clock_hw2mono_get (struct rift_s_tracker *t, uint64_t device_ts, timepoint_ns *out)
 Camera specific logic for clock conversion. More...
 
void rift_s_tracker_imu_update (struct rift_s_tracker *t, uint64_t device_timestamp_ns, const struct xrt_vec3 *accel, const struct xrt_vec3 *gyro)
 
void rift_s_tracker_push_slam_frames (struct rift_s_tracker *t, uint64_t frame_ts_ns, struct xrt_frame *frames[RIFT_S_CAMERA_COUNT])
 
static XRT_MAYBE_UNUSED void rift_s_tracker_correct_pose_from_basalt (struct xrt_pose *pose)
 Specific pose correction for Basalt to OpenXR coordinates. More...
 
void rift_s_tracker_get_tracked_pose (struct rift_s_tracker *t, enum rift_s_tracker_pose pose, uint64_t at_timestamp_ns, struct xrt_space_relation *out_relation)
 
void rift_s_tracker_start (struct rift_s_tracker *t)
 

Variables

static const bool slam_supported = false
 
static const bool hand_supported = false
 

Detailed Description

Driver code for Oculus Rift S headsets.

Implementation for the HMD 3dof and 6dof tracking

Author
Jan Schmidt jan@c.nosp@m.entr.nosp@m.icula.nosp@m.r.co.nosp@m.m

Function Documentation

◆ clock_hw2mono_get()

static void clock_hw2mono_get ( struct rift_s_tracker t,
uint64_t  device_ts,
timepoint_ns out 
)
static

Camera specific logic for clock conversion.

◆ rift_s_fill_slam_cameras_calibration()

static void rift_s_fill_slam_cameras_calibration ( struct rift_s_tracker t,
struct rift_s_hmd_config hmd_config 
)
static

◆ rift_s_tracker_correct_pose_from_basalt()

static XRT_MAYBE_UNUSED void rift_s_tracker_correct_pose_from_basalt ( struct xrt_pose pose)
inlinestatic

Specific pose correction for Basalt to OpenXR coordinates.

References xrt_quat::math_quat_rotate(), and xrt_quat::math_quat_rotate_vec3().

◆ rift_s_tracker_create()

struct rift_s_tracker * rift_s_tracker_create ( struct xrt_tracking_origin origin,
struct xrt_frame_context xfctx,
struct rift_s_hmd_config hmd_config 
)

Procedure to setup trackers: 3dof, SLAM and hand tracking.

Determines which trackers to initialize

Parameters
xfctxthe frame server that will own processing nodes
hmd_configHMD configuration and firmware info
Returns
initialised tracker on success, NULL if creation fails

◆ rift_s_tracker_get_tracked_pose_imu()

static void rift_s_tracker_get_tracked_pose_imu ( struct xrt_device xdev,
enum xrt_input_name  name,
int64_t  at_timestamp_ns,
struct xrt_space_relation out_relation 
)
static

Specifies whether the user wants to use a SLAM tracker.

Specifies whether the user wants to use the hand tracker.