-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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 (#1336)
# Description <!-- Thank you for your interest in sending a pull request. Please make sure to check the contribution guidelines. Link: https://isaac-sim.github.io/IsaacLab/source/refs/contributing.html --> This PR adds a recorder manager (RecorderManager) and relevant utility classes for recording data produced in various reset and step stages in manager-based environments. Wither the built-in recorder manager, users can create custom recorder terms in their environment configurations with callback functions returning tensors to be recorded as environments advance. It is particularly useful for implementing an app that collects human-operated demos and for those who want to record robot actions for post-validation/replay in Isaac Lab environments. The recorder manager works in both single- and multi-environment use cases. An episode for an environment instance is exported to a dataset file, via a dataset file handler, upon completion (a termination term is signaled a reset to the environment instance is triggered). By default, the recorder manager is inactive (by assigning no recorder terms in the default configuration), which should have minimal performance impact for existing apps that do not require data recording. ## Type of change <!-- As you go through the list, delete the ones that are not applicable. --> - New feature (non-breaking change which adds functionality) - This change requires a documentation update -- to be updated in later PRs ## Checklist - [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with `./isaaclab.sh --format` - [ ] I have made corresponding changes to the documentation - [ ] My changes generate no new warnings - [x] I have added tests that prove my fix is effective or that my feature works - [x] I have updated the changelog and the corresponding version in the extension's `config/extension.toml` file - [x] I have added my name to the `CONTRIBUTORS.md` or my name already exists there <!-- As you go through the checklist above, you can mark something as done by putting an x character in it For example, - [x] I have done this task - [ ] I have not done this task --> --------- Signed-off-by: CY Chen <[email protected]> Co-authored-by: Kelly Guo <[email protected]>
- Loading branch information
1 parent
efc1a0b
commit 01a2547
Showing
24 changed files
with
2,086 additions
and
9 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 * |
38 changes: 38 additions & 0 deletions
38
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,38 @@ | ||
# 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 omni.isaac.lab.managers.recorder_manager import RecorderTerm | ||
|
||
|
||
class InitialStateRecorder(RecorderTerm): | ||
"""Recorder term that records the initial state of the environment after reset.""" | ||
|
||
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 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 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 record_pre_step(self): | ||
return "obs", self._env.obs_buf["policy"] |
Oops, something went wrong.