igibson.object_states package

Submodules

igibson.object_states.aabb module

class igibson.object_states.aabb.AABB(obj)

Bases: igibson.object_states.object_state_base.CachingEnabledObjectState

load(data)

igibson.object_states.adjacency module

class igibson.object_states.adjacency.AxisAdjacencyList(positive_neighbors, negative_neighbors)

Bases: tuple

property negative_neighbors

Alias for field number 1

property positive_neighbors

Alias for field number 0

class igibson.object_states.adjacency.HorizontalAdjacency(obj)

Bases: igibson.object_states.object_state_base.CachingEnabledObjectState

State representing the object’s horizontal adjacencies in a preset number of directions.

The HorizontalAdjacency state returns adjacency lists for equally spaced coordinate planes. Each plane consists of 2 orthogonal axes, and adjacencies are checked for both the positive and negative directions of each axis.

The value of the state is List[List[AxisAdjacencyList]], where the list dimensions are _HORIZONTAL_AXIS_COUNT and 2. The first index is used to choose between the different planes, the second index to choose between the orthogonal axes of that plane. Given a plane/axis combo, the item in the list is a AxisAdjacencyList containing adjacencies in both directions of the axis.

If the idea of orthogonal bases is not relevant (and your use case simply requires checking adjacencies in each direction), the flatten_planes() function can be used on the state value to reduce the output to List[AxisAdjacencyList], a list of adjacency lists for all 2 * _HORIZONTAL_AXIS_COUNT directions.

static get_dependencies()

Get the dependency states for this state, e.g. states that need to be explicitly enabled on the current object before the current state is usable. States listed here will be enabled for all objects that have this current state, and all dependency states will be processed on all objects prior to this state being processed on any object.

Returns

List of strings corresponding to state keys.

load(data)
class igibson.object_states.adjacency.VerticalAdjacency(obj)

Bases: igibson.object_states.object_state_base.CachingEnabledObjectState

State representing the object’s vertical adjacencies. Value is a AxisAdjacencyList object.

static get_dependencies()

Get the dependency states for this state, e.g. states that need to be explicitly enabled on the current object before the current state is usable. States listed here will be enabled for all objects that have this current state, and all dependency states will be processed on all objects prior to this state being processed on any object.

Returns

List of strings corresponding to state keys.

load(data)
igibson.object_states.adjacency.compute_adjacencies(obj, axes, max_distance)

Given an object and a list of axes, find the adjacent objects in the axes’ positive and negative directions.

Parameters
  • obj – The object to check adjacencies of.

  • axes – The axes to check in. Note that each axis will be checked in both its positive and negative direction.

Returns

List[AxisAdjacencyList] of length len(axes) containing the adjacencies.

igibson.object_states.adjacency.flatten_planes(planes)
igibson.object_states.adjacency.get_equidistant_coordinate_planes(n_planes)

Given a number, sample that many equally spaced coordinate planes.

The samples will cover all 360 degrees (although rotational symmetry is assumed, e.g. if you take into account the axis index and the positive/negative directions, only 1/4 of the possible coordinate planes will be sampled: the ones where the first axis’ positive direction is in the first quadrant).

Parameters

n_planes – number of planes to sample

:return np.array of shape (n_planes, 2, 3) where the first dimension

is the sampled plane index, the second dimension is the axis index (0/1), and the third dimension is the 3-D world-coordinate vector corresponding to the axis.

igibson.object_states.burnt module

class igibson.object_states.burnt.Burnt(obj, burn_temperature=200)

Bases: igibson.object_states.object_state_base.AbsoluteObjectState, igibson.object_states.object_state_base.BooleanState, igibson.object_states.texture_change_state_mixin.TextureChangeStateMixin

static create_transformed_texture(diffuse_tex_filename, diffuse_tex_filename_transformed)
static get_dependencies()

Get the dependency states for this state, e.g. states that need to be explicitly enabled on the current object before the current state is usable. States listed here will be enabled for all objects that have this current state, and all dependency states will be processed on all objects prior to this state being processed on any object.

Returns

List of strings corresponding to state keys.

load(data)

igibson.object_states.cleaning_tool module

class igibson.object_states.cleaning_tool.CleaningTool(obj)

Bases: igibson.object_states.object_state_base.AbsoluteObjectState, igibson.object_states.link_based_state_mixin.LinkBasedStateMixin

static get_dependencies()

Get the dependency states for this state, e.g. states that need to be explicitly enabled on the current object before the current state is usable. States listed here will be enabled for all objects that have this current state, and all dependency states will be processed on all objects prior to this state being processed on any object.

Returns

List of strings corresponding to state keys.

static get_optional_dependencies()

Get states that should be processed prior to this state if they are already enabled. These states will not be enabled because of this state’s dependency on them, but if they are already enabled for another reason (e.g. because of an ability or another state’s dependency etc.), they will be processed on all objects prior to this state being processed on any object.

Returns

List of strings corresponding to state keys.

load(data)

igibson.object_states.contact_bodies module

class igibson.object_states.contact_bodies.ContactBodies(obj)

Bases: igibson.object_states.object_state_base.CachingEnabledObjectState

load(data)

igibson.object_states.cooked module

class igibson.object_states.cooked.Cooked(obj, cook_temperature=70)

Bases: igibson.object_states.object_state_base.AbsoluteObjectState, igibson.object_states.object_state_base.BooleanState, igibson.object_states.texture_change_state_mixin.TextureChangeStateMixin

static create_transformed_texture(diffuse_tex_filename, diffuse_tex_filename_transformed)
static get_dependencies()

Get the dependency states for this state, e.g. states that need to be explicitly enabled on the current object before the current state is usable. States listed here will be enabled for all objects that have this current state, and all dependency states will be processed on all objects prior to this state being processed on any object.

Returns

List of strings corresponding to state keys.

load(data)

igibson.object_states.dirty module

class igibson.object_states.dirty.Dusty(obj)

Bases: igibson.object_states.dirty._Dirty

DIRT_CLASS

alias of igibson.objects.particles.Dust

class igibson.object_states.dirty.Stained(obj)

Bases: igibson.object_states.dirty._Dirty

DIRT_CLASS

alias of igibson.objects.particles.Stain

igibson.object_states.factory module

igibson.object_states.factory.get_all_states()
igibson.object_states.factory.get_default_states()
igibson.object_states.factory.get_object_state_instance(state_class, obj, params=None)

Create an BaseObjectState child class instance for a given object & state.

The parameters passed in as a dictionary through params are passed as kwargs to the object state class constructor.

Parameters
  • state_class – The state name from the state name dictionary.

  • obj – The object for which the state is being constructed.

  • params – Dict of {param: value} corresponding to the state’s params.

Returns

The constructed state object, an instance of a child of BaseObjectState.

igibson.object_states.factory.get_state_dependency_graph()

Produce dependency graph of supported object states.

igibson.object_states.factory.get_state_from_name(name)
igibson.object_states.factory.get_state_name(state)
igibson.object_states.factory.get_states_by_dependency_order()

Produce a list of all states in topological order of dependency.

igibson.object_states.factory.get_states_for_ability(ability)
igibson.object_states.factory.prepare_object_states(obj, abilities=None, online=True)

Prepare the state dictionary for an object by generating the appropriate object state instances.

This uses the abilities of the object and the state dependency graph to find & instantiate all relevant states.

Parameters
  • obj – The object to generate states for.

  • abilities – dict in the form of {ability: {param: value}} containing object abilities and parameters.

  • online – Whether or not the states should be generated for an online object. Offline mode involves using dummy objects rather than real state objects.

igibson.object_states.frozen module

class igibson.object_states.frozen.Frozen(obj, freeze_temperature=0.0)

Bases: igibson.object_states.object_state_base.AbsoluteObjectState, igibson.object_states.object_state_base.BooleanState, igibson.object_states.texture_change_state_mixin.TextureChangeStateMixin

static create_transformed_texture(diffuse_tex_filename, diffuse_tex_filename_transformed)
static get_dependencies()

Get the dependency states for this state, e.g. states that need to be explicitly enabled on the current object before the current state is usable. States listed here will be enabled for all objects that have this current state, and all dependency states will be processed on all objects prior to this state being processed on any object.

Returns

List of strings corresponding to state keys.

load(data)

igibson.object_states.heat_source_or_sink module

class igibson.object_states.heat_source_or_sink.HeatSourceOrSink(obj, temperature=200, heating_rate=0.04, distance_threshold=0.2, requires_toggled_on=False, requires_closed=False, requires_inside=False)

Bases: igibson.object_states.object_state_base.AbsoluteObjectState, igibson.object_states.link_based_state_mixin.LinkBasedStateMixin

This state indicates the heat source or heat sink state of the object.

Currently, if the object is not an active heat source/sink, this returns (False, None). Otherwise, it returns True and the position of the heat source element, or (True, None) if the heat source has no heating element / only checks for Inside. E.g. on a stove object, True and the coordinates of the heating element will be returned. on a microwave object, True and None will be returned.

static get_dependencies()

Get the dependency states for this state, e.g. states that need to be explicitly enabled on the current object before the current state is usable. States listed here will be enabled for all objects that have this current state, and all dependency states will be processed on all objects prior to this state being processed on any object.

Returns

List of strings corresponding to state keys.

static get_optional_dependencies()

Get states that should be processed prior to this state if they are already enabled. These states will not be enabled because of this state’s dependency on them, but if they are already enabled for another reason (e.g. because of an ability or another state’s dependency etc.), they will be processed on all objects prior to this state being processed on any object.

Returns

List of strings corresponding to state keys.

load(data)

igibson.object_states.inside module

class igibson.object_states.inside.Inside(*args, **kwargs)

Bases: igibson.object_states.memoization.PositionalValidationMemoizedObjectStateMixin, igibson.object_states.kinematics.KinematicsMixin, igibson.object_states.object_state_base.RelativeObjectState, igibson.object_states.object_state_base.BooleanState

static get_dependencies()

Get the dependency states for this state, e.g. states that need to be explicitly enabled on the current object before the current state is usable. States listed here will be enabled for all objects that have this current state, and all dependency states will be processed on all objects prior to this state being processed on any object.

Returns

List of strings corresponding to state keys.

igibson.object_states.kinematics module

class igibson.object_states.kinematics.KinematicsMixin(obj)

Bases: igibson.object_states.object_state_base.BaseObjectState

This class is a subclass of BaseObjectState that adds dependencies on the default kinematics states.

static get_dependencies()

Get the dependency states for this state, e.g. states that need to be explicitly enabled on the current object before the current state is usable. States listed here will be enabled for all objects that have this current state, and all dependency states will be processed on all objects prior to this state being processed on any object.

Returns

List of strings corresponding to state keys.

igibson.object_states.max_temperature module

class igibson.object_states.max_temperature.MaxTemperature(obj)

Bases: igibson.object_states.object_state_base.AbsoluteObjectState

This state remembers the highest temperature reached by an object.

static get_dependencies()

Get the dependency states for this state, e.g. states that need to be explicitly enabled on the current object before the current state is usable. States listed here will be enabled for all objects that have this current state, and all dependency states will be processed on all objects prior to this state being processed on any object.

Returns

List of strings corresponding to state keys.

load(data)

igibson.object_states.memoization module

class igibson.object_states.memoization.MemoizedObjectStateMixin(*args, **kwargs)

Bases: object

abstract get_validation_cache(*args, **kwargs)
get_value(*args, **kwargs)
abstract validate_validation_cache(cache, *args, **kwargs)
class igibson.object_states.memoization.PositionalValidationMemoizedObjectStateMixin(*args, **kwargs)

Bases: igibson.object_states.memoization.MemoizedObjectStateMixin

get_validation_cache(*args, **kwargs)
validate_validation_cache(cache, *args, **kwargs)

igibson.object_states.next_to module

class igibson.object_states.next_to.NextTo(*args, **kwargs)

Bases: igibson.object_states.memoization.PositionalValidationMemoizedObjectStateMixin, igibson.object_states.kinematics.KinematicsMixin, igibson.object_states.object_state_base.RelativeObjectState, igibson.object_states.object_state_base.BooleanState

static get_dependencies()

Get the dependency states for this state, e.g. states that need to be explicitly enabled on the current object before the current state is usable. States listed here will be enabled for all objects that have this current state, and all dependency states will be processed on all objects prior to this state being processed on any object.

Returns

List of strings corresponding to state keys.

igibson.object_states.object_state_base module

class igibson.object_states.object_state_base.AbsoluteObjectState(obj)

Bases: igibson.object_states.object_state_base.BaseObjectState

This class is used to track object states that are absolute, e.g. do not require a second object to compute the value.

dump()
abstract load(data)
class igibson.object_states.object_state_base.BaseObjectState(obj)

Bases: object

Base ObjectState class. Do NOT inherit from this class directly - use either AbsoluteObjectState or RelativeObjectState.

static get_dependencies()

Get the dependency states for this state, e.g. states that need to be explicitly enabled on the current object before the current state is usable. States listed here will be enabled for all objects that have this current state, and all dependency states will be processed on all objects prior to this state being processed on any object.

Returns

List of strings corresponding to state keys.

static get_optional_dependencies()

Get states that should be processed prior to this state if they are already enabled. These states will not be enabled because of this state’s dependency on them, but if they are already enabled for another reason (e.g. because of an ability or another state’s dependency etc.), they will be processed on all objects prior to this state being processed on any object.

Returns

List of strings corresponding to state keys.

get_value(*args, **kwargs)
initialize(simulator)
set_value(*args, **kwargs)
update()
class igibson.object_states.object_state_base.BooleanState

Bases: object

This class is a mixin used to indicate that a state has a boolean value.

class igibson.object_states.object_state_base.CachingEnabledObjectState(obj)

Bases: igibson.object_states.object_state_base.AbsoluteObjectState

This class is used to track absolute states that are expensive to compute. It adds out-of-the-box support for caching the results for each simulator step.

clear_cached_value()
class igibson.object_states.object_state_base.RelativeObjectState(obj)

Bases: igibson.object_states.object_state_base.BaseObjectState

This class is used to track object states that are relative, e.g. require two objects to compute a value. Note that subclasses will typically compute values on-the-fly.

igibson.object_states.on_floor module

class igibson.object_states.on_floor.OnFloor(obj)

Bases: igibson.object_states.object_state_base.RelativeObjectState, igibson.object_states.kinematics.KinematicsMixin, igibson.object_states.object_state_base.BooleanState

static get_dependencies()

Get the dependency states for this state, e.g. states that need to be explicitly enabled on the current object before the current state is usable. States listed here will be enabled for all objects that have this current state, and all dependency states will be processed on all objects prior to this state being processed on any object.

Returns

List of strings corresponding to state keys.

class igibson.object_states.on_floor.RoomFloor(category, name, scene, room_instance, floor_obj)

Bases: object

igibson.object_states.on_top module

class igibson.object_states.on_top.OnTop(*args, **kwargs)

Bases: igibson.object_states.memoization.PositionalValidationMemoizedObjectStateMixin, igibson.object_states.object_state_base.RelativeObjectState, igibson.object_states.object_state_base.BooleanState

static get_dependencies()

Get the dependency states for this state, e.g. states that need to be explicitly enabled on the current object before the current state is usable. States listed here will be enabled for all objects that have this current state, and all dependency states will be processed on all objects prior to this state being processed on any object.

Returns

List of strings corresponding to state keys.

igibson.object_states.open module

class igibson.object_states.open.Open(obj)

Bases: igibson.object_states.object_state_base.CachingEnabledObjectState, igibson.object_states.object_state_base.BooleanState

load(data)

igibson.object_states.pose module

class igibson.object_states.pose.Pose(obj)

Bases: igibson.object_states.object_state_base.CachingEnabledObjectState

load(data)

igibson.object_states.room_states module

class igibson.object_states.room_states.InsideRoomTypes(obj)

Bases: igibson.object_states.object_state_base.CachingEnabledObjectState

The value of this state is the list of rooms that the object currently is in.

load(data)
class igibson.object_states.room_states.IsInRoomTemplate(obj)

Bases: igibson.object_states.object_state_base.AbsoluteObjectState, igibson.object_states.object_state_base.BooleanState

ROOM_TYPE = None
static get_dependencies()

Get the dependency states for this state, e.g. states that need to be explicitly enabled on the current object before the current state is usable. States listed here will be enabled for all objects that have this current state, and all dependency states will be processed on all objects prior to this state being processed on any object.

Returns

List of strings corresponding to state keys.

load(data)

igibson.object_states.sliced module

class igibson.object_states.sliced.Sliced(obj, slice_force=10)

Bases: igibson.object_states.object_state_base.AbsoluteObjectState, igibson.object_states.object_state_base.BooleanState

load(data)

igibson.object_states.slicer module

class igibson.object_states.slicer.Slicer(obj)

Bases: igibson.object_states.object_state_base.AbsoluteObjectState, igibson.object_states.link_based_state_mixin.LinkBasedStateMixin

static get_dependencies()

Get the dependency states for this state, e.g. states that need to be explicitly enabled on the current object before the current state is usable. States listed here will be enabled for all objects that have this current state, and all dependency states will be processed on all objects prior to this state being processed on any object.

Returns

List of strings corresponding to state keys.

load(data)

igibson.object_states.soaked module

class igibson.object_states.soaked.Soaked(obj)

Bases: igibson.object_states.object_state_base.AbsoluteObjectState, igibson.object_states.object_state_base.BooleanState, igibson.object_states.texture_change_state_mixin.TextureChangeStateMixin

static create_transformed_texture(diffuse_tex_filename, diffuse_tex_filename_transformed)
static get_optional_dependencies()

Get states that should be processed prior to this state if they are already enabled. These states will not be enabled because of this state’s dependency on them, but if they are already enabled for another reason (e.g. because of an ability or another state’s dependency etc.), they will be processed on all objects prior to this state being processed on any object.

Returns

List of strings corresponding to state keys.

load(data)

igibson.object_states.temperature module

class igibson.object_states.temperature.Temperature(obj)

Bases: igibson.object_states.object_state_base.AbsoluteObjectState

static get_dependencies()

Get the dependency states for this state, e.g. states that need to be explicitly enabled on the current object before the current state is usable. States listed here will be enabled for all objects that have this current state, and all dependency states will be processed on all objects prior to this state being processed on any object.

Returns

List of strings corresponding to state keys.

static get_optional_dependencies()

Get states that should be processed prior to this state if they are already enabled. These states will not be enabled because of this state’s dependency on them, but if they are already enabled for another reason (e.g. because of an ability or another state’s dependency etc.), they will be processed on all objects prior to this state being processed on any object.

Returns

List of strings corresponding to state keys.

load(data)

igibson.object_states.texture_change_state_mixin module

class igibson.object_states.texture_change_state_mixin.TextureChangeStateMixin

Bases: object

update_texture()

igibson.object_states.toggle module

class igibson.object_states.toggle.ToggledOn(obj)

Bases: igibson.object_states.object_state_base.AbsoluteObjectState, igibson.object_states.object_state_base.BooleanState, igibson.object_states.link_based_state_mixin.LinkBasedStateMixin, igibson.object_states.texture_change_state_mixin.TextureChangeStateMixin

static create_transformed_texture(diffuse_tex_filename, diffuse_tex_filename_transformed)
load(data)

igibson.object_states.under module

class igibson.object_states.under.Under(*args, **kwargs)

Bases: igibson.object_states.memoization.PositionalValidationMemoizedObjectStateMixin, igibson.object_states.object_state_base.RelativeObjectState, igibson.object_states.object_state_base.BooleanState

static get_dependencies()

Get the dependency states for this state, e.g. states that need to be explicitly enabled on the current object before the current state is usable. States listed here will be enabled for all objects that have this current state, and all dependency states will be processed on all objects prior to this state being processed on any object.

Returns

List of strings corresponding to state keys.

igibson.object_states.utils module

igibson.object_states.utils.clear_cached_states(obj)
igibson.object_states.utils.detect_collision(bodyA)
igibson.object_states.utils.get_center_extent(obj_states)
igibson.object_states.utils.sample_kinematics(predicate, objA, objB, binary_state, use_ray_casting_method=False, max_trials=100, z_offset=0.05, skip_falling=False)

igibson.object_states.water_source module

class igibson.object_states.water_source.WaterSource(obj)

Bases: igibson.object_states.object_state_base.AbsoluteObjectState, igibson.object_states.link_based_state_mixin.LinkBasedStateMixin

static get_dependencies()

Get the dependency states for this state, e.g. states that need to be explicitly enabled on the current object before the current state is usable. States listed here will be enabled for all objects that have this current state, and all dependency states will be processed on all objects prior to this state being processed on any object.

Returns

List of strings corresponding to state keys.

static get_optional_dependencies()

Get states that should be processed prior to this state if they are already enabled. These states will not be enabled because of this state’s dependency on them, but if they are already enabled for another reason (e.g. because of an ability or another state’s dependency etc.), they will be processed on all objects prior to this state being processed on any object.

Returns

List of strings corresponding to state keys.

load(data)

Module contents