smarts.core.trap_manager module

class smarts.core.trap_manager.Trap(geometry: Polygon, mission: NavigationMission, activation_time: float, patience: float, default_entry_speed: float, entry_tactic: TrapEntryTactic)[source]

Caches geometry and temporal information to use to capture actors for social agents

activation_time: float

The amount of time left until this trap activates.

default_entry_speed: float

The default entry speed of a new vehicle should this trap expire.

entry_tactic: TrapEntryTactic

The entry tactic that this trap was generated with.

geometry: Polygon

The trap area within which actors are considered for capture.

includes(vehicle_id: str)[source]

Returns if the given actor should be considered for capture.

mission: NavigationMission

The mission that this trap should assign the captured actor.

patience: float

Patience to wait for better capture circumstances after which the trap expires.

patience_expired(sim_time: float)[source]

If the trap has expired and should no longer capture a vehicle.

ready(sim_time: float)[source]

If the trap is ready to capture a vehicle.

class smarts.core.trap_manager.TrapManager[source]

Facilitates agent hijacking of actors

add_trap_for_agent(agent_id: str, mission: NavigationMission, road_map: RoadMap, sim_time: float, reject_expired: bool = False) Tuple[bool, bool][source]

Add a new trap to capture an actor for the given agent.

Parameters:
  • agent_id (str) – The agent to associate to this trap.

  • mission (smarts.core.plan.NavigationMission) – The mission to assign to the agent and vehicle.

  • road_map (RoadMap) – The road map to provide information to about the map.

  • sim_time (float) – The current simulator time.

  • reject_expired (bool) – If traps should be ignored if their patience would already be expired on creation

Returns:

If the trap was added and if the trap is already expired.

Return type:

Tuple[bool, bool]

init_traps(road_map, missions, sim: SMARTS)[source]

Set up the traps used to capture actors.

remove_traps(used_traps)[source]

Remove the given used traps.

reset(scenario: smarts.core.scenario.Scenario, sim: SMARTS)[source]
Parameters:
reset_traps(used_traps)[source]

Reset all used traps.

step(sim: SMARTS)[source]

Run vehicle hijacking and update agent and actor states.

teardown()[source]

Clean up any unmanaged resources this manager uses (e.g. file handles.)

property traps: Dict[str, Trap]

The traps in this manager.