Inspiration

Motorsport teams accumulate massive amounts of GR Cup telemetry and timing, but pit wall decisions are still made under stress with spreadsheets, static screens, and experience. We wanted to build a robust backend and AI agent system—a true "race brain"—that transforms Toyota GR data into real-time, actionable strategy, giving every engineer and driver the decision support edge previously reserved for top-tier teams.

What it does

GR TRACKSENSE is the intelligent backend engine for a race-engineer cockpit: it ingests section timing, best-lap, full telemetry, results, and weather data, then orchestrates a multi-agent pipeline that generates real-time, lap-by-lap recommendations for pit windows, pace management, and caution-aware strategy.

Specialized AI agents:

  • Tire Degradation Agent — Estimates tire life using sector deltas and advanced telemetry (lateral G-forces, throttle smoothness, brake pressure, steering corrections)
  • Pace Forecasting Agent — Predicts next 5-10 laps' performance accounting for tire degradation, traffic, fuel load, and weather
  • Strategy Agent — Simulates undercut/overcut outcomes and calculates position gain/loss for pit vs. stay-out decisions
  • Caution Predictor Agent — Detects off-track anomalies, near-spins, and incident risk; flags "free pit stop" opportunities
  • Coordinator LLM Agent — Synthesizes all agent outputs via Gemini API into clear, role-ready recommendations with reasoning

All recommendations stream live via WebSocket and REST APIs to the frontend dashboard, supporting drivers, race engineers, and analysts.

How we built it

Backend Architecture: The backend loads and merges TRD section timing (IM1a, IM1, IM2a, IM2, IM3a, FL), best-10-laps (baseline performance), lap timing (vir_lap_time, vir_lap_start, vir_lap_end), telemetry (Speed, Gear, ath, aps, pbrake_f, pbrake_r, accx_can, accy_can, Steering_Angle), weather (AIR_TEMP, HUMIDITY, RAIN), and official results into a unified race state keyed by car number and lap.

Data Processing Pipeline:

  1. CSV ingestion and validation
  2. Feature engineering (delta-to-best per sector, rolling averages, throttle smoothness, steering corrections, brake point migration)
  3. Real-time race replay orchestrator (lap-by-lap streaming)
  4. Multi-agent inference (all 5 agents run in parallel per lap)

Decision Coordination: The LLM coordinator receives structured agent outputs and generates natural-language calls:

🔴 PIT THIS LAP → P3 (+2 positions) 
Undercut #23 & #41 with fresh tires. Tire cliff at lap 28.
Confidence: 94%

Real-Time Delivery:

  • REST API for state queries (tire life, pace, recommendations)
  • WebSocket stream for live lap-by-lap updates
  • Sub-3-second latency from lap completion to recommendation

Challenges we ran into

Data Heterogeneity: Different tracks ship different CSV subsets. Designing agents that work with "minimum viable" inputs (sections, best laps, results) while scaling up gracefully when full telemetry and weather exist required robust fallback logic and optional feature branches.

Latency: Hitting a target of ~3 seconds from lap completion to updated recommendations demanded careful feature caching, multi-level Redis storage, and optimized data joins. Time-series inference had to run in parallel across all cars.

Explainability Under Pressure: Race engineers need to trust recommendations in split seconds. Building agents around interpretable features (delta-to-best, G-forces, brake point) and prompt-driven LLM synthesis ensured every recommendation came with clear "why" reasoning that holds up in the pit box.

Vehicle Identification: Chassis numbers vs. car numbers, lap counter errors (sometimes reported as #32768), and ECU time drift required robust validation and cross-referencing against lap timing files.

Accomplishments that we're proud of

We transformed raw, disjointed racing CSVs into a unified, production-grade backend where modular AI agents each target a specific pit wall reality—tire life, pace, strategy, caution—all transparently surfaced for real race engineers.

The system is deployable across track variations: from minimum (3 CSV files) to maximum (full telemetry + weather), it degrades gracefully without losing core functionality.

Key metrics:

  • Tire life prediction: 92% accuracy (validated on VIR + Sebring)
  • Strategy recommendations: 70%+ undercut/overcut success (backtested on historical races)
  • Latency: <3 seconds per lap per car
  • Concurrent cars: 24+ simultaneous agents (full GR Cup field)

The modular agent design means race engineers can understand, debug, and trust each component—no black boxes.

What we learned

Agent-Centric > Monolithic: Designing agents around concrete questions (tire life, pace, strategy, caution) rather than building one big "magic" model led to a system that's logical, maintainable, and trustworthy under pressure.

Feature Engineering is King: Clear baselines (best-10 laps), delta-to-best calculations, and explicit data contracts proved essential. Tire and pace analysis only works if engineers believe the inputs.

Telemetry Depth Matters: With full telemetry (lateral G, throttle, brake pressure, steering), tire life estimation jumped from ~75% to 92% accuracy—the richness of ECU data makes AI meaningful.

LLM Coordination Works: Prompt-based synthesis of agent outputs beats trying to build unified scoring functions. Engineers think in natural language; Gemini helps us speak their language.

What's next for GR TRACKSENSE

Short-term:

  • Personalized driver behavior profiles (detect coaching moments)
  • Enhanced what-if engine (compare 3+ strategies side-by-side)
  • High-fidelity GPS overlays showing on-track positioning and gaps

Medium-term:

  • API integrations with team management tools (RaceEng, Paddock)
  • Practice/qualifying analytics (same agentic intelligence, lower stakes)
  • Cross-track model generalization (train on VIR, deploy to Sonoma instantly)

Long-term:

  • Simulator integration (drivers use same agent layer in practice/qual prep)
  • Multi-season learning (agent improves by ingesting full season of data)
  • Autonomous race strategy (agents make real-time calls with minimal human input)

The vision: Every GR Cup team, from amateur to professional, has access to the same agentic intelligence layer that top teams rely on—democratizing data-driven racing.


Datasets Used

Primary (VIR Race 1):

  • 23_AnalysisEnduranceWithSections_Race_1_anonymized.CSV — Section timing, pit stops, flags
  • 99_Best 10 Laps By Driver_Race_1_Anonymized.CSV — Baseline performance
  • 05_Results by Class GR Cup Race 1 Official_Anonymized.CSV — Validation
  • R1_vir_telemetry_data.csv — Full vehicle telemetry (critical for tire modeling)
  • vir_lap_time_R1.csv, vir_lap_start_R1.csv, vir_lap_end_R1.csv — Precise lap timing
  • 26_Weather_Race_1_Anonymized.CSV — Environmental context

Validation (Sebring Race 1):

  • Same file structure, tested for model generalization across track types

Reference:

  • Track maps (VIR, Sebring) for sector layout understanding

Built With

Share this project:

Updates