Inspiration

In the Toyota GR Cup, the difference between winning and losing is measured in milliseconds. Professional teams spend hours analyzing squiggly lines on telemetry charts to find time, often backed by a dedicated race engineer. Amateur and semi-pro drivers, however, often lack the budget or the data literacy to interpret raw sensor data. They know where they are slow, but not why.

I wanted to bridge this gap. ApexAI Co-Pilot was born from my idea to democratize race engineering turning raw, overwhelming CSV data into a digital coach that speaks plain English.

What it does

ApexAI Co-Pilot is an automated analytics platform that acts as a virtual race engineer.

  1. Automated Opportunity Detection: It instantly ranks every sector of the track by "Time Loss," telling the driver exactly where to focus.
  2. Physics-Based AI Coaching: Instead of generic advice, it analyzes brake pressure, throttle application, and G-forces. It identifies specific driving errors like "braking 10 bar too soft" or "hesitating on throttle exit" and delivers actionable coaching tips generated by Google Gemini.
  3. Interactive Race Console: A dark-mode dashboard lets drivers zoom into telemetry traces to compare their inputs directly against the class leader or their ideal lap.
  4. "Ask Apex" Chatbot: A RAG-based agent that allows drivers to query their data using natural language (e.g., "Where am I losing time?" or "Check my braking in Turn 7").

How I built it

I built a high-performance data pipeline centered around DuckDB and Google Gemini.

  • Data Engineering: I ingested the provided Toyota GR Cup datasets (telemetry, lap timing, and sector analysis) into a local DuckDB database for ultra-fast analytical querying.
  • Physics Engine: I wrote custom Python algorithms to normalize lap distances and calculate "Physics Deltas" (e.g., the difference in peak brake pressure between the driver and the class leader at every specific turn).
  • The AI Layer: I used Google Gemini 2.5 Flash via the GenAI SDK. I engineered a prompt pipeline that feeds these physics metrics into the model, forcing it to act as a Race Engineer. For the Chatbot, I implemented a Text-to-SQL agent that allows the LLM to query the DuckDB database directly.
  • Frontend: I built the UI in Streamlit, featuring custom CSS for a professional "Dark Mode" race console look and Plotly for interactive telemetry visualization.

Challenges I ran into

  • The "Nested JSON" Hallucination: Early on, the LLM would return valid JSON wrapped inside Markdown code blocks, breaking my frontend parser. I had to write a robust cleaning script to handle variable LLM output formats.
  • Data Syncing: Mapping "Lap Progress" (0% to 100%) across different cars with slightly different racing lines was difficult. I built a sector-mapping logic that aligns telemetry based on track landmarks rather than just timestamps.
  • Rate Limiting: Processing hundreds of laps triggered API limits. I implemented a robust retry-and-backoff mechanism to ensure the "Push Coach" could process the entire field without crashing.

Accomplishments that I'm proud of

I am most proud of the "Ask Apex" agent. It doesn't just summarize text; it actually writes valid SQL queries on the fly to answer complex physics questions like "Compare my throttle application in Sector 3 vs the class best." Seeing the AI correctly identify that a driver was losing time due to "soft braking" in Sunset Bend—purely from data, was a huge win.

What I learned

I learned the immense power of DuckDB for local analytics; it handled millions of telemetry rows instantly without the overhead of a heavy SQL server. I also learned that regarding AI in sports, Context is King—feeding the LLM precise, pre-calculated physics metrics yields far better results than asking it to interpret raw numbers.

What's next for ApexAI Co-Pilot

  • Real-Time Ingestion: Moving from post-session CSV analysis to a live stream from the car's CAN bus.
  • Video Overlay: Syncing the AI coaching tips as subtitles over on-board race footage.
  • Multi-Lap Comparison: Allowing drivers to compare their consistency across an entire stint rather than just single laps.

Built With

Share this project:

Updates