Toyota GR Cup Racing Replay & Analysis
Interactive Racing Telemetry Replay & AI Coaching System
Real-time race data visualization with intelligent performance analysis
π Project Overview
This is an interactive web-based racing replay application that visualizes Toyota GR Cup telemetry data with an integrated AI racing coach. The system provides comprehensive race analysis, telemetry visualization, and AI-powered coaching insights for racing performance improvement.
π Live Demo
For a live demo, login at: http://52.6.147.127
username: demo
password: TRDHackathon2025Demo@!!
π Core Features
- Interactive Race Replay: Real-time visualization of car movement on track with full telemetry data
- AI Racing Coach: Powered by Strands Agents SDK with access to comprehensive racing data
- PDF Report Generation: Professional performance analysis reports with optimized formatting
- Live Telemetry Display: Real-time speed, RPM, throttle, brake, steering, and G-force data
- Lap Analysis: Detailed lap timing, sector analysis, and performance comparisons
- GPS Trace Visualization: Precise car positioning with racing line overlay
- Auto-Detection: Automatic AWS region and account detection for seamless setup
πΊοΈ Available Data
Datasets are available here: https://trddev.com/hackathon-2025/
The application includes comprehensive Toyota GR Cup racing data from Barber Motorsports Park:
- Race Data: R1 (Race 1) and R2 (Race 2) complete datasets
- Telemetry: High-frequency GPS, speed, throttle, brake, steering, G-forces
- Lap Timing: Sector splits, best laps, lap comparisons, pit stop analysis
- Weather Data: Track conditions, temperature, humidity, wind data
- Track Layout: 15-turn circuit with sector boundaries and corner analysis
π Quick Start
Prerequisites
- Python 3.13+
- uv package manager
- Git LFS (for large telemetry files)
Installation
# Clone the repository
git clone https://github.com/your-username/trd-hackathon.git
cd trd-hackathon
# Install dependencies
uv sync
# Start the application
python api_server.pyAccess the Application
- Start the server:
python api_server.py - Open browser: Navigate to
http://localhost:8001 - Select race: Choose R1 or R2 from the dropdown
- Select car: Pick a car from the available vehicles
- Explore: Use playback controls to replay races and analyze performance
ποΈ Application Architecture
trd-hackathon/
βββ api_server.py # Flask backend with telemetry API
βββ racing_agent.py # Strands AI agent for racing analysis
βββ race_replay/ # Frontend web application
β βββ index.html # Main application interface
β βββ track-map.js # D3.js visualization & controls
β βββ race_maps/ # Track map images
βββ dataset/ # Racing telemetry data (Git LFS)
βββ pyproject.toml # Dependencies and configuration
βββ .gitattributes # Git LFS configuration for data files
π― Key Components
Backend (api_server.py)
- Flask REST API with CORS support for browser requests
- Chunked data loading for smooth telemetry playback
- AWS auto-detection using boto3 for seamless cloud deployment
- Caching system for optimized data access
- Multi-race support with R1/R2 datasets
AI Racing Coach (racing_agent.py)
- Strands Agents SDK integration for intelligent analysis
- 6 specialized tools for comprehensive racing data access:
- Telemetry Analysis (throttle, brake, steering technique)
- Best Laps Data (competitive performance rankings)
- Race Results Analysis (positions, gaps, finishing data)
- Lap Sector Analysis (sector splits, improvements, pit stops)
- Track Position Analysis (corner-by-corner location awareness)
- Weather Conditions (environmental impact on performance)
Frontend (race_replay/)
- Interactive track map with D3.js visualization
- Real-time telemetry display with live data updates
- Video-style controls (play, pause, step forward/backward)
- Lap jumping with dropdown navigation
- AI chat interface for performance coaching questions
- PDF report generation with jsPDF for downloadable analysis
- Responsive design for desktop and mobile
π Racing Analytics Features
Telemetry Visualization
- GPS-based car positioning on accurate track map
- Real-time speed, RPM, gear, throttle, and brake display
- G-force visualization for cornering and braking analysis
- Steering angle and lap distance tracking
Performance Analysis
- Best lap identification and comparison
- Sector time analysis with improvement tracking
- Gap analysis between drivers and optimal performance
- Weather impact assessment on lap times
AI Coaching
- Context-aware coaching based on current track position
- Technique analysis using high-resolution telemetry data
- Comparative performance insights vs. field leaders
- Strategic recommendations for improvement
- Professional PDF reports with comprehensive lap analysis
- Optimized formatting with minimal whitespace
- Color-coded performance indicators (green for achievements, red for critical findings)
- Detailed sector-by-sector breakdowns
- Comparative analysis tables and data visualization
- Downloadable for offline review and sharing
π οΈ API Endpoints
The backend provides comprehensive REST API endpoints:
Race Management
GET /api/races- Available racesGET /api/races/{race_id}/cars- Cars for specific race
Telemetry Data
GET /api/telemetry/{race_id}/{vehicle_id}/timeline- Timeline metadataGET /api/telemetry/{race_id}/{vehicle_id}/chunk- Chunked telemetry dataGET /api/telemetry/{race_id}/{vehicle_id}/position- Position at timestamp
Performance Data
GET /api/laps/{race_id}/{vehicle_id}- Lap timing and analysis
AI Assistant
GET /api/ai/regions- AWS region auto-detectionPOST /api/ai/test-connection- AI agent connection testPOST /api/ai/analyze- Racing performance analysis
π Usage Examples
Interactive Race Replay
- Select a race (R1/R2) and car from the dropdowns
- Use the timeline slider to scrub through the race
- Watch real-time telemetry data as the car moves around the track
- Use play/pause controls for automatic playback
AI Coaching
Ask the AI racing coach questions like:
- "What could I have done better on this lap?"
- "Why was I slower in sector 2?"
- "Compare my braking points to the fastest lap"
- "How can I improve my cornering technique?"
- "Generate a comprehensive performance report for this lap"
Generate PDF Reports: Click the "Generate Report" button in the AI Racing Coach panel to create a professional, downloadable PDF analysis of your current lap performance.
Performance Analysis
- Jump to specific laps using the lap dropdown
- Compare current lap times to your best lap
- Analyze sector splits and identify improvement areas
- Review weather conditions that affected performance
π§ Development
Dependencies
All dependencies are managed through pyproject.toml:
- Flask & Flask-CORS for web API
- Pandas & NumPy for data processing
- Boto3 for AWS integration
- Strands Agents for AI coaching
- D3.js (CDN) for frontend visualization
- jsPDF (CDN) for PDF report generation
Data Management
Large telemetry CSV files are managed using Git LFS:
- Configured in
.gitattributesfor automatic handling - Local data stored in
dataset/data_files/barber/ - Efficient chunked loading prevents memory issues
π Performance Optimizations
- Chunked data loading (60-second segments) for smooth playback
- In-memory caching with LRU cache for frequently accessed data
- Background preloading of upcoming data chunks
- Efficient GPS coordinate conversion for track positioning
- Optimized telemetry sampling for AI analysis
π Deployment
The application automatically detects AWS environment settings:
- Region detection via boto3 Session, EC2 metadata, or environment variables
- Account identification using AWS STS for proper context
- Fallback mechanisms ensure functionality in any environment
π License
This project is licensed under the MIT License - see the LICENSE file for details.
π€ Contributing
This racing replay application demonstrates advanced telemetry visualization and AI-powered racing analysis. The codebase showcases integration of modern web technologies with intelligent data processing for motorsports applications.
π Contact
TRD Hackathon Team
Project: Interactive Racing Telemetry Replay & AI Coaching System
Built with β€οΈ for the racing community