Skip to content

plugins.robothor_plugin.robothor_environment#

[view_source]

RoboThorEnvironment#

class RoboThorEnvironment()

[view_source]

Wrapper for the robo2thor controller providing additional functionality and bookkeeping.

See here for comprehensive documentation on RoboTHOR.

Attributes

  • controller: The AI2THOR controller.
  • config: The AI2THOR controller configuration

RoboThorEnvironment.initialize_grid_dimensions#

 | initialize_grid_dimensions(reachable_points: Collection[Dict[str, float]]) -> Tuple[int, int, int, int]

[view_source]

Computes bounding box for reachable points quantized with the current gridSize.

RoboThorEnvironment.access_grid#

 | access_grid(target: str) -> float

[view_source]

Returns the geodesic distance from the quantized location of the agent in the current scene's grid to the target object of given type.

RoboThorEnvironment.initialize_grid#

 | initialize_grid() -> None

[view_source]

Initializes grid for current scene if not already initialized.

RoboThorEnvironment.object_reachable#

 | object_reachable(object_type: str) -> bool

[view_source]

Determines whether a path can be computed from the discretized current agent location to the target object of given type.

RoboThorEnvironment.point_reachable#

 | point_reachable(xyz: Dict[str, float]) -> bool

[view_source]

Determines whether a path can be computed from the current agent location to the target point.

RoboThorEnvironment.path_corners#

 | path_corners(target: Union[str, Dict[str, float]]) -> List[Dict[str, float]]

[view_source]

Returns an array with a sequence of xyz dictionaries objects representing the corners of the shortest path to the object of given type or end point location.

RoboThorEnvironment.path_corners_to_dist#

 | path_corners_to_dist(corners: Sequence[Dict[str, float]]) -> float

[view_source]

Computes the distance covered by the given path described by its corners.

RoboThorEnvironment.quantized_agent_state#

 | quantized_agent_state(xz_subsampling: int = 1, rot_subsampling: int = 1) -> Tuple[int, int, int]

[view_source]

Quantizes agent location (x, z) to a (subsampled) position in a fixed size grid derived from the initial set of reachable points; and rotation (around y axis) as a (subsampled) discretized angle given the current rotateStepDegrees.

RoboThorEnvironment.dist_to_object#

 | dist_to_object(object_type: str) -> float

[view_source]

Minimal geodesic distance to object of given type from agent's current location.

It might return -1.0 for unreachable targets.

RoboThorEnvironment.dist_to_point#

 | dist_to_point(xyz: Dict[str, float]) -> float

[view_source]

Minimal geodesic distance to end point from agent's current location.

It might return -1.0 for unreachable targets.

RoboThorEnvironment.agent_state#

 | agent_state() -> Dict

[view_source]

Return agent position, rotation and horizon.

RoboThorEnvironment.reset#

 | reset(scene_name: str = None) -> None

[view_source]

Resets scene to a known initial state.

RoboThorEnvironment.randomize_agent_location#

 | randomize_agent_location(seed: int = None, partial_position: Optional[Dict[str, float]] = None) -> Dict[str, Union[Dict[str, float], float]]

[view_source]

Teleports the agent to a random reachable location in the scene.

RoboThorEnvironment.random_reachable_state#

 | random_reachable_state(seed: Optional[int] = None) -> Dict[str, Union[Dict[str, float], float]]

[view_source]

Returns a random reachable location in the scene.

RoboThorEnvironment.currently_reachable_points#

 | @property
 | currently_reachable_points() -> List[Dict[str, float]]

[view_source]

List of {"x": x, "y": y, "z": z} locations in the scene that are currently reachable.

RoboThorEnvironment.scene_name#

 | @property
 | scene_name() -> str

[view_source]

Current ai2thor scene.

RoboThorEnvironment.current_frame#

 | @property
 | current_frame() -> np.ndarray

[view_source]

Returns rgb image corresponding to the agent's egocentric view.

RoboThorEnvironment.current_depth#

 | @property
 | current_depth() -> np.ndarray

[view_source]

Returns depth image corresponding to the agent's egocentric view.

RoboThorEnvironment.last_event#

 | @property
 | last_event() -> ai2thor.server.Event

[view_source]

Last event returned by the controller.

RoboThorEnvironment.last_action#

 | @property
 | last_action() -> str

[view_source]

Last action, as a string, taken by the agent.

RoboThorEnvironment.last_action_success#

 | @property
 | last_action_success() -> bool

[view_source]

Was the last action taken by the agent a success?

RoboThorEnvironment.last_action_return#

 | @property
 | last_action_return() -> Any

[view_source]

Get the value returned by the last action (if applicable).

For an example of an action that returns a value, see "GetReachablePositions".

RoboThorEnvironment.step#

 | step(action_dict: Dict) -> ai2thor.server.Event

[view_source]

Take a step in the ai2thor environment.

RoboThorEnvironment.stop#

 | stop()

[view_source]

Stops the ai2thor controller.

RoboThorEnvironment.all_objects#

 | all_objects() -> List[Dict[str, Any]]

[view_source]

Return all object metadata.

RoboThorEnvironment.all_objects_with_properties#

 | all_objects_with_properties(properties: Dict[str, Any]) -> List[Dict[str, Any]]

[view_source]

Find all objects with the given properties.

RoboThorEnvironment.visible_objects#

 | visible_objects() -> List[Dict[str, Any]]

[view_source]

Return all visible objects.

RoboThorCachedEnvironment#

class RoboThorCachedEnvironment()

[view_source]

Wrapper for the robo2thor controller providing additional functionality and bookkeeping.

See here for comprehensive documentation on RoboTHOR.

Attributes

  • controller: The AI2THOR controller.
  • config: The AI2THOR controller configuration

RoboThorCachedEnvironment.agent_state#

 | agent_state() -> Dict[str, Union[Dict[str, float], float]]

[view_source]

Return agent position, rotation and horizon.

RoboThorCachedEnvironment.reset#

 | reset(scene_name: str = None) -> None

[view_source]

Resets scene to a known initial state.

RoboThorCachedEnvironment.currently_reachable_points#

 | @property
 | currently_reachable_points() -> List[Dict[str, float]]

[view_source]

List of {"x": x, "y": y, "z": z} locations in the scene that are currently reachable.

RoboThorCachedEnvironment.scene_name#

 | @property
 | scene_name() -> str

[view_source]

Current ai2thor scene.

RoboThorCachedEnvironment.current_frame#

 | @property
 | current_frame() -> np.ndarray

[view_source]

Returns rgb image corresponding to the agent's egocentric view.

RoboThorCachedEnvironment.current_depth#

 | @property
 | current_depth() -> np.ndarray

[view_source]

Returns depth image corresponding to the agent's egocentric view.

RoboThorCachedEnvironment.last_event#

 | @property
 | last_event() -> ai2thor.server.Event

[view_source]

Last event returned by the controller.

RoboThorCachedEnvironment.last_action#

 | @property
 | last_action() -> str

[view_source]

Last action, as a string, taken by the agent.

RoboThorCachedEnvironment.last_action_success#

 | @property
 | last_action_success() -> bool

[view_source]

In the cached environment, all actions succeed.

RoboThorCachedEnvironment.last_action_return#

 | @property
 | last_action_return() -> Any

[view_source]

Get the value returned by the last action (if applicable).

For an example of an action that returns a value, see "GetReachablePositions".

RoboThorCachedEnvironment.step#

 | step(action_dict: Dict[str, Union[str, int, float]]) -> ai2thor.server.Event

[view_source]

Take a step in the ai2thor environment.

RoboThorCachedEnvironment.stop#

 | stop()

[view_source]

Stops the ai2thor controller.

RoboThorCachedEnvironment.all_objects#

 | all_objects() -> List[Dict[str, Any]]

[view_source]

Return all object metadata.

RoboThorCachedEnvironment.all_objects_with_properties#

 | all_objects_with_properties(properties: Dict[str, Any]) -> List[Dict[str, Any]]

[view_source]

Find all objects with the given properties.

RoboThorCachedEnvironment.visible_objects#

 | visible_objects() -> List[Dict[str, Any]]

[view_source]

Return all visible objects.