How pushpak1203/v2 works
Purpose and execution modes
This repository simulates cooperative autonomous vehicles in MetaDrive. Vehicles exchange encrypted V2V state/messages, feed shared awareness into planning, and execute driving actions in a multi-agent environment. Primary runners are main.py, main_autonomous_complex.py, and main_autonomous_idm.py; drive_in_real_env.py is a separate real-environment driving-oriented entry point.
Simulation environment boundary
The MetaDrive integration owns scenario lifecycle, vehicle/environment setup, stepping, and observations/actions. It isolates simulator-specific APIs from planning and communications:
• metadrive_env/env_manager.py
• metadrive_env/env_manager_with_idm.py
• metadrive_env/__init__.py
The IDM-specific manager provides an alternate traffic/control mode used by the IDM runner, rather than the default autonomous scenario path.
Agent orchestration and control loop
Entrypoints assemble configuration, environment management, communication, and planning into the per-step simulation loop:
• main.py
• main_autonomous_complex.py
• main_autonomous_idm.py
The core control flow is: initialize scenario and agents → obtain local simulator state → receive peer V2V information → select/plan cooperative response → apply controls to MetaDrive → log outcomes → repeat until simulation termination.
Decision and path-planning layer
The decision engine converts vehicle state and received peer context into maneuver/action decisions. planner.py is the central planning interface/orchestrator, while Hybrid A* supplies path-search behavior and response planning handles reactions to detected/cooperative conditions:
• decision_engine/planner.py
• decision_engine/hybrid_astar_planner.py
• decision_engine/response_planner.py
This is the key boundary between high-level cooperative intent and low-level simulator actions.
V2V transport and security
The communication subsystem provides the inter-agent message boundary. Broadcasters publish vehicle/situational data; receivers ingest peer messages; encryption utilities protect message payloads:
• communication/broadcaster.py
• communication/receiver.py
• communication/encryption_utils.py
Encryption requires an external secret.key at runtime, as described by the README but not present in the tree. Logging configuration supports communication observability through communication/logging_config.py.
Configuration, runtime dependencies, and observability
Simulation parameters are centralized in config/config.yaml, allowing scenarios and behavior to be adjusted without changing orchestration code. The material runtime is Python with MetaDrive, plus dependencies declared in requirements.txt. Simulation output is retained in logs/sim_log.txt; communication logging is intended as a separate operational stream for latency, coordination, and safety evaluation.
Architectural variants
The repository intentionally supports multiple policy/scenario variants rather than one fixed application path:
• default multi-agent cooperative simulation: main.py
• complex cooperative scenario: main_autonomous_complex.py
• Intelligent Driver Model integration: main_autonomous_idm.py
All variants share the same broad environment → state sharing → decision/planning → control feedback loop, while selecting different environment managers and driving behavior.
Main entry points: env_manager.py Environment manager · planner.py Planning orchestrator · env_manager_with_idm.py IDM environment manager · __init__.py MetaDrive environment API
Components 16
Simulation Runners
Select cooperative scenario and control variant.
- Default simulation
main.py - Complex scenario
main_autonomous_complex.py - IDM simulation
main_autonomous_idm.py - Real-environment drive · Separate driving-oriented entry point.
drive_in_real_env.py
MetaDrive Boundary
Owns simulator lifecycle, state, and action integration.
- Environment manager · Default scenario lifecycle and simulator integration.
metadrive_env/env_manager.py - IDM environment manager · Alternate IDM traffic and control mode.
metadrive_env/env_manager_with_idm.py - MetaDrive environment API
metadrive_env/__init__.py
Secure V2V
Shares protected peer vehicle and situational data.
- V2V broadcaster
communication/broadcaster.py - V2V receiver
communication/receiver.py - Payload encryption · Requires the external secret.key at runtime.
communication/encryption_utils.py
Cooperative Planning
Converts local and shared state into driving controls.
- Planning orchestrator · Combines local state and peer context into cooperative actions.
decision_engine/planner.py - Hybrid A* search
decision_engine/hybrid_astar_planner.py - Response planner
decision_engine/response_planner.py
Other components
- Simulation config
config/config.yaml - Simulation log
logs/sim_log.txt - Python dependencies · Declares Python and MetaDrive runtime dependencies.
requirements.txt
Connections 20
- Default simulation → Simulation config: loads
- Complex scenario → Simulation config: loads
- IDM simulation → Simulation config: loads
- Default simulation → Environment manager: runs
- Complex scenario → Environment manager: runs
- IDM simulation → IDM environment manager: runs
- Environment manager → MetaDrive environment API: uses
- IDM environment manager → MetaDrive environment API: uses
- Environment manager → V2V broadcaster: provides local state
- V2V broadcaster → Payload encryption: encrypts payload
- Payload encryption → V2V receiver: protects messages
- V2V receiver → Planning orchestrator: supplies peer context
- Environment manager → Planning orchestrator: supplies observations
- Planning orchestrator → Hybrid A* search: searches paths
- Planning orchestrator → Response planner: selects response
- Planning orchestrator → Environment manager: applies controls
- Planning orchestrator → IDM environment manager: applies controls
- Environment manager → Simulation log: logs outcomes
- IDM environment manager → Simulation log: logs outcomes
- Python dependencies → MetaDrive environment API: declares dependency