igibson.envs package

Submodules

igibson.envs.behavior_env module

class igibson.envs.behavior_env.BehaviorEnv(config_file, scene_id=None, mode='headless', action_timestep=0.03333333333333333, physics_timestep=0.0033333333333333335, device_idx=0, render_to_tensor=False, automatic_reset=False, seed=0, action_filter='all', instance_id=0, episode_save_dir=None)

Bases: igibson.envs.igibson_env.iGibsonEnv

iGibson Environment (OpenAI Gym interface)

get_potential(satisfied_predicates)
get_reward(satisfied_predicates)
get_state(collision_links=[])

Get the current observation

Parameters

collision_links – collisions from last physics timestep

Returns

observation as a dictionary

load()

Load environment

load_action_space()

Load action space

load_behavior_task_setup()

Load task setup

load_observation_space()

Load observation space

load_task_setup()

Load task setup

reset(resample_objects=False)

Reset episode

reset_scene_and_agent()
step(action)

Apply robot’s action. Returns the next state, reward, done and info, following OpenAI Gym’s convention

Parameters

action – robot actions

Returns

state: next observation

Returns

reward: reward of this time step

Returns

done: whether the episode is terminated

Returns

info: info dictionary with any useful information

igibson.envs.behavior_mp_env module

class igibson.envs.behavior_mp_env.ActionPrimitives(value)

Bases: enum.IntEnum

An enumeration.

CLOSE = 5
GRASP = 1
NAVIGATE_TO = 0
OPEN = 4
PLACE_INSIDE = 3
PLACE_ONTOP = 2
class igibson.envs.behavior_mp_env.BehaviorMPEnv(config_file, scene_id=None, mode='headless', action_timestep=0.1, physics_timestep=0.004166666666666667, device_idx=0, render_to_tensor=False, automatic_reset=False, seed=0, action_filter='mobile_manipulation', use_motion_planning=False)

Bases: igibson.envs.behavior_env.BehaviorEnv

iGibson Environment (OpenAI Gym interface)

execute_grasp_plan(plan, obj)
get_body_ids(include_self=False)
grasp_obj(obj, use_motion_planning=False)
load_action_space()

Load action space

navigate_to_obj(obj, use_motion_planning=False)
place_obj(original_state, target_pos, target_orn, use_motion_planning=False)
reset(resample_objects=False)

Reset episode

reset_and_release_hand()
sample_fn()
step(action)

Apply robot’s action. Returns the next state, reward, done and info, following OpenAI Gym’s convention

Parameters

action – robot actions

Returns

state: next observation

Returns

reward: reward of this time step

Returns

done: whether the episode is terminated

Returns

info: info dictionary with any useful information

igibson.envs.behavior_mp_env.detect_collision(bodyA, object_in_hand=None)
igibson.envs.behavior_mp_env.detect_robot_collision(robot)
igibson.envs.behavior_mp_env.get_aabb_volume(lo, hi)

igibson.envs.env_base module

class igibson.envs.env_base.BaseEnv(config_file, scene_id=None, mode='headless', action_timestep=0.1, physics_timestep=0.004166666666666667, render_to_tensor=False, device_idx=0)

Bases: gym.core.Env

Base Env class, follows OpenAI Gym interface Handles loading scene and robot Functions like reset and step are not implemented

clean()

Clean up

close()

Synonymous function with clean

get_next_scene_random_seed()

Get the next scene random seed

load()

Load the scene and robot

reload(config_file)

Reload another config file Thhis allows one to change the configuration on the fly

Parameters

config_file – new config file path

reload_model(scene_id)

Reload another scene model This allows one to change the scene on the fly

Parameters

scene_id – new scene_id

reload_model_object_randomization()

Reload the same model, with the next object randomization random seed

reset()

Overwritten by subclasses

set_mode(mode)

Set simulator mode

simulator_step()

Step the simulation. This is different from environment step that returns the next observation, reward, done, info.

step(action)

Overwritten by subclasses

igibson.envs.igibson_env module

class igibson.envs.igibson_env.iGibsonEnv(config_file, scene_id=None, mode='headless', action_timestep=0.1, physics_timestep=0.004166666666666667, device_idx=0, render_to_tensor=False, automatic_reset=False)

Bases: igibson.envs.env_base.BaseEnv

iGibson Environment (OpenAI Gym interface)

build_obs_space(shape, low, high)

Helper function that builds individual observation spaces

check_collision(body_id)

Check with the given body_id has any collision after one simulator step

Parameters

body_id – pybullet body id

Returns

whether the given body_id has no collision

Filter out collisions that should be ignored

Parameters

collision_links – original collisions, a list of collisions

Returns

filtered collisions

get_state(collision_links=[])

Get the current observation

Parameters

collision_links – collisions from last physics timestep

Returns

observation as a dictionary

land(obj, pos, orn)

Land the robot or the object onto the floor, given a valid position and orientation

Parameters
  • obj – an instance of robot or object

  • pos – position

  • orn – orientation

load()

Load environment

load_action_space()

Load action space

load_miscellaneous_variables()

Load miscellaneous variables for book keeping

load_observation_space()

Load observation space

load_task_setup()

Load task setup

populate_info(info)

Populate info dictionary with any useful information

randomize_domain()

Domain randomization Object randomization loads new object models with the same poses Texture randomization loads new materials and textures for the same object models

reset()

Reset episode

reset_variables()

Reset bookkeeping variables for the next new episode

run_simulation()

Run simulation for one action timestep (same as one render timestep in Simulator class)

Returns

collision_links: collisions from last physics timestep

set_pos_orn_with_z_offset(obj, pos, orn=None, offset=None)

Reset position and orientation for the robot or the object

Parameters
  • obj – an instance of robot or object

  • pos – position

  • orn – orientation

  • offset – z offset

step(action)

Apply robot’s action. Returns the next state, reward, done and info, following OpenAI Gym’s convention

Parameters

action – robot actions

Returns

state: next observation

Returns

reward: reward of this time step

Returns

done: whether the episode is terminated

Returns

info: info dictionary with any useful information

test_valid_position(obj, pos, orn=None)

Test if the robot or the object can be placed with no collision

Parameters
  • obj – an instance of robot or object

  • pos – position

  • orn – orientation

Returns

validity

igibson.envs.igibson_ray_env module

igibson.envs.igibson_rllib_env module

igibson.envs.parallel_env module

class igibson.envs.parallel_env.ParallelNavEnv(env_constructors, blocking=False, flatten=False)

Bases: igibson.envs.igibson_env.iGibsonEnv

Batch together environments and simulate them in external processes. The environments are created in external processes by calling the provided callables. This can be an environment class, or a function creating the environment and potentially wrapping it. The returned environment should not access global variables.

property batch_size
property batched
close()

Close all external process.

reset()

Reset all environments and combine the resulting observation.

Returns

a list of [next_obs, reward, done, info]

start()

Start all children processes

step(actions)

Forward a batch of actions to the wrapped environments.

Parameters

actions – batched action, possibly nested, to apply to the environment.

Returns

a list of [next_obs, reward, done, info]

class igibson.envs.parallel_env.ProcessPyEnvironment(env_constructor, flatten=False)

Bases: object

Step a single env in a separate process for lock free paralellism.

call(name, *args, **kwargs)

Asynchronously call a method of the external environment.

Parameters
  • name – name of the method to call.

  • args – positional arguments to forward to the method.

  • kwargs – keyword arguments to forward to the method.

Returns

promise object that blocks and provides the return value when called.

close()

Send a close message to the external process and join it.

reset(blocking=True)

Reset the environment.

Parameters

blocking – whether to wait for the result.

Returns

next_obs when blocking, otherwise callable that returns next_obs

start()

Start the process.

step(action, blocking=True)

Step the environment.

Parameters
  • action – the action to apply to the environment.

  • blocking – whether to wait for the result.

Returns

(next_obs, reward, done, info) tuple when blocking, otherwise callable that returns that tuple

Module contents