Repository navigation
Expose scene-owned surface grippers in Isaac Lab - #9070
Conversation
[Medium impact] The PR affects gripper workflows in scenes across both physics backends. Fix the seeded reset calls before merging. Findings
SummaryAdds scene-owned surface grippers with one command interface for Newton and PhysX.
Seeded resets now call a missing method and must be fixed before merging. Diagram%%{init: {'theme': 'neutral'}}%%
flowchart TD
C[SurfaceGripperCfg] --> S[InteractiveScene]
S --> F[SurfaceGripper factory]
F --> N[Newton four-pad suction]
F --> P[PhysX authored gripper]
S --> W[Write commands and reset selected worlds]
W --> N
W --> P
E[Environment close] --> X[Scene close]
X --> D[Remove gripper callbacks]
Reviews (1) · Last reviewed commit: "Expose scene-owned surface grippers in I..." · Reviewed by Greptile |
| # set the seed | ||
| if seed is not None: | ||
| self.seed(seed) | ||
| self.event_manager.reseed(self.seed(seed)) |
There was a problem hiding this comment.
There was a problem hiding this comment.
Isaac Lab Review Bot
Needs attention: Design and architecture (1), Scope and over-engineering (2), API (1), Compatibility and deprecation (1), Style consistency (9), Test quality (2). Other reviewed categories look good.
- PR description: Title and body match the API, backend, documentation, and test scope; provide reproducible baseline/candidate timings for Newton’s per-substep acquisition scan, including revisions, command/workload, hardware, backend, environment count, warmup, and metric.
- Design and architecture: PhysX reset clears commands and reports open without releasing native attachments; open the selected native grippers to satisfy the new shared reset contract.
- Scope and over-engineering: Minimal implementation: extend InteractiveScene and NewtonManager; keep the shared config, factory, interface, both packages’ lazy-export modules and stubs, and Newton’s lifecycle-owning implementation—all eight added modules; delete copied config fields and duplicate engagement storage, preserving staged commands, selected resets, acquisition, and force delivery through the existing PhysX owner and Newton callbacks; scope is cohesive; no split recommended.
- API: PhysX accepts nondefault Newton-only settings without implementing them; reject unsupported target and pad settings during construction rather than silently ignoring requested behavior.
- Compatibility and deprecation: Breaking changes: scene construction unconditionally passes sim to configured gripper extensions, breaking cfg-only constructors; preserve that constructor contract through targeted warnings, migration documentation, removal guidance, and transition coverage.
- Implementation: Implementation looks good.
- Style consistency: New custom Warp kernels bypass the required cached make_* factories and module isolation; return concrete module="unique" kernels from cached factories.
- Test quality: The target-ID case selects the only nearby eligible box, so ignored restrictions still pass; select a distant eligible box and assert acquisition remains unsuccessful.
Significant concerns. Posted 16 inline findings.
Automated review; human maintainers own approval decisions.
|
|
||
| @abstractmethod | ||
| def reset(self, env_ids: Sequence[int] | torch.Tensor | None = None, env_mask: wp.array | None = None) -> None: | ||
| """Release selected grippers without changing other worlds or physical poses.""" |
There was a problem hiding this comment.
🔴 Critical · Design Architecture — Make PhysX reset release
The shared reset contract promises release, but PhysX reset writes a zero command, which retains the vacuum state, and merely reports open. Open the selected native grippers during reset.
|
|
||
| After simulation initialization, access ``scene["suction"]``. Its ``command`` and measured | ||
| ``state`` are Warp arrays. Commands use +1 to close, -1 to open and 0 to retain the current | ||
| command. States use +1 for sealed, 0 for closing and -1 for open. Stage commands with |
There was a problem hiding this comment.
🟡 Warning · Style Consistency — Describe zero commands accurately
Zero retains the enabled vacuum state, not the stored command: the staged command remains zero. Correct the guide’s description.
| """Create the active backend's surface gripper. | ||
|
|
||
| Configure this asset with :class:`SurfaceGripperCfg` and access it through | ||
| :attr:`~isaaclab.scene.InteractiveScene.surface_grippers`. Commands above 0.3 |
There was a problem hiding this comment.
🟡 Warning · Style Consistency — Avoid duplicate command documentation
The factory repeats thresholds, staging, and state values owned by BaseSurfaceGripper, creating parallel contract prose. Keep construction and backend constraints here and refer to the shared interface.
| def _add_entities_from_cfg(self): # noqa: C901 | ||
| """Add scene entities from the config.""" | ||
| from isaaclab_physx.assets import SurfaceGripperCfg # noqa: PLC0415 | ||
| from isaaclab.assets import SurfaceGripperCfg # noqa: PLC0415 |
There was a problem hiding this comment.
🟡 Warning · Style Consistency — Import the config with other assets
SurfaceGripperCfg is runtime-independent, so this local absolute import no longer defers a simulator dependency. Put it in the existing module-level relative asset import group.
| self._global_prim_paths += asset_paths | ||
| elif isinstance(asset_cfg, SurfaceGripperCfg): | ||
| self._surface_grippers[asset_name] = instantiate(asset_cfg) | ||
| self._surface_grippers[asset_name] = instantiate(asset_cfg, sim=self.sim) |
There was a problem hiding this comment.
🟡 Warning · Compatibility — Preserve cfg-only gripper constructors
Configured gripper extensions previously received only cfg. Passing sim unconditionally breaks their constructors. Keep cfg-only construction functional through a documented transition with a targeted deprecation warning.
| @pytest.mark.parametrize("device", test_devices(DeviceScope.CUDA)) | ||
| def test_box_acquisition_lift_release_and_rebind(device): | ||
| """Payloads lift after hard resets, release on command, and reset independently.""" | ||
| legacy_cfg = SurfaceGripperCfg(*([None] * 8), 0.01, 5.0, 3.0, 0.1) |
There was a problem hiding this comment.
🟡 Warning · Test Quality — Exercise the legacy configuration import
This positional assertion constructs the new Lab config, so a broken isaaclab_physx.assets.SurfaceGripperCfg import or constructor still passes. Check positional construction through that legacy import.
| parcels = [body for body, label in enumerate(model.body_label) if label.endswith("/Cube2")] | ||
| distant = [body for body, label in enumerate(model.body_label) if label.endswith("/Cube0")] | ||
| if reset_index: | ||
| gripper.set_target_ids(torch.ones(2, dtype=torch.long, device=device)) |
There was a problem hiding this comment.
🟡 Warning · Test Quality — Make target restrictions observable
The requested target is already the only nearby eligible box; ignoring target_ids gives the same result. Restrict acquisition to a distant eligible box and assert that no seal forms.
| """ | ||
|
|
||
| def __init__(self, cfg: SurfaceGripperCfg): | ||
| def __init__(self, cfg: SurfaceGripperCfg, *, sim=None): |
There was a problem hiding this comment.
🟡 Warning · Style Consistency — Type the edited constructor
The added sim parameter and constructor return lack annotations. Declare SimulationContext | None and -> None, matching the shared and Newton constructors.
|
|
||
| retry_interval: float | None = None | ||
| """The amount of time the gripper will spend trying to grasp an object.""" | ||
| class SurfaceGripperCfg(BaseSurfaceGripperCfg): |
There was a problem hiding this comment.
🟡 Warning · Api — Reject ignored Newton settings
Inherited target and pad settings are accepted by PhysX but never consumed. Reject nondefault Newton-only values at PhysX construction so configuration cannot silently promise behavior it lacks.
| retry_interval: float | None = None | ||
| """The amount of time the gripper will spend trying to grasp an object.""" | ||
| class SurfaceGripperCfg(BaseSurfaceGripperCfg): | ||
| """Keep the existing PhysX-specific configuration import and implementation.""" |
There was a problem hiding this comment.
🟡 Warning · Style Consistency — Document the current PhysX contract
The class docstring repeats the module’s migration description instead of explaining its configuration. Describe the current PhysX-specific contract; leave import history in the changelog.
There was a problem hiding this comment.
Isaac Lab Review Bot
Needs attention: Design and architecture (1), Scope and over-engineering (2), Compatibility and deprecation (1), Implementation (1), Style consistency (8), Test quality (1). Other reviewed categories look good.
- PR description: Benchmark Newton’s per-substep acquisition callback with baseline/candidate revisions, command/workload, hardware, backend, environment/candidate counts, warmup, and latency; the title, backend limits, scene lifecycle, and stated validation scope match the diff.
- Design and architecture: PhysX reset violates the new physical-release contract by clearing buffers without opening native grips; send an open action to selected grippers.
- Scope and over-engineering: Minimal implementation: Extend InteractiveScene and the existing PhysX gripper; keep both packages’ init.py/init.pyi pairs, the shared base, factory, configuration module, and Newton runtime for their public contracts and callback lifecycle; delete duplicate configuration attributes and engagement storage, retaining staged commands, batched acquisition, forces, measurement, reset, and teardown. Scope is cohesive; no split recommended.
- API: API changes look good.
- Compatibility and deprecation: Breaking changes: InteractiveScene now passes sim to configured gripper constructors previously called with cfg alone; preserve cfg-only constructors through a functional bridge and document, warn, and cover any deprecation transition.
- Implementation: Newton publishes seal state before solver substeps while update does nothing, leaving final-substep breakage reported as sealed; refresh measurement after the completed step.
- Style consistency: Newton’s custom kernels omit the required cached make_ factories and module="unique" isolation; construct and warm the required kernels through the prescribed pattern before capture.
- Test quality: The target-restriction case selects the payload automatic acquisition already reaches, so ignoring target_ids still passes; select an unreachable target and assert blocked acquisition if the API remains.
Significant concerns. Posted 14 inline findings.
Automated review; human maintainers own approval decisions.
|
|
||
| @abstractmethod | ||
| def reset(self, env_ids: Sequence[int] | torch.Tensor | None = None, env_mask: wp.array | None = None) -> None: | ||
| """Release selected grippers without changing other worlds or physical poses.""" |
There was a problem hiding this comment.
🔴 Critical · Design Architecture — Release PhysX grips on reset
The new contract promises physical release, but PhysX reset only clears commands and reports open; its zero command retains the native grip. Send an open action to selected native grippers during reset.
| device=self._model.device, | ||
| ) | ||
|
|
||
| def update(self, dt: float) -> None: |
There was a problem hiding this comment.
🔴 Critical · Implementation — Publish state after the solver step
Seal state is written by a pre-substep force callback, and update does nothing. A seal broken in the final solver substep remains reported as sealed until the next step. Refresh measurement after stepping.
| def set_grippers_command_index( | ||
| self, states: torch.Tensor | wp.array, env_ids: wp.array | None = None, full_data: bool = False | ||
| ) -> None: | ||
| """Stage compact commands, or full-sized commands when ``full_data`` is true.""" |
There was a problem hiding this comment.
🟡 Warning · Style Consistency — Document command selection and shapes
The public setters and reset omit Google-style argument documentation for compact versus full-sized commands, shapes, and selector precedence. Add those contracts at the shared interface.
| self._global_prim_paths += asset_paths | ||
| elif isinstance(asset_cfg, SurfaceGripperCfg): | ||
| self._surface_grippers[asset_name] = instantiate(asset_cfg) | ||
| self._surface_grippers[asset_name] = instantiate(asset_cfg, sim=self.sim) |
There was a problem hiding this comment.
🟡 Warning · Compatibility — Preserve configured gripper constructors
Configured gripper classes accepting only cfg now receive an unexpected sim keyword. Construct through the former signature where possible; any replacement constructor contract needs a documented, warned deprecation transition.
| from isaaclab.utils.warp import ProxyArray | ||
| from isaaclab.utils.warp.memory import make_masked_copy, resolve_1d_indices, resolve_1d_mask, resolve_ids | ||
|
|
||
| from isaaclab_newton.physics import NewtonManager |
There was a problem hiding this comment.
🟡 Warning · Style Consistency — Use the package-relative import
NewtonManager is in the same package within the permitted relative-import depth. Import it from ...physics to follow the repository’s package-local rule.
| values = wp.from_torch(target_ids.to(dtype=torch.int32)) if isinstance(target_ids, torch.Tensor) else target_ids | ||
| wp.copy(wp.indexedarray(self._target_ids.warp, [ids]), values) | ||
|
|
||
| def set_grippers_command_index(self, states, env_ids=None, full_data: bool = False) -> None: |
There was a problem hiding this comment.
🟡 Warning · Style Consistency — Type the runtime method inputs
The Newton command setters and reset omit input and selector annotations despite the typed shared interface. Annotate their accepted Torch, Warp and selector inputs explicitly.
| self._target_ids = ProxyArray(wp.full(self._num_envs, -1, dtype=wp.int32, device=model.device)) | ||
| self._command = ProxyArray(wp.zeros(self._num_envs, dtype=wp.float32, device=model.device)) | ||
| self._state = ProxyArray(wp.full(self._num_envs, -1.0, dtype=wp.float32, device=model.device)) | ||
| self._engaged = ProxyArray(wp.zeros(self._num_envs, dtype=wp.bool, device=model.device)) |
There was a problem hiding this comment.
🟡 Warning · Scope Complexity — Remove duplicate engagement storage
engaged is true exactly when state is 1, including after reset. Derive the property from state and remove the extra buffer and per-substep writes.
| parcels = [body for body, label in enumerate(model.body_label) if label.endswith("/Cube2")] | ||
| distant = [body for body, label in enumerate(model.body_label) if label.endswith("/Cube0")] | ||
| if reset_index: | ||
| gripper.set_target_ids(torch.ones(2, dtype=torch.long, device=device)) |
There was a problem hiding this comment.
🟡 Warning · Test Quality — Make target restriction observable
The selected target is the box automatic acquisition already reaches, so ignoring target_ids passes every assertion. If restriction remains, select an unreachable target first and assert that acquisition is blocked.
| """ | ||
|
|
||
| def __init__(self, cfg: SurfaceGripperCfg): | ||
| def __init__(self, cfg: SurfaceGripperCfg, *, sim=None): |
There was a problem hiding this comment.
🟡 Warning · Style Consistency — Type the added context argument
The new sim parameter has no type or constructor return annotation, unlike the shared factory signature. Annotate it as SimulationContext | None and the constructor as returning None.
| retry_interval: float | None = None | ||
| """The amount of time the gripper will spend trying to grasp an object.""" | ||
| class SurfaceGripperCfg(BaseSurfaceGripperCfg): | ||
| """Keep the existing PhysX-specific configuration import and implementation.""" |
There was a problem hiding this comment.
🟡 Warning · Style Consistency — Describe the current PhysX contract
The class docstring describes preserving an old import rather than what this configuration selects. Describe the native PhysX implementation here; keep migration history in the changelog.
|
Updated in
The CUDA fixture, legacy configuration checks, and repository formatting and changelog checks passed. The native benchmark used an RTX PRO 6000, 256 worlds with five candidates each, two MJWarp substeps, and CUDA graph replay. After 120 warmup steps, five blocks of 300 steps gave medians of 0.519 ms at |
|
run-ci |
Adds `ConveyorCfg` and `Conveyor` to Isaac Lab for commanding existing collision surfaces. The Newton MJWarp implementation uses Newton’s conveyor force model for straight and curved belts, with batched speed commands, selected resets, and hard-reset rebinding. Includes a two-world transport test and a controller usage guide. The surface-gripper API is in #9070 and the Franka examples are in #9071. The full integration is in #8960. ## Newton runtime The controller temporarily imports `ConveyorForceModel` from the conveyor example at the Newton revision in `uv.lock` (`d31603ff5e8389d1d6b2a5daef6ea2cb074c26ff`). The import and the controller's per-world speed and force-buffer handling depend on that example implementation. The switch to a supported runtime interface is tracked upstream. [Newton #5501](newton-physics/newton#5501) ## Validation - 21 focused Newton controller and lifecycle cases passed. - Both conveyor tasks use the native collision defaults. On frozen warehouse and suction models, toggling the removed option produced identical collision pairs. - Formatting, changelog, and lock checks passed. - All 11 combined cases passed. The published racetrack policy matched the previous example-backed trace over 600 steps.
|
run-ci |
| @@ -0,0 +1,50 @@ | |||
| :orphan: | |||
|
|
|||
| Scene-owned surface grippers | |||
There was a problem hiding this comment.
can we combine this with the above tutorial? it's confusing to have 2 different guides on using surface grippers. we can document clearly which method is for which backend.
| @@ -561,6 +561,7 @@ def render(self, recompute: bool = False) -> np.ndarray | None: | |||
| def close(self): | |||
| """Cleanup for the environment.""" | |||
| if not self._is_closed: | |||
There was a problem hiding this comment.
this addition looks a bit fishy
|
run-ci |
## Description The Documentation Links job on #9070 fails because the G1 motion preview was renamed from `g1_cr7.mp4` to `g1_jump_and_turn.mp4` on the documentation asset host. [Hugging Face PR #6](https://huggingface.co/datasets/nvidia/isaaclab-docs-assets/discussions/6) confirms a 100% identical file rename. Update the G1 motion-tracking guide and Command Builder to use the renamed asset, preserving both video previews. The old reference is already on `main`, introduced in #9098. [Failing link-check job](https://github.com/isaac-sim/IsaacLab/actions/runs/45206719337/job/137804323431) ## Type of change - Documentation update ## Validation - Renamed video URL: HTTP 200; old URL: HTTP 404. - Lychee v0.24.2 on the updated motion-tracking guide: four links OK, zero errors. - `ISAACLAB_CHANGELOG_BASE_REF=upstream/main uv run --no-sync isaaclab --format`: passed all hooks. - `node --check docs/source/_static/css/environment-browser.js` and `git diff --check`: passed. - Clean Sphinx build attempted locally; blocked during API autosummary imports by missing simulation dependencies in the minimal macOS environment. Full documentation build remains for CI. ## Checklist - [x] I have read and understood the contribution guidelines - [x] I have run the pre-commit checks with `isaaclab --format` - [x] I have made corresponding changes to the documentation - [x] I have validated the changed behavior with focused coverage - No source package changes or test changes; no changelog fragment required.
## Description Adds a standalone [conveyor and suction tutorial](https://github.com/maxkra15/IsaacLab/blob/maximiliank/conveyor-franka-examples/docs/source/how-to/conveyors.rst). A procedural belt moves one parcel, then a kinematic suction tool seals against it. The example uses the conveyor controller and the scene-owned gripper API to seal, lift, and release the parcel onto the belt. This PR uses the conveyor controller from #9069 and depends on the surface-gripper API in #9070. The [tutorial-only diff](maxkra15/IsaacLab@maximiliank/surface-gripper-api...maximiliank/conveyor-franka-examples) isolates the example and its documentation. The larger task and asset implementation remains available in the combined preview #8960. ## Validation - The tutorial completed on Newton MJWarp on CPU and CUDA. In both runs the belt moved the parcel 0.18 m, and the gripper lifted it 0.07 m and released it onto the belt. - Four native conveyor and surface-gripper tests passed. The full formatting and Sphinx checks also passed. --------- Co-authored-by: Kelly Guo <kellyg@nvidia.com>
Adds
SurfaceGripperCfgandSurfaceGripperas scene-owned Isaac Lab assets. The same command and state interface selects Newton suction or the existing PhysX implementation. Scenes handle selected resets, command writes, and cleanup.Newton uses a four-pad gripper and acquires rigid payloads with one box collider. Tool offsets are relative to the selected body. Seal thresholds and pad forces are internal to the Newton implementation. The existing PhysX imports and authored prims remain supported. Two small Newton callback cleanup methods also appear in #9069 and are identical in both branches.
MDP2 applies the same selected-world reset and closes scene grippers before stopping physics.
Validation
See the surface gripper guide, the conveyor and suction tutorial in #9071, and combined draft #8960.