Integrate dexsim gizmo controllers - #431
Conversation
Delegate entity and robot gizmo control to dexsim, wire entity gizmos into viewer lifecycle, and exclude the default plane from manipulation.
Greptile SummaryThe PR integrates DexSim entity and robot IK Gizmo controllers across native-window, Viser, and preview workflows.
Confidence Score: 4/5The PR is not yet safe to merge because picker ownership and manifest/frame synchronization failures remain outstanding. Picking an entity can still claim and later destroy a pre-existing user Gizmo, while a topology-changing manifest can still pair new node IDs with old picker transforms until the next matching frame. Files Needing Attention: embodichain/lab/sim/sim_manager.py; embodichain/lab/visualization/backends/viser.py
|
| Filename | Overview |
|---|---|
| embodichain/lab/sim/sim_manager.py | Adds entity-Gizmo lifecycle management, picker integration, and simulation-thread Gizmo command processing. |
| embodichain/lab/sim/objects/gizmo.py | Reworks robot Gizmos around DexSim Newton IK while retaining rigid-object and camera control paths. |
| embodichain/lab/visualization/backends/viser.py | Adds browser click-to-pick controls, ray-cast state, and pick-command publication. |
| embodichain/lab/visualization/picker.py | Introduces backend-neutral ray-to-triangle selection for static scene meshes. |
| embodichain/lab/scripts/run_env.py | Adds native single-environment preview setup and visibility controls for robot IK Gizmos. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart LR
A[Native window] --> B[DexSim EntityGizmoManipulator]
C[Viser click] --> D[ScenePicker]
D --> E[PickCommand queue]
E --> F[SimulationManager]
F --> G[Target Gizmo]
H[Robot TCP target] --> I[IKGizmoController]
I --> J[NewtonChainIK]
J --> K[Robot joint drive targets]
Reviews (2): Last reviewed commit: "wip" | Re-trigger Greptile
There was a problem hiding this comment.
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:
There was a problem hiding this comment.
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()
Description
Summary
EntityGizmoManipulator.default_planeas a static external target so it cannot be manipulated.IKGizmoControllerandNewtonChainIK, while adapting joint state reads and writes through EmbodiChain'sRobotabstraction.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(), andWorld.get_entity_gizmo();EntityGizmoManipulatorsupport, includingregister_external_target();dexsim.kit.ik.IKGizmoControlleranddexsim.kit.ik.NewtonChainIK.The dependency file is intentionally unchanged because that dexsim version has not been released yet.
Related: #420
Type of change
Screenshots
Not applicable; behavior is covered by automated tests and interactive dexsim smoke tests.
Validation
black .git diff --checkpython -m compileallon changed Python modulespytest -q tests/sim/test_cfg.py tests/sim/test_sim_manager.py tests/sim/objects/test_gizmo.py— 28 passedpytest -q tests/sim/objects/test_robot_cfg.py -k 'not pk_dof'— 20 passedpytest -q tests/sim/objects/test_robot_cfg.py -k 'pk_dof'— 8 passedChecklist
black .command to format the code base.