Skip to content

refactor(xarm): one grasping stack, hardware by default - #3873

Open
mustafab0 wants to merge 1 commit into
mb/grasp-05-reset-and-cancelfrom
mb/grasp-06-one-grasping-stack
Open

refactor(xarm): one grasping stack, hardware by default#3873
mustafab0 wants to merge 1 commit into
mb/grasp-05-reset-and-cancelfrom
mb/grasp-06-one-grasping-stack

Conversation

@mustafab0

Copy link
Copy Markdown
Contributor

This is the shape PR of the stack. Everything after it composes onto the file it introduces, so the thing worth deciding here is the shape, not the diff.

What was there. xarm-perception and xarm-room-sim were the same stack described twice, in two files. They planned the same way, picked the same way, and registered the same kind of scene; what actually differed between them was the hardware adapter, the base pose, the camera, the detector backends and the home pose. Because the difference was expressed by writing the whole stack out twice, every improvement landed on one copy. The sim copy got the newer thinking and the hardware copy rotted: xarm-perception had no coordinator at all, so it could plan and had nothing to drive the arm with; the sim copy had one but no rerun bridge and no viewer.

What replaces it. blueprints/grasp.py, one composition, with the arm-versus-sim split decided at import time the way mujoco_if_sim already does it — it has to be import time, because composition runs before module config is applied. Hardware is the default. --simulation mujoco swaps exactly the five things that genuinely differ, through two small functions (_sensing, _scene_registration) and one if over the model and the hardware component. Everything else is written once, in a shared module tuple, so a later PR that adds the voxel chain or a grasp provider adds it to both paths or neither.

Why a tuple and not more blueprints. _XARM_GRASP_MODULES is everything except the grasp provider, and the next PR composes a second variant from it by adding one module. That is the only axis on which the grasping blueprints are allowed to differ, and it stays visible: exactly one GraspGenSpec provider may be composed in, because PickAndPlaceModule resolves its generator by spec and two would be ambiguous.

Two geometry lies die here. xarm-perception pitched the planning base 45 degrees; the arm is mounted at identity, and a wrong base pose puts every planned pose wrong in exactly the way the 12 cm pedestal does. xarm-room-sim then made the mirror-image mistake, inheriting data/xarm7's 12 cm pedestal base_pose against a scene that bolts link_base to the world origin, so the planner solved every pose 12 cm high — the exact failure the comment on XARM7_SIM_BASE_POSE warns about. make_xarm7_sim_robot_config now takes the scene's base pose.

One hardcoded obstacle survives, deliberately. floor_z=-0.02 installs a 0.6 x 1.2 x 0.2 m box at (0.7, 0, -0.12) — not a floor, one bench, pinned to one spot, leaving everything nearer than x=0.4 unguarded. It is a lie, and it is the only thing standing in for the table on hardware, so it stays until the voxel map replaces it three PRs later rather than leaving the hardware planner with no ground at all in between.

xarm-perception-sim is untouched: it is the plain planning and teleop sim, not part of the grasping stack.

Sixth of nine in the xArm grasping re-landing stack.

xarm-perception and xarm-room-sim were the same stack described twice, in two
files, with the sim copy carrying the newer thinking and the hardware copy
quietly rotting. blueprints/grasp.py replaces both with one composition whose
arm-versus-sim split is decided at import time, the way mujoco_if_sim already
does it. Hardware is the default; --simulation swaps the hardware adapter, the
base pose, the camera and the engine behind it, the detector backends and the
home pose, and nothing else.

Three things that only existed on one side are now on both. The hardware path
gains a coordinator, which xarm-perception never had -- it could plan and had
nothing to drive the arm with. Both paths get the rerun bridge, which only
xarm-perception-sim composed. And both get the viser viewer, which the room sim
turned off.

Two hardware-only defects die with the old file. xarm-perception pitched the
planning base 45 degrees; the arm is mounted at identity, and a wrong base pose
puts every planned pose wrong the same way the 12 cm pedestal did. The room sim
then made the mirror-image mistake, inheriting data/xarm7's 12 cm pedestal
base_pose against a scene that bolts link_base to the world origin, so the
planner solved every pose 12 cm high; make_xarm7_sim_robot_config now takes the
scene's base pose.

The one hardcoded planner obstacle survives for now: floor_z=-0.02 stays on the
hardware path, and goes when the voxel map replaces it later in this stack.

xarm-perception-sim is untouched; it is the plain planning/teleop sim and not
part of the grasping stack.
@codecov

codecov Bot commented Sep 1, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 84.31373% with 8 lines in your changes missing coverage. Please review.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
dimos/robot/manipulators/xarm/blueprints/grasp.py 81.39% 5 Missing and 3 partials ⚠️
@@                       Coverage Diff                        @@
##           mb/grasp-05-reset-and-cancel    #3873      +/-   ##
================================================================
- Coverage                         77.72%   77.65%   -0.07%     
================================================================
  Files                              1324     1324              
  Lines                            125488   125505      +17     
  Branches                          10912    10915       +3     
================================================================
- Hits                              97537    97465      -72     
- Misses                            24865    24895      +30     
- Partials                           3086     3145      +59     
Flag Coverage Δ
OS-ubuntu-24.04-arm 74.32% <83.67%> (-0.01%) ⬇️
OS-ubuntu-latest 74.87% <83.67%> (-0.01%) ⬇️
Py-3.10 74.86% <83.67%> (?)
Py-3.11 74.86% <83.67%> (-0.01%) ⬇️
Py-3.12 74.86% <83.67%> (-0.01%) ⬇️
Py-3.13 74.86% <83.67%> (-0.01%) ⬇️
Py-3.14 74.87% <83.67%> (-0.01%) ⬇️
Py-3.14t 74.86% <83.67%> (?)
SelfHosted-Large 30.20% <77.55%> (-0.02%) ⬇️
SelfHosted-Linux 34.71% <78.43%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
dimos/robot/all_blueprints.py 100.00% <ø> (ø)
...imos/robot/manipulators/xarm/blueprints/agentic.py 100.00% <100.00%> (ø)
...s/robot/manipulators/xarm/blueprints/simulation.py 100.00% <ø> (ø)
...s/robot/manipulators/xarm/blueprints/test_grasp.py 100.00% <100.00%> (ø)
.../robot/manipulators/xarm/blueprints/test_teleop.py 100.00% <100.00%> (ø)
dimos/robot/manipulators/xarm/config.py 92.68% <100.00%> (ø)
dimos/robot/test_all_blueprints.py 87.50% <ø> (ø)
dimos/robot/manipulators/xarm/blueprints/grasp.py 81.39% <81.39%> (ø)

... and 6 files with indirect coverage changes

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@greptile-apps

greptile-apps Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This change consolidates the xArm grasping blueprints into a hardware-default stack that switches its model, hardware adapter, sensing, and scene registration components for MuJoCo.

Two launch paths need attention before merging: the Python API applies the MuJoCo override after resolving the grasp blueprint, and the standalone grasp composition does not explicitly preserve the detector isolation used by the agent composition.

T-Rex validation blocked

The Python API check could not load the project because the available environment was missing the pydantic_settings package and the repository virtual environment referenced an unavailable Python interpreter. The worker-allocation check was blocked before allocation or detector startup because numpy was missing from the available runtime environment.

Confidence Score: 3/5

Not safe to merge until the simulation-resolution ordering and standalone worker isolation are addressed.

The code paths indicate two independent launch reliability failures, but the focused runtime exercises could not complete because required runtime packages and a working project interpreter were unavailable.

Files Needing Attention: dimos/robot/manipulators/xarm/blueprints/grasp.py needs attention at the import-time simulation selection and the standalone blueprint composition.

T-Rex T-Rex Logs

What T-Rex did

    • The focused Python API validation script invoked Dimos(simulation="mujoco").run("xarm-grasp"), but execution stopped before blueprint resolution due to environment import failure.
    • The focused worker validation script attempted to deploy the standalone and agent grasp blueprints through the Python worker manager, but runtime imports failed because NumPy was unavailable, so no allocation or startup result.
    • The captured evidence shows a ModuleNotFoundError: No module named 'dimos' before correcting the repository root, and it was confirmed there was no functioning project interpreter available to produce a runtime result.
    • The validation artifact set documents the scripts and logs used for the attempts, including trex-artifacts/xarm-grasp-worker-validation.py and its before/after logs, to preserve evidence for review.

View all artifacts

T-Rex Ran code and verified through T-Rex

Reviews (1): Last reviewed commit: "refactor(xarm): one grasping stack, hard..." | Re-trigger Greptile

from dimos.utils.data import LfsPath
from dimos.visualization.rerun.bridge import RerunBridgeModule

SIMULATED = bool(global_config.simulation)

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.

P1 Simulation choice freezes too early

When Dimos(simulation="mujoco").run("xarm-grasp") resolves the blueprint, SIMULATED captures the default value before the Python API applies its configuration overrides. The resulting composition initializes the physical xArm and RealSense instead of MuJoCo, causing the simulation-requested run to fail without the hardware devices and configuration.

),
)

xarm_grasp = autoconnect(*_XARM_GRASP_MODULES, HeuristicGraspModule.blueprint())

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.

P1 Standalone detector loses worker isolation

When the standalone xarm-grasp blueprint runs, the dedicated Rerun bridge occupies one of the default two workers and every remaining module is packed into the other. This recreates the detector packing that the agent variant explicitly avoids because its lazy Transformers import fails, preventing the standalone grasp stack from initializing.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant