scenic.simulators.webots.model

Generic Scenic world model for the Webots simulator.

This model provides a general type of object WebotsObject corresponding to a node in the Webots scene tree, as well as a few more specialized objects.

Scenarios using this model cannot be launched directly from the command line using the --simulate option. Instead, Webots should be started first, with a .wbt file that includes nodes for all the objects in the scenario (see the WebotsObject documentation for how to specify which objects correspond to which nodes). A supervisor node can then invoke Scenic to compile the scenario and run dynamic simulations: see scenic.simulators.webots.simulator for details.

Summary of Module Members

Functions

is2DMode

Classes

Ground

Special kind of object representing a (possibly irregular) ground surface.

Hill

Terrain shaped like a Gaussian.

Terrain

Abstract class for objects added together to make a Ground.

WebotsObject

Abstract class for Webots objects.

Member Details

class WebotsObject <specifiers>[source]

Bases: Object

Abstract class for Webots objects.

There several ways to specify which Webots node this object corresponds to:

  • Set the webotsName property to the DEF name of the Webots node, which must already exist in the world loaded into Webots.

  • Set the webotsType property to a prefix like ‘ROCK’: the interface will then search for nodes called ‘ROCK_0’, ‘ROCK_1’, etc. Again the nodes must already exist in the world loaded into Webots.

  • Set the webotsAdhoc property to a dictionary of parameters. This will cause Scenic to dynamically create an Object in Webots, according to the parameters in the dictionary. This is currently the only way to create objects in Webots that do not correspond to an existing node. The parameters that can be contained in the dictionary are:

    • physics: Whether or not physics should be enabled for this object. Default value is True.

Properties:
  • elevation (float or None; dynamic) – default None (see above).

  • requireVisible (bool) – Default value False (overriding the default from Object).

  • webotsAdhoc (None | dict) – None implies this object is not Adhoc. A dictionary implies this is an object that Scenic should create in Webots.. If a dictionary, provides parameters for how to instantiate the adhoc object. See scenic.simulators.webots.model for more details.

  • webotsName (str) – ‘DEF’ name of the Webots node to use for this object.

  • webotsType (str) – If webotsName is not set, the first available node with ‘DEF’ name consisting of this string followed by ‘_0’, ‘_1’, etc. will be used for this object.

  • webotsObject – Is set at runtime to a handle to the Webots node for the object, for use with the Supervisor API. Primarily for internal use.

  • controller (str or None) – name of the Webots controller to use for this object, if any (instead of a Scenic behavior).

  • resetController (bool) – Whether to restart the controller for each simulation (default True).

  • positionOffset (Vector) – Offset to add when computing the object’s position in Webots; for objects whose Webots translation field is not aligned with the center of the object.

  • rotationOffset (tuple[float, float, float]) – Offset to add when computing the object’s orientation in Webots; for objects whose front is not aligned with the Webots North axis.

  • density (float) – Density of this object in kg/m^3. The corresponding Webots object must have the density field.

class Ground <specifiers>[source]

Bases: WebotsObject

Special kind of object representing a (possibly irregular) ground surface.

Implemented using an ElevationGrid node in Webots.

Attributes:
  • allowCollisions (bool) – default value True (overriding default from Object).

  • webotsName (str) – default value ‘Ground’

class Terrain <specifiers>[source]

Bases: Object

Abstract class for objects added together to make a Ground.

This is not a WebotsObject since it doesn’t actually correspond to a Webots node. Only the overall Ground has a node.

class Hill <specifiers>[source]

Bases: Terrain

Terrain shaped like a Gaussian.

Attributes:
  • height (float) – height of the hill (default 1).

  • spread (float) – standard deviation as a fraction of the hill’s size (default 3).