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

This commit is contained in:
Jakob Bornecrantz 2023-04-24 16:45:21 +01:00
parent 9d8668a0a6
commit ce3c5d59fb
2 changed files with 18 additions and 1 deletions

View file

@ -1091,6 +1091,9 @@ wmr_hmd_get_tracked_pose(struct xrt_device *xdev,
DRV_TRACE_MARKER();
struct wmr_hmd *wh = wmr_hmd(xdev);
at_timestamp_ns += (uint64_t)(wh->tracked_offset_ms.val * (double)U_TIME_1MS_IN_NS);
if (wh->tracking.slam_enabled && wh->slam_over_3dof) {
wmr_hmd_get_slam_tracked_pose(xdev, name, at_timestamp_ns, out_relation);
} else {
@ -1617,6 +1620,7 @@ wmr_hmd_setup_ui(struct wmr_hmd *wh)
u_var_add_pose(wh, &wh->pose, "Tracked Pose");
u_var_add_pose(wh, &wh->offset, "Pose Offset");
u_var_add_bool(wh, &wh->average_imus, "Average IMU samples");
u_var_add_draggable_f32(wh, &wh->tracked_offset_ms, "Timecode offset(ms)");
u_var_add_gui_header(wh, NULL, "3DoF Tracking");
m_imu_3dof_add_vars(&wh->fusion.i3dof, wh, "");
@ -1887,6 +1891,12 @@ wmr_hmd_create(enum wmr_headset_type hmd_type,
wh->pose = (struct xrt_pose)XRT_POSE_IDENTITY;
wh->offset = (struct xrt_pose)XRT_POSE_IDENTITY;
wh->average_imus = true;
wh->tracked_offset_ms = (struct u_var_draggable_f32){
.val = 0.0,
.min = -40.0,
.step = 0.1,
.max = +120.0,
};
/* Now that we have the config loaded, iterate the map of known headsets and see if we have
* an entry for this specific headset (otherwise the generic entry will be used)

View file

@ -1,6 +1,6 @@
// Copyright 2018, Philipp Zabel.
// Copyright 2020-2021, N Madsen.
// Copyright 2020-2021, Collabora, Ltd.
// Copyright 2020-2023, Collabora, Ltd.
// SPDX-License-Identifier: BSL-1.0
/*!
* @file
@ -174,6 +174,13 @@ struct wmr_hmd
//! Average 4 IMU samples before sending them to the trackers
bool average_imus;
/*!
* 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
{
struct u_var_button hmd_screen_enable_btn;