Skip to content

Fix OvPhysX scene gravity randomization - #7213

Merged
kellyguo11 merged 3 commits into
isaac-sim:developfrom
AntoineRichard:codex/ovstage-gravity-fix
Aug 20, 2026
Merged

kellyguo11 merged 3 commits into
isaac-sim:developfrom
AntoineRichard:codex/ovstage-gravity-fix

Conversation

@AntoineRichard

@AntoineRichard AntoineRichard commented Aug 20, 2026 •

Copy link
Copy Markdown
Collaborator

Description

Routes scene-wide gravity randomization for the kitless OvPhysX backend through sealed OvStage control ordinals. The change adds a live OvPhysxManager.set_gravity() path, dispatches the shared gravity event to it, and re-enables the intended variable-gravity event and ADR curriculum for Kuka-Allegro tasks.

Native OvStage path/query resources are released deterministically on success and failure. No new dependencies are required.

Validation:

  • 19 focused lifecycle, task-preset, and combined dispatch/real-backend tests passed.
  • Isaac-Lift-KukaAllegro with physics=ovphysx, presets=cube, two CUDA environments completed initialization, first reset, and five steps with variable_gravity and gravity_adr active.
  • uv run isaaclab -f passed.
  • Warmed CPU microbenchmark, 30 calls: update_from_ovstage mean 1.56 ms / p95 1.75 ms; complete set_gravity mean 1.78 ms / p95 1.99 ms.

Type of change

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

Screenshots

Not applicable.

Checklist

  • I have read and understood the contribution guidelines
  • I have run the pre-commit checks with uv run isaaclab -f
  • I updated API documentation and changelog fragments; no separate user guide change is required
  • My changes generate no new warnings
  • I have added tests that prove the fix is effective
  • I have added a changelog fragment for every touched package
  • My name already exists in CONTRIBUTORS.md

@AntoineRichard
AntoineRichard requested a review from a team August 20, 2026 09:22
@github-actions github-actions Bot added bug Something isn't working isaac-lab Related to Isaac Lab team labels Aug 20, 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 PR correctly adds live OvPhysX gravity updates through sealed OvStage control ordinals, routes scene gravity randomization through the new manager setter, and re-enables Kuka-Allegro gravity events. One API consistency issue remains: the manager’s gravity getter continues to report the configured baseline after the solver gravity changes.

  • Design and architecture: The OvPhysX branch fits the existing backend dispatch, and control ordinals are reset with the OvStage lifecycle. However, the runtime gravity state now has separate write and read paths that are not synchronized.
  • API: The new set_gravity() classmethod has clear units, validation, and failure contracts. It must also keep get_gravity() consistent: that backend-agnostic accessor currently returns cls._sim.cfg.gravity, which becomes stale after a live update. Cache the applied value separately so the configuration remains the randomization baseline.
  • Implementation: OvStage path dictionaries, path lists, and queries are released deterministically on success and failure. The remaining implementation fix is to track the applied gravity, reset that state with the stage lifecycle, and return it from get_gravity().

Minor fixes needed. Posted 1 actionable finding inline.

Automated review; human maintainers own approval decisions.

return cls._sim.cfg.gravity

@classmethod
def set_gravity(cls, gravity: tuple[float, float, float]) -> 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.

🟡 Warning · Api — set_gravity leaves get_gravity returning stale value

get_gravity() returns cls._sim.cfg.gravity and is documented as mirroring PhysX's SimulationView.get_gravity() so backend-agnostic sensor code can read gravity through one classmethod. set_gravity() changes the running solver without recording the applied vector, so after the now-enabled variable_gravity event OvPhysX consumers read nominal gravity while physics uses the randomized value. Cache the applied vector (reset with the stage lifecycle) and return it from get_gravity(); do not overwrite cfg.gravity, which the event uses as its sampling baseline.

@greptile-apps

greptile-apps Bot commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Routes scene-wide gravity randomization through the OvPhysX manager and re-enables the associated Kuka-Allegro event and curriculum.

  • Adds live gravity updates using sealed OvStage control ordinals with deterministic native-resource cleanup.
  • Dispatches the shared gravity-randomization event to the OvPhysX backend.
  • Restores variable-gravity randomization and ADR for Kuka-Allegro OvPhysX presets.
  • Adds dispatch, backend, lifecycle, and task-configuration coverage.

Confidence Score: 5/5

The PR appears safe to merge with no concrete blocking or independently actionable non-blocking defects identified.

The new dispatch follows the documented scene-wide backend semantics, the first live ordinal follows the sealed initialization ordinal, native resources are cleaned up on failure, and focused tests cover dispatch, lifecycle, task configuration, and real-backend behavior.

Important Files Changed

Filename Overview
source/isaaclab/isaaclab/envs/mdp/events.py Adds explicit OvPhysX backend detection and routes scene-wide gravity samples to the physics manager.
source/isaaclab_ov/isaaclab_ov/physics/ovphysx_manager.py Implements validated live gravity updates through sealed OvStage ordinals and deterministic path/query cleanup.
source/isaaclab_tasks/isaaclab_tasks/core/lift/config/kuka_allegro/kuka_allegro_env_cfg.py Removes the OvPhysX-specific suppression of variable gravity and its ADR curriculum.
source/isaaclab_ov/test/physics/test_ovphysx_manager_lifecycle.py Covers successful control updates and native-resource cleanup after query or write failures.
source/isaaclab_ov/test/physics/test_ovphysx_gravity.py Verifies against the real backend that live gravity changes affect rigid-body motion.

Sequence Diagram

sequenceDiagram
    participant Event as Gravity randomization event
    participant Manager as OvPhysxManager
    participant Stage as OvStage
    participant PhysX as OvPhysX runtime
    Event->>Manager: set_gravity(vector)
    Manager->>Stage: write gravityDirection(ordinal)
    Manager->>Stage: write gravityMagnitude(ordinal)
    Manager->>Stage: advance_write_floor(ordinal)
    Manager->>PhysX: update_from_ovstage(ordinal, ordinal)
    Manager-->>Event: gravity update applied
Loading

Reviews (1): Last reviewed commit: "Complete OvPhysX gravity randomization s..." | Re-trigger Greptile

@marcodiiga marcodiiga 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.

Re-reviewed at 0659722. No blocking issues found. The consolidated real-backend regression now exercises the full event dispatch, and focused CPU/CUDA validation confirms that the sealed OvStage update changes the running solver. The Kuka-Allegro reset path also runs with variable gravity and its curriculum enabled.

Two non-blocking follow-ups remain: the existing get_gravity() consistency thread, and the scene-wide PhysX/OvPhysX paths forcing non-uniform configurations through the uniform sampler. Approving.

None,
slice(None),
operation=operation,
distribution="uniform",

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.

The configured distribution is ignored here. Initialization accepts gaussian and log_uniform, but this new OvPhysX path always passes distribution="uniform", so those modes silently sample from the wrong distribution. Please preserve the configured distribution for this branch; the corresponding PhysX branch currently has the same issue. This is non-blocking for the Kuka configuration, which uses constant bounds.

@kellyguo11
kellyguo11 merged commit f41e4bd into isaac-sim:develop Aug 20, 2026
47 of 48 checks passed
kellyguo11 added a commit that referenced this pull request Aug 21, 2026
## Summary

Cherry-picks the following merged PRs from `develop` onto
`release/3.0.0`, preserving each as an individual commit with `-x`
provenance:

- #7193 — Bake CI pytest deps into the built Docker image
- #7077 — Add OVPhysX support to Franka deformable lift tasks
- #7175 — Raise on unsupported camera renderer outputs
- #7174 — Fix benchmark play inference scope
- #7173 — Report resolved backend for play benchmarks
- #7172 — Add video recording to play benchmarks
- #7215 — Reduce GearAssembly default environment count
- #7214 — Remove Kamino preset from open drawer
- #7213 — Fix OvPhysX scene gravity randomization
- #7212 — Fix OVPhysX material binding device selection
- #7189 — Make preview surfaces renderer agnostic
- #7206 — Fix OVPhysX benchmark articulation setup

All cherry-picks and the final rebase onto the latest `release/3.0.0`
tip completed without conflicts.

## Validation

- Verified all 12 backported commits have patch IDs identical to their
source squash commits and retain their `cherry picked from` footers.
- `git diff --check upstream/release/3.0.0..HEAD`
- Bash syntax validation for the modified CI shell scripts.
- YAML parsing for the modified composite actions.
- Changelog validation against `release/3.0.0`.
- Targeted pytest coverage for benchmark APIs/play, video recording,
GearAssembly defaults, OVPhysX presets and runtime semantics, and
renderer-agnostic materials: **81 passed, 4 skipped, 1 deselected**.
- The deselected case is an unchanged test that hard-codes a POSIX
`/tmp` path and fails on Windows path normalization.
- `uv run isaaclab -f` passed all hooks except the changelog hook's
known release-branch baseline finding for
`source/isaaclab/changelog.d/core-test-config-fixtures.skip`; the
targeted release-base changelog check passed.

---------

Co-authored-by: Matthew Taylor <[email protected]>
Co-authored-by: Antoine RICHARD <[email protected]>
Co-authored-by: Mike Yan Michelis <[email protected]>
Co-authored-by: Maximilian Krause <[email protected]>
Co-authored-by: Octi Zhang <[email protected]>
Co-authored-by: Mustafa H <[email protected]>
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.

3 participants