Repository navigation
Add the Isaac Lab conveyor controller API - #9069
Conversation
[Medium impact] The changes affect conveyor workflows and Newton solver callbacks. Fix the frame used by body-attached belt surfaces before merging. Findings
SummaryAdds batched conveyor commands and connects Newton conveyor forces to each solver substep.
One issue needs fixing: surfaces attached to rotated or translated bodies use the wrong frame when setting their travel direction and curve center. Diagram%%{init: {'theme': 'neutral'}}%%
flowchart LR
A[Per-environment speed commands] --> B[Surface velocity targets]
C[Saved conveyor forces] --> D[Apply forces before solve]
D --> E[Solver substep]
E --> F[Solved contact forces]
F --> G[Compute next conveyor forces]
B --> G
G --> C
F --> H[Contact sensors after final step]
Reviews (1) · Last reviewed commit: "Add the Isaac Lab conveyor controller AP..." · Reviewed by Greptile |
| values = transforms[shape_id] | ||
| transform = wp.transform(wp.vec3(*values[:3]), wp.quat(*values[3:])) | ||
| direction = np.asarray(_world_vector(transform, spec.direction), dtype=np.float32) | ||
| speed = np.float32(spec.velocity) | ||
| parameters = { | ||
| "surface_normal": _world_vector(transform, spec.surface_normal), |
There was a problem hiding this comment.
Attached belts use wrong frame. In
_bind_solver, model.shape_transform is relative to the owning body when shape_body is not -1. Using it directly ignores that body's pose. A stationary belt on a rotated kinematic body therefore gets the wrong travel direction and surface normal; a curved belt on a translated body gets the wrong pivot.
Compose the shape transform with the owning body's world pose before converting the configured vectors and pivot. The transport test only uses shapes attached directly to the world, so it misses this case.
Knowledge Base Used: Newton backend
There was a problem hiding this comment.
Isaac Lab Review Bot
Needs attention: Design and architecture (2), Scope and over-engineering (1), Compatibility and deprecation (1), Implementation (1), Style consistency (5), Test quality (3). Other reviewed categories look good.
- PR description: Document per-substep observable work and validation commands; provide baseline/candidate step latency for requested observables with revisions, workload, hardware, backend, environment count, warmup, and capture mode.
- Design and architecture: Closing a conveyor leaves CONTACT_F requested and populated after subsequent hard resets; give observable requests consumer ownership and release this controller's request on close.
- Scope and over-engineering: Minimal implementation: Extend NewtonManager and NewtonBackend for observable ownership and substep callbacks; keep isaaclab/controllers/conveyor_cfg.py for the configuration contract, isaaclab/controllers/conveyor.py for command state and dispatch, and isaaclab_newton/controllers/conveyor.py for solver-binding lifecycle; delete the host-conversion helper and shifting collision field, and resolve paths from the simulation clone plan; retain command updates, binding, traction, reset, and cleanup. Scope is cohesive; no split recommended.
- API: API changes look good.
- Compatibility and deprecation: Breaking changes: inserting include_static_kinematic_pairs before reduce_contacts silently shifts existing positional constructor arguments without a deprecation bridge; remove the added field.
- Implementation: The MJWarp-only binding accepts incompatible Newton solvers before constructing a MuJoCo force model; reject unsupported solver configurations before requesting observables or registering callbacks.
- Style consistency: Controller constructors own configuration-field validation despite the configuration validation boundary; move startup-duration and transported-body-count checks into ConveyorCfg.validate_config.
- Test quality: Teardown assertions reset away active callbacks, and the late-callback check never replays its graph; verify detachment before resetting and advance another step to assert replay.
Significant concerns. Posted 13 inline findings.
Automated review; human maintainers own approval decisions.
| sim=sim, | ||
| ) | ||
| sim.reset() | ||
| conveyor.set_speed_scale(0.5) # Request 0.175 m/s in every environment. |
There was a problem hiding this comment.
🟡 Warning · Style Consistency — Remove command-narrating comments
The four inline comments restate the speed, stop, start, and reverse calls, while nearby prose explains command behavior. Remove the comments.
| from .differential_ik_cfg import DifferentialIKControllerCfg | ||
| from .operational_space import OperationalSpaceController | ||
| from .operational_space_cfg import OperationalSpaceControllerCfg | ||
| from .conveyor import Conveyor |
There was a problem hiding this comment.
🟡 Warning · Style Consistency — Sort the stub imports
The conveyor imports are appended after operational_space rather than following the required sorted import order. Move them before differential_ik.
| def _world_vector(transform: wp.transform, vector: tuple[float, float, float]) -> wp.vec3: | ||
| """Rotate and normalize an authored direction or surface normal.""" | ||
| rotated = wp.transform_vector(transform, wp.vec3(*vector)) | ||
| values = np.asarray([float(rotated[index]) for index in range(3)], dtype=np.float32) |
There was a problem hiding this comment.
🟡 Warning · Scope Complexity — Keep vector preparation in Warp
Each hard-reset binding converts rotated Warp vectors through Python and NumPy before reconstructing Warp values. Normalize the rotated vector directly with Warp operations and remove this conversion helper.
| return wp.vec3(*(float(value) for value in values)) | ||
|
|
||
|
|
||
| class Conveyor(BaseConveyor): |
There was a problem hiding this comment.
🟡 Warning · Style Consistency — Restore public member ordering
Conveyor follows private module helpers, and its public reset and close methods follow private callbacks. The contribution guide requires public classes before private functions and public instance methods before private ones; reorder them.
| """Bind configured surfaces before the first simulation reset.""" | ||
| super().__init__(cfg, num_envs, sim=sim) | ||
| self._surface_specs = tuple(self.cfg.surface_specs) | ||
| self._prim_paths = _resolve_surface_paths(num_envs, self._surface_specs, self.cfg.env_path_format) |
There was a problem hiding this comment.
🟡 Warning · Design Architecture — Use the simulation clone template
Surface paths use a separate configured template while the solver uses the simulation clone plan. Custom environment roots can therefore leave surfaces unmatched. Resolve paths from that plan, with a fallback for manually built worlds.
|
|
||
| def close(self) -> None: | ||
| """Detach lifecycle and graph callbacks before the model is released.""" | ||
| self._manager.unregister_solver_init_callback(self._bind_solver) |
There was a problem hiding this comment.
🟡 Warning · Design Architecture — Release owned observable requests
close() detaches callbacks but leaves CONTACT_F requested. Later hard resets allocate and populate per-substep outputs without a consumer. Track requests by owner and release this controller's request on close.
| Defaults to ``"explicit"`` (same as Newton's default when ``broad_phase=None``). | ||
| """ | ||
|
|
||
| include_static_kinematic_pairs: bool = True |
There was a problem hiding this comment.
🟡 Warning · Compatibility — Remove the shifting collision field
This unused field takes the former positional slot of reduce_contacts, silently changing existing constructor calls. Remove it; the conveyor and changed tests use the existing default.
| np.testing.assert_allclose(delta[0, :2], 0.0, atol=0.001) | ||
| assert np.linalg.norm(delta[2, :2]) > 0.001 | ||
|
|
||
| driver.set_speed_scale(-1.0, env_ids=(0,)) |
There was a problem hiding this comment.
🟡 Warning · Test Quality — Remove the unchanged speed command
Environment 0 already has scale -1, so this selected command cannot detect a broken update. Remove it or set a different value and assert the selected-world effect.
| assert driver.speed_scale.tolist() == [-1.0, 1.0] | ||
| assert transport()[2, 1] > 0.025 | ||
| driver.close() | ||
| sim.reset() |
There was a problem hiding this comment.
🟡 Warning · Test Quality — Check teardown on the active backend
This hard reset discards callbacks and graphs before the zero-motion assertion, so missing close-time detachment can pass. Verify the active backend stops applying conveyor traction before resetting.
| manager.register_post_solver_substep_callback( | ||
| lambda contacts, observables, state, dt: wp.launch(_count_steps, 1, inputs=[substeps]) | ||
| ) | ||
| sim.step(render=False) |
There was a problem hiding this comment.
🟡 Warning · Test Quality — Replay the late callback graph
The first step after registration runs eagerly and records a graph; its counter does not prove callback replay. Step again and assert the counter advances on replay.
There was a problem hiding this comment.
Isaac Lab Review Bot
Needs attention: Design and architecture (1), Scope and over-engineering (4), API (1), Compatibility and deprecation (1), Implementation (2), Style consistency (3), Test quality (2).
- PR description: The title fits; document solver hooks, remove the collision option, supply validation commands, and benchmark per-substep work against baseline/candidate revisions with workload, hardware, backend, environment count, warmup, and timing.
- Design and architecture: Closing a conveyor leaves CONTACT_F requested, so subsequent hard resets allocate and populate unused outputs; release consumer-owned observable requests on close.
- Scope and over-engineering: Minimal implementation: extend NewtonManager and NewtonBackend for observable ownership and callbacks; keep shared conveyor.py for dispatch and command state, conveyor_cfg.py for runtime-independent configuration, and Newton conveyor.py for binding lifecycle; collapse duplicate surface storage and vector conversions, derive clone roots from the active plan, and delete the unrelated collision option. Essential flow remains configuration, binding, commands, traction, reset, and cleanup. Scope is cohesive; no split recommended.
- API: Array commands discard env_ids when env_mask is supplied; reject conflicting selectors before branching so scalar and array commands share selection semantics.
- Compatibility and deprecation: Breaking changes: late contact-sensor registration now raises when requested solver outputs omit CONTACT_F, without a deprecation bridge; preserve separate sensor outputs without replacing bindings retained by existing consumers.
- Implementation: Failed hard-reset rebinding retains the old conveyor model, allowing reset to touch obsolete buffers; clear the binding when rebinding starts and reject reset while uninitialized.
- Style consistency: The guide promises storage reuse for all same-device indices, although strided and int64 selectors require conversion; restrict the claim to contiguous int32 indices.
- Test quality: The teardown assertion follows a hard reset that independently removes callbacks, masking failed close-time cleanup; verify removal on the active backend before resetting.
Significant concerns. Posted 14 inline findings.
Automated review; human maintainers own approval decisions.
|
|
||
| For device-side selection, use ``set_speed_scale(..., env_mask=mask)`` and | ||
| ``reset(env_mask=mask)`` with a full-environment boolean Warp or Torch mask. | ||
| Same-device masks and indices reuse native storage without a host round trip. |
There was a problem hiding this comment.
🟡 Warning · Style Consistency — Qualify native index reuse
Same-device int64 or strided indices still need normalization and copying; the test itself uses int64 indices. Limit the reuse claim to contiguous int32 indices.
| device=self.device, | ||
| ) | ||
| return | ||
| ids = ( |
There was a problem hiding this comment.
🟡 Warning · Api — Reject conflicting command selectors
Array commands silently discard env_ids whenever env_mask is supplied, unlike scalar commands. Reject both selectors together before branching so the command type cannot change the selection.
| optional: bool = False | ||
| """Permit this surface to be absent from some scene variants.""" | ||
|
|
||
| def __post_init__(self) -> None: |
There was a problem hiding this comment.
🟡 Warning · Implementation — Revalidate mutable surface settings
These checks run only at construction; later configuration updates can set a curved radius to zero before binding divides by it. Put the checks in the configuration validation hook.
| startup_duration_s: float = 1.0 | ||
| """Initial traction-ramp duration [s].""" | ||
|
|
||
| env_path_format: str = DEFAULT_ENV_TEMPLATE |
There was a problem hiding this comment.
🟡 Warning · Scope Complexity — Use the active clone template
This separate environment format can disagree with the clone plan already used for solver initialization, making valid surfaces appear missing. Resolve roots from the supplied simulation's plan.
| def _advance_startup_scale( | ||
| dt: wp.float32, duration: wp.float32, elapsed: wp.array[wp.float32], scale: wp.array[wp.float32] | ||
| ): | ||
| elapsed[0] += dt |
There was a problem hiding this comment.
🟡 Warning · Style Consistency — Use an exclusive-cell assignment
One thread owns elapsed[0], but Warp array += may lower to an atomic. Use explicit read-add-write assignment as required for exclusively owned output cells.
|
|
||
| def close(self) -> None: | ||
| """Detach lifecycle and graph callbacks before the model is released.""" | ||
| self._manager.unregister_solver_init_callback(self._bind_solver) |
There was a problem hiding this comment.
🟡 Warning · Design Architecture — Release the observable request
close() removes callbacks but leaves CONTACT_F requested. Later hard resets still allocate and populate unused per-substep outputs. Track requests by consumer and release this one on close.
| sensor = self.contact_sensors.get(key) | ||
| if sensor is not None: | ||
| return sensor | ||
| if ( |
There was a problem hiding this comment.
🟡 Warning · Compatibility — Preserve late sensor registration
A late contact sensor previously allocated its own outputs; it now raises if another consumer requested observables without CONTACT_F. Preserve that path without replacing outputs already bound to consumers.
| Defaults to ``"explicit"`` (same as Newton's default when ``broad_phase=None``). | ||
| """ | ||
|
|
||
| include_static_kinematic_pairs: bool = True |
There was a problem hiding this comment.
🟡 Warning · Scope Complexity — Remove unrelated collision policy
Neither the conveyor binding nor its transport test uses this option. It expands public physics configuration independently of the stated feature; remove it from this change.
| assert driver.speed_scale.tolist() == [-1.0, 1.0] | ||
| assert transport()[2, 1] > 0.025 | ||
| driver.close() | ||
| sim.reset() |
There was a problem hiding this comment.
🟡 Warning · Test Quality — Check teardown before hard reset
Hard reset independently discards backend callbacks, so this assertion cannot detect failed close-time removal. Check transport on the active backend immediately after close.
| manager.register_post_solver_substep_callback( | ||
| lambda contacts, observables, state, dt: wp.launch(_count_steps, 1, inputs=[substeps]) | ||
| ) | ||
| sim.step(render=False) |
There was a problem hiding this comment.
🟡 Warning · Test Quality — Replay the registered callback
This step executes eagerly while recording the replacement graph. It passes even if replay omits the late callback. Step again and assert that the counter advances.
|
Updated in
On an RTX PRO 6000 with 256 worlds, four boxes per world, two MJWarp substeps, and CUDA graph replay, the median synchronized step took 0.502 ms on |
|
run-ci |
Adds `SurfaceGripperCfg` and `SurfaceGripper` as 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 - Native acquisition, lift, release, and selected reset passed on CPU and CUDA. - A captured MDP2 scene passed selected-world resets with changing masks and detached the gripper before simulation shutdown. - Formatting, changelog, and strict documentation checks passed. Native PhysX operation requires Isaac Sim. - The consolidated guide passed Sphinx and the repository format checks. See the [surface gripper guide](https://github.com/maxkra15/IsaacLab/blob/maximiliank/surface-gripper-api/docs/source/how-to/run_surface_gripper.rst), the conveyor and suction tutorial in #9071, and combined draft #8960. --------- Co-authored-by: Kelly Guo <kellyg@nvidia.com>
## 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
ConveyorCfgandConveyorto 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
ConveyorForceModelfrom the conveyor example at the Newton revision inuv.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 #5501Validation