Skip to content

Accept done-only final observations with learned dynamics - #308

Merged
ClemensSchwarke merged 1 commit into
leggedrobotics:extrasfrom
lgulich:lgulich/learned-dynamics-done-only-final-obs
Nov 25, 2026
Merged

ClemensSchwarke merged 1 commit into
leggedrobotics:extrasfrom
lgulich:lgulich/learned-dynamics-done-only-final-obs

Conversation

@lgulich

@lgulich lgulich commented Nov 24, 2026

Copy link
Copy Markdown
Collaborator

SHAC with learned dynamics requires every environment to report extras["final_obs_every_step"] = True, i.e. to capture the physical successor of every environment on every step, before resets and before interval events such as pushes. In Isaac Lab this needs a dedicated mode in every environment base class (manager-based, direct, multi-agent and the Warp environments) plus the wrappers, which is most of the core-environment change in isaac-sim/IsaacLab#8867.

Resets don't need it. The successor of a finished episode is already available from the regular extras["final_obs"], the same contract SAC uses, and replay windows still end at dones, so no world-model window ever spans two episodes. The flag only adds something for interval edits in the middle of an episode, which are rare: in G1 motion tracking, pushes touch about 0.16% of transitions (the logged window_break_fraction). The original SuperMimic implementation on mjlab sidesteps them the same way, by disabling pushes and not using pre-reset successors at all.

Learned dynamics now follows the SAC contract: done environments take their successor from final_obs, the others the returned observations, and a step with a done but without final_obs raises. Environments that set final_obs_every_step keep the current behavior, including cutting model-fitting windows after interval edits through window_break; without it, pushes are learned as part of the dynamics. SHAC with a differentiable task is unchanged.

On G1 motion tracking (Isaac Lab, 3 seeds of 60 minutes each on one L40S, before the SHAC refactor but with the same change), training without every-step capture matched training with it:

  • SuperMimic recipe: episode reward 12.1 ± 0.4 vs 11.7 ± 0.3, world-model error 0.027 vs 0.029
  • BlinkMimic recipe: episode reward 13.8 ± 0.2 vs 13.5 ± 0.7, body position error 0.024 vs 0.031 m

To run the tests:

pytest tests/algorithms/test_shac.py

🤖 Generated with Claude Code

Learned dynamics required every environment to capture physical
successors before interval events on every step, which needs a dedicated
environment feature. Interval edits such as pushes are rare, about one
transition in 600 in G1 motion tracking, while resets are covered by the
final observations that SAC already relies on. On G1 motion tracking,
3 seeds of 60 minutes per recipe trained as well without every-step
capture as with it.

Successors now follow the SAC contract: done environments use
extras["final_obs"] and the others the returned observations.
Environments that set extras["final_obs_every_step"] still provide
pre-event successors and cut model-fitting windows after interval
edits.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@ClemensSchwarke
ClemensSchwarke merged commit 10c49d2 into leggedrobotics:extras Nov 25, 2026
7 checks passed
lgulich added a commit to isaac-sim/IsaacLab that referenced this pull request Nov 25, 2026
## Motivation

#9193 added a public option, `final_obs_every_step`, to the configs of
the manager-based, direct and multi-agent environments. Only SuperMimic
uses it: its learned dynamics needed every environment to capture the
physical successor on every step, before resets and interval events.
That is a public API change to every environment type for a single
learner, and it hasn't shipped yet. This PR reverts it before 3.1 is
released.

## Change

The revert is possible because of `rsl-rl-lib-extras` 6.0.0.2
(leggedrobotics/rsl_rl#308). Learned dynamics there follows the same
contract as SAC: the successors of finished episodes come from the
regular `extras["final_obs"]`, and the others from the returned
observations. The environments go back to their state before #9193, the
SuperMimic runner config enables `compute_final_obs` instead of the
removed option, and the dependency moves to 6.0.0.2.

## Effect on training

Training is unaffected. Resets are handled as before, and replay windows
still stop at dones. Command updates only change goal observations, not
the `state` and `labels` groups the world model learns from. So the only
difference is that physical interval edits such as pushes now enter the
world model's targets, about one transition in 600 in G1 motion
tracking. On `Isaac-Motion-Tracking-G1` (Newton, default environment
count, one L40S per run, 3 seeds × 60 minutes per recipe), training with
and without every-step capture gave the same results: episode reward
12.1 ± 0.4 without vs 11.7 ± 0.3 with it for the SuperMimic recipe, and
13.8 ± 0.2 vs 13.5 ± 0.7 for the BlinkMimic recipe, with the same
world-model error.

## Viewer-reset fix

Since SuperMimic now relies on `final_obs`, this also fixes a gap that
affected SAC: a reset requested from the viewer on a step without an
automatic reset ended episodes without capturing their final
observations. The three environment types now capture them in that case
too.

## Testing

To train:

```
uv run isaaclab train --rl_library rsl_rl --task Isaac-Motion-Tracking-G1 \
    --agent rsl_rl_supermimic_cfg_entry_point presets=state_obs
```

On one RTX 6000 Ada with 1024 environments, the reward rose from 0.17 to
7.4 in under 8 minutes.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants