[PR #131] fix(data): Eliminate Telemetry Lag via Timestamp Deduplication #162

Open
opened 2026-05-07 00:18:59 +02:00 by BreizhHardware · 0 comments

📋 Pull Request Information

Original PR: https://github.com/IAmTomShaw/f1-race-replay/pull/131
Author: @shash-hq
Created: 12/27/2025
Status: 🔄 Open

Base: mainHead: fix/telemetry-sync


📝 Commits (1)

  • 7e74d49 Fix: Add timestamp deduplication to prevent telemetry lag at lap boundaries

📊 Changes

1 file changed (+23 additions, -0 deletions)

View changed files

📝 src/f1_data.py (+23 -0)

📄 Description

Analysis of Issue

A "lag" phenomenon was observed at lap boundaries where the visual position of the vehicle and the LapCounter were desynchronized. Debugging src/f1_data.py indicated that FastF1 telemetry often contains duplicate timestamps at the exact moment of a lap transition—one associated with Lap N and the subsequent with Lap N+1. The existing pipeline processed these sequentially without filtering, causing a temporary reversion to the old state or stuttering.

Implementation Details

  • Deduplication Algorithm (src/f1_data.py):
    • Introduced a post-processing step to filter the t_all, x_all, y_all, etc., arrays.
    • Applied a np.unique filter on confirmed timestamps, configured to retain the last occurrence (latest index).
    • This ensures that for any collision in time T, the data associated with the higher LapNumber is prioritized.

Verification

  • Simulated lap transitions to verify immediate LapCounter updates upon crossing the finish line.
  • Confirmed zero-frame delay between visual position update and state change.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/IAmTomShaw/f1-race-replay/pull/131 **Author:** [@shash-hq](https://github.com/shash-hq) **Created:** 12/27/2025 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/telemetry-sync` --- ### 📝 Commits (1) - [`7e74d49`](https://github.com/IAmTomShaw/f1-race-replay/commit/7e74d4999c0febfcd51149416605016fd1a86ced) Fix: Add timestamp deduplication to prevent telemetry lag at lap boundaries ### 📊 Changes **1 file changed** (+23 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `src/f1_data.py` (+23 -0) </details> ### 📄 Description ## Analysis of Issue A "lag" phenomenon was observed at lap boundaries where the visual position of the vehicle and the `LapCounter` were desynchronized. Debugging `src/f1_data.py` indicated that FastF1 telemetry often contains duplicate timestamps at the exact moment of a lap transition—one associated with `Lap N` and the subsequent with `Lap N+1`. The existing pipeline processed these sequentially without filtering, causing a temporary reversion to the old state or stuttering. ## Implementation Details - **Deduplication Algorithm (`src/f1_data.py`):** - Introduced a post-processing step to filter the `t_all`, `x_all`, `y_all`, etc., arrays. - Applied a `np.unique` filter on confirmed timestamps, configured to retain the **last occurrence** (latest index). - This ensures that for any collision in time `T`, the data associated with the higher `LapNumber` is prioritized. ## Verification - Simulated lap transitions to verify immediate `LapCounter` updates upon crossing the finish line. - Confirmed zero-frame delay between visual position update and state change. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/f1-race-replay#162
No description provided.