Skip to content

Validate gaussian scale randomization parameters as mean and std - #8123

Closed
mmporong wants to merge 2 commits into
isaac-sim:developfrom
mmporong:fix-gaussian-scale-validation
Closed

mmporong wants to merge 2 commits into
isaac-sim:developfrom
mmporong:fix-gaussian-scale-validation

Conversation

@mmporong

@mmporong mmporong commented Sep 29, 2026 •

Copy link
Copy Markdown

Description

randomize_rigid_body_mass, randomize_rigid_body_inertia, randomize_actuator_gains, randomize_joint_parameters and randomize_fixed_tendon_parameters check their *_distribution_params with _validate_scale_range when operation="scale". That check, added in #3058, treats the parameters as a (low, high) range for every distribution, but with distribution="gaussian" they are (mean, std). The configuration from the issue,

mass_distribution_params=(0.5, 0.1), operation="scale", distribution="gaussian"

fails at term construction with ValueError: mass_distribution_params: upper bound (0.1) must be ≥ lower bound (0.5).

This PR passes the term's distribution (default "uniform", the same default as the term's __call__) to _validate_scale_range at all nine call sites. For gaussian parameters the function now:

  • applies the existing lower-bound rules to the mean, so a mean that Adds basic validation tests for scale-based randomization ranges #3058 would reject as a lower bound (for example, a mass mean of 0.0) is still rejected. Gaussian samples are unbounded, so this checks the configuration, not every sampled scale;
  • reports a negative standard deviation as standard deviation must be ≥ 0. develop already rejected such a configuration, but as an upper/lower-bound ordering error.

uniform and log_uniform ranges are accepted and rejected as before. The docstrings of the five terms list the new error.

Tested without Isaac Sim, on CPU in an Ubuntu 24.04 Docker container (Python 3.12, torch 2.12.0 CPU wheel, isaaclab, isaaclab_physx and isaaclab_contrib installed in editable mode):

  • The new parametrized test_scale_range_validation_follows_distribution in source/isaaclab/test/envs/test_event_requirements.py builds randomize_rigid_body_mass with a SimpleNamespace env. On develop the valid gaussian case fails with the error from the issue, and the negative-std and zero-mean cases fail because develop rejects them with the (low, high) wording; the uniform case passes. With this change all four pass.
  • source/isaaclab/test/envs/test_event_requirements.py: 10 passed. source/isaaclab/test/managers/test_event_manager.py: 14 passed.
  • The hooks in .pre-commit-config.yaml pass on the changed files (run with pre-commit run --files).

The issue is assigned. If a fix is already in progress there, I am happy to close this one.

This PR was prepared with Claude Code (Claude Opus 5.5): the code change, the test, the verification and this description.

Fixes #3514

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Release backport

  • Backport this pull request to the active release branch after it merges into develop

Screenshots

Not applicable.

Checklist

Docker and GPU tests run on demand. Push the commits you want tested, then
comment run-ci on the pull request.

  • I have read and understood the contribution guidelines
  • I have run the pre-commit checks with uv run isaaclab --format
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have validated the changed behavior with focused coverage and applied the test-audit criteria to any test changes
  • I have added a changelog fragment under source/<pkg>/changelog.d/ for every touched package (do not edit CHANGELOG.rst or bump package versions — CI handles that)
  • I have added my name to the CONTRIBUTORS.md or my name already exists there

The scale operation of the rigid body mass, inertia, actuator gain, joint
parameter and fixed tendon randomization terms validated the distribution
parameters as a (low, high) range for every distribution. With
distribution="gaussian" the parameters are (mean, std), so a valid
configuration such as (0.5, 0.1) was rejected with "upper bound (0.1)
must be ≥ lower bound (0.5)".

Pass the distribution to _validate_scale_range. For gaussian it checks the
mean with the existing lower-bound rules and requires a non-negative
standard deviation. Uniform and log-uniform ranges are checked as before.

Fixes #3514

Signed-off-by: Lim-jooyoung <mmporong@gmail.com>
@mmporong
mmporong requested a review from a team September 29, 2026 03:15
@github-actions github-actions Bot added bug Something isn't working isaac-lab Related to Isaac Lab team labels Sep 29, 2026
@mmporong

Copy link
Copy Markdown
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 Sep 29, 2026

@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

The change correctly makes scale validation distribution-aware across the five affected event terms, interpreting gaussian parameters as (mean, std) while preserving range validation for uniform and log-uniform distributions. Documentation, changelog, and focused regression coverage accompany the implementation.

  • Design and architecture: Validation remains centralized in the existing private _validate_scale_range helper. Each of the nine affected parameter paths forwards the event term’s configured distribution, with the default aligned to the corresponding __call__ default. Gaussian sampling remains unbounded, so validation intentionally constrains the configured mean and standard deviation rather than guaranteeing every sampled multiplier is non-negative.
  • API: The private helper gains a keyword-only argument with a default, preserving existing internal call compatibility. Public event-term signatures are unchanged, constructor error documentation is updated, and the package changelog records the corrected gaussian parameter semantics.
  • Implementation: The validator preserves existing positivity and zero constraints on the first parameter, retains ordering checks for uniform and log-uniform ranges, and adds the appropriate non-negative standard-deviation check for gaussian parameters. The focused test exercises mass-term construction; the remaining affected paths use the same helper and were traced to ensure they pass their configured distribution consistently.

No blocking issues. No inline issue met the actionable-evidence threshold; the assessment above records the review feedback.

Automated review; human maintainers own approval decisions.

@greptile-apps

greptile-apps Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 4/5

[Medium risk] Fixes parameter validation for randomization functions.

The PR appears safe to merge; broader construction-time coverage would reduce regression risk.

Findings

  1. P2 Other terms lack test coverage ▶

Summary

The PR updates scale-parameter validation to interpret Gaussian parameters as (mean, std) while preserving range checks for uniform distributions, and adds a construction-time regression test.

  • Extends the distribution-aware check to five event terms and nine parameter fields.
  • Adds documentation and a changelog fragment.

Reviews (1) · Last reviewed commit: "Validate gaussian scale randomization pa..."

pytest.param("uniform", (0.5, 0.1), "upper bound", id="uniform-reversed-range"),
],
)
def test_scale_range_validation_follows_distribution(distribution, params, error) -> None:

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 Other terms lack test coverage The new cases construct only randomize_rigid_body_mass, but this change updates nine validation calls across five terms. A missed or mismatched call in another term would go unnoticed. Please add construction-time cases for the other terms, including a field that allows zero and a term with multiple distribution parameters.

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!

Extend the scale validation test to randomize_rigid_body_inertia,
randomize_actuator_gains, randomize_joint_parameters and
randomize_fixed_tendon_parameters, so each of the nine
_validate_scale_range calls is exercised at term construction.

Add rows for a field that allows a zero mean (tendon damping) and one
that does not (tendon stiffness), and check the uniform fallback when no
distribution is given.

Signed-off-by: Lim-jooyoung <mmporong@gmail.com>
@mmporong

Copy link
Copy Markdown
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 Sep 29, 2026
ooctipus added a commit that referenced this pull request Sep 30, 2026
…ibutions (#8127)

# Description

Manager term constructors currently repeat defaults already declared in
their callable signatures. This can make construction disagree with
execution: omitting an optional `operation` raises `KeyError` in several
randomization terms, and Gaussian mass scaling `(0.5, 0.1)` is rejected
as a reversed `(low, high)` range.

Resolve omitted keyword defaults into the term's existing `params`
mapping before construction and scene resolution. The stable and
experimental managers share the implementation; mutable defaults are
copied per term and explicit values, including `None`, are preserved.
Direct class construction receives the same defaults after
`super().__init__`. Backend and task constructors now consume those
resolved parameters. Observation-manager `out` buffers remain
manager-owned, and task guards for required values now check `None`
where appropriate.

Replace scale-only validation with distribution-aware construction
checks for mass, inertia, actuator gains, joint parameters, and fixed
tendons. Gaussian parameters are `(mean, std)`, uniform ranges remain
ordered, log-uniform bounds must be positive, and non-finite parameters
fail early. These checks cover `add`, `abs`, and `scale`; the existing
scale-sign policy remains separate from distribution validity. Exception
documentation uses one `ValueError` entry per constructor.

No validation or signature inspection is added to simulation/reset
loops. Runtime parameter changes continue through the same mapping; this
change does not add revalidation of arbitrary mutations after
construction. A positive Gaussian mean still does not guarantee positive
samples.

Fixes #3514. This is a broader alternative to #8123, with shared
parameter-default resolution and repository-wide adoption.

## Validation

- **183 passed across 15 test files**, each run in its own process:
stable manager suites; event requirements; camera terms and
camera/manager integration; experimental frontend and reward parity;
task curricula; PhysX, Newton and OVPhysX event integration.
- Confirmed the default-resolution regression fails when default
population is disabled, and the Gaussian regression fails against the
original mass constructor with the reported bound-order error.
- `uv run isaaclab -f` and the changelog gate passed against the
upstream PR base; GitHub pre-commit and changelog checks also passed.
- Clean `uv run isaaclab --docs` build passed with warnings treated as
errors; the final incremental build also passed.
- Existing dependency deprecation warnings remain in test output.

## Type of change

- Bug fix

## Release backport

- [x] <!-- backport-active-release --> Backport this pull request to the
active release branch after it merges into `develop`

## Checklist

- [x] I have read and understood the contribution guidelines
- [x] I have run the pre-commit checks with `uv run isaaclab --format`
- [x] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [x] I have validated the changed behavior with focused coverage and
applied the test-audit criteria
- [x] I have added a changelog fragment for every touched package
- [x] My name already exists in `CONTRIBUTORS.md`

---------

Co-authored-by: Octi Zhang <zhengyuz@nvidia.com>
isaaclab-bot Bot pushed a commit that referenced this pull request Sep 30, 2026
…ibutions (#8127)

# Description

Manager term constructors currently repeat defaults already declared in
their callable signatures. This can make construction disagree with
execution: omitting an optional `operation` raises `KeyError` in several
randomization terms, and Gaussian mass scaling `(0.5, 0.1)` is rejected
as a reversed `(low, high)` range.

Resolve omitted keyword defaults into the term's existing `params`
mapping before construction and scene resolution. The stable and
experimental managers share the implementation; mutable defaults are
copied per term and explicit values, including `None`, are preserved.
Direct class construction receives the same defaults after
`super().__init__`. Backend and task constructors now consume those
resolved parameters. Observation-manager `out` buffers remain
manager-owned, and task guards for required values now check `None`
where appropriate.

Replace scale-only validation with distribution-aware construction
checks for mass, inertia, actuator gains, joint parameters, and fixed
tendons. Gaussian parameters are `(mean, std)`, uniform ranges remain
ordered, log-uniform bounds must be positive, and non-finite parameters
fail early. These checks cover `add`, `abs`, and `scale`; the existing
scale-sign policy remains separate from distribution validity. Exception
documentation uses one `ValueError` entry per constructor.

No validation or signature inspection is added to simulation/reset
loops. Runtime parameter changes continue through the same mapping; this
change does not add revalidation of arbitrary mutations after
construction. A positive Gaussian mean still does not guarantee positive
samples.

Fixes #3514. This is a broader alternative to #8123, with shared
parameter-default resolution and repository-wide adoption.

## Validation

- **183 passed across 15 test files**, each run in its own process:
stable manager suites; event requirements; camera terms and
camera/manager integration; experimental frontend and reward parity;
task curricula; PhysX, Newton and OVPhysX event integration.
- Confirmed the default-resolution regression fails when default
population is disabled, and the Gaussian regression fails against the
original mass constructor with the reported bound-order error.
- `uv run isaaclab -f` and the changelog gate passed against the
upstream PR base; GitHub pre-commit and changelog checks also passed.
- Clean `uv run isaaclab --docs` build passed with warnings treated as
errors; the final incremental build also passed.
- Existing dependency deprecation warnings remain in test output.

## Type of change

- Bug fix

## Release backport

- [x] <!-- backport-active-release --> Backport this pull request to the
active release branch after it merges into `develop`

## Checklist

- [x] I have read and understood the contribution guidelines
- [x] I have run the pre-commit checks with `uv run isaaclab --format`
- [x] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [x] I have validated the changed behavior with focused coverage and
applied the test-audit criteria
- [x] I have added a changelog fragment for every touched package
- [x] My name already exists in `CONTRIBUTORS.md`

---------

Co-authored-by: Octi Zhang <zhengyuz@nvidia.com>

(cherry picked from commit e73d1f1)
@StafaH

StafaH commented Oct 1, 2026

Copy link
Copy Markdown
Collaborator

This is now resolved by #8127 which does a more broader fix of this issue across the codebase

@StafaH StafaH closed this Oct 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working isaac-lab Related to Isaac Lab team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug Report] Incorrect Parameter Validation for Gaussian Distribution in randomize_rigid_body_mass

3 participants