From ec9ecf6332898c8f2dfeb3bd2b796530c8d4ff60 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Sat, 1 Aug 2020 21:10:28 +0100 Subject: [PATCH] d/psvr: Fix 3DOF tracking --- doc/changes/drivers/mr.474.md | 2 ++ src/xrt/drivers/psvr/psvr_device.c | 7 ++++--- 2 files changed, 6 insertions(+), 3 deletions(-) create mode 100644 doc/changes/drivers/mr.474.md diff --git a/doc/changes/drivers/mr.474.md b/doc/changes/drivers/mr.474.md new file mode 100644 index 000000000..2956118a5 --- /dev/null +++ b/doc/changes/drivers/mr.474.md @@ -0,0 +1,2 @@ +psvr: We were sending in the wrong type of time to the 3DOF fusion code, +switch to nanoseconds instead of fractions of seconds. diff --git a/src/xrt/drivers/psvr/psvr_device.c b/src/xrt/drivers/psvr/psvr_device.c index b850dc3ac..d7c8db143 100644 --- a/src/xrt/drivers/psvr/psvr_device.c +++ b/src/xrt/drivers/psvr/psvr_device.c @@ -320,12 +320,13 @@ update_fusion(struct psvr_device *psvr, xrt_tracked_psvr_push_imu(psvr->tracker, timestamp_ns, &sample); } else { - float delta_secs = tick_delta / PSVR_TICKS_PER_SECOND; - #if 1 - m_imu_3dof_update(&psvr->fusion, delta_secs, &psvr->read.accel, + timepoint_ns now = os_monotonic_get_ns(); + m_imu_3dof_update(&psvr->fusion, now, &psvr->read.accel, &psvr->read.gyro); #else + float delta_secs = tick_delta / PSVR_TICKS_PER_SECOND; + math_quat_integrate_velocity(&psvr->fusion.rot, &psvr->read.gyro, delta_secs, &psvr->fusion.rot);