Repository navigation
Add OVPhysX deformable object support - #6665
AntoineRichard merged 28 commits into
Conversation
Greptile SummaryThis PR adds a full OVPhysX deformable-object backend (volume and surface), including typed views, a lazy data container, Warp kernels, and material adapters. It also upgrades the
Confidence Score: 3/5The core deformable simulation path works for the tested single-reset scenario, but a latent defect in the full-stage flag lifecycle means the binding layer may silently break on full simulation restarts, which no current test covers. The Focus on Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant SimCtx as SimulationContext
participant OVMgr as OvPhysxManager
participant DefObj as DeformableObject
participant OVView as OvPhysxView
User->>SimCtx: build_simulation_context()
SimCtx->>OVMgr: "initialize() → _requires_full_stage = False"
User->>DefObj: __init__(cfg)
DefObj->>OVMgr: "require_full_stage() → _requires_full_stage = True"
Note over DefObj: queue_usd_replication(cfg)
User->>SimCtx: sim.reset()
Note over SimCtx,OVMgr: Full sim reset calls initialize() again → _requires_full_stage = False
SimCtx->>DefObj: _initialize_impl()
DefObj->>OVView: "OvPhysxView(..., eager=True)"
OVView->>OVMgr: create_tensor_binding()
OVMgr->>OVMgr: _warmup_and_load() uses _requires_full_stage
OVMgr->>OVMgr: _replay_pending_clones()
OVView-->>DefObj: bindings ready
DefObj->>DefObj: _create_buffers()
loop Simulation steps
User->>DefObj: write_nodal_pos_to_sim_index(pos, env_ids)
DefObj->>OVView: set_simulation_nodal_positions(f32_view, indices)
User->>DefObj: data.nodal_pos_w (lazy read)
DefObj->>OVView: read_simulation_nodal_positions_into(buf)
end
Reviews (1): Last reviewed commit: "Fix OVPhysX deformable type detection" | Re-trigger Greptile |
| super().__init__(cfg) | ||
| queue_usd_replication(cfg) | ||
| OvPhysxManager.require_full_stage() | ||
| self._DTYPE_TO_TORCH_TRAILING_DIMS = {**self._DTYPE_TO_TORCH_TRAILING_DIMS, vec6f: (6,)} |
There was a problem hiding this comment.
require_full_stage() not repeated in _initialize_impl
OvPhysxManager.require_full_stage() is called only in __init__, but both OvPhysxManager.initialize() (line 325 of ovphysx_manager.py) and OvPhysxManager.reset() unconditionally reset _requires_full_stage = False. If either is invoked after asset construction — which happens on a full simulation reset when assets are invalidated and _initialize_impl is called again — the flag is cleared before _warmup_and_load() runs. The stage would then be exported env_0-only, the per-environment deformable prims would be absent, and create_tensor_binding for every deformable would raise or silently produce empty bindings. Adding OvPhysxManager.require_full_stage() at the top of _initialize_impl (before any binding creation) would make the flag robust to reinitialisation cycles.
| def _detect_deformable_type(root_prim: Usd.Prim, material_prim: Usd.Prim | None) -> str: | ||
| """Detect one unambiguous volume or surface deformable type from authored evidence.""" | ||
| root_schemas = _get_api_schemas(root_prim) | ||
| material_schemas = _get_api_schemas(material_prim) if material_prim is not None else set() | ||
| hierarchy_prims = sim_utils.get_all_matching_child_prims( | ||
| root_prim.GetPath(), | ||
| stage=root_prim.GetStage(), | ||
| traverse_instance_prims=False, | ||
| ) | ||
| hierarchy_types = {prim.GetTypeName() for prim in hierarchy_prims} | ||
|
|
||
| detected_types = { | ||
| deformable_type | ||
| for deformable_type, schemas in ( | ||
| ("volume", _VOLUME_BODY_SCHEMAS), | ||
| ("surface", _SURFACE_BODY_SCHEMAS), | ||
| ) | ||
| if root_schemas & schemas | ||
| } | ||
| if material_schemas & _SURFACE_MATERIAL_SCHEMAS: | ||
| detected_types.add("surface") | ||
| elif material_schemas & _GENERIC_MATERIAL_SCHEMAS: | ||
| detected_types.add("volume") | ||
| if "TetMesh" in hierarchy_types: | ||
| detected_types.add("volume") | ||
| if "Mesh" in hierarchy_types: | ||
| detected_types.add("surface") | ||
|
|
||
| if len(detected_types) == 1: | ||
| return next(iter(detected_types)) | ||
| raise RuntimeError( | ||
| f"Failed to determine deformable type for '{root_prim.GetPath().pathString}'. " | ||
| f"Root schemas: {sorted(root_schemas)}; Material schemas: {sorted(material_schemas)}; " | ||
| f"Hierarchy types: {sorted(hierarchy_types)}; Detected deformable types: {sorted(detected_types)}." | ||
| ) |
There was a problem hiding this comment.
Fragile Mesh-type fallback in
_detect_deformable_type
The heuristic if "Mesh" in hierarchy_types: detected_types.add("surface") traverses all descendants of the deformable body prim. A volume deformable whose prim subtree contains any UsdGeom.Mesh child — for example a visual-proxy mesh, a collision-hull mesh, or an LOD mesh that a content pipeline adds automatically — would have both "volume" (from its OmniPhysicsVolumeDeformableSimAPI schema or a TetMesh descendant) and "surface" (from the Mesh child) in detected_types, triggering the RuntimeError. Because the API-schema check is sufficient for well-authored assets, the TetMesh/Mesh type fallbacks should be used only when the schema-based detection yields an empty set, not additively with it.
| @staticmethod | ||
| def _normalize_values(values: wp.array | torch.Tensor) -> wp.array: | ||
| if isinstance(values, torch.Tensor): | ||
| return wp.from_torch(values.contiguous(), dtype=wp.float32) | ||
| return values |
There was a problem hiding this comment.
_normalize_values hard-codes wp.float32 regardless of binding dtype
The method converts every incoming torch.Tensor to wp.float32. For the current set of deformable tensor types this is correct, but any future non-float tensor passed through _set would be silently mis-cast. Deriving the target dtype from the binding makes the conversion self-consistent with the dtype-aware logic already present in OvPhysxView._as_binding_view.
| @staticmethod | |
| def _normalize_values(values: wp.array | torch.Tensor) -> wp.array: | |
| if isinstance(values, torch.Tensor): | |
| return wp.from_torch(values.contiguous(), dtype=wp.float32) | |
| return values | |
| @staticmethod | |
| def _normalize_values(values: wp.array | torch.Tensor, dtype: Any = wp.float32) -> wp.array: | |
| if isinstance(values, torch.Tensor): | |
| return wp.from_torch(values.contiguous(), dtype=dtype) | |
| return values |
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!
Validate complete nodal states before splitting them so malformed input cannot partially mutate simulation state. Resolve material paths with USD ancestry to avoid rewriting lexical siblings.
Aggregate authored body, material, and topology evidence before selecting a deformable kind so conflicting stages fail with a complete diagnostic. Align dtype and material unit docs with binding and PhysX contracts, and keep connectivity checks ordering-independent.
Add the shared deformable behavior scenarios to the OVPhysX real-backend suite while retaining its topology and material coverage. Extend the authored fixture so initialization exercises local, shared, and absent material bindings.
Run the CPU initialization contract in a fresh spawned process so the test always reaches the deformable CUDA-only guard instead of accepting the parent process device lock.
Refresh stale full nodal buffers before patching a strict subset so unselected environments remain current.
Classify all documented read-only articulation tensors and reject surface collision connectivity with a public diagnostic instead of leaking a map KeyError.
Materialize only missing clone targets in the temporary full-stage USD before loading it. This avoids unsafe post-load leaf cloning while preserving authored targets and clearing queued work safely.
Snapshot retained deformable buffers before stale-row hydration and key structured read views by both destination and binding. This preserves caller edits and revalidates cross-binding reads.
Mirror PhysX deformable scenarios and assertions, cover the heterogeneous mixed scene, fix quaternion authoring, and document setter arguments with physical units.
Preserve descendant-created target ancestors while composing queued physics into full-stage exports. Retain clone recipes across re-warmups, fail on export save errors, and correct deformable material units.
Plan full-stage clone materialization shallow-to-deep and create temporary intermediate ancestors after validating each environment root. Keep the warmup lifecycle documentation aligned with retained active clone recipes.
Promote only temporary intermediate ancestor specs created for child-only nested clone targets so copied physics composes beneath defined prims. Preserve authored specs and environment-boundary validation.
Use the generic OVPhysX view for deformable state and material bindings, keeping only mesh dimension queries in a thin body view. Align discovery and tests with PhysX while retaining the Kitless schema and tensor-type specifics required by OVPhysX.
Use AssetBase's unified replication registration after rebasing onto the latest develop cloning API. Align full-stage and device tests with the current serialized-stage and explicit-buffer behavior.
792b3c6 to
b6b479b
Compare
marcodiiga
left a comment
There was a problem hiding this comment.
Reviewed exact head b6b479b5d16834547d77b922d2b6419d3ae62534 after its rebase onto develop.
I am requesting changes for the two reproduced silent-correctness failures and
the stale-binding lifecycle failure in the inline threads:
- an aliased selected position/velocity command can be overwritten by stale-cache hydration before it reaches OVPhysX;
- mixed deformable topologies average invalid padded nodes into
root_pos_wandroot_vel_w; - a forced manager re-warm replaces the attached stage without invalidating existing asset bindings.
Validation was otherwise encouraging: the live GPU job reports 18/18 deformable asset tests and the task smoke passing, and focused view/manager/data suites passed locally. The in-memory OVStage ingestion is directionally consistent with the current backend architecture.
Two additional merge gates remain separate from those findings:
- Current CI is red in Docs because the daily
warp-lang==1.17.0.dev20260728Linux wheel is unavailable, and inisaaclab_ovon an unchanged joint-wrench tolerance assertion. Other required jobs are still running. - The support matrix still says OvPhysX deformables are unsupported, and the OvPhysX backend page does not document the new support or its current full-stage scaling limit. In a minimal five-node volume scene I measured reset at 1.59 s for 128 environments, 10.54 s for 512, 36.66 s for 1024, and no completion within 120 s for 4096. Please either bound the supported scale or address this before advertising normal thousand-environment use.
| ): | ||
| nodal_pos = wp.clone(nodal_pos) | ||
| if env_ids.shape[0] < self.num_instances: | ||
| _ = self._data.nodal_pos_w |
There was a problem hiding this comment.
[P1] Preserve aliased partial edits before refreshing the cache.
When a caller retains data.nodal_pos_w, advances the simulation, edits retained.torch[1:2], and then calls the default write_nodal_pos_to_sim_index(..., env_ids=[1]), the input slice aliases the stale stable cache. This line refreshes that allocation before the write kernel and overwrites the command. With ovphysx==0.5.9 on GPU, I reproduced both the slice and the simulator readback reverting to the old simulator values. The velocity path has the same issue at line 270.
The current clone guard covers only full_data=True and exact base pointers. Please snapshot any overlapping source range before hydration and add retained-slice regressions for both position and velocity.
| wp.launch( | ||
| compute_mean_vec3f_over_vertices, | ||
| dim=self._num_instances, | ||
| inputs=[self.nodal_pos_w.warp, self._max_sim_vertices], |
There was a problem hiding this comment.
[P1] Account for each body's valid node count here, or reject nonuniform topology.
This binding dimension is the maximum node count across all matches, not the valid count for every body. In a real ovphysx==0.5.9 binding with a five-node and a four-node volume, the shape is (2, 5, 3) and the native read leaves the short body's fifth slot untouched. This kernel therefore averages padding: with the normal zero-initialized buffer, the valid mean [2.25, 0.25, 0.25] becomes [1.8, 0.2, 0.2]; after a full-buffer write, arbitrary stale padding can persist across refreshes.
The same issue affects root_vel_w and padded nodal_state_w, and the soft-lift task consumes the derived COM in observations, rewards, and termination. Please carry a per-row valid-node count or mask into these reductions, or fail initialization for nonuniform matched topology until the runtime exposes that metadata.
| # re-populates env_1..N. Features that need distinct authored physics in | ||
| # every environment request the full stage. Missing heterogeneous clone | ||
| # targets are copied into the serialized stage before it is attached. | ||
| cls._rearm_pending_clones() |
There was a problem hiding this comment.
[P2] Invalidate asset bindings before replacing the attached stage on a forced re-warmup.
This reuse path resets and destroys the attached stage, but it never emits the
lifecycle event that clears initialized asset views. I reproduced the documented
forced path (_warmup_done = False; sim.reset()) with a real deformable: the view
and TensorBinding identities were unchanged, and the next read failed because
the binding's stage ID referred to the prior attachment. PHYSICS_READY does not
rebuild it because the asset remains initialized.
Please dispatch the stop/invalidation event before detaching (or explicitly
recreate dependent views), then add a real-binding regression that verifies a
post-rewarm read/step and changed binding identity.
Preserve aliased partial writes across lazy cache hydration and invalidate stage-bound views before forced re-warms replace their bindings. Reject mixed simulation-node counts until padded state can be represented safely, and document the current CUDA and full-stage scaling limits.
|
Implemented the submitted review feedback in
The support matrix and OvPhysX backend page now mark deformables as experimental and CUDA-only, require uniform simulation-node counts, and explicitly scope the current full-stage path to small validation scenes; training-scale workloads with thousands of environments are unsupported. I intentionally kept full-stage ingestion optimization outside this PR. Fresh validation on the PR head:
Fresh CI is running for the new head. I did not add unrelated changes for the previously reported daily Warp-wheel availability or unchanged |
mmichelis
left a comment
There was a problem hiding this comment.
thanks for adding deformable support in ovphysx!
## Summary - build on the merged OvPhysX deformable support from #6665 - add `ovphysx` presets for the Franka soft-volume and cloth-surface lift environments - run the deformables demo and deformable-object tutorial through the existing multi-backend launcher - expose OvPhysX link/COM Jacobians, mass matrices, and gravity compensation through the shared articulation data API - preserve fixed/floating-base layouts plus configured body and joint ordering for computed dynamics - run both public task presets with their configured arm actions and replicated deformables in every environment - resolve automatic physics selection before stage creation so only the selected backend registers its schemas - enable supported OvPhysX + OVRTX rendering cases and add one shared reviewed golden set for legacy and OvStage - retain explicit `isaacsim_physx` catalog labels while documenting `ovphysx` for both Franka deformable tasks ## Rendering baselines - 23 reviewed PNGs: 12 Franka soft and 11 Franka cloth; requesting RGB also validates the RGBA output - the same files are consumed by both legacy and OvStage OVRTX paths - no thresholds were widened - retained skips are limited to soft/cloth instance segmentation (`NVBUG#6463802`) and cloth motion vectors (`NVBUG#6489754`) ## Validation - legacy OvPhysX + OVRTX matrix: `21 passed, 3 skipped, 128 deselected` - OvStage OvPhysX + OVRTX matrix against the same PNGs: `21 passed, 3 skipped, 128 deselected` - focused config, two-environment live soft/cloth task, full OvPhysX manager, and articulation dynamics/reordering sweep: `40 passed, 3 skipped` - live DexSuite state-task check after the cloner refactor: `Isaac-Lift-KukaAllegro` resolved the homogeneous `CuboidCfg`, created two environments, reset contact sensors, and completed the first OvPhysX step - both live OvPhysX demo entry points reached setup and advanced simulation without tracebacks - deformable-object tutorial produced finite CUDA root positions through 24 simulated seconds - full repository pre-commit suite passed on final head `74ce113386` Validated with OvPhysX 0.5.9. The local uv environment is kitless, so the Kit-backed `test_simulation_context.py` module was not runnable there because `isaacsim` is not installed; PR CI covers the Kit jobs. @mmichelis could you take another look at the final rendering baselines and review fixes? @huidongc the shared legacy/OvStage baseline expectation is now implemented. --------- Co-authored-by: Kelly Guo <[email protected]>
# Description Adds PhysX-style volume and surface deformable-object support to the OVPhysX backend while preserving OVPhysX native device placement and full-buffer indexed write semantics. - derives Warp allocation and validation dtypes from each OVPhysX binding DLPack metadata - keeps `OvPhysxDeformableBodyView` thin, adding only nodal and element count properties over the regular `OvPhysxView` - accesses deformable body and material tensors directly through the generic view with `TensorType` keys - mirrors PhysX volume/surface discovery, optional-material behavior, data access, and contract tests while retaining additive OVPhysX topology, cache, and full-stage coverage - supports nodal state, volume kinematic targets, mesh connectivity, optional materials, and derived root state - preserves heterogeneous rigid/deformable clones across full-stage loads, re-warmups, ancestor shells, and nested clone targets - adds authored CUDA coverage for volume, surface, multi-environment replication, mixed rigid/deformable scenes, and the Franka soft-lift task - documents the public API and adds the `isaaclab_ovphysx` changelog fragment Dependency status: isaac-sim#6660 has landed on develop. It owns the OVPhysX dependency floor and in-memory OVStage serializer. This PR intentionally does not modify dependency pins or lock files. ## Type of change - [x] New feature (non-breaking change which adds functionality) - [x] Documentation update ## Validation - 141 focused OVPhysX deformable, view, manager, replication, and task tests passed - Python byte-compilation passed - documentation build succeeded without warnings - all repository pre-commit hooks passed twice at the final branch tip - independent whole-branch review findings were resolved ## Screenshots Not applicable. ## Checklist - [x] I have read and understood the contribution guidelines - [x] I have run the pre-commit checks with `./isaaclab.sh -f` - [x] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [x] I have added tests that prove the feature works - [x] I have added a changelog fragment under `source/isaaclab_ovphysx/changelog.d/` - [x] My name already exists in `CONTRIBUTORS.md`
## Summary - build on the merged OvPhysX deformable support from isaac-sim#6665 - add `ovphysx` presets for the Franka soft-volume and cloth-surface lift environments - run the deformables demo and deformable-object tutorial through the existing multi-backend launcher - expose OvPhysX link/COM Jacobians, mass matrices, and gravity compensation through the shared articulation data API - preserve fixed/floating-base layouts plus configured body and joint ordering for computed dynamics - run both public task presets with their configured arm actions and replicated deformables in every environment - resolve automatic physics selection before stage creation so only the selected backend registers its schemas - enable supported OvPhysX + OVRTX rendering cases and add one shared reviewed golden set for legacy and OvStage - retain explicit `isaacsim_physx` catalog labels while documenting `ovphysx` for both Franka deformable tasks ## Rendering baselines - 23 reviewed PNGs: 12 Franka soft and 11 Franka cloth; requesting RGB also validates the RGBA output - the same files are consumed by both legacy and OvStage OVRTX paths - no thresholds were widened - retained skips are limited to soft/cloth instance segmentation (`NVBUG#6463802`) and cloth motion vectors (`NVBUG#6489754`) ## Validation - legacy OvPhysX + OVRTX matrix: `21 passed, 3 skipped, 128 deselected` - OvStage OvPhysX + OVRTX matrix against the same PNGs: `21 passed, 3 skipped, 128 deselected` - focused config, two-environment live soft/cloth task, full OvPhysX manager, and articulation dynamics/reordering sweep: `40 passed, 3 skipped` - live DexSuite state-task check after the cloner refactor: `Isaac-Lift-KukaAllegro` resolved the homogeneous `CuboidCfg`, created two environments, reset contact sensors, and completed the first OvPhysX step - both live OvPhysX demo entry points reached setup and advanced simulation without tracebacks - deformable-object tutorial produced finite CUDA root positions through 24 simulated seconds - full repository pre-commit suite passed on final head `74ce113386` Validated with OvPhysX 0.5.9. The local uv environment is kitless, so the Kit-backed `test_simulation_context.py` module was not runnable there because `isaacsim` is not installed; PR CI covers the Kit jobs. @mmichelis could you take another look at the final rendering baselines and review fixes? @huidongc the shared legacy/OvStage baseline expectation is now implemented. --------- Co-authored-by: Kelly Guo <[email protected]>
Description
Adds PhysX-style volume and surface deformable-object support to the OVPhysX backend while preserving OVPhysX native device placement and full-buffer indexed write semantics.
OvPhysxDeformableBodyViewthin, adding only nodal and element count properties over the regularOvPhysxViewTensorTypekeysisaaclab_ovphysxchangelog fragmentDependency status: #6660 has landed on develop. It owns the OVPhysX dependency floor and in-memory OVStage serializer. This PR intentionally does not modify dependency pins or lock files.
Type of change
Validation
Screenshots
Not applicable.
Checklist
./isaaclab.sh -fsource/isaaclab_ovphysx/changelog.d/CONTRIBUTORS.md