scenic.simulators.carla.model

Scenic world model for traffic scenarios in CARLA.

The model currently supports vehicles, pedestrians, and props. It implements the basic Car and Pedestrian classes from the scenic.domains.driving domain, while also providing convenience classes for specific types of objects like bicycles, traffic cones, etc. Vehicles and pedestrians support the basic actions and behaviors from the driving domain; several more are automatically imported from scenic.simulators.carla.actions and scenic.simulators.carla.behaviors.

The model defines several global parameters, whose default values can be overridden in scenarios using the param statement or on the command line using the --param option:

Global Parameters:
  • carla_map (str) – Name of the CARLA map to use, e.g. ‘Town01’. Can also be set to None, in which case CARLA will attempt to create a world from the map file used in the scenario (which must be an .xodr file).

  • timestep (float) – Timestep to use for simulations (i.e., how frequently Scenic interrupts CARLA to run behaviors, check requirements, etc.), in seconds. Default is 0.1 seconds.

  • snapToGroundDefault (bool) – Default value for snapToGround on CarlaActor objects. Default is True if 2D Compatibility Mode is enabled and False otherwise.

  • weather (str or dict) – Weather to use for the simulation. Can be either a string identifying one of the CARLA weather presets (e.g. ‘ClearSunset’) or a dictionary specifying all the weather parameters (see carla.WeatherParameters). Default is a uniform distribution over all the weather presets.

  • address (str) – IP address at which to connect to CARLA. Default is localhost (127.0.0.1).

  • port (int) – Port on which to connect to CARLA. Default is 2000.

  • timeout (float) – Maximum time to wait when attempting to connect to CARLA, in seconds. Default is 10.

  • render (int) – Whether or not to have CARLA create a window showing the simulations from the point of view of the ego object: 1 for yes, 0 for no. Default 1.

  • record (str) – If nonempty, folder in which to save CARLA record files for replaying the simulations.

Summary of Module Members

Functions

freezeTrafficLights

Freezes all traffic lights in the scene.

getClosestTrafficLightStatus

getTrafficLightStatus

setAllIntersectionTrafficLightsStatus

setClosestTrafficLightStatus

setTrafficLightStatus

unfreezeTrafficLights

Unfreezes all traffic lights in the scene.

withinDistanceToRedYellowTrafficLight

withinDistanceToTrafficLight

Classes

ATM

Advertisement

Barrel

Barrier

Bench

Bicycle

Box

BusStop

Car

A car.

CarlaActor

Abstract class for CARLA objects.

Case

Chair

Cone

Container

CreasedBox

Debris

Garbage

Gnome

IronPlate

Kiosk

Mailbox

Motorcycle

NPCCar

Pedestrian

A pedestrian.

PlantPot

Prop

Abstract class for props, i.e. non-moving objects.

Table

TrafficWarning

Trash

Truck

Vehicle

Abstract class for steerable vehicles.

VendingMachine

Member Details

class CarlaActor <specifiers>[source]

Bases: DrivingObject

Abstract class for CARLA objects.

Properties:
  • carlaActor (dynamic) – Set during simulations to the carla.Actor representing this object.

  • blueprint (str) – Identifier of the CARLA blueprint specifying the type of object.

  • rolename (str) – Can be used to differentiate specific actors during runtime. Default value None.

  • physics (bool) – Whether physics is enabled for this object in CARLA. Default true.

  • snapToGround (bool) – Whether or not to snap this object to the ground when placed in CARLA. The default is set by the snapToGroundDefault global parameter above.

class Vehicle <specifiers>[source]

Bases: Vehicle, CarlaActor, Steers

Abstract class for steerable vehicles.

class Car <specifiers>[source]

Bases: Vehicle

A car.

The default blueprint (see CarlaActor) is a uniform distribution over the blueprints listed in scenic.simulators.carla.blueprints.carModels.

class Pedestrian <specifiers>[source]

Bases: Pedestrian, CarlaActor, Walks

A pedestrian.

The default blueprint (see CarlaActor) is a uniform distribution over the blueprints listed in scenic.simulators.carla.blueprints.walkerModels.

class Prop <specifiers>[source]

Bases: CarlaActor

Abstract class for props, i.e. non-moving objects.

Properties:
  • parentOrientation (Orientation) – Default value overridden to have uniformly random yaw.

  • physics (bool) – Default value overridden to be false.

freezeTrafficLights()[source]

Freezes all traffic lights in the scene.

Frozen traffic lights can be modified by the user but the time will not update them until unfrozen.

unfreezeTrafficLights()[source]

Unfreezes all traffic lights in the scene.

_getClosestTrafficLight(vehicle, distance=100)[source]

Returns the closest traffic light affecting ‘vehicle’, up to a maximum of ‘distance’