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.

apply_actions(actions: Sequence[Action]) dict[str, dict][source]#

Execute the given actions in the environment.

Parameters:

actions – The actions to execute.

Returns:

A dictionary with the observations grouped by agent_id.

Note

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

close() None[source]#

Close any resources used by the simulator.

Return type:

None

initialize_agent(agent_id: AgentID, agent_state) None[source]#

Update agent runtime state.

Return type:

None

remove_all_objects() None[source]#

Remove all objects from the simulated environment.

Return type:

None

reset()[source]#

Reset the simulator.

property num_objects: int#

Return the number of instantiated objects in the environment.

property observations#

Get sensor observations.

property states#

Get agent and sensor states.