Project Info
Inspiration
Learning to drive can be stressful, expensive, and often inaccessible. Traditional driving lessons and instructors cost hundreds of dollars, and many beginners struggle to build confidence behind the wheel. We wanted to create a safe, affordable, and AI-powered virtual alternative, a system that helps people learn and improve their driving skills from anywhere. By combining VR immersion, AI feedback, and custom hardware, we aimed to build a simulator that feels realistic, builds confidence, and provides the same (or better) learning experience as a real instructor, without the cost or risk of being on the road.
What it does
The VR driving simulator has different experiences or tracks for drivers to try and test their skills. Each experience is built with a specific goal in mind such as merging lanes on a highway, turning at intersections, and much more. The game feed is sent to a YOLOv8 computer vision model, which performs real-time object detection (cars, signs, pedestrians, etc.) and extracts telemetry data (speed, steering angle, lane deviation, collisions). This data is analyzed by the AI to generate performance cues and feedback. These cues are passed to our custom Toolhouse AI agent that acts as a virtual driving coach, providing real-time commentary and post-session advice. The coach’s responses are converted into natural speech using Fish AI and played inside the VR environment, creating the effect of a live instructor talking to you while you drive. The coach also gives the driver a final score based on their overall performance along with tips to improve their driving!
How we built it
Hardware: Built a custom steering wheel system using an ESP32 microcontroller and rotary encoder for steering input. Established serial communication between the ESP32 and Unity for real-time input mapping. (The encoder was later discovered to be faulty, preventing final calibration — but hardware communication and Unity integration were functional.) Software & AI Pipeline: The driving simulator environment was created in Unity using the XR SDK for VR support. The gameplay feed was captured and sent to a Python FastAPI server running YOLOv8 for real-time object detection. Telemetry data (steering angle, acceleration, collisions) was streamed to the same endpoint for analysis. The AI model evaluated performance and generated driver cues such as “Slow down,” “Maintain lane,” or “Pedestrian ahead.” These cues were sent to a Toolhouse AI agent, which structured them into natural coaching dialogue and feedback. The final text was passed through Fish AI for text-to-speech conversion, and the resulting audio was played directly inside Unity. Tech Stack: Hardware: ESP32, Rotary Encoder, Serial over USB Software: Unity (C#), Python, FastAPI, YOLOv8, OpenCV AI Tools: Toolhouse AI (driving coach), Fish AI (text-to-speech) VR Platform: Oculus/Meta headset
Challenges we ran into
While building our custom steering wheel, we ran into multiple hardware related challenges such as our rotary encoder malfunctioning or being defective and not reading the pulses correctly. This prevented us from completing the steering input mapping. However, we pushed through and worked with what we had to connect the VR headset to the Unity driving simulation. Another challenge we had was integrating real-time object detection with Unity while maintaining performance in VR. This required significant optimization of the models. Managing synchronization between multiple systems (Unity, ESP32, YOLOv8, Toolhouse AI, Fish AI) in real time was complex. Building natural-sounding, contextual AI feedback that felt like a real driving coach required prompt engineering and tuning.
Accomplishments we're proud of
We are really proud that even through times of adversity when our hardware was not functioning properly, we did not give up and worked through creating this project to build something that integrated hardware, VR, and AI! We achieved real time analysis of the driving footage using the YOLOv8 model We also created a driving coach AI agent that talks to the user making the experience more human like for the driver. Finally we were able to almost wrap up creating a custom steering wheel for the VR headset driving.
What we learned
We learned a lot about choosing various AI models pretrained on hugging face and fine tuning them to our use case. Moreover, we learned how to use custom hardware such as ESP32 boards, rotary encoder, and connecting embedded systems with VR.
What's next
We plan on building more experiences in the driving simulation for people to use. We want to create all kinds of driving scenarios for our users to practice so that they feel prepared and confident before they hit the roads!
CrashCourse - Driving Evaluation System
A real-time driving evaluation and coaching system that analyzes driving video footage to assess driver safety and behavior.
Features
- Real-time object detection using YOLOv8
- Lane detection and departure warnings
- Time-to-collision (TTC) estimation
- Driving performance scoring with multiple dimensions:
- Speeding violations
- Lane keeping
- Headway management
- Smooth driving (harsh braking detection)
- Traffic compliance (red lights, stop signs)
- Real-time coaching cues
- Multiple integration options (FastAPI, WebSocket, LiveKit)
Project Structure
CrashCourse/
├── ai/src/ # AI inference engine
│ ├── api.py # FastAPI endpoints
│ ├── detector.py # YOLOv8 object detection
│ ├── rules.py # Scoring and cuing logic
│ ├── lane_simple.py # Lane detection
│ └── video_only.py # Vision-based utilities
├── backend/ # WebSocket backend
│ └── app.py # WebSocket server
└── livekit_backend/ # LiveKit integration
└── livekit_backend.py
Setup
1. Install Dependencies
pip install -r ai/requirements.txt
2. Download YOLOv8 Model
The YOLOv8n model will be automatically downloaded on first run, or you can place yolov8n.pt in the ai/src/ directory.
3. Configure Environment (for LiveKit only)
If using LiveKit integration:
cd livekit_backend
cp .env.example .env
# Edit .env with your LiveKit credentials
Usage
Option 1: FastAPI Server (Recommended)
Start the inference API server:
cd ai/src
uvicorn api:app --host 0.0.0.0 --port 8000
API Endpoints:
-
POST /infer_frame- Send frame + telemetry for inference- Parameters:
image: multipart image filetelemetry: JSON string with driving data
- Returns:
{"cues": [...], "ttc": float, "detections": int}
- Parameters:
-
POST /end_session- Get final driving score- Returns:
{"subscores": {...}, "final": float, "violations": {...}}
- Returns:
Option 2: WebSocket Server
Start the WebSocket server (automatically connects to FastAPI):
# Terminal 1: Start FastAPI server
cd ai/src
uvicorn api:app --host 0.0.0.0 --port 8000
# Terminal 2: Start WebSocket server
cd backend
python app.py
The WebSocket server listens on ws://localhost:8765
Protocol:
- Send binary frame data (JPEG encoded)
- Send JSON telemetry data
- Receive real-time inference results
- Send "DONE" message to get final score
Option 3: LiveKit Integration
For Unity/WebRTC integration:
# Terminal 1: Start FastAPI server
cd ai/src
uvicorn api:app --host 0.0.0.0 --port 8000
# Terminal 2: Start LiveKit backend
cd livekit_backend
python livekit_backend.py
Telemetry Data Format
{
"t": 1.5, // timestamp in seconds
"speed_mps": 15.0, // current speed in m/s
"speed_limit_mps": 13.4, // speed limit in m/s
"throttle": 0.5, // throttle position (0-1)
"brake": 0.0, // brake position (0-1)
"steer_deg": -5.0, // steering angle in degrees
"lane_offset_m": 0.2, // lane offset in meters (optional)
"tl_state": "green", // traffic light state (optional)
"in_stop_zone": false, // in stop zone (optional)
"collision": false // collision detected (boolean)
}
Coaching Cues
The system generates the following real-time cues:
SLOW_DOWN- Speed exceeds limitKEEP_LANE- Lane departure detectedINCREASE_HEADWAY- Following too closely (low TTC)SMOOTHER_BRAKE- Harsh braking detectedBRAKE_NOW- Red light/stop sign violation imminent
Scoring
Final scores are calculated across 5 dimensions:
- Speeding (25% weight): Time spent over speed limit
- Lane Keeping (25% weight): Time spent out of lane
- Headway (20% weight): Time with inadequate TTC
- Smoothness (15% weight): Number of harsh braking events
- Compliance (15% weight): Red light violations and collisions
Each subscore ranges from 0-100, with the final score being a weighted average.
Troubleshooting
Model not found error:
- Ensure
yolov8n.ptis inai/src/or let it auto-download - Check internet connection for first-time model download
Connection refused errors:
- Verify FastAPI server is running on port 8000
- Check firewall settings
No cues generated:
- Verify telemetry data format matches specification
- Check that speed limits and thresholds are realistic
Development
To run tests with sample video:
cd ai/src
python replay_test.py # With synthetic telemetry
python replay_video_only.py # Vision-only mode
License
[Add your license here]
Analysis
View
Metric
- 9
- 4
Figures cover GitHub contributors during the hackathon window. A co-authored commit counts in full for each author, so per-member totals add up to more than the whole-team figures.
Technology
- FastAPIIn code
- PythonIn code
- CClaimed
- C#Claimed
- PyTorchClaimed
2 of 5 appear in the indexed code. 3 claimed on Devpost could not be matched to code, which may simply mean the tool leaves no trace in the repository.
AI coding agents
No AI coding agent signals were found in this repository.
Detected from committed agent config files and commit authorship. Absence of a signal is not proof an agent was unused.
Codebase size
Source size
54 KB
Source files
14
Counts recognized source files only; vendored directories, binaries and lockfiles are excluded, so this is smaller than the repository on disk.
Repository
LucasStevenson/CrashCourse
25 files · 17.8 MB · @ df646ff
Structure
Application logic
15 files · 60%Domain rules, services and shared utilities.
Supporting
Layers are inferred from where files sit in the tree, not from reading the code. A project that names its directories unconventionally will read oddly here — open the file browser to check anything the diagram implies.
Languages
- Python91%
- Markdown9%
Share of indexed source by file size. Binary and vendored files are excluded.
Dependencies
ai/requirements.txt
pypi · 11- aiohttp
- fastapi
- livekit
- numpy
- opencv-python
- pydantic
- python-dotenv
- python-multipart
- ultralytics
- uvicorn[standard]
- websockets
backend/requirements.txt
pypi · 1- PyAudio
Declared in the repository’s manifests at the indexed commit. A declared package is not proof it is used, and runtime dependencies are listed first.
This project’s features have not been analysed yet.
Export this project's context (description, README, evidence, key source files) to chat with an AI agent elsewhere.