smarts.env.gymnasium.platoon_env module

smarts.env.gymnasium.platoon_env.platoon_env(scenario: str, agent_interface: AgentInterface, seed: int = 42, headless: bool = True, sumo_headless: bool = True, envision_record_data_replay_path: str | None = None)[source]

All ego agents should track and follow the leader (i.e., lead vehicle) in a single-file fashion. The lead vehicle is marked as a vehicle of interest and may be found by filtering the interest attribute of the neighborhood vehicles in the observation. The episode ends when the leader reaches its destination. Ego agents do not have prior knowledge of the leader’s destination.

Observation space for each agent:

Formatted Observation using multi_agent option is returned as observation. See ObservationSpacesFormatter for a sample formatted observation data structure.

Action space for each agent:

Action space for an ego can be either Continuous or RelativeTargetPose. User should choose one of the action spaces and specify the chosen action space through the ego’s agent interface.

Agent interface:

Using the input argument agent_interface, users may configure any field of AgentInterface, except

Reward:

Default reward is distance travelled (in meters) in each step, including the termination step.

Episode termination:

Episode is terminated if any of the following occurs.

  1. Lead vehicle reaches its pre-programmed destination.

  2. Steps per episode exceed 1000.

  3. Agent collides or drives off road.

Parameters:
  • scenario (str) – Scenario name or path to scenario folder.

  • agent_interface (AgentInterface) – Agent interface specification.

  • seed (int, optional) – Random number generator seed. Defaults to 42.

  • headless (bool, optional) – If True, disables visualization in Envision. Defaults to False.

  • sumo_headless (bool, optional) – If True, disables visualization in SUMO GUI. Defaults to True.

  • envision_record_data_replay_path (Optional[str], optional) – Envision’s data replay output directory. Defaults to None.

Returns:

An environment described by the input argument scenario.

smarts.env.gymnasium.platoon_env.resolve_agent_interface(agent_interface: AgentInterface)[source]

Resolve the agent interface for a given environment. Some interface values can be configured by the user, but others are pre-determined and fixed.