Inspiration

I have always been obsessed with motorsports. From the strategic precision of Formula 1 to the raw adaptability of Rally, I’ve grown up fascinated not just by the drivers, but by the invisible decisions made on the pit wall.

Watching races, I often found myself shouting at the screen: "Box now! The undercut is open!" or "Stay out, the rain is passing!". I realized that victory isn't just about speed; it's about data-driven timing.

When I saw the Hack the Track challenge, I knew I didn't just want to visualize past data. I wanted to build the tool I always wished I had: a system that predicts the future of the race and answers the ultimate question: "What do we do NOW?"

What it does

The Digital Pit Wall is a real-time strategy simulator for the Toyota GR Cup. It uses Machine Learning to predict tire degradation and simulates critical race scenarios.

It allows a Race Engineer to:

  1. Predict Lap Delta: Forecast exactly how much time a driver will lose per lap due to tire wear and track conditions.
  2. Simulate "What-If" Scenarios: Instantly calculate the outcome of pitting under a Caution Flag vs. Green Flag.
  3. Calculate Undercuts: Simulate a 3-lap battle with a rival to see if an early pit stop will gain track position.

How we built it

We built a robust ETL (Extract, Transform, Load) and ML pipeline using Python.

  1. Data Processing (The Heavy Lifting): We processed over 20GB of raw data using pandas. This involved merging race timing loops with high-frequency telemetry data.
  2. Feature Engineering: We didn't just use the raw data. We engineered a custom metric called "Driver Aggression" by analyzing the Lateral-G forces from the telemetry files.
  3. Machine Learning: We trained seven track-specific Random Forest Regressors (scikit-learn).
  4. The Frontend: We built an interactive, low-latency dashboard using Streamlit, calibrated with specific pit-lane transit times for each track.

The Math behind the Model

Unlike standard tools that try to predict a raw lap time (which is noisy due to traffic), our model predicts the Lap Delta $$\Delta t$$

This isolates the pure physical degradation of the tire.

The core prediction function can be described as:

$$ \Delta t_{pred} = f(L_n, T_{track}, A_{driver}) $$

Where:

  • Wear ($$L_n$$): Cumulative laps on the current set.

  • Temp ($$T_{track}$$): Track surface temperature.

  • Aggression ($$A_{driver}$$): A derived metric from the telemetry sensors, specifically the mean absolute Lateral-G force:

$$ A_{driver} = \frac{1}{N} \sum_{i=1}^{N} |G_{lat}^{(i)}| $$

This allows the model to adapt: a driver pushing hard ($$High\ G$$) will degrade tires faster than a driver conserving rubber.

Challenges we ran into

This project was a massive data engineering challenge.

  1. The "Time Travel" Bug: When processing the 2.5GB telemetry files, we found that the ECU timestamps were often set to dates before the actual race (e.g., Thursday practice vs. Saturday race). We had to reverse-engineer the synchronization using the meta_time headers to align telemetry with lap times.
  2. Data Corruption: We discovered that the weather sensor data for Barber Motorsports Park was corrupt (reading 0.0°C). A standard model would have failed. We built a fault-tolerant system that detects this anomaly and automatically swaps to a simplified 2-feature model for that specific track.
  3. Inconsistent Formats: Some telemetry files were in LONG format, while others (like Sebring R2) were nested JSON. We wrote a polymorphic parser to handle both structures dynamically.

Accomplishments that we're proud of

  • Successfully processing and merging 14 different races worth of data.
  • Building a "Robust Mode" that prevents the app from crashing even when input data is missing or corrupt.
  • Achieving a prediction error (MAE) of less than 0.5 seconds on the COTA dataset.

What's next for Digital Pit Wall

We plan to implement a GPS-based traffic predictor. By calculating the position of all cars on track, we could add a "Traffic Penalty" variable to our simulation, making the Undercut calculator even more precise in heavy traffic.

Built With

Share this project:

Updates