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: Tuple[float, float, float] = (0.0, 0.0, 0.0), rotation: Tuple[float, float, float, float] = (1.0, 0.0, 0.0, 0.0), scale: Tuple[float, float, float] = (1.0, 1.0, 1.0), semantic_id: str | None = None, enable_physics: bool = False, object_to_avoid: bool = False, primary_target_bb: List | None = None) None[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 (Tuple[float, float, float]) – Initial absolute position of the object.

  • rotation (Tuple[float, float, float, float]) – Initial orientation of the object.

  • scale (Tuple[float, float, float]) – Initial object scale.

  • semantic_id (Optional[str]) – Optional override for the object’s semantic ID.

  • enable_physics (bool) – Whether to enable physics on the object.

  • object_to_avoid (bool) – If True, ensure the object is not colliding with other objects.

  • primary_target_bb (Optional[List]) – If not None, this is a list of the min and max corners of a bounding box for the primary object, used to prevent obscuring the primary object with the new object.

Return type:

None

apply_action(action: Action) Dict[str, Dict][source]#

Execute the given action in the environment.

Parameters:

action (Action) – The action to execute.

Return type:

Dict[str, Dict]

Returns:

A dictionary with the observations grouped by agent_id.

close()[source]#

Close any resources used by the simulator.

get_action_space()[source]#

Returns the set of all available actions.

get_agent(agent_id)[source]#

Return agent instance.

get_num_objects() int[source]#

Return the number of instantiated objects in the environment.

Return type:

int

get_observations()[source]#

Get sensor observations.

get_states()[source]#

Get agent and sensor states.

initialize_agent(agent_id, agent_state)[source]#

Update agent runtime state.

remove_all_objects()[source]#

Remove all objects from the simulated environment.

reset()[source]#

Reset the simulator.