Skip to content

Allow explicit step overrides and move recording into workflows - #9121

Open
ooctipus wants to merge 6 commits into
isaac-sim:mainfrom
ooctipus:configurable-step-function
Open

ooctipus wants to merge 6 commits into
isaac-sim:mainfrom
ooctipus:configurable-step-function

Conversation

@ooctipus

@ooctipus ooctipus commented Nov 20, 2026 •

Copy link
Copy Markdown
Collaborator

Description

Manager-based RL environments can take a complete custom step function through env_cfg.step_fn. The default step keeps the decimation loop, rewards, terminations, resets, commands, events, and observations visible in one function.

Recording workflows define their own step in the script or entry point that runs them. Each owns its decimation loop and makes direct capture calls where the workflow needs them. Teleoperation evaluates success over consecutive control steps. Mimic owns generation and annotation boundaries. The locomanipulation scripts export on task termination. The shared capture module reads fields and metadata, and EpisodeRecorder owns batched storage and HDF5 export.

Removed RecorderManager, its term and configuration classes, and environment-owned recording from step, reset, reset-to-state, and close. The architecture test guards both the environment and capture module boundaries. The documentation shows the actual teleoperation step and where a script can insert per-physics-step capture.

No unmerged dependencies.

Migration

This removes env.recorder_manager and env_cfg.recorders. Instantiate EpisodeRecorder and import DatasetExportMode from isaaclab.utils.datasets. Define the step in your script and call the capture functions at your chosen points. For an explicit decimation loop, set backend decimation to one before the first environment step. Mimic generation APIs receive the recorder directly. Task image exports use the global step in filenames.

Validation

  • 22 focused tests passed across episode storage and architecture, physics action eligibility, manager-based RL, and Mimic generation failure limits.
  • Newton XPBD CPU verified the existing observation history, partial reset, and policy RNG assertions.
  • An isolated Newton MuJoCo CPU harness exercised all six script-local functions on a moving rigid body. It checked simulation duration, task and visualizer resets, export classification, and initial-state capture. It also compared task-terminating paths against the default step at an absolute tolerance of 1e-7.
  • The default step matched the original implementation exactly over 12 transitions with two autoresets. The empty-scene Newton CPU timing was about 92.4 µs before and 91.3 µs after.
  • Repository formatting, lint, changelog checks, and the clean documentation build passed.

Full Kit/PhysX, teleoperation CLI, XR, and GPU coverage remains for CI. Local Kit bootstrap requires interactive license acceptance.

Type of change

  • Breaking change
  • New feature
  • Documentation update

@github-actions github-actions Bot added documentation Improvements or additions to documentation isaac-lab Related to Isaac Lab team labels Nov 20, 2026
@ooctipus ooctipus changed the title Allow configuring the manager-based RL step function Simplify step overrides and make episode recording explicit Nov 20, 2026
@github-actions github-actions Bot added the isaac-mimic Related to Isaac Mimic team label Nov 20, 2026
@ooctipus ooctipus changed the title Simplify step overrides and make episode recording explicit Allow explicit step overrides and move recording into workflows Nov 20, 2026
@ooctipus
ooctipus marked this pull request as ready for review November 20, 2026 21:12
@ooctipus
ooctipus requested a review from a team November 20, 2026 21:12

@isaaclab-review-bot isaaclab-review-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isaac Lab Review Bot

Needs attention: Design and architecture (1), Compatibility and deprecation (10), Implementation (3), Style consistency (5), Test quality (2). Other reviewed categories look good.

  • PR description: Qualify default-step parity as recorder-free; make the quoted timing reproducible with baseline/candidate revisions, command, hardware, backend, environment count, warmup, and metric, while preserving the template sections.
  • Design and architecture: The locomanipulation payload schema has one script consumer but remains in the environment module; move its conversion beside generate_data.py's capture call.
  • Scope and over-engineering: No over-engineering issues.
  • API: API changes look good.
  • Compatibility and deprecation: Breaking changes: recording configuration, hooks, imports, extensions, Mimic construction and setup, teleoperation returns, and image filenames change without functional deprecation bridges; retain old behavior with targeted warnings, migration/removal guidance, and transition coverage.
  • Implementation: Mimic metadata now reads raw actions before processing rather than the manager-owned action buffer, changing captured targets; process actions before deriving metadata.
  • Style consistency: Several changed signatures add required recorder arguments without documenting them in existing Args sections; document each argument's storage and capture responsibility.
  • Test quality: The new structural test requires legacy APIs to disappear and constrains private syntax, obstructing deprecation bridges and harmless reorganization; replace those assertions with transition behavior and independent storage-boundary checks.

Needs rework. Posted 21 inline findings.

Automated review; human maintainers own approval decisions.


def _step_annotation(env, action: torch.Tensor, *, recorder: EpisodeRecorder):
"""Replay one action and capture the fields used for Mimic annotations."""
recorder.add_to_episodes("obs/datagen_info", get_datagen_info(env, action.to(env.device)))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 Critical · Implementation — Capture processed Mimic targets

The former pre-step term derived target_eef_pose from action_manager.action after processing; this call uses raw input first. Process the action, then pass the manager's action to get_datagen_info.

Please refer to the :class:`isaaclab.scene.InteractiveSceneCfg` class for more details.
"""

recorders: object = DefaultEmptyRecorderManagerCfg()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 Critical · Compatibility — Keep configured recording functional

Removing recorders and environment lifecycle dispatch stops existing configured capture, reset, and export. Retain the old manager path, including Warp dispatch, with targeted warnings, migration guidance, and old/new tests through deprecation.

"RewardTermCfg",
"TerminationTermCfg",
"ObservationManager",
"DatasetExportMode",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 Critical · Compatibility — Retain public recorder import paths

Removing the manager module, types, and DatasetExportMode export breaks existing imports and recorder subclasses. Keep their original paths functional with targeted deprecation warnings, migration guidance, and transition tests.

*manager* objects (``ObservationManager``, ``RewardManager``, ``TerminationManager``,
``EventManager``, ``CurriculumManager``, ``CommandManager``, ``ActionManager``,
``RecorderManager``). Each manager is driven by small, reusable MDP term functions that live
``EventManager``, ``CurriculumManager``, ``CommandManager``, ``ActionManager``). Each manager is driven by small, reusable MDP term functions that live

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Warning · Style Consistency — Wrap the shortened manager list

The edited list and following sentence now occupy one overlong source line. Break after the list to match the surrounding documentation layout.

from isaaclab.utils.datasets import EpisodeData, EpisodeRecorder, EpisodeRecorderCfg, HDF5DatasetFileHandler

import isaaclab_mimic.envs # noqa: F401
from isaaclab_mimic.datagen.generation import get_datagen_info

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Warning · Implementation — Defer Mimic runtime imports

Importing generation before launch imports runtime environment code, contrary to this script's deferred-import boundary. Import it after launch; do the same for consolidated_demo and generate_data's new environment-module import.

}

return "locomanipulation_sdg_output_data", output_data_dict
def locomanipulation_sdg_output_data(output_data: LocomanipulationSDGOutputData) -> tuple[str, dict]:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Warning · Design Architecture — Keep the payload in its workflow

Only generate_data.py consumes this dataset payload, yet its schema remains in the environment module. Move the conversion beside that script's capture call.

filename = (
f"{image_path}_{data_type}_trial_{total_successes}_tile_{tile}_step_{env.common_step_counter}.png"
)
filename = f"{image_path}_{data_type}_tile_{tile}_step_{env.common_step_counter}.png"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Warning · Compatibility — Preserve documented image names

Removing the trial component changes filenames produced by save_image_to_file and contradicts its documented format. Keep legacy naming during a warned transition before switching formats.

def create_environment_config(
output_dir: str, output_file_name: str
) -> tuple[ManagerBasedRLEnvCfg | DirectRLEnvCfg, object | None, IsaacTeleopCfg | DeviceCfg]:
) -> tuple[ManagerBasedRLEnvCfg | DirectRLEnvCfg, object | None, IsaacTeleopCfg | DeviceCfg, EpisodeRecorderCfg]:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Warning · Compatibility — Preserve teleop setup return

create_environment_config now returns four values instead of three, breaking existing unpacking callers. Retain the three-value interface through a warned transition and expose recorder settings separately.

env_cfg.recorders.dataset_export_dir_path = output_dir
env_cfg.recorders.dataset_filename = output_file_name
env_cfg.recorders.dataset_export_mode = DatasetExportMode.EXPORT_SUCCEEDED_ONLY
recorder_cfg = load_cfg_from_registry(args_cli.task, "demo_recorder_cfg_entry_point")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Warning · Compatibility — Execute registered capture terms

The registered demo recorder configuration can contain custom terms, but the fixed workflow step uses only its output settings. Preserve configured fields during deprecation instead of silently omitting them.



def process_success_condition(
env: gym.Env, recorder: EpisodeRecorder, success_term: object | None, success_step_count: int

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Warning · Style Consistency — Document teleop recorder arguments

process_success_condition, handle_reset, and run_simulation_loop add recorder arguments but omit them from their Google-style Args sections. Document the shared storage and each function's use.

@greptile-apps

greptile-apps Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 4/5

[High impact] The PR changes how episode data is collected across several simulation and dataset workflows.

Fix the ignored custom step setting in the Warp frontend before merging.

Findings

  1. P1 Warp ignores custom steps ▶
  2. P2 Recording steps lack regression tests ▶

Summary

Adds ManagerBasedRLEnvCfg.step_fn and moves episode recording out of environments into recording workflows.

  • RL environments can use a custom function for each complete step.
  • Recording workflows choose when episodes are captured and exported.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A[Environment configuration] --> B{Frontend}
  B -->|Torch| C[Bind custom step when configured]
  B -->|Warp| D[Run Warp step]
  E[Recording workflow] --> F[Apply actions and advance physics]
  F --> G[Capture fields]
  G --> H[EpisodeRecorder]
  H --> I[Export or discard episode]
  I --> J[Reset and capture initial state]
Loading

Reviews (1) · Last reviewed commit: "Keep recording steps in their workflows" · Reviewed by Greptile

Comment on lines +92 to +93
if self.cfg.step_fn is not None:
self.step = MethodType(self.cfg.step_fn, self)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Warp ignores custom steps

With --frontend=warp, step_fn is silently ignored. That frontend creates ManagerBasedRLEnvWarp, which accepts ManagerBasedRLEnvCfg but does not inherit from ManagerBasedRLEnv or run this binding. Tasks therefore run the ordinary Warp step instead of their configured behavior. Bind the function in the Warp constructor too, or reject the setting there with a clear error.

Comment on lines +25 to +26
def test_configured_step_owns_execution_per_environment(monkeypatch):
"""A configured step receives its environment and bypasses the default stepping pipeline."""

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Recording steps lack regression tests

The new binding test uses a stub step, and the storage tests never call the six new workflow step functions. Each workflow now owns physics timing, capture, export, and reset ordering. The current tests cannot catch a misplaced capture call, a wrong export flag, or an extra physics step. Preserve the isolated workflow checks described in the PR as repeatable tests.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

@ooctipus
ooctipus force-pushed the configurable-step-function branch from b5c110f to 999bfc6 Compare November 20, 2026 21:18
@ooctipus

Copy link
Copy Markdown
Collaborator Author

run-ci

@isaaclab-bot isaaclab-bot Bot added ci:run-docker Trigger the on-demand Docker and GPU CI workflow and removed ci:run-docker Trigger the on-demand Docker and GPU CI workflow labels Nov 20, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation isaac-lab Related to Isaac Lab team isaac-mimic Related to Isaac Mimic team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant