From 5981221824a8070f3ee8bf2ef6e5cb9365ddab9a Mon Sep 17 00:00:00 2001 From: rakadu1 Date: Wed, 27 Aug 2025 18:02:19 +0530 Subject: [PATCH] Subject: feat(sync): Add advanced debug overlay and fix timing bugs Body: This commit introduces a new advanced debugging overlay to help diagnose synchronization issues and fixes three core timing bugs that caused data streams to be misaligned. Advanced Debug Overlay: A new "Show Advanced Debug" toggle has been added to the UI. When enabled, it displays critical synchronization diagnostics in real-time, including: Video vs. Target Radar timestamps The calculated "Drift" in milliseconds between the two Absolute start times for video and radar recordings The currently applied offset This provides a precise tool for manually calibrating the offset and verifying sync accuracy. Synchronization Fixes: The previous implementation suffered from several race conditions and logical errors in its time management: Speed Graph Misalignment: The ego speed line on the graph was plotted using raw radar timestamps, ignoring the video offset. This has been corrected to use the offset-adjusted timestampMs, aligning it with the CAN data. Playback Drift: The main animation loop was incorrectly applying the time offset a second time during playback, causing the radar visualization to lead or lag the video. The redundant offset calculation has been removed from the animationLoop. Seeking Inaccuracy: When scrubbing the timeline, the UI would update the CAN speed using a stale videoPlayer.currentTime value due to the asynchronous nature of video seeking. The logic in updateFrame now uses the precise, calculated target time for the update, ensuring the EGO and CAN speed indicators match perfectly during seeks. These changes result in a significantly more robust and verifiable synchronization between the video and radar data feeds. --- steps/index.html | 164 ++++++++------ steps/src/dom.js | 357 +++++++++++++++++++------------ steps/src/main.js | 4 +- steps/src/p5/speedGraphSketch.js | 2 +- steps/src/sync.js | 2 +- 5 files changed, 327 insertions(+), 202 deletions(-) diff --git a/steps/index.html b/steps/index.html index 65ad670..029c373 100644 --- a/steps/index.html +++ b/steps/index.html @@ -3,39 +3,41 @@ - - + + Radar and Video Visualizer - Timestamp Synchronized - - + + + rel="stylesheet" />