Repository navigation
[Backport release/3.0.0] [5D] Bind Newton consumers to shared native resources - #8099
Conversation
Backport isaac-sim#8027 without changes. (cherry picked from commit b05a35a)
|
run-ci |
|
| sim = SimulationContext.instance() | ||
| self.backend = sim.get_or_create_backend(self.newton_cfg) | ||
| self._scene_data_provider = sim.get_scene_data_provider() | ||
| self._transform_mapping = self._scene_data_provider.create_mapping(list(self.backend.model.body_label)) |
There was a problem hiding this comment.
In a foreign-physics scene, a Newton body can be labeled with its joint prim path, while PhysX publishes the rigid-body prim path. Passing the joint label directly to create_mapping raises KeyError and prevents this renderer from initializing. The removed visualization path resolved joint labels to their target bodies; the Newton visualizers and ray caster now use this direct mapping too.
| if self.cfg.streaming_cam_target_prim_path is None: | ||
| cameras = self._scene_data_provider.get_camera_sensors() | ||
| if cameras: | ||
| self._camera_sensor = next(iter(cameras.values())) |
There was a problem hiding this comment.
Fallback camera count unchecked
If a scene has multiple cameras and the first covers fewer environments than the simulation, this selects it without checking its view count. The streaming path then uses simulation environment IDs to index that camera's frames, which can raise an out-of-range error even when a suitable camera appears later. Viser makes the same selection.
There was a problem hiding this comment.
Isaac Lab Review Bot
The Newton consumer-ownership backport coherently moves builders, native models, renderers, and query consumers onto the simulation registry and SDP paths. Before merge, restore Kit's camera-enablement gate, make the new PhysX synchronization CPU-safe, and document the newly public NewtonQueries symbol.
- Design and architecture: The
NewtonBuilderCfg/NewtonBackendCfglifetime split and consumer-owned query graphs align with the registry and SDP ownership rules. However, centralizing early renderer acquisition inBaseVisualizerremoved Kit's/isaaclab/cameras_enabledguard, so an auto-camera configuration can initialize RTX infrastructure even when cameras were not enabled. - API: The breaking Newton manager and streaming-renderer migrations include migration guidance.
NewtonQueriesis now exported through the package API and described in the changelog, but it is missing from the updated generated API reference; add an autosummary/autoclass entry or keep the helper private. - Implementation: The Newton renderer, ray-caster, and visualizer producer/consumer paths consistently acquire shared resources and use SDP. Two concrete fixes remain: preserve Kit's camera-availability precondition before renderer construction, and replace or guard
wp.synchronize_stream(self.device)because CPU-backed rigid-object mass, COM, and inertia setters cannot synchronize a CUDA stream.
Minor fixes needed. Posted 3 actionable findings inline.
Automated review; human maintainers own approval decisions.
| # Declare the camera renderer before cloning gathers consumer requirements. | ||
| owns_camera = cfg.streaming_sensor_prim_path is None and cfg.streaming_cam_target_prim_path is not None | ||
| if cfg.streaming_view and owns_camera: | ||
| sim_utils.SimulationContext.instance().get_or_create_backend(cfg.streaming_cam_renderer_cfg) |
There was a problem hiding this comment.
🟡 Warning · Implementation — Kit streaming renderer loses cameras-enabled guard
The registration moved from KitVisualizer.__init__ drops the /isaaclab/cameras_enabled condition. With streaming_view=True and an auto-created camera target but no --enable_cameras, IsaacRtxRendererCfg is now constructed, enabling omni.replicator.core and attaching the RTX Hydra engine. KitVisualizerCfg's unchanged docstring still promises the streaming view is silently skipped in that case. Re-apply the camera-availability gate before acquiring the renderer.
| cpu_env_ids = self._get_cpu_env_ids(env_ids, sim_env_ids) | ||
| wp.copy(self._cpu_body_mass, self.data._body_mass) | ||
| # PhysX reads pinned host data immediately; the asynchronous copy must finish first. | ||
| wp.synchronize_stream(self.device) |
There was a problem hiding this comment.
🟡 Warning · Implementation — synchronize_stream is invalid on CPU devices
wp.synchronize_stream(device) resolves Device.stream, which is only defined for CUDA devices. When self.device is "cpu", the public set_masses_index, set_coms_index, and set_inertias_index writes (and the mask variants plus mass/inertia randomization events routed through them) now raise instead of writing. Use wp.synchronize_device(self.device), which is a no-op on CPU, or guard the call on a CUDA device.
| "NewtonKaminoManager", | ||
| "NewtonMPMManager", | ||
| "NewtonManager", | ||
| "NewtonQueries", |
There was a problem hiding this comment.
🔵 Suggestion · Api — Exported NewtonQueries missing from API docs
NewtonQueries is added to the package's public __all__ and stub exports and described as public in the changelog, but docs/source/api/lab_newton/isaaclab_newton.physics.rst was updated only for NewtonBuilderCfg and create_newton_builder. The new query/capture helper is therefore absent from the generated reference. Add it to the autosummary list with a matching autoclass block, or keep it private.
Summary
Backports #8027 (
b05a35a0eedda86662f82e663993c2b7046bf94f) torelease/3.0.0.Newton cameras, raycasters, and visualizers acquire shared native resources through the simulation registry and consume transforms and geometry through SDP. The original API migration notes and changelog fragments are included unchanged.
This is an exact, conflict-free cherry-pick. The prerequisite #8021 is already present on the release branch. No additional refactoring or fixes are included.
Validation