CoolFace
Apppublic

sasikumarM/detraff-env

sourceHugging Faceupdated 6mo agoView on Hugging Face
0likes
models.py23 linesDownload Raw Back to root
1from openenv.core.env_server.types import Action, Observation, State2from pydantic import Field3from typing import Dict, Any4 5 6class DetraffAction(Action):7    # 0: North-South Green, 1: East-West Green8    phase: int = Field(..., description="0 for North-South Green, 1 for East-West Green")9 10 11class DetraffObservation(Observation):12    # Traffic State13    lane_queues: Dict[str, int] = Field(..., description="Number of vehicles in each lane")14    emergency_waiting: Dict[str, bool] = Field(..., description="True if an emergency vehicle is in the lane")15    current_phase: int = Field(..., description="The currently active traffic light phase")16    17    # Required Hackathon Fields (Flat Style)18    reward: float = Field(..., description="Step reward normalized between 0.0 and 1.0")19    done: bool = Field(False, description="Whether the episode has reached its step limit")20    21    # Debugging/Metadata22    metadata: Dict[str, Any] = Field(default_factory=dict)23