Fix OvPhysX 0.4 compatibility#5545
Conversation
Greptile SummaryThis PR fixes several OvPhysX 0.4 API compatibility issues in IsaacLab: the
Confidence Score: 4/5The changes are well-scoped bug fixes with no cross-cutting regressions; the main area worth a closer look is the ovphysx constructor dispatch in the manager. The CPU-only tensor staging, write-view raw-pointer fix, and sensor class-name guard are all straightforward and correctly implemented. The only open questions are whether older ovphysx wheels require gpu_index even for CPU-mode instantiation, and whether the active_cuda_gpus string format matches the published 0.4 spec. Both are low-impact edge cases but warrant a quick confirmation before merge. source/isaaclab_ovphysx/isaaclab_ovphysx/physics/ovphysx_manager.py — the dual-path constructor dispatch and the active_cuda_gpus string representation deserve a final check against the ovphysx 0.4 API surface. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[OvPhysxManager._warmup_and_load] --> B{ovphysx_device == gpu?}
B -- No --> C[physx_kwargs = device:cpu]
B -- Yes --> D{active_cuda_gpus in PhysX signature?}
D -- Yes, new 0.4 API --> E[kwargs += active_cuda_gpus + PhysXConfig]
D -- No, old API --> F[kwargs += gpu_index]
C --> G[ovphysx.PhysX instantiated]
E --> G
F --> G
subgraph Read path in ArticulationData
H[_read_binding_into_view] --> I{CPU_ONLY_TYPES AND view.device != cpu?}
I -- Yes --> J[binding.read to CPU scratch]
J --> K[wp.copy: CPU scratch to GPU view]
I -- No --> L[binding.read directly into view]
end
subgraph sensor_base.py
M[Register callbacks] --> N{physics_mgr_cls.__name__ == PhysxManager?}
N -- Yes --> O[Register prim-deletion callback]
N -- No --> P[Skip prim-deletion]
end
Reviews (1): Last reviewed commit: "Fix OvPhysX 0.4 compatibility" | Re-trigger Greptile |
Update the OvPhysX backend for the upcoming ovphysx 0.4 API while preserving the older constructor path. Fix CPU-only tensor binding reads into GPU buffers, use raw Warp buffers for write views, and add the OvPhysX preset to the cartpole camera task.
5318097 to
6f33d74
Compare
# Description Implements `RigidObjectCollection` and `RigidObjectCollectionData` for the OVPhysX backend, completing the rigid-body asset surface alongside `RigidObject` (#5426) and `Articulation` (#5459). The collection manages N distinct rigid bodies per environment with `(env, body)` dual indexing. The asset creates **one native fused TensorBinding per tensor type** via the ovphysx 0.4.3 `create_tensor_binding(prim_paths=[glob_0, …, glob_{B-1}])` API, mirroring how PhysX's `RigidBodyView` aggregates multiple body prims into a single flat view. Each binding spans `num_instances * num_bodies` prims and returns body-major flat data `(body_0_env_0, body_0_env_1, …, body_1_env_0, …)`. The data class and asset writers use strided-view reshape helpers (`_reshape_view_to_data_2d/_3d` and `reshape_data_to_view_2d/_3d`, ported from the PhysX collection) to convert between body-major view layout and the instance-major `(N, B, D)` layout exposed to users — no Warp kernels added, no per-body Python fan-out at runtime. Fixes #5317 **Stacked on:** - #5459 — OVPhysX `Articulation` - #5426 — OVPhysX `RigidObject` **Carries a one-commit cherry-pick of #5545's `ovphysx_manager.py` portion** (required for ovphysx 0.4 `active_cuda_gpus` API). Drop the cherry-pick once #5545 lands. ## Type of change - New feature (non-breaking change which adds functionality) ## Screenshots N/A — backend infrastructure, no visible behaviour change. ## 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 - [x] I have added tests that prove my fix is effective or that my feature works - [x] I have updated the changelog (fragment file under `source/isaaclab_ovphysx/changelog.d/`) - [x] I have added my name to the `CONTRIBUTORS.md` or my name already exists there ## Test plan Tested in a Docker container built from `docker/Dockerfile.base` (IsaacSim `6.0.0-dev2`) with the ovphysx 0.4.3 wheel installed: - `./scripts/run_ovphysx.sh -m pytest source/isaaclab/test/assets/test_rigid_object_collection_iface.py -k ovphysx` → **636 passed** - `./scripts/run_ovphysx.sh -m pytest source/isaaclab_ovphysx/test/assets/test_rigid_object_collection.py` → **72 passed, 76 skipped (device-mode lock — a second invocation with `-k 'cpu'` covers CPU), 4 xfailed** (material-properties gap shared with `RigidObject` until the wheel exposes `RIGID_BODY_MATERIAL`) - `./isaaclab.sh -f` → clean
Summary
active_cuda_gpusand explicit DirectGPU Carbonite settings when supported, while preserving the oldergpu_indexconstructor path.ProxyArraywrappers.ovphysxphysics preset to the cartpole camera presets task.Validation
./isaaclab.sh -f./isaaclab.sh -p -m pytest source/isaaclab_ovphysx/test/assets/test_articulation_data.py source/isaaclab_ovphysx/test/assets/test_articulation.py./isaaclab.sh -p scripts/reinforcement_learning/rsl_rl/train.py --task Isaac-Cartpole-Direct-v0 --num_envs 64 --max_iterations 2 --headless presets=ovphysx./isaaclab.sh -p scripts/reinforcement_learning/rsl_rl/train.py --task Isaac-Ant-Direct-v0 --num_envs 64 --max_iterations 2 --headless presets=ovphysx./isaaclab.sh -p scripts/reinforcement_learning/rsl_rl/train.py --task Isaac-Humanoid-Direct-v0 --num_envs 64 --max_iterations 2 --headless presets=ovphysx./isaaclab.sh -p scripts/reinforcement_learning/rl_games/train.py --task=Isaac-Cartpole-Camera-Presets-Direct-v0 --num_envs=32 --max_iterations=2 --headless --enable_cameras presets=ovphysx,ovrtx_renderer,rgbDescription
This PR fixes several small IsaacLab-side issues needed for the OvPhysX backend to run the supported direct cartpole, ant, and humanoid tasks with the upcoming ovphysx 0.4 wheel. It also enables the cartpole camera presets task to select the
ovphysxphysics preset.The OvPhysX manager now detects the new constructor surface and passes explicit DirectGPU settings for GPU simulations. Older public wheels that still use
gpu_indexkeep the previous constructor path.Fixes # (not applicable)
Type of change
Screenshots
Not applicable.
Checklist
pre-commitchecks with./isaaclab.sh --formatsource/<pkg>/changelog.d/for every touched package (do not editCHANGELOG.rstor bumpextension.toml— CI handles that)CONTRIBUTORS.mdor my name already exists there