PeerDrive: P2P vehicle mesh to prevent traffic and accelerate emergency response
PeerDrive is a decentralized, privacy-first vehicle network that lets nearby cars coordinate in real time to prevent traffic and improve safety. Each car becomes an intelligent node that maintains a precise, local map of nearby vehicles and cooperatively chooses actions—like easing speed to dissolve traffic waves or clearing a lane for an ambulance—without relying on a central server.
Simulation and algorithm refinement → minimal viable pilot with paired vehicles → city-scale trials with early adopters and fleets → broader deployment.
Built a clear, non-technical description focused on purpose, user value, behavior, and impact.
Avoided implementation details to keep this distinct from the upcoming “How it’s made.”
Core language and architecture
cmd/peerdrive (CLI) and cmd/peerdrive-gui (desktop UI entrypoints)pkg/strategy/ (simulation engine, scenarios, analysis/metrics)pkg/models/ (shared state like NetworkState, VehicleState)pkg/sensor/ (parsers and mock.go for synthetic data)pkg/network/ (manager, rewards scaffolding)pkg/hardware/crypto.go (crypto/identity primitives)ui/ (desktop UI, including widgets/roadmap.go)Strategy engine (simulation)
strategy.NewEngine(...), StartScenario(...), IsRunning(), and StopScenario().pkg/strategy:
State and data model
pkg/models/state.go defines NetworkState (peers, alerts, recommendations) and per-vehicle state (position, velocity, acceleration, lane).Sensors and inputs
pkg/sensor/mock.go generates repeatable sensor streams for deterministic tests.pkg/sensor/parser.go defines a thin interface layer so real inputs (phone GPS/IMU or hardware) can replace mocks without touching the engine.Networking
docs/Readme.md) uses a hybrid mesh:
pkg/network/manager.go and rewards.go outline the coordination and incentive hooks the engine will call into once live networking is enabled.Crypto/identity
pkg/hardware/crypto.go encapsulates cryptographic key handling to represent vehicles as keys (not license plates), enabling authenticated alerts without personal IDs.Desktop UI and visualization
cmd/peerdrive-gui launches a desktop app that embeds a right‑panel “road map” widget (ui/widgets/roadmap.go).GetWorldBounds(), worldToPixel(x,y), pixelToWorld(x,y)Examples and automation
examples/demo_scenarios.go runs both scenarios end-to-end and writes timestamped results.examples/compare/ and examples/compare_scenarios.go are used to baseline “No Comm” vs “V2V” configurations under identical seeds.Build and run
go run cmd/peerdrive-gui/main.gocd examples && go run demo_scenarios.goHardware track (prototyping path)
docs/Hardware.md: a cost‑optimized “Sentinel Unit” built around ESP32‑S3 + LLCC68 LoRa transceiver, USB‑C power/data, and external GPS/IMU when needed.What was hacky and worth noting
Why these technologies
Partner/adjacent tech and impact
What’s next
pkg/strategy.Focused on concrete implementation: code layout, APIs, data flow, concurrency, metrics, UI, hardware approach, and hacky shortcuts—distinct from the high‑level “what/why” description.

