From 95c5d056cff43606adac9a8f3ad3595875030a42 Mon Sep 17 00:00:00 2001 From: DeeJanuz <45082401+DeeJanuz@users.noreply.github.com> Date: Sat, 3 Oct 2026 09:26:54 -0600 Subject: [PATCH] Gaze: ft-gaze's loop runs every 4 ms instead of 2 ft-gaze's loop slept 2 ms, so 500 times a second it read the head pose (GetDeviceToAbsoluteTrackingPose), checked the eye tracker's counter, and drained SteamVR's events, for samples that come 90 times a second. It now sleeps 4 ms. A new sample is printed within 4 ms of appearing, 2 on average (was 1), and the pose history still has a pose within 2 ms of any sample's time, which keeps the head-pose error under 0.2 degrees for a head turning 100 degrees a second. Sleeping until the next sample is due would have thinned the pose history to 11 ms. Co-Authored-By: Claude Opus 5.5 --- gaze/ft-gaze.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gaze/ft-gaze.cpp b/gaze/ft-gaze.cpp index 2e23b0a..0c9393c 100644 --- a/gaze/ft-gaze.cpp +++ b/gaze/ft-gaze.cpp @@ -690,7 +690,10 @@ int main(int argc, char **argv) { break; } if (stdinClosed) break; - std::this_thread::sleep_for(std::chrono::milliseconds(2)); + // 250 passes a second: a new sample is printed within 4 ms (2 on average) of appearing, + // and the pose history has a pose within 2 ms of any sample's time (a 0.2 degree head + // turn at 100 degrees a second). Every 2 ms read the pose and the events twice as often. + std::this_thread::sleep_for(std::chrono::milliseconds(4)); } screens.Stop(); vr::VR_Shutdown();