Skip to content

[Kamino] Success Metric for Fourbar-pole and DR Legs - #6542

Merged
AntoineRichard merged 6 commits into
isaac-sim:developfrom
aserifi:aserifi/kamion-success-metric
Jul 30, 2026
Merged

AntoineRichard merged 6 commits into
isaac-sim:developfrom
aserifi:aserifi/kamion-success-metric

Conversation

@aserifi

@aserifi aserifi commented Jul 15, 2026

Copy link
Copy Markdown
Collaborator

Description

Add success metrics for the Kamino tasks

Adds a unified Metrics/success_rate metric to three tasks so training runs and the benchmark tooling can measure task success:

  • Fourbar-pole: success = pole held within the upright cone (cos > success_threshold) for the final hold_time_s of the episode.
  • DR-Legs walk: success = survived AND base velocity tracked within tolerance AND foot-contact pattern matched the reference gait (episode-mean).
  • DR-Legs hold-pose: success = survived the full episode without falling/tilting.

All three emit the standard Metrics/success_rate tag, so the benchmark success tracking / --check_success early-stop works with no benchmark-side changes. The two threshold/hold params on each metric are logging-only and do not affect training.

Checklist

  • I have read and understood the contribution guidelines
  • I have run the pre-commit checks with ./isaaclab.sh --format
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • I have updated the changelog and the corresponding version in the extension's config/extension.toml file
  • I have added my name to the CONTRIBUTORS.md or my name already exists there

@aserifi aserifi self-assigned this Jul 15, 2026
@github-actions github-actions Bot added the isaac-lab Related to Isaac Lab team label Jul 15, 2026
@greptile-apps

greptile-apps Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds a unified Metrics/success_rate logging metric to three Kamino tasks (fourbar-pole swing-up, DR-Legs walk, DR-Legs hold-pose) by converting the relevant reward terms to stateful ManagerTermBase classes that accumulate per-episode data and flush the metric on reset. The old command-based UprightSuccessRateCommand mechanism for the fourbar-pole task is removed and replaced with a simpler in-reward approach.

  • Fourbar-pole: pole_upright is refactored from a plain function to a stateful class that tracks consecutive upright steps and logs whether the pole was held upright for at least hold_time_s seconds at episode end.
  • DR-Legs walk: New walk_success_rate term accumulates per-step velocity-tracking error and gait-contact match rate, then computes a combined success flag on reset; weight=1.0 is necessary (not a training signal) because the reward manager skips __call__ for weight=0.0 terms \u2014 this constraint is currently undocumented.
  • DR-Legs hold-pose: New survival_success_rate term correctly uses weight=0.0 since its __call__ is a no-op and the only logic runs in reset() via termination_manager.time_outs.

Confidence Score: 4/5

Safe to merge with the walk_success_rate weight caveat addressed; the metric infrastructure is sound and training behavior is unchanged.

The walk_success_rate term sets weight=1.0 and returns zeros on every call, meaning it adds nothing to training. However, the non-zero weight is a structural necessity — the RewardManager skips call entirely for weight=0.0 terms, so changing it to 0.0 (a natural cleanup given that survival_success_rate uses 0.0) would silently freeze the accumulators and cause the metric to always report 0% success. This invariant is not documented anywhere in the code or PR description, making it a quiet trap for future maintainers.

walk_env_cfg.py (weight=1.0 constraint on walk_success_rate needs an inline comment) and dr_legs/mdp/rewards.py (walk_success_rate class needs a docstring note about the weight requirement).

Important Files Changed

Filename Overview
source/isaaclab_tasks/isaaclab_tasks/contrib/dr_legs/walk_env_cfg.py Adds walk_success_rate term to WalkRewardsCfg with weight=1.0. The non-zero weight is a structural requirement (not a training signal), but no comment explains this; the pattern established by survival_success_rate uses weight=0.0, making the inconsistency easy to trigger as a silent bug.
source/isaaclab_tasks/isaaclab_tasks/contrib/dr_legs/mdp/rewards.py Adds survival_success_rate and walk_success_rate stateful reward classes. walk_success_rate accumulates per-step velocity and contact errors and logs a success metric on episode reset. The non-zero weight (1.0) on walk_success_rate is necessary for call to be invoked but is undocumented.
source/isaaclab_tasks/isaaclab_tasks/core/fourbar_pole/mdp/rewards.py Refactors pole_upright from a plain function to a ManagerTermBase class tracking consecutive upright steps. Removes old UprightSuccessRateCommand approach. Minor: hold_steps is recomputed on every call.
source/isaaclab_tasks/isaaclab_tasks/contrib/dr_legs/hold_pose_env_cfg.py Adds survival_success_rate with weight=0.0 to RewardsCfg; correct since its call is a no-op and logic only runs in reset().
source/isaaclab_tasks/isaaclab_tasks/core/fourbar_pole/fourbar_pole_manager_env_cfg.py Removes CommandsCfg and the upright command term, adds success_threshold and hold_time_s params to pole_upright. Clean removal of the command-based approach.
source/isaaclab_tasks/isaaclab_tasks/core/fourbar_pole/mdp/init.pyi Removes UprightSuccessRateCommand and UprightSuccessRateCommandCfg exports; stub kept in sync.
source/isaaclab_tasks/isaaclab_tasks/contrib/dr_legs/mdp/init.pyi Adds survival_success_rate and walk_success_rate exports; stub kept in sync.
source/isaaclab_tasks/changelog.d/aserifi-kamion-success-metric.minor.rst Changelog entry for the new Metrics/success_rate addition.

Sequence Diagram

%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
    participant RM as RewardManager
    participant WSR as walk_success_rate
    participant SSR as survival_success_rate
    participant PU as pole_upright
    participant Extras as env.extras

    note over RM: Each env step
    RM->>WSR: "__call__ [weight=1.0, not skipped]"
    WSR->>WSR: accumulate error sums and steps
    WSR-->>RM: zeros tensor
    RM->>SSR: "__call__ SKIPPED [weight=0.0]"
    RM->>PU: __call__
    PU->>PU: update consecutive_upright and success
    PU-->>RM: sum(cos(pole_angle))

    note over RM: Episode end - reset(env_ids)
    RM->>WSR: reset(env_ids)
    WSR->>Extras: Metrics/success_rate, error_vel_xy, contact_match_rate
    RM->>SSR: reset(env_ids)
    SSR->>Extras: Metrics/success_rate
    RM->>PU: reset(env_ids)
    PU->>Extras: Metrics/success_rate
    PU->>PU: clear consecutive_upright
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
    participant RM as RewardManager
    participant WSR as walk_success_rate
    participant SSR as survival_success_rate
    participant PU as pole_upright
    participant Extras as env.extras

    note over RM: Each env step
    RM->>WSR: "__call__ [weight=1.0, not skipped]"
    WSR->>WSR: accumulate error sums and steps
    WSR-->>RM: zeros tensor
    RM->>SSR: "__call__ SKIPPED [weight=0.0]"
    RM->>PU: __call__
    PU->>PU: update consecutive_upright and success
    PU-->>RM: sum(cos(pole_angle))

    note over RM: Episode end - reset(env_ids)
    RM->>WSR: reset(env_ids)
    WSR->>Extras: Metrics/success_rate, error_vel_xy, contact_match_rate
    RM->>SSR: reset(env_ids)
    SSR->>Extras: Metrics/success_rate
    RM->>PU: reset(env_ids)
    PU->>Extras: Metrics/success_rate
    PU->>PU: clear consecutive_upright
Loading

Reviews (1): Last reviewed commit: "Add changelog" | Re-trigger Greptile

@AntoineRichard AntoineRichard left a comment •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looks fine by me, let me check with the team if we'd be happy with this style.

@aserifi
aserifi requested a review from kellyguo11 July 19, 2026 13:58
@aserifi
aserifi force-pushed the aserifi/kamion-success-metric branch from 5b3d841 to 30c1209 Compare July 20, 2026 01:02
@aserifi
aserifi requested a review from a team July 20, 2026 01:02
@aserifi
aserifi force-pushed the aserifi/kamion-success-metric branch from 30c1209 to 5105a08 Compare July 23, 2026 15:35
@aserifi
aserifi force-pushed the aserifi/kamion-success-metric branch 2 times, most recently from 363369e to 27b668e Compare July 28, 2026 12:14
@aserifi
aserifi force-pushed the aserifi/kamion-success-metric branch from 27b668e to 8e4ad4d Compare July 28, 2026 18:37
@AntoineRichard
AntoineRichard merged commit a050cea into isaac-sim:develop Jul 30, 2026
40 checks passed
matthewtrepte pushed a commit to matthewtrepte/IsaacLab that referenced this pull request Aug 4, 2026
# Description

Add success metrics for the Kamino tasks

Adds a unified `Metrics/success_rate` metric to three tasks so training
runs and the benchmark tooling can measure task success:

- Fourbar-pole: success = pole held within the upright cone (`cos >
success_threshold`) for the final `hold_time_s` of the episode.
- DR-Legs walk: success = survived AND base velocity tracked within
tolerance AND foot-contact pattern matched the reference gait
(episode-mean).
- DR-Legs hold-pose: success = survived the full episode without
falling/tilting.

All three emit the standard `Metrics/success_rate` tag, so the benchmark
success tracking / `--check_success` early-stop works with no
benchmark-side changes. The two threshold/hold params on each metric are
logging-only and do not affect training.

## Checklist

- [x] I have read and understood the [contribution
guidelines](https://isaac-sim.github.io/IsaacLab/main/source/refs/contributing.html)
- [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with
`./isaaclab.sh --format`
- [x] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [ ] 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
-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

isaac-lab Related to Isaac Lab team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants