smarts.core.external_provider module

class smarts.core.external_provider.ExternalProvider(sim)[source]

A provider that is intended to be used for external intervention in the simulation. Vehicles managed by this provider cannot be hijacked by social agents and may have privileged VehicleStates.

property actions: Set[ActionSpaceType]

The action spaces of the provider.

property actor_ids: Iterable[str]

A set of actors that this provider manages.

Returns:

The actors this provider manages.

Return type:

Iterable[str]

property all_vehicle_states: List[VehicleState]

Get all current vehicle states.

manages_actor(actor_id: str) bool[source]

Returns True if the actor referenced by actor_id is managed by this Provider.

property recovery_flags: ProviderRecoveryFlags

Flags specifying what this provider should do if it fails. (May be overridden by child classes.)

reset()[source]

Reset this provider to a pre-initialized state.

set_manager(manager: ProviderManager)[source]

Indicate the manager that this provider should inform of all actor hand-offs.

setup(scenario: Scenario) ProviderState[source]

Initialize the provider with a scenario.

state_update(vehicle_states: Sequence[VehicleState], step_delta: float)[source]

Update vehicle states. Use all_vehicle_states() to look at previous states.

step(actions, dt: float, elapsed_sim_time: float) ProviderState[source]

Progress the provider to generate new actor state. :param actions: one or more valid actions from the supported action_spaces of this provider :param dt: time (in seconds) to simulate during this simulation step :type dt: float :param elapsed_sim_time: amount of time (in seconds) that’s elapsed so far in the simulation :type elapsed_sim_time: float

Returns:

State representation of all actors this manages.

Return type:

ProviderState

sync(provider_state: ProviderState)[source]

Synchronize with state managed by other Providers.

teardown()[source]

Clean up provider resources.