scenic.domains.driving.model
Scenic world model for scenarios using the driving domain.
Imports actions and behaviors for dynamic agents from scenic.domains.driving.actions and scenic.domains.driving.behaviors.
The map file to use for the scenario must be specified before importing this model by
defining the global parameter map. This path is passed to the Network.fromFile
function to create a Network object representing the road network. Extra options may be
passed to the function by defining the global parameter map_options, which should be
a dictionary of keyword arguments. For example, we could write:
param map = localPath('mymap.xodr')
param map_options = { 'tolerance': 0.1 }
model scenic.domains.driving.model
If you are writing a generic scenario that supports multiple maps, you may leave the
map parameter undefined; then running the scenario will produce an error unless the
user uses the --param command-line option to specify the map.
Note
If you are using a simulator, you may have to also define simulator-specific global
parameters to tell the simulator which world to load. For example, our LGSVL
interface uses a parameter lgsvl_map to specify the name of the Unity scene.
See the documentation of the simulator interfaces for
details.
Summary of Module Members
Module Attributes
|
The road network being used for the scenario, as a |
|
The union of all drivable roads, including intersections but not shoulders or parking lanes. |
|
The union of all curbs. |
|
The union of all sidewalks. |
|
The union of all shoulders, including parking lanes. |
|
All drivable areas, including both ordinary roads and shoulders. |
|
The union of all intersections. |
|
A |
Functions
returns boolean |
|
checks whether there exists any obj (1) in front of the vehicle, (2) within thresholdDistance |
|
checks whether there exists any obj (1) in front of the vehicle, (2) on the same lane, (3) within thresholdDistance |
Classes
A car. |
|
Abstract class for objects in a road network. |
|
Car for which accurate physics is not required. |
|
A pedestrian. |
|
Vehicles which drive, such as cars. |
Member Details
- class DrivingObject(<specifiers>)[source]
Bases:
ObjectAbstract class for objects in a road network.
Provides convenience properties for the lane, road, intersection, etc. at the object’s current position (if any).
Also defines the
elevationproperty as a standard way to access the Z component of an object’s position, since the Scenic built-in propertypositionis only 2D. Ifelevationis set toNone, the simulator is responsible for choosing an appropriate Z coordinate so that the object is on the ground, then updating the property. 2D simulators should set the property to zero.- Properties
elevation (float or None; dynamic) – default
None(see above).requireVisible (bool) – Default value
False(overriding the default fromObject).
- property lane: Lane
The
Laneat the object’s current position.The simulation is rejected if the object is not in a lane. (Use
DrivingObject._laneto getNoneinstead.)
- property laneSection: LaneSection
The
LaneSectionat the object’s current position.The simulation is rejected if the object is not in a lane.
- property _laneSection: Optional[LaneSection]
The
LaneSectionat the object’s current position, if any.
- property laneGroup: LaneGroup
The
LaneGroupat the object’s current position.The simulation is rejected if the object is not in a lane.
- property oppositeLaneGroup: LaneGroup
The
LaneGroupon the other side of the road from the object.The simulation is rejected if the object is not on a two-way road.
- property road: Road
The
Roadat the object’s current position.The simulation is rejected if the object is not on a road.
- property intersection: Intersection
The
Intersectionat the object’s current position.The simulation is rejected if the object is not in an intersection.
- property _intersection: Optional[Intersection]
The
Intersectionat the object’s current position, if any.
- property crossing: PedestrianCrossing
The
PedestrianCrossingat the object’s current position.The simulation is rejected if the object is not in a crosswalk.
- property _crossing: Optional[PedestrianCrossing]
The
PedestrianCrossingat the object’s current position, if any.
- property element: NetworkElement
The highest-level
NetworkElementat the object’s current position.See
Network.elementAtfor the details of how this is determined. The simulation is rejected if the object is not in any network element.
- property _element: Optional[NetworkElement]
The highest-level
NetworkElementat the object’s current position, if any.
- class Pedestrian(<specifiers>)[source]
Bases:
DrivingObjectA pedestrian.
- Properties
position – The default position is uniformly random over sidewalks and crosswalks.
heading – The default heading is uniformly random.
viewAngle – The default view angle is 90 degrees.
width – The default width is 0.75 m.
length – The default length is 0.75 m.
color – The default color is turquoise. Pedestrian colors are not necessarily used by simulators, but do appear in the debugging diagram.
- class Vehicle(<specifiers>)[source]
Bases:
DrivingObjectVehicles which drive, such as cars.
- Properties
position – The default position is uniformly random over the
road.heading – The default heading is aligned with
roadDirection, plus an offset given by roadDeviation.roadDeviation (float) – Relative heading with respect to the road direction at the
Vehicle’s position. Used by the default value for heading.regionContainedIn – The default container is
roadOrShoulder.viewAngle – The default view angle is 90 degrees.
width – The default width is 2 meters.
length – The default length is 4.5 meters.
color (
Coloror RGB tuple) – Color of the vehicle. The default value is a distribution derived from car color popularity statistics; seeColor.defaultCarColor.