How xdefox/intelligent-traffic-control-system works
Smart Crossroads is a traffic-control prototype combining a Unity intersection simulation with an asynchronous FastAPI service. The main loop sends batched camera detections to the API, where the orchestrator evaluates emergency priority and signal phases using the network model, then returns per-camera signal commands. A cloud coordinator handles network-wide green-wave commands and statistics; the Flet dashboard presents traffic, topology, and analytics. Unity and several backend subsystems are represented from README and the source index where implementation details were not excerpted, so their internal links are limited to documented relationships.
Main entry points: orchestrator.py Intersection orchestrator · main.py FastAPI endpoints · IntersectionVisionManager.cs Intersection client · graph_manager.py Road graph
Components 22
Unity Simulation
- Camera vision
Scene/Diplom_scene/Assets/Scripts/EdgeVisionCamera.cs - Intersection client
Scene/Diplom_scene/Assets/Scripts/IntersectionVisionManager.cs - Signal display
Scene/Diplom_scene/Assets/Scripts/TraddicLightViewer.cs - Vehicle navigation
Scene/Diplom_scene/Assets/Scripts/WaypointNavigator.cs - Traffic generation
Scene/Diplom_scene/Assets/Scripts/TrafficGenerator.cs
Telemetry API
- FastAPI endpoints
backend/main.py - Telemetry DTOs
backend/models/traffic.py
Traffic Control
- Intersection orchestrator
backend/services/orchestrator.py - Emergency detection
backend/core/emergency.py - Phase manager
backend/services/phase_manager.py - Cloud coordinator
backend/services/cloud_orchestrator.py - Green-wave coordinator
backend/services/green_wave.py
Dashboard and Analytics
- Traffic statistics
backend/services/statistics.py - Dashboard entry
backend/UI/admin_panel.py - Control panels
backend/UI/ui/panels.py - Network map
backend/UI/ui/map.py
Traffic Model
- Road graph
backend/services/graph_manager.py - Road configuration
backend/core/road_config.py - Lane utilities
backend/core/lane_utils.py
Other components
- Simulation operator
- Unity client
- Dashboard user
Connections 23
- Simulation operator → Traffic generation: starts simulation
README.md - Camera vision → Intersection client: sends detections
README.md - Intersection client → FastAPI endpoints: posts telemetry
README.md - FastAPI endpoints → Telemetry DTOs: validates payload
backend/main.py - FastAPI endpoints → Intersection orchestrator: routes batch
backend/main.py - Intersection orchestrator → Emergency detection: detects priority
backend/services/orchestrator.py - Intersection orchestrator → Road graph: reads topology
backend/services/orchestrator.py - Intersection orchestrator → Phase manager: chooses phase
backend/services/orchestrator.py - Intersection orchestrator → Cloud coordinator: gets wave commands
backend/services/orchestrator.py - Intersection orchestrator → Telemetry DTOs: builds response
backend/services/orchestrator.py - FastAPI endpoints → Intersection client: returns commands
README.md - Intersection client → Signal display: updates signals
README.md - Vehicle navigation → FastAPI endpoints: requests congestion
backend/main.py - Cloud coordinator → Green-wave coordinator: calculates waves
backend/services/cloud_orchestrator.py - Green-wave coordinator → Road graph: reads topology
backend/services/green_wave.py - Cloud coordinator → Traffic statistics: records traffic
backend/services/cloud_orchestrator.py - Road graph → Road configuration: loads network
backend/services/graph_manager.py - Road graph → Lane utilities: parses lane IDs
backend/services/graph_manager.py - Dashboard entry → Control panels: starts dashboard
backend/UI/admin_panel.py - Control panels → Network map: updates topology view
backend/UI/ui/panels.py - Control panels → Traffic statistics: shows analytics
backend/UI/ui/panels.py - Dashboard user → Dashboard entry: opens dashboard
README.md - Traffic generation → Vehicle navigation: creates traffic
README.md