smarts.core.plan module

class smarts.core.plan.EndlessGoal[source]

A goal that can never be completed.

class smarts.core.plan.Goal[source]

Describes an expected end state for a route or mission.

is_reached(vehicle_state) bool[source]

If the goal has been completed.

is_specific() bool[source]

If the goal is reachable at a specific position.

class smarts.core.plan.LapMission(start: ~smarts.core.plan.Start, goal: ~smarts.core.plan.Goal, route_vias: ~typing.Tuple[str, ...] = <factory>, start_time: float = 9223372036854775807, entry_tactic: ~smarts.sstudio.sstypes.entry_tactic.EntryTactic | None = None, via: ~typing.Tuple[~smarts.core.plan.Via, ...] = (), vehicle_spec: ~smarts.core.plan.VehicleSpec | None = None, num_laps: int | None = None, route_length: float | None = None)[source]

A mission requiring a number of laps through the goal.

is_complete(vehicle_state, distance_travelled: float) bool[source]

If the mission has been completed.

num_laps: int | None = None
route_length: float | None = None
class smarts.core.plan.NavigationMission(start: ~smarts.core.plan.Start, goal: ~smarts.core.plan.Goal, route_vias: ~typing.Tuple[str, ...] = <factory>, start_time: float = 9223372036854775807, entry_tactic: ~smarts.sstudio.sstypes.entry_tactic.EntryTactic | None = None, via: ~typing.Tuple[~smarts.core.plan.Via, ...] = (), vehicle_spec: ~smarts.core.plan.VehicleSpec | None = None)[source]

A navigation mission describing a desired trip.

static endless_mission(start_pose: Pose) NavigationMission[source]

Generate an endless mission.

entry_tactic: EntryTactic | None = None
goal: Goal
is_complete(vehicle_state, distance_travelled: float) bool[source]

If the mission has been completed successfully.

static random_endless_mission(road_map: RoadMap, min_range_along_lane: float = 0.3, max_range_along_lane: float = 0.9) NavigationMission[source]

A mission that starts from a random location and continues indefinitely.

property requires_route: bool

If the mission requires a route to be generated.

route_vias: Tuple[str, ...]
start: Start
start_time: float = 9223372036854775807
vehicle_spec: VehicleSpec | None = None
via: Tuple[Via, ...] = ()
class smarts.core.plan.Plan(road_map: RoadMap, mission: NavigationMission | None = None, find_route: bool = True)[source]

Describes a navigation plan (route) to fulfill a mission.

create_route(mission: NavigationMission, start_lane_radius: float | None = None, end_lane_radius: float | None = None)[source]

Generates a route that conforms to a mission.

Parameters:
  • mission (Mission) – A mission the agent should follow. Defaults to endless if None.

  • start_lane_radius (Optional[float]) – Radius (meter) to find the nearest starting lane for the given mission. Defaults to a function of _default_lane_width of the underlying road_map.

  • end_lane_radius (Optional[float]) – Radius (meter) to find the nearest ending lane for the given mission. Defaults to a function of _default_lane_width of the underlying road_map.

frame() PlanFrame[source]

Get the state of this plan.

classmethod from_frame(plan_frame: PlanFrame, road_map: RoadMap) Plan[source]

Generate the plan from a frame.

property mission: NavigationMission | None

The mission this plan is meant to fulfill.

property road_map: RoadMap

The road map this plan is relative to.

property route: Route | None

The route that this plan calls for.

class smarts.core.plan.PlanFrame(road_ids: List[str], mission: NavigationMission | None)[source]

Describes a plan that is serializable.

classmethod empty()[source]

Creates an empty plan frame.

mission: NavigationMission | None
road_ids: List[str]
exception smarts.core.plan.PlanningError[source]

Raised in cases when map related planning fails.

class smarts.core.plan.PositionalGoal(position: Point, radius: float)[source]

A goal that can be completed by reaching an end area.

classmethod from_road(road_id: str, road_map: RoadMap, lane_index: int = 0, lane_offset: float | None = None, radius: float = 1)[source]

Generate the goal ending at the specified road lane.

is_reached(vehicle_state) bool[source]

If the goal has been completed.

is_specific() bool[source]

If the goal is reachable at a specific position.

position: Point
radius: float
class smarts.core.plan.Start(position: ndarray, heading: Heading, from_front_bumper: bool | None = True)[source]

A starting state for a route or mission.

from_front_bumper: bool | None = True
classmethod from_pose(pose: Pose)[source]

Convert to a starting location from a pose.

heading: Heading
property point: Point

The coordinate of this starting location.

position: ndarray
class smarts.core.plan.TraverseGoal(road_map: RoadMap)[source]

A TraverseGoal is satisfied whenever an Agent-driven vehicle successfully finishes traversing a non-closed (acyclic) map It’s a way for the vehicle to exit the simulation successfully, for example, driving across from one side to the other on a straight road and then continuing off the map. This goal is non-specific about where the map is exited, save for that the vehicle must be going the correct direction in its lane just prior to doing so.

is_reached(vehicle_state) bool[source]

If the goal has been completed.

is_specific() bool[source]

If the goal is reachable at a specific position.

road_map: RoadMap
class smarts.core.plan.VehicleSpec(veh_id: str, veh_config_type: str, dimensions: Dimensions)[source]

Vehicle specifications

dimensions: Dimensions
veh_config_type: str
veh_id: str
class smarts.core.plan.Via(lane_id: str, road_id: str, lane_index: int, position: Tuple[float, float], hit_distance: float, required_speed: float)[source]

Describes a collectible item that can be used to shape rewards.

hit_distance: float
lane_id: str
lane_index: int
position: Tuple[float, float]
required_speed: float
road_id: str
smarts.core.plan.default_entry_tactic(default_entry_speed: float | None = None) EntryTactic[source]

The default tactic the simulation will use to acquire an actor for an agent.