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.

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=False, object_to_avoid=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 (VectorXYZ) – Initial absolute position of the object

  • rotation (QuaternionWXYZ) – Initial orientation of the object

  • scale (VectorXYZ) – Initial object scale

  • semantic_id (Optional[str]) – Optional override object 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 (List | None) – 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 objet with the new object.

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

Execute the given action in the environment.

Parameters:

action (Action) – the action to execute

Returns:

A dictionary with the observations grouped by agent_id

Return type:

(Dict[str, Dict])

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.

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.