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

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 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 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).

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 WebotsObject(<specifiers>)[source]

Bases: Object

Abstract class for Webots objects.

There are two ways to specify which Webots node this object corresponds to (which must already exist in the world loaded into Webots): most simply, you can set the webotsName property to the DEF name of the Webots node. For convenience when working with many objects of the same type, you can instead set the webotsType property to a prefix like ‘ROCK’: the interface will then search for nodes called ‘ROCK_0’, ‘ROCK_1’, etc.

Also defines the elevation property as a standard way to access the “up” component of an object’s position, since the Scenic built-in property position is only 2D. If elevation is set to None, it will be updated to the object’s “up” coordinate in Webots when the simulation starts.

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

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

  • 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 (float) – Offset to add when computing the object’s rotation in Webots; for objects whose front is not aligned with the Webots North axis.