simulator

Interface for simulators and everything to tell them what to do.

Package Contents

Classes

Batch

A set of scenes and shared parameters for simulation.

BatchParameters

Parameters for a simulation batch.

RecordSettings

Settings for recording a simulation.

Simulator

Interface for a simulator.

Viewer

An abstract viewer class, enabling the rendering of simulations.

class Batch

A set of scenes and shared parameters for simulation.

parameters: simulation.simulator._batch_parameters.BatchParameters
scenes: list[simulation.scene.Scene]

The scenes to simulate.

record_settings: simulation.simulator._record_settings.RecordSettings | None
class BatchParameters

Parameters for a simulation batch.

simulation_time: int | None

Seconds. The duration for which each robot should be simulated. If set to ‘None’, the simulation will run indefinitely.

sampling_frequency: float | None

Hz. Frequency for state sampling during the simulation. The simulator will attempt to follow this as closely as possible, but is dependent on the actual step frequency of the simulator. If set to ‘None’, no sampling will be performed.

simulation_timestep: float

Simulation time step in seconds. This is an important parameter that affects the trade-off between speed and accuracy, as well as the stability of the robot model. Smaller values of this parameter generally result in better accuracy and stability. However, the specific value of this parameter may vary depending on the scenes being simulated and other batch parameters.

control_frequency: float

Similar to sampling_frequency but for how often the control function is called.

class RecordSettings

Settings for recording a simulation.

video_directory: str
overwrite: bool = False
fps: int = 24
width: int | None
height: int | None
class Simulator

Bases: abc.ABC

Inheritance diagram of simulation.simulator.Simulator

Interface for a simulator.

abstract simulate_batch(batch: simulation.simulator._batch.Batch) list[list[simulation.scene.SimulationState]]

Simulate the provided batch by simulating each contained scene.

Parameters:

batch – The batch to run.

Returns:

List of simulation states in ascending order of time.

class Viewer

Bases: abc.ABC

Inheritance diagram of simulation.simulator.Viewer

An abstract viewer class, enabling the rendering of simulations.

abstract property view_port: Any

Get the viewport.

Returns:

The viewport object.

abstract property context: Any

Return the viewer context.

Returns:

The context object.

abstract property can_record: bool

Check if this viewer can record.

Returns:

The truth.

abstract close_viewer() None

Close the viewer.

abstract render() Any | None

Render the scene on the viewer.

Returns:

Nothing or feedback.

abstract current_viewport_size() tuple[int, int]

Get the current viewport size.

Returns:

The size as a tuple.