PitWall Devlog 3 — Mistake Detector
What I built
Mistake Detector it compares a driver’s telemetry lap by lap at the same point on track. FastF1 gives car data sampled every few milliseconds but the points aren’t evenly spaced by distance, so I used scipy to interpolate both laps onto a common grid every 10 meters, then subtracted one speed trace from the other to find where time was lost.
detect_mistakes finds every zone where speed dropped more than 5 km/h, calculates time lost using distance ÷ speed physics, and maps each mistake to the nearest turn number using FastF1’s circuit info.
chart_track_mistakes draws the full circuit map colored by speed using matplotlib, green for fast, red for slow and with mistake zones highlighted and labeled with turn number and time lost.
get_perfect_lap finds the best individual three sectors from all of a driver’s qualifying laps and combines them into the theoretical fastest possible lap, showing how much time they left on the table.
chart_perfect_lap visualizes this as a grouped bar chart, green for perfect lap sectors, driver’s color for actual best lap.
Results from British GP 2026 qualifying
NOR had 5 mistake zones totalling 0.77 seconds lost between his best and second best lap. Biggest mistake at Turn 18 — 22.7 km/h speed loss, 0.31 seconds gone.
Problems I hit
- Interpolation was the hardest concept to understand and implement, two laps have telemetry at different distance points so you can’t compare directly.
scipy’sinterp1dsolved it - Had
return figaccidentally inside aforloop inchart_race_paceand only the first stint would show up - Also needed to fix charts where you’re comparing 2 drivers from the same team because they have the same color which makes the chart unreadable
Also done this session
- Set up GitHub and pushed the code so far
- Changed the color scheme for the charts
- Fixed teammate differentiation across the charts
Comments 0
No comments yet. Be the first!
Sign in to join the conversation.