d/vive: Add a slider to adjust all tracked pose timestamps

This commit is contained in:
Jakob Bornecrantz 2023-04-21 21:35:01 +01:00
parent ce3c5d59fb
commit 5197b4a42f
2 changed files with 19 additions and 1 deletions

View file

@ -178,6 +178,10 @@ vive_device_get_tracked_pose(struct xrt_device *xdev,
XRT_TRACE_MARKER();
struct vive_device *d = vive_device(xdev);
// Ajdust the timestamp with the offset.
at_timestamp_ns += (uint64_t)(d->tracked_offset_ms.val * (double)U_TIME_1MS_IN_NS);
if (d->tracking.slam_enabled && d->slam_over_3dof) {
vive_device_get_slam_tracked_pose(xdev, name, at_timestamp_ns, out_relation);
} else {
@ -829,6 +833,7 @@ vive_device_setup_ui(struct vive_device *d)
}
u_var_add_pose(d, &d->pose, "Tracked Pose");
u_var_add_pose(d, &d->offset, "Pose Offset");
u_var_add_draggable_f32(d, &d->tracked_offset_ms, "Timecode offset(ms)");
u_var_add_gui_header(d, NULL, "3DoF Tracking");
m_imu_3dof_add_vars(&d->fusion.i3dof, d, "");
@ -956,6 +961,12 @@ vive_device_create(struct os_hid_device *mainboard_dev,
d->sensors_dev = sensors_dev;
d->log_level = debug_get_log_option_vive_log();
d->watchman_dev = watchman_dev;
d->tracked_offset_ms = (struct u_var_draggable_f32){
.val = 0.0,
.min = -40.0,
.step = 0.1,
.max = +120.0,
};
d->base.hmd->distortion.models = XRT_DISTORTION_MODEL_COMPUTE;
d->base.hmd->distortion.preferred = XRT_DISTORTION_MODEL_COMPUTE;

View file

@ -1,4 +1,4 @@
// Copyright 2019, Collabora, Ltd.
// Copyright 2019-2023, Collabora, Ltd.
// SPDX-License-Identifier: BSL-1.0
/*!
* @file
@ -99,6 +99,13 @@ struct vive_device
bool imu2me;
} tracking;
/*!
* Offset for tracked pose offsets (applies to both fusion and SLAM).
* Applied when getting the tracked poses, so is effectivily a offset
* to increase or decrease prediction.
*/
struct u_var_draggable_f32 tracked_offset_ms;
struct xrt_pose P_imu_me; //!< IMU to head/display/middle-of-eyes transform in OpenXR coords
//! Whether to track the HMD with 6dof SLAM or fallback to the 3dof tracker