smarts.core.bubble_manager module

class smarts.core.bubble_manager.Bubble(bubble: Bubble, road_map: RoadMap)[source]

Wrapper around sstudio.sstypes.Bubble to cache bubble geometry (and does some internal Bubble-related business logic).

property active_condition: Condition

Fast inclusions for the bubble.

property actor: SocialAgentActor | TrafficEngineActor

The actor that should replace the captured actor.

admissibility(vehicle_id: str, index: VehicleIndex, vehicle_ids_in_bubbles: Dict[Bubble, Set[str]], running_cursors: Set[Cursor])[source]

The vehicle_id we are querying for and the other_vehicle_ids _presently in this Bubble.

property airlock_condition: Condition

Conditions under which this bubble will accept an agent.

property airlock_geometry: Polygon

The airlock geometry of the managed bubble.

condition_passes(active_condition_requirements)[source]

If the broadphase condition allows for this

property exclusion_prefixes

The blacklist of actor prefixes, used to ignore specific actors.

property follow_actor_id: str

A target actor that the bubble should remain at a fixed offset from.

property follow_vehicle_id: str

A target vehicle that the bubble should remain at a fixed offset from.

property geometry: Polygon

The geometry of the managed bubble.

property id

The id of the underlying bubble.

in_bubble_or_airlock_zone(position: Point)[source]

Test if the position is within the bubble or airlock around the bubble.

property is_boid

If the actors captured by the bubble should be controlled by a boid agent.

property is_traveling

If the bubble is following an actor.

property keep_alive

If enabled, the social agent actor will be spawned upon first vehicle airlock and be reused for every subsequent vehicle entering the bubble until the episode is over.

property limit

The maximum number of actors that the bubble can have captured at the same time.

move_to_follow_vehicle(vehicle: Vehicle)[source]

Move the bubble to a pose relative to the given vehicle.

class smarts.core.bubble_manager.BubbleCaptureState(value)[source]

Describes the actor’s capture state in the bubble.

Captured = 1
Controlled = 0
Uncaptured = 2
class smarts.core.bubble_manager.BubbleManager(bubbles: Sequence[Bubble], road_map: RoadMap)[source]

Manages bubble interactions.

property active_bubbles: Sequence[Bubble]

A sequence of currently active bubbles.

agent_ids_for_bubble(bubble: Bubble, sim) Set[str][source]

Agents generated by this bubble.

step(sim)[source]

Update the associations between bubbles, actors, and agents

teardown()[source]

Clean up internal state.

vehicle_ids_per_bubble() Dict[Bubble, Set[str]][source]

Bubbles associated with the vehicles they contain.

class smarts.core.bubble_manager.BubbleRelationState(value)[source]

Describes the actor’s spatial occupancy in a bubble.

InAirlock = 1
InBubble = 0
WasInBubble = 2
class smarts.core.bubble_manager.BubbleTransition(value)[source]

Describes a bubble transition state.

AirlockEntered = 0
AirlockExited = 3
Entered = 1
Exited = 2
class smarts.core.bubble_manager.Cursor(vehicle_id: str, state: BubbleRelationState | None = None, capture: BubbleCaptureState | None = None, transition: BubbleTransition | None = None, bubble: Bubble | None = None)[source]

Tracks an actor through an airlock or a bubble.

bubble: Bubble | None = None
capture: BubbleCaptureState | None = None
static for_removed(vehicle_id: str, bubble: Bubble, index: VehicleIndex, vehicle_ids_per_bubble: Dict[Bubble, Set[str]]) Cursor[source]

Generate a cursor for an inactive bubble. :param vehicle: The vehicle that is to be tracked. :type vehicle: Vehicle :param bubble: The bubble that the vehicle is interacting with. :type bubble: Bubble :param index: The vehicle index the vehicle is in. :type index: VehicleIndex :param vehicle_ids_per_bubble: Bubbles associated with vehicle ids. :type vehicle_ids_per_bubble: Dict[Bubble, Set[str]] :param running_cursors: A set of existing cursors. :type running_cursors: Set[“Cursor”]

static from_pos(position: Point, vehicle_id: str, bubble: Bubble, index: VehicleIndex, vehicle_ids_per_bubble: Dict[Bubble, Set[str]], running_cursors: Set[Cursor], previous_cursor: Cursor | None, is_hijack_admissible, is_airlock_admissible) Cursor[source]

Generate a cursor. :param position: The shapely position of the vehicle. :type position: Point :param vehicle: The vehicle that is to be tracked. :type vehicle: Vehicle :param bubble: The bubble that the vehicle is interacting with. :type bubble: Bubble :param index: The vehicle index the vehicle is in. :type index: VehicleIndex :param vehicle_ids_per_bubble: Bubbles associated with vehicle ids. :type vehicle_ids_per_bubble: Dict[Bubble, Set[str]] :param running_cursors: A set of existing cursors. :type running_cursors: Set[“Cursor”]

state: BubbleRelationState | None = None
transition: BubbleTransition | None = None
vehicle_id: str