sierra.plugins.platform.argos.generators.platform_generators

Classes for generating common XML modifications for ARGoS.

I.e., changes which are platform-specific, but applicable to all projects using the platform.

class sierra.plugins.platform.argos.generators.platform_generators.PlatformExpDefGenerator(exp_spec: ExperimentSpec, controller: str, cmdopts: Dict[str, Any], **kwargs)[source]

Init the object.

controller

The controller used for the experiment.

cmdopts

Dictionary of parsed cmdline parameters.

Inheritance

Inheritance diagram of PlatformExpDefGenerator
__dict__ = mappingproxy({'__module__': 'sierra.plugins.platform.argos.generators.platform_generators', '__doc__': '\n    Init the object.\n\n    Attributes:\n\n        controller: The controller used for the experiment.\n\n        cmdopts: Dictionary of parsed cmdline parameters.\n    ', '__init__': <function PlatformExpDefGenerator.__init__>, 'generate': <function PlatformExpDefGenerator.generate>, 'generate_physics': <function PlatformExpDefGenerator.generate_physics>, 'generate_arena_shape': <function PlatformExpDefGenerator.generate_arena_shape>, '_generate_n_robots': <function PlatformExpDefGenerator._generate_n_robots>, '_generate_saa': <function PlatformExpDefGenerator._generate_saa>, '_generate_time': <function PlatformExpDefGenerator._generate_time>, '_generate_threading': <function PlatformExpDefGenerator._generate_threading>, '_generate_library': <function PlatformExpDefGenerator._generate_library>, '_generate_visualization': <function PlatformExpDefGenerator._generate_visualization>, '__dict__': <attribute '__dict__' of 'PlatformExpDefGenerator' objects>, '__weakref__': <attribute '__weakref__' of 'PlatformExpDefGenerator' objects>, '__annotations__': {}})
__doc__ = '\n    Init the object.\n\n    Attributes:\n\n        controller: The controller used for the experiment.\n\n        cmdopts: Dictionary of parsed cmdline parameters.\n    '
__init__(exp_spec: ExperimentSpec, controller: str, cmdopts: Dict[str, Any], **kwargs) None[source]
__module__ = 'sierra.plugins.platform.argos.generators.platform_generators'
__weakref__

list of weak references to the object (if defined)

_generate_library(exp_def: XMLExpDef) None[source]

Generate XML changes for ARGoS search paths for controller,loop functions.

Set to the name of the plugin passed on the cmdline, unless overriden in configuration. The __CONTROLLER__ tag is changed during stage 1, but since this function is called as part of common def generation, it happens BEFORE that, and so this is OK. If, for some reason that assumption becomes invalid, a warning will be issued about a non-existent XML path, so it won’t be a silent error.

Does not write generated changes to the simulation definition pickle file.

_generate_n_robots(exp_def: XMLExpDef) None[source]

Generate XML changes to setup # robots (if specified on cmdline).

Writes generated changes to the simulation definition pickle file.

_generate_saa(exp_def: XMLExpDef) None[source]

Generate XML changes to disable selected sensors/actuators.

Some sensors and actuators are computationally expensive in large populations, but not that costly if the # robots is small.

Does not write generated changes to the simulation definition pickle file.

_generate_threading(exp_def: XMLExpDef) None[source]

Generate XML changes to set the # of cores for a simulation to use.

This may be less than the total # available on the system, depending on the experiment definition and user preferences.

Does not write generated changes to the simulation definition pickle file.

_generate_time(exp_def: XMLExpDef) None[source]

Generate XML changes to setup simulation time parameters.

Writes generated changes to the simulation definition pickle file.

_generate_visualization(exp_def: XMLExpDef) None[source]

Generate XML changes to remove visualization elements from input file.

This depends on cmdline parameters, as visualization definitions should be left in if ARGoS should output simulation frames for video creation.

Does not write generated changes to the simulation definition pickle file.

generate() XMLExpDef[source]

Generate XML modifications common to all ARGoS experiments.

generate_arena_shape(exp_def: XMLExpDef, shape: ArenaShape) None[source]

Generate XML changes for the specified arena shape.

Writes generated changes to the simulation definition pickle file.

generate_physics(exp_def: XMLExpDef, cmdopts: Dict[str, Any], engine_type: str, n_engines: int, extents: List[ArenaExtent], remove_defs: bool = True) None[source]

Generate XML changes for the specified physics engines configuration.

Physics engine definition removal is optional, because when mixing 2D/3D engine definitions, you only want to remove the existing definitions BEFORE you have adding first of the mixed definitions. Doing so every time results in only the LAST of the mixed definitions being present in the input file.

Does not write generated changes to the simulation definition pickle file.

class sierra.plugins.platform.argos.generators.platform_generators.PlatformExpRunDefUniqueGenerator(run_num: int, run_output_path: Path, launch_stem_path: Path, random_seed: int, cmdopts: Dict[str, Any])[source]

Generate XML changes unique to each experimental run.

These include:

  • Random seeds for each simulation.

run_num

The runulation # in the experiment.

run_output_path

Path to simulation output directory within experiment root.

cmdopts

Dictionary containing parsed cmdline options.

Inheritance

Inheritance diagram of PlatformExpRunDefUniqueGenerator
__dict__ = mappingproxy({'__module__': 'sierra.plugins.platform.argos.generators.platform_generators', '__doc__': 'Generate XML changes unique to each experimental run.\n\n    These include:\n\n    - Random seeds for each simulation.\n\n    Attributes:\n\n        run_num: The runulation # in the experiment.\n\n        run_output_path: Path to simulation output directory within experiment\n                         root.\n\n        cmdopts: Dictionary containing parsed cmdline options.\n\n    ', '__init__': <function PlatformExpRunDefUniqueGenerator.__init__>, '_PlatformExpRunDefUniqueGenerator__generate_random': <function PlatformExpRunDefUniqueGenerator.__generate_random>, 'generate': <function PlatformExpRunDefUniqueGenerator.generate>, '_PlatformExpRunDefUniqueGenerator__generate_visualization': <function PlatformExpRunDefUniqueGenerator.__generate_visualization>, '__dict__': <attribute '__dict__' of 'PlatformExpRunDefUniqueGenerator' objects>, '__weakref__': <attribute '__weakref__' of 'PlatformExpRunDefUniqueGenerator' objects>, '__annotations__': {}})
__doc__ = 'Generate XML changes unique to each experimental run.\n\n    These include:\n\n    - Random seeds for each simulation.\n\n    Attributes:\n\n        run_num: The runulation # in the experiment.\n\n        run_output_path: Path to simulation output directory within experiment\n                         root.\n\n        cmdopts: Dictionary containing parsed cmdline options.\n\n    '
__generate_random(exp_def) None

Generate XML changes for random seeding for a specific simulation.

__generate_visualization(exp_def: XMLExpDef)

Generate XML changes for setting up rendering for a specific simulation.

__init__(run_num: int, run_output_path: Path, launch_stem_path: Path, random_seed: int, cmdopts: Dict[str, Any]) None[source]
__module__ = 'sierra.plugins.platform.argos.generators.platform_generators'
__weakref__

list of weak references to the object (if defined)

generate(exp_def: XMLExpDef)[source]