Skip to content

Integrate dexsim gizmo controllers - #431

Open
yuecideng wants to merge 7 commits into
mainfrom
feat/dexsim-gizmo-integration
Open

Integrate dexsim gizmo controllers#431
yuecideng wants to merge 7 commits into
mainfrom
feat/dexsim-gizmo-integration

Conversation

@yuecideng

Copy link
Copy Markdown
Contributor

Description

Summary

  • Delegate world-level rigid-body and articulation manipulation to dexsim's EntityGizmoManipulator.
  • Enable entity gizmos by default when a viewer window opens, keep headless simulations disabled, and expose explicit enable/disable/query APIs.
  • Register EmbodiChain's built-in default_plane as a static external target so it cannot be manipulated.
  • Bind robot TCP gizmos to dexsim's IKGizmoController and NewtonChainIK, while adapting joint state reads and writes through EmbodiChain's Robot abstraction.
  • Update gizmo examples and documentation, and add lifecycle, exclusion, and robot-controller tests.

Dependency / merge gate

This PR requires the next dexsim release and must not be merged or released before that version is published and EmbodiChain's dexsim requirement is updated.

The required dexsim release must include:

  • World.enable_entity_gizmo(), World.disable_entity_gizmo(), and World.get_entity_gizmo();
  • multi-target EntityGizmoManipulator support, including register_external_target();
  • dexsim.kit.ik.IKGizmoController and dexsim.kit.ik.NewtonChainIK.

The dependency file is intentionally unchanged because that dexsim version has not been released yet.

Related: #420

Type of change

  • New feature (non-breaking change which adds functionality)
  • Documentation update

Screenshots

Not applicable; behavior is covered by automated tests and interactive dexsim smoke tests.

Validation

  • black .
  • git diff --check
  • python -m compileall on changed Python modules
  • pytest -q tests/sim/test_cfg.py tests/sim/test_sim_manager.py tests/sim/objects/test_gizmo.py — 28 passed
  • pytest -q tests/sim/objects/test_robot_cfg.py -k 'not pk_dof' — 20 passed
  • pytest -q tests/sim/objects/test_robot_cfg.py -k 'pk_dof' — 8 passed
  • Interactive smoke checks for entity attach/detach, window reopen/config restore, headless behavior, default-plane exclusion, and robot IK on CPU/CUDA

Checklist

  • I have run the black . command to format the code base.
  • I have made corresponding changes to the documentation.
  • I have added tests that prove my feature works.
  • Dependencies have been updated — pending the next dexsim release described above.

Delegate entity and robot gizmo control to dexsim, wire entity gizmos into viewer lifecycle, and exclude the default plane from manipulation.
Copilot AI lite review requested due to automatic review settings July 27, 2026 11:45
@yuecideng yuecideng added enhancement New feature or request visualization Features or functions for visualization with the simulation dexsim Things related to dexsim robot Module related to robot interaction The interaction simulation features labels Jul 27, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI review requested due to automatic review settings August 6, 2026 06:36
@greptile-apps

greptile-apps Bot commented Aug 6, 2026

Copy link
Copy Markdown

Greptile Summary

The PR delegates native entity and robot IK gizmos to DexSim while adding Viser click-to-pick lifecycle management and robot-state adapters.

  • Adds DexSim entity-gizmo and Newton IK integration.
  • Adds picker-owned Viser gizmo acquisition and cleanup.
  • Updates examples, documentation, and lifecycle regression tests.

Confidence Score: 4/5

The PR should not merge until the outstanding manifest-to-frame picker-state mismatch is fixed, because an interim browser click can crash or select using stale transforms.

A topology-changing manifest replaces picker geometry and node ordering while retaining pose and visibility arrays from the previous revision until the next frame; clicks during that interval can index beyond the old arrays or ray-cast nodes with mismatched transforms.

Files Needing Attention: embodichain/lab/visualization/backends/viser.py

Important Files Changed

Filename Overview
embodichain/lab/sim/sim_manager.py Adds entity-gizmo lifecycle integration and tracks picker-owned Viser gizmos separately from user-created gizmos.
embodichain/lab/sim/objects/gizmo.py Reworks gizmo support around Viser controls and a DexSim Newton IK adapter for EmbodiChain robots.
embodichain/lab/visualization/backends/viser.py Adds click-to-pick interaction state and strengthens picker cleanup during backend shutdown.
embodichain/lab/visualization/picker.py Implements scene-geometry ray picking used by the browser gizmo workflow.
tests/sim/test_sim_manager.py Covers picker ownership, target replacement, stale command rejection, and visualization shutdown behavior.
tests/visualization/test_viser_backend.py Exercises browser picking, command emission, and interaction cleanup.

Reviews (3): Last reviewed commit: "wip" | Re-trigger Greptile

Comment thread embodichain/lab/sim/sim_manager.py

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 21 out of 21 changed files in this pull request and generated no new comments.

Suppressed comments (2)

embodichain/lab/visualization/runtime.py:168

  • PickCommandQueue.put() replaces an existing command in-place, which breaks the stated “arrival order” semantics when a client clicks again after other clients (e.g., A, B, A drains as A, B instead of B, A). To keep only the latest command per client while preserving correct ordering of the retained commands, remove any previous entry for the client and append the new command at the end.
            for index in range(len(self._commands) - 1, -1, -1):
                if self._commands[index].client_id == command.client_id:
                    self._commands[index] = command
                    return

embodichain/lab/sim/sim_manager.py:2367

  • process_pick_commands() is driven by the Viser backend, but enable_gizmo() defaults to creating a native DexSim gizmo whenever sim_config.headless is False. If a user configures Viser with headless=False (native window suppressed by Viser), this call can raise because no native window exists. For click-to-pick, force enable_native=False so the picker always uses the backend-neutral (Viser) gizmo path.
            self._release_picker_gizmo()
            gizmo = self.enable_gizmo(uid=uid)
            if gizmo is not None:

Copilot AI review requested due to automatic review settings August 6, 2026 07:34

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 26 out of 26 changed files in this pull request and generated no new comments.

Suppressed comments (1)

embodichain/lab/sim/sim_manager.py:2358

  • Click-to-pick currently clears the existing picker-owned Gizmo when the clicked node resolves to an unsupported kind (e.g., articulation/soft/camera). The docs state these are ignored by the picker, and clearing here also makes accidental clicks on non-pickable nodes unexpectedly detach the current pick.

Suggestion: keep the warning (or drop it), but do not call _release_picker_gizmo() for unsupported kinds—just continue processing the next command.

                logger.log_warning(
                    f"Pick target kind {kind!r} (uid {uid!r}) is not gizmo-able; "
                    "only rigid objects and robots can be picked."
                )
                self._release_picker_gizmo()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dexsim Things related to dexsim enhancement New feature or request interaction The interaction simulation features robot Module related to robot visualization Features or functions for visualization with the simulation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants