Skip to content

task_base

BaseTask

Bases: GymObservable, Registerable

Base Task class. Task-specific reset_scene, reset_agent, step methods are implemented in subclasses

Parameters:

Name Type Description Default
termination_config None or dict

Keyword-mapped configuration to use to generate termination conditions. This should be specific to the task class. Default is None, which corresponds to a default config being usd. Note that any keyword required by a specific task class but not specified in the config will automatically be filled in with the default config. See cls.default_termination_config for default values used

None
reward_config None or dict

Keyword-mapped configuration to use to generate reward functions. This should be specific to the task class. Default is None, which corresponds to a default config being usd. Note that any keyword required by a specific task class but not specified in the config will automatically be filled in with the default config. See cls.default_reward_config for default values used

None
include_obs bool

Whether to include observations or not for this task

True
Source code in OmniGibson/omnigibson/tasks/task_base.py
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
class BaseTask(GymObservable, Registerable, metaclass=ABCMeta):
    """
    Base Task class.
    Task-specific reset_scene, reset_agent, step methods are implemented in subclasses

    Args:
        termination_config (None or dict): Keyword-mapped configuration to use to generate termination conditions. This
            should be specific to the task class. Default is None, which corresponds to a default config being usd.
            Note that any keyword required by a specific task class but not specified in the config will automatically
            be filled in with the default config. See cls.default_termination_config for default values used
        reward_config (None or dict): Keyword-mapped configuration to use to generate reward functions. This should be
            specific to the task class. Default is None, which corresponds to a default config being usd. Note that
            any keyword required by a specific task class but not specified in the config will automatically be filled
            in with the default config. See cls.default_reward_config for default values used
        include_obs (bool): Whether to include observations or not for this task
    """

    def __init__(self, termination_config=None, reward_config=None, include_obs=True):
        # Make sure configs are dictionaries
        termination_config = dict() if termination_config is None else termination_config
        reward_config = dict() if reward_config is None else reward_config

        # Sanity check termination and reward conditions -- any keys found in the inputted config but NOT
        # found in the default config should raise an error
        unknown_termination_keys = set(termination_config.keys()) - set(self.default_termination_config.keys())
        assert (
            len(unknown_termination_keys) == 0
        ), f"Got unknown termination config keys inputted: {unknown_termination_keys}"
        unknown_reward_keys = set(reward_config.keys()) - set(self.default_reward_config.keys())
        assert len(unknown_reward_keys) == 0, f"Got unknown reward config keys inputted: {unknown_reward_keys}"

        # Combine with defaults and store internally
        self._termination_config = self.default_termination_config
        self._termination_config.update(termination_config)
        self._reward_config = self.default_reward_config
        self._reward_config.update(reward_config)

        # Generate reward and termination functions
        self._termination_conditions = self._create_termination_conditions()
        self._reward_functions = self._create_reward_functions()

        # Store other internal vars that will be populated at runtime
        self._loaded = False
        self._num_envs = None
        self._reward = None
        self._done = None
        self._success = None
        self._info = None
        self._low_dim_obs_dim = None
        self._low_dim_obs_keys = None
        self._include_obs = include_obs

        # Run super init
        super().__init__()

    @abstractmethod
    def _load(self, env):
        """
        Load this task. Should be implemented by subclass. Can include functionality, e.g.: loading dynamic objects
        into the environment
        """
        raise NotImplementedError()

    @abstractmethod
    def _load_non_low_dim_observation_space(self):
        """
        Loads any non-low dim observation spaces for this task.

        Returns:
            dict: Keyword-mapped observation space for this object mapping non low dim task observation name to
                observation space
        """
        raise NotImplementedError()

    @classmethod
    def verify_scene_and_task_config(cls, scene_cfg, task_cfg):
        """
        Runs any necessary sanity checks on the scene and task configs passed; and possibly modifies them in-place

        Args:
            scene_cfg (dict): Scene configuration
            task_cfg (dict): Task configuration
        """
        # Default is no-op
        pass

    def _load_observation_space(self):
        # Create the non low dim obs space
        obs_space = self._load_non_low_dim_observation_space()

        # Create the low dim obs space and add to the main obs space dict -- make sure we're flattening low dim obs
        if self._low_dim_obs_dim > 0:
            obs_space["low_dim"] = self._build_obs_box_space(
                shape=(self._low_dim_obs_dim,), low=-float("inf"), high=float("inf"), dtype=NumpyTypes.FLOAT32
            )

        return obs_space

    def load(self, env):
        """
        Load this task
        """
        self._num_envs = env.num_envs

        # Make sure all scenes are of the correct type!
        for scene in env.scenes:
            assert any([issubclass(scene.__class__, valid_cls) for valid_cls in self.valid_scene_types]), (
                f"Got incompatible scene type {scene.__class__.__name__} for task {self.__class__.__name__}! "
                f"Scene class must be a subclass of at least one of: "
                f"{[cls_type.__name__ for cls_type in self.valid_scene_types]}"
            )

        # Run internal method
        self._load(env=env)

        # We're now initialized
        self._loaded = True

    def post_play_load(self, env):
        """
        Complete any loading tasks that require the simulator to be playing

        Args:
            env (Environment): environment instance
        """
        # Reset all scenes to their initial stored configuration
        for scene in env.scenes:
            scene.reset(hard=False)

        # Compute the low dimensional observation dimension. Obs keys and shape are task-defined
        # and identical across envs, so env 0 is canonical.
        obs = self.get_obs(env=env, env_idx=0, flatten_low_dim=False)
        if "low_dim" in obs:
            self._low_dim_obs_keys = list(obs["low_dim"].keys())
            self._low_dim_obs_dim = len(self._flatten_low_dim_obs(obs=obs["low_dim"]))
        else:
            self._low_dim_obs_keys = []
            self._low_dim_obs_dim = 0

    @property
    def low_dim_obs_keys(self):
        """
        Returns:
            list of str: List of low-dimensional observation keys for this task
        """
        # Make sure we're loaded
        assert self._loaded, "Task must be loaded using load() before accessing low_dim_obs_keys!"
        return self._low_dim_obs_keys

    @abstractmethod
    def _create_termination_conditions(self):
        """
        Creates the termination functions in the environment

        Returns:
            dict of BaseTerminationCondition: Termination functions created for this task
        """
        raise NotImplementedError()

    @abstractmethod
    def _create_reward_functions(self):
        """
        Creates the reward functions in the environment

        Returns:
            dict of BaseRewardFunction: Reward functions created for this task
        """
        raise NotImplementedError()

    def _reset_scene(self, env, env_indices):
        """
        Task-specific scene reset. Default is resetting specified scenes.

        Args:
            env (Environment): environment instance
            env_indices (th.Tensor): Indices of environments to reset
        """
        for idx in env_indices:
            env.scenes[idx].reset()

    def _reset_agent(self, env, env_indices):
        """
        Task-specific agent reset

        Args:
            env (Environment): environment instance
            env_indices (th.Tensor): Indices of environments to reset
        """
        # Default is no-op
        pass

    def _reset_variables(self, env, env_indices):
        """
        Task-specific internal variable reset

        Args:
            env (Environment): environment instance
            env_indices (th.Tensor): Indices of environments to reset
        """
        if self._reward is None:
            # First-time init
            self._reward = th.zeros(self._num_envs, dtype=th.float32)
            self._done = th.zeros(self._num_envs, dtype=th.bool)
            self._success = th.zeros(self._num_envs, dtype=th.bool)
        self._reward[env_indices] = 0.0
        self._done[env_indices] = False
        self._success[env_indices] = False
        self._info = None  # info is rebuilt each step

    def reset(self, env, env_indices=None):
        """
        Resets this task in the environment

        Args:
            env (Environment): environment instance to reset
            env_indices (None or th.Tensor): Indices of environments to reset. If None, resets all.
        """
        if env_indices is None:
            env_indices = th.arange(self._num_envs)

        # Reset the scene, agent, and variables
        self._reset_scene(env, env_indices)
        self._reset_agent(env, env_indices)
        self._reset_variables(env, env_indices)

        # Also reset all termination conditions and reward functions
        for termination_condition in self._termination_conditions.values():
            termination_condition.reset(self, env, env_indices)
        for reward_function in self._reward_functions.values():
            reward_function.reset(self, env, env_indices)

    def _step_termination(self, env, action, infos=None):
        """
        Step and aggregate termination conditions

        Args:
            env (Environment): Environment instance
            action (n-array): 1D flattened array of actions executed by all agents in the environment
            infos (None or list[dict]): If provided, a list of per-env info dicts to accumulate into.
                If None, fresh info dicts are created.

        Returns:
            2-tuple:
                - th.Tensor: (num_envs,) bool tensor of dones
                - list[dict]: per-env info dicts
        """
        # Get all dones and successes from individual termination conditions
        if infos is not None:
            for i in range(self._num_envs):
                if "termination_conditions" not in infos[i]:
                    infos[i]["termination_conditions"] = dict()
        else:
            infos = [{"termination_conditions": dict()} for _ in range(self._num_envs)]
        dones = th.zeros(self._num_envs, dtype=th.bool)
        successes = th.zeros(self._num_envs, dtype=th.bool)

        for name, termination_condition in self._termination_conditions.items():
            d, s = termination_condition.step(self, env, action)
            dones = dones | d
            successes = successes | s
            for env_idx in range(self._num_envs):
                infos[env_idx]["termination_conditions"][name] = {
                    "done": d[env_idx].item(),
                    "success": s[env_idx].item(),
                }

        for env_idx in range(self._num_envs):
            infos[env_idx]["success"] = successes[env_idx].item()

        return dones, infos

    def _step_reward(self, env, action, infos=None):
        """
        Step and aggregate reward functions

        Args:
            env (Environment): Environment instance
            action (n-array): 1D flattened array of actions executed by all agents in the environment
            infos (None or list[dict]): If provided, a list of per-env info dicts to accumulate into.
                If None, fresh info dicts are created.

        Returns:
            2-tuple:
                - th.Tensor: (num_envs,) float tensor of total rewards
                - list[dict]: per-env info dicts
        """
        # Aggregate rewards over all reward functions
        infos = infos if infos is not None else [dict() for _ in range(self._num_envs)]
        total_rewards = th.zeros(self._num_envs, dtype=th.float32)

        for reward_name, reward_function in self._reward_functions.items():
            rewards, reward_infos = reward_function.step(self, env, action)
            total_rewards += rewards
            for env_idx in range(self._num_envs):
                infos[env_idx][reward_name] = reward_infos[env_idx]
                if "reward_breakdown" not in infos[env_idx]:
                    infos[env_idx]["reward_breakdown"] = dict()
                infos[env_idx]["reward_breakdown"][reward_name] = rewards[env_idx].item()

        return total_rewards, infos

    @abstractmethod
    def _get_obs(self, env, env_idx):
        """
        Get task-specific observation for a specific environment

        Args:
            env (Environment): Environment instance
            env_idx (int): Index of the environment

        Returns:
            2-tuple:
                - dict: Keyword-mapped low dimensional observations from this task
                - dict: All other keyword-mapped observations from this task
        """
        raise NotImplementedError()

    def _flatten_low_dim_obs(self, obs):
        """
        Flattens dictionary containing low-dimensional observations @obs and converts it from a dictionary into a
        1D numpy array

        Args:
            obs (dict): Low-dim observation dictionary where each value is a 1D array

        Returns:
            n-array: 1D-numpy array of flattened low-dim observations
        """
        # By default, we simply concatenate all values in our obs dict
        return th.cat([ob for ob in obs.values()]) if len(obs.values()) > 0 else th.empty(0)

    def get_obs(self, env, env_idx=None, flatten_low_dim=True):
        """
        Get task observations.

        Args:
            env (Environment): environment instance
            env_idx (int or None): If specified, return obs for one env. If None, return list for all envs.
            flatten_low_dim (bool): Whether to flatten low-dimensional observations
        """
        if not self._include_obs:
            return dict() if env_idx is not None else [dict()] * self._num_envs

        if env_idx is not None:
            low_dim_obs, obs = self._get_obs(env=env, env_idx=env_idx)
            if low_dim_obs:
                obs["low_dim"] = self._flatten_low_dim_obs(obs=low_dim_obs) if flatten_low_dim else low_dim_obs
            return obs
        else:
            return [self.get_obs(env, env_idx=i, flatten_low_dim=flatten_low_dim) for i in range(self._num_envs)]

    def step(self, env, action):
        """
        Perform task-specific step for every timestep

        Args:
            env (Environment): Environment instance
            action (n-array): 1D flattened array of actions executed by all agents in the environment

        Returns:
            3-tuple:
                - th.Tensor: (num_envs,) reward tensor
                - th.Tensor: (num_envs,) done bool tensor
                - list[dict]: per-env info dicts
        """
        # Make sure we're initialized
        assert self._loaded, "Task must be loaded using load() before calling step()!"

        # We calculate termination conditions first and then rewards
        # (since some rewards can rely on termination conditions to update)
        dones, done_infos = self._step_termination(env=env, action=action)
        rewards, reward_infos = self._step_reward(env=env, action=action)

        # Update the internal state of this task
        self._reward = rewards
        self._done = dones
        self._success = th.tensor([di["success"] for di in done_infos], dtype=th.bool)
        self._info = [{"reward": reward_infos[i], "done": done_infos[i]} for i in range(self._num_envs)]

        return self._reward, self._done, deepcopy(self._info)

    @property
    def name(self):
        """
        Returns:
            str: Name of this task. Defaults to class name
        """
        return self.__class__.__name__

    @property
    def reward(self):
        """
        Returns:
            th.Tensor: (num_envs,) current reward tensor for this task
        """
        assert self._reward is not None, "At least one step() must occur before reward can be calculated!"
        return self._reward

    @property
    def done(self):
        """
        Returns:
            th.Tensor: (num_envs,) bool tensor of whether each env is done
        """
        assert self._done is not None, "At least one step() must occur before done can be calculated!"
        return self._done

    @property
    def success(self):
        """
        Returns:
            th.Tensor: (num_envs,) bool tensor of whether each env has succeeded
        """
        assert self._success is not None, "At least one step() must occur before success can be calculated!"
        return self._success

    @property
    def info(self):
        """
        Returns:
            list[dict]: Per-env nested dictionary of information for this task, including reward- and done-specific information
        """
        assert self._info is not None, "At least one step() must occur before info can be calculated!"
        return self._info

    @classproperty
    def valid_scene_types(cls):
        """
        Returns:
            set of Scene: Scene type(s) that are valid (i.e.: compatible) with this specific task. This will be
                used to sanity check the task + scene combination at runtime
        """
        raise NotImplementedError()

    @classproperty
    def default_reward_config(cls):
        """
        Returns:
            dict: Default reward configuration for this class. Should include any kwargs necessary for
                any of the reward classes generated in self._create_rewards(). Note: this default config
                should be fully verbose -- any keys inputted in the constructor but NOT found in this default config
                will raise an error!
        """
        raise NotImplementedError()

    @classproperty
    def default_termination_config(cls):
        """
        Returns:
            dict: Default termination configuration for this class. Should include any kwargs necessary for
                any of the termination classes generated in self._create_terminations(). Note: this default config
                should be fully verbose -- any keys inputted in the constructor but NOT found in this default config
                will raise an error!
        """
        raise NotImplementedError()

    @classproperty
    def _do_not_register_classes(cls):
        # Don't register this class since it's an abstract template
        classes = super()._do_not_register_classes
        classes.add("BaseTask")
        return classes

    @classproperty
    def _cls_registry(cls):
        # Global registry
        global REGISTERED_TASKS
        return REGISTERED_TASKS

done property

Returns:

Type Description
Tensor

(num_envs,) bool tensor of whether each env is done

info property

Returns:

Type Description
list[dict]

Per-env nested dictionary of information for this task, including reward- and done-specific information

low_dim_obs_keys property

Returns:

Type Description
list of str

List of low-dimensional observation keys for this task

name property

Returns:

Type Description
str

Name of this task. Defaults to class name

reward property

Returns:

Type Description
Tensor

(num_envs,) current reward tensor for this task

success property

Returns:

Type Description
Tensor

(num_envs,) bool tensor of whether each env has succeeded

default_reward_config()

Returns:

Type Description
dict

Default reward configuration for this class. Should include any kwargs necessary for any of the reward classes generated in self._create_rewards(). Note: this default config should be fully verbose -- any keys inputted in the constructor but NOT found in this default config will raise an error!

Source code in OmniGibson/omnigibson/tasks/task_base.py
@classproperty
def default_reward_config(cls):
    """
    Returns:
        dict: Default reward configuration for this class. Should include any kwargs necessary for
            any of the reward classes generated in self._create_rewards(). Note: this default config
            should be fully verbose -- any keys inputted in the constructor but NOT found in this default config
            will raise an error!
    """
    raise NotImplementedError()

default_termination_config()

Returns:

Type Description
dict

Default termination configuration for this class. Should include any kwargs necessary for any of the termination classes generated in self._create_terminations(). Note: this default config should be fully verbose -- any keys inputted in the constructor but NOT found in this default config will raise an error!

Source code in OmniGibson/omnigibson/tasks/task_base.py
@classproperty
def default_termination_config(cls):
    """
    Returns:
        dict: Default termination configuration for this class. Should include any kwargs necessary for
            any of the termination classes generated in self._create_terminations(). Note: this default config
            should be fully verbose -- any keys inputted in the constructor but NOT found in this default config
            will raise an error!
    """
    raise NotImplementedError()

get_obs(env, env_idx=None, flatten_low_dim=True)

Get task observations.

Parameters:

Name Type Description Default
env Environment

environment instance

required
env_idx int or None

If specified, return obs for one env. If None, return list for all envs.

None
flatten_low_dim bool

Whether to flatten low-dimensional observations

True
Source code in OmniGibson/omnigibson/tasks/task_base.py
def get_obs(self, env, env_idx=None, flatten_low_dim=True):
    """
    Get task observations.

    Args:
        env (Environment): environment instance
        env_idx (int or None): If specified, return obs for one env. If None, return list for all envs.
        flatten_low_dim (bool): Whether to flatten low-dimensional observations
    """
    if not self._include_obs:
        return dict() if env_idx is not None else [dict()] * self._num_envs

    if env_idx is not None:
        low_dim_obs, obs = self._get_obs(env=env, env_idx=env_idx)
        if low_dim_obs:
            obs["low_dim"] = self._flatten_low_dim_obs(obs=low_dim_obs) if flatten_low_dim else low_dim_obs
        return obs
    else:
        return [self.get_obs(env, env_idx=i, flatten_low_dim=flatten_low_dim) for i in range(self._num_envs)]

load(env)

Load this task

Source code in OmniGibson/omnigibson/tasks/task_base.py
def load(self, env):
    """
    Load this task
    """
    self._num_envs = env.num_envs

    # Make sure all scenes are of the correct type!
    for scene in env.scenes:
        assert any([issubclass(scene.__class__, valid_cls) for valid_cls in self.valid_scene_types]), (
            f"Got incompatible scene type {scene.__class__.__name__} for task {self.__class__.__name__}! "
            f"Scene class must be a subclass of at least one of: "
            f"{[cls_type.__name__ for cls_type in self.valid_scene_types]}"
        )

    # Run internal method
    self._load(env=env)

    # We're now initialized
    self._loaded = True

post_play_load(env)

Complete any loading tasks that require the simulator to be playing

Parameters:

Name Type Description Default
env Environment

environment instance

required
Source code in OmniGibson/omnigibson/tasks/task_base.py
def post_play_load(self, env):
    """
    Complete any loading tasks that require the simulator to be playing

    Args:
        env (Environment): environment instance
    """
    # Reset all scenes to their initial stored configuration
    for scene in env.scenes:
        scene.reset(hard=False)

    # Compute the low dimensional observation dimension. Obs keys and shape are task-defined
    # and identical across envs, so env 0 is canonical.
    obs = self.get_obs(env=env, env_idx=0, flatten_low_dim=False)
    if "low_dim" in obs:
        self._low_dim_obs_keys = list(obs["low_dim"].keys())
        self._low_dim_obs_dim = len(self._flatten_low_dim_obs(obs=obs["low_dim"]))
    else:
        self._low_dim_obs_keys = []
        self._low_dim_obs_dim = 0

reset(env, env_indices=None)

Resets this task in the environment

Parameters:

Name Type Description Default
env Environment

environment instance to reset

required
env_indices None or Tensor

Indices of environments to reset. If None, resets all.

None
Source code in OmniGibson/omnigibson/tasks/task_base.py
def reset(self, env, env_indices=None):
    """
    Resets this task in the environment

    Args:
        env (Environment): environment instance to reset
        env_indices (None or th.Tensor): Indices of environments to reset. If None, resets all.
    """
    if env_indices is None:
        env_indices = th.arange(self._num_envs)

    # Reset the scene, agent, and variables
    self._reset_scene(env, env_indices)
    self._reset_agent(env, env_indices)
    self._reset_variables(env, env_indices)

    # Also reset all termination conditions and reward functions
    for termination_condition in self._termination_conditions.values():
        termination_condition.reset(self, env, env_indices)
    for reward_function in self._reward_functions.values():
        reward_function.reset(self, env, env_indices)

step(env, action)

Perform task-specific step for every timestep

Parameters:

Name Type Description Default
env Environment

Environment instance

required
action n - array

1D flattened array of actions executed by all agents in the environment

required

Returns:

Type Description
3 - tuple
  • th.Tensor: (num_envs,) reward tensor
  • th.Tensor: (num_envs,) done bool tensor
  • list[dict]: per-env info dicts
Source code in OmniGibson/omnigibson/tasks/task_base.py
def step(self, env, action):
    """
    Perform task-specific step for every timestep

    Args:
        env (Environment): Environment instance
        action (n-array): 1D flattened array of actions executed by all agents in the environment

    Returns:
        3-tuple:
            - th.Tensor: (num_envs,) reward tensor
            - th.Tensor: (num_envs,) done bool tensor
            - list[dict]: per-env info dicts
    """
    # Make sure we're initialized
    assert self._loaded, "Task must be loaded using load() before calling step()!"

    # We calculate termination conditions first and then rewards
    # (since some rewards can rely on termination conditions to update)
    dones, done_infos = self._step_termination(env=env, action=action)
    rewards, reward_infos = self._step_reward(env=env, action=action)

    # Update the internal state of this task
    self._reward = rewards
    self._done = dones
    self._success = th.tensor([di["success"] for di in done_infos], dtype=th.bool)
    self._info = [{"reward": reward_infos[i], "done": done_infos[i]} for i in range(self._num_envs)]

    return self._reward, self._done, deepcopy(self._info)

valid_scene_types()

Returns:

Type Description
set of Scene

Scene type(s) that are valid (i.e.: compatible) with this specific task. This will be used to sanity check the task + scene combination at runtime

Source code in OmniGibson/omnigibson/tasks/task_base.py
@classproperty
def valid_scene_types(cls):
    """
    Returns:
        set of Scene: Scene type(s) that are valid (i.e.: compatible) with this specific task. This will be
            used to sanity check the task + scene combination at runtime
    """
    raise NotImplementedError()

verify_scene_and_task_config(scene_cfg, task_cfg) classmethod

Runs any necessary sanity checks on the scene and task configs passed; and possibly modifies them in-place

Parameters:

Name Type Description Default
scene_cfg dict

Scene configuration

required
task_cfg dict

Task configuration

required
Source code in OmniGibson/omnigibson/tasks/task_base.py
@classmethod
def verify_scene_and_task_config(cls, scene_cfg, task_cfg):
    """
    Runs any necessary sanity checks on the scene and task configs passed; and possibly modifies them in-place

    Args:
        scene_cfg (dict): Scene configuration
        task_cfg (dict): Task configuration
    """
    # Default is no-op
    pass