-
Notifications
You must be signed in to change notification settings - Fork 885
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds recorder manager in manager-based environments
- Loading branch information
Showing
24 changed files
with
1,967 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
source/extensions/omni.isaac.lab/omni/isaac/lab/envs/mdp/recorders/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Copyright (c) 2024, The Isaac Lab Project Developers. | ||
# All rights reserved. | ||
# | ||
# SPDX-License-Identifier: BSD-3-Clause | ||
|
||
"""Various recorder terms that can be used in the environment.""" | ||
|
||
from .recorders import * | ||
from .recorders_cfg import * |
65 changes: 65 additions & 0 deletions
65
source/extensions/omni.isaac.lab/omni/isaac/lab/envs/mdp/recorders/recorders.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
# Copyright (c) 2024, The Isaac Lab Project Developers. | ||
# All rights reserved. | ||
# | ||
# SPDX-License-Identifier: BSD-3-Clause | ||
|
||
from __future__ import annotations | ||
|
||
from collections.abc import Sequence | ||
from typing import TYPE_CHECKING | ||
|
||
from omni.isaac.lab.managers.manager_term_cfg import RecorderTermCfg | ||
from omni.isaac.lab.managers.recorder_manager import RecorderTerm | ||
|
||
if TYPE_CHECKING: | ||
from omni.isaac.lab.envs import ManagerBasedEnv | ||
|
||
|
||
class InitialStateRecorder(RecorderTerm): | ||
"""Recorder term that records the initial state of the environment after reset.""" | ||
|
||
def __init__(self, cfg: RecorderTermCfg, env: ManagerBasedEnv) -> None: | ||
super().__init__(cfg, env) | ||
|
||
def record_post_reset(self, env_ids: Sequence[int] | None): | ||
return "initial_state", self._env.scene.get_state(is_relative=True) | ||
|
||
|
||
class PostStepStatesRecorder(RecorderTerm): | ||
"""Recorder term that records the state of the environment at the end of each step.""" | ||
|
||
def __init__(self, cfg: RecorderTermCfg, env: ManagerBasedEnv) -> None: | ||
super().__init__(cfg, env) | ||
|
||
def record_post_step(self): | ||
return "states", self._env.scene.get_state(is_relative=True) | ||
|
||
|
||
class PreStepActionsRecorder(RecorderTerm): | ||
"""Recorder term that records the actions in the beginning of each step.""" | ||
|
||
def __init__(self, cfg: RecorderTermCfg, env: ManagerBasedEnv) -> None: | ||
super().__init__(cfg, env) | ||
|
||
def record_pre_step(self): | ||
return "actions", self._env.action_manager.action | ||
|
||
|
||
class PreStepFlatPolicyObservationsRecorder(RecorderTerm): | ||
"""Recorder term that records the policy group observations in each step.""" | ||
|
||
def __init__(self, cfg: RecorderTermCfg, env: ManagerBasedEnv) -> None: | ||
super().__init__(cfg, env) | ||
|
||
def record_pre_step(self): | ||
return "obs", self._env.obs_buf["policy"] | ||
|
||
|
||
class PreStepSubtaskTermsObservationsRecorder(RecorderTerm): | ||
"""Recorder term that records the subtask completion observations in each step.""" | ||
|
||
def __init__(self, cfg: RecorderTermCfg, env: ManagerBasedEnv) -> None: | ||
super().__init__(cfg, env) | ||
|
||
def record_pre_step(self): | ||
return "obs/subtask_term_signals", self._env.obs_buf["subtask_terms"] |
Oops, something went wrong.