# Virtual Vehicle Simulator A lightweight vehicle simulator that generates CAN telemetry and sends it to the cloud gateway. ## Background This service replaces the older `project-ai/tools/k8s-socket-can` tool. We rewrote it because: 1. **Simpler deployment** - Pure Go service that runs in K8s without SocketCAN kernel dependencies 2. **No hardware requirements** - The original required a CAN interface or vcan setup; this generates synthetic frames 3. **Cloud-native** - Designed for K8s from the start, uses the shared cloud-services build/deploy pipeline 4. **Self-registering** - Automatically registers with manufacturer API and handles certificate provisioning 5. **Configurable** - VIN prefix, send interval, and endpoints all configurable via env vars The original k8s-socket-can was designed for testing with real CAN hardware or Linux vcan interfaces. For demo/testing purposes where we just need telemetry flowing through the system, this lightweight simulator is more practical. ## Overview This service simulates a connected vehicle (T.Rex) by: 1. Registering with the manufacturer API to get certificates 2. Connecting to the gateway via WebSocket with mTLS 3. Generating and sending CAN frames ## Configuration | Env Var | Description | Default | |---------|-------------|---------| | MANUFACTURER_URL | URL for vehicle registration | http://gateway:8077/manufacture/manufacturer | | GATEWAY_WS_URL | WebSocket URL for gateway | ws://gateway:8077/session | | API_KEY | API key for manufacturer endpoint | - | | VIN_PREFIX | Prefix for generated VIN | VIRTUAL | | SEND_INTERVAL_MS | Telemetry interval in ms | 1000 | ## CAN Frame IDs | CAN ID | Description | |--------|-------------| | 0x100 | Speed | | 0x101 | RPM | | 0x102 | Battery SOC | | 0x103 | Battery voltage | | 0x104 | Temperature | | 0x105 | GPS latitude | | 0x106 | GPS longitude | | 0x200 | Door status | | 0x201 | Light status | | 0x300 | HVAC |