Skip to content

temperature

Temperature

Bases: TensorizedValueState

Source code in omnigibson/object_states/temperature.py
class Temperature(TensorizedValueState):

    def __init__(self, obj):
        # Run super first
        super(Temperature, self).__init__(obj)

        # Set value to be default
        self._set_value(m.DEFAULT_TEMPERATURE)

    @classmethod
    def update_temperature_from_heatsource_or_sink(cls, objs, temperature, rate):
        """
        Updates @objs' internal temperatures based on @temperature and @rate

        Args:
            objs (Iterable of StatefulObject): Objects whose temperatures should be updated
            temperature (float): Heat source / sink temperature
            rate (float): Heating rate of the source / sink
        """
        # Get idxs for objs
        idxs = [cls.OBJ_IDXS[obj] for obj in objs]
        cls.VALUES[idxs] += (temperature - cls.VALUES[idxs]) * rate * og.sim.get_sim_step_dt()

    @classmethod
    def get_dependencies(cls):
        deps = super().get_dependencies()
        deps.add(AABB)
        return deps

    @classmethod
    def get_optional_dependencies(cls):
        deps = super().get_optional_dependencies()
        deps.add(HeatSourceOrSink)
        return deps

    @classmethod
    def _update_values(cls, values):
        # Apply temperature decay
        return values + (m.DEFAULT_TEMPERATURE - values) * m.TEMPERATURE_DECAY_SPEED * og.sim.get_sim_step_dt()

    @classproperty
    def value_name(cls):
        return "temperature"

update_temperature_from_heatsource_or_sink(objs, temperature, rate) classmethod

Updates @objs' internal temperatures based on @temperature and @rate

Parameters:

Name Type Description Default
objs Iterable of StatefulObject

Objects whose temperatures should be updated

required
temperature float

Heat source / sink temperature

required
rate float

Heating rate of the source / sink

required
Source code in omnigibson/object_states/temperature.py
@classmethod
def update_temperature_from_heatsource_or_sink(cls, objs, temperature, rate):
    """
    Updates @objs' internal temperatures based on @temperature and @rate

    Args:
        objs (Iterable of StatefulObject): Objects whose temperatures should be updated
        temperature (float): Heat source / sink temperature
        rate (float): Heating rate of the source / sink
    """
    # Get idxs for objs
    idxs = [cls.OBJ_IDXS[obj] for obj in objs]
    cls.VALUES[idxs] += (temperature - cls.VALUES[idxs]) * rate * og.sim.get_sim_step_dt()