tbp.monty.simulators#

tbp.monty.simulators.simulator#

class Simulator(*args, **kwargs)[source]#

Bases: Protocol

A Protocol defining a simulator for use in simulated environments.

A Simulator is responsible for a simulated environment that contains objects to interact with, agents to do the interacting, and for collecting observations and proprioceptive state to send to Monty.

__init__(*args, **kwargs)#
add_object(name: str, position: VectorXYZ = (0.0, 0.0, 0.0), rotation: QuaternionWXYZ = (1.0, 0.0, 0.0, 0.0), scale: VectorXYZ = (1.0, 1.0, 1.0), semantic_id: SemanticID | None = None, primary_target_object: ObjectID | None = None) ObjectInfo[source]#

Add new object to simulated environment.

Adds a new object based on the named object. This assumes that the set of available objects are preloaded and keyed by name.

Parameters:
  • name (str) – Registered object name.

  • position (VectorXYZ) – Initial absolute position of the object.

  • rotation (QuaternionWXYZ) – Initial orientation of the object.

  • scale (VectorXYZ) – Initial object scale.

  • semantic_id (SemanticID | None) – Optional override for the object’s semantic ID.

  • primary_target_object (ObjectID | None) – ID of the primary target object. If not None, the added object will be positioned so that it does not obscure the initial view of the primary target object (which avoiding collision alone cannot guarantee). Used when adding multiple objects. Defaults to None.

Return type:

ObjectInfo

Returns:

The added object’s information.

close() None[source]#

Close any resources used by the simulator.

Return type:

None

remove_all_objects() None[source]#

Remove all objects from the simulated environment.

Return type:

None

reset() tuple[Observations, ProprioceptiveState][source]#

Reset the simulator.

Returns:

The initial observations from the simulator and proprioceptive state.

step(actions: Sequence[Action]) tuple[Observations, ProprioceptiveState][source]#

Execute the given actions in the environment.

Parameters:

actions – The actions to execute.

Returns:

The observations from the simulator and proprioceptive state.

Note

If the actions are an empty sequence, the current observations are returned.