Repository navigation
Conversation
[Medium impact] The changes affect native task-program expansion and its simulated skill handoffs. The PR should not merge until both earlier problems are fixed.
|
| bridge = owned_plan.diagnostics.metadata.get("reference_bridge") | ||
| if bridge: | ||
| protected = int(bridge["prefix_samples"]) + 3 | ||
| if not torch.equal( | ||
| trajectory.positions[:, :protected], original.positions[:, :protected] | ||
| ): | ||
| raise ValueError( | ||
| "Plan rebuilding cannot change the reference takeover or its join stencil" |
There was a problem hiding this comment.
Native edits hit protected samples. A supported
joint_residual job can select pick_up: [approach], but _NativePlanExpansion._transform still protects only the first two phase samples. It can change index 2, while this new check protects indices 0–2 even when prefix_samples is zero. A nonempty prefix protects more. Candidates that pass motion checks then raise here instead of executing. Apply the bridge-aware phase narrowing to the native transform before it generates candidates; retain this safety check.
Knowledge Base Used: Atomic skill execution
Prompt To Fix With AI
This is a comment left during a code review.
Path: embodichain/lab/sim/atomic_skills/engine.py
Line: 1398-1405
Comment:
**Native edits hit protected samples.** A supported `joint_residual` job can select `pick_up: [approach]`, but `_NativePlanExpansion._transform` still protects only the first two phase samples. It can change index 2, while this new check protects indices 0–2 even when `prefix_samples` is zero. A nonempty prefix protects more. Candidates that pass motion checks then raise here instead of executing. Apply the bridge-aware phase narrowing to the native transform before it generates candidates; retain this safety check.
**Knowledge Base Used:** [Atomic skill execution](https://app.greptile.com/-/switch-tenant?tenant=dexforce&next=%2Fcustom-context%2Fknowledge-base%2Fdexforce%2Fembodichain%2F-%2Fdocs%2Fatomic-action-execution.md)
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.| pending = execution_mask & (self._boundary_stable < 2) | ||
| timed_out = pending & (elapsed_terminal >= boundary.boundary_timeout) |
There was a problem hiding this comment.
Settled rows lose their targets. With timed terminal acceptance and
boundary_stop=True, one row can become ready while a peer still waits. pending excludes the ready row, so the terminal frame marks it inactive. SimulationExecutionAdapter.send replaces inactive targets with measured positions, including contact-blocked fingers. This drops grasp pressure and changes the arm reference before the batch finishes. Keep still-eligible rows on the terminal command while peers wait, without reactivating failed rows.
Knowledge Base Used: Atomic skill execution
Prompt To Fix With AI
This is a comment left during a code review.
Path: embodichain/lab/sim/atomic_skills/execution.py
Line: 1274-1275
Comment:
**Settled rows lose their targets.** With timed terminal acceptance and `boundary_stop=True`, one row can become ready while a peer still waits. `pending` excludes the ready row, so the terminal frame marks it inactive. `SimulationExecutionAdapter.send` replaces inactive targets with measured positions, including contact-blocked fingers. This drops grasp pressure and changes the arm reference before the batch finishes. Keep still-eligible rows on the terminal command while peers wait, without reactivating failed rows.
**Knowledge Base Used:** [Atomic skill execution](https://app.greptile.com/-/switch-tenant?tenant=dexforce&next=%2Fcustom-context%2Fknowledge-base%2Fdexforce%2Fembodichain%2F-%2Fdocs%2Fatomic-action-execution.md)
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.
Description
Follow-up to merged #1192. Resetting the next skill's first target to measured qpos creates a controller-reference jump when the previous target has steady tracking error. Native expansion now retains a qualified stop and plans a bounded reference prefix before the original trajectory, without replacing measured observations or smoothing exported recordings.
Final implementation
Drive-bias evidence
Four matched layouts retain bitwise-identical Pick terminal command targets. The mean of each episode's maximum arm-joint reference error is 5.842 mrad at stiffness/damping 10000/1000, 2.900 mrad at 20000/1000, and 4.387 mrad at 10000/500. These diagnosis-only interventions support gain-dependent steady tracking bias; they are excluded from performance comparisons. No claim attributes the entire residual to gravity or saturation: the effort channel does not supply measured drive torque, and a gravity-toggle probe lacked independently verified post-reset readback.
The planner fixes the reference reset, not the underlying tracking bias. Main comparisons retain original gains and acceptance criteria.
Fresh paired results
Baseline: stop-only commit
532fe6ef4. Default CPU physics, independent Newton CPU geometry checks, UR5 open pick-place, seed 7, B=4, 16-rollout / 512-proposal budgets. Before/after then after/before, serial execution, fixed eight CPU cores, one numerical thread and visible GPU 1. AMD EPYC 9K65 / RTX PRO 5000 72GB; DexSim 0.6.0+879e1dae. Wall time includes setup, execution, validation and export, not Python import.All qualified Pick→Place boundaries have zero command position jump. Window maxima are .459 and .400 rad/s², below the unchanged .5 bound; the window normally spans −.04 to +.48 s and is recorded per row. Mean wall time increases 4.4% and 2.9%. These are two orders of one seed, not general performance guarantees.
Broader qualification limits: D's existing stop-gate rejection and candidate-budget shortfall remain. Relative to original main, the stop gate still excludes a high-bias sample; no threshold was loosened. The earlier joint-residual yield issue is addressed by the separately qualified repair below.
Joint-residual budget-exhaustion repair
The nominal Place/retract phase passes but already uses about 99% of its acceleration budget. Joint-range-normalized draws do not account for this thin dynamic margin; preserving endpoints alone does not bound discrete acceleration. Small reference changes can make the closest full-amplitude draw cross the limit, and the old exception reports only the last rejected draw. Some exploratory baseline runs pass 4/4; the frozen before/after/after/before comparison reproduces 3/4 in both baseline runs.
The repair retains the original 64 raw random draws and their order. Only exhaustion activates at most eight deterministic halvings of one retained best rejection (O(TD) storage). Every materialized variant must pass the original joint/motion validators and minimum delta, followed by unchanged FK, restoration, plan rebuilding, collision and physical/task checks. Passing original draws remain unscaled. The raw proposal count and deterministic refinement are recorded separately; no rollout or IK budget is increased.
Fresh baseline
6cd7da36b, same Default CPU pick-place group A, seed 7, B=4, 4 rollouts / 128 scene candidates / 240 seconds, two serial orders:Restored ordinal 2: closest raw proposal index 4 has acceleration ratio 1.000464, above the unchanged 1+1e-6 threshold. Scale 0.5 yields 0.993311 (0.993013 in the other run), with actual delta 0.009999 rad, above the original 0.002 rad minimum. Time grid, endpoints, hand columns and noneditable samples remain unchanged. The 2.6% wall-time difference is descriptive for this small sample; the effective-throughput gain comes primarily from recovering the fourth qualified episode.
The raw rejected candidate was not executed. Its planned residual/acceleration is shown separately from the measured handoff comparison:
Repair validation: 294 passed, 16 deselected in affected expansion/Task Program/trajectory suites; final focused tests 44 passed; final native smoke 4/4. Independent numerical/lifecycle review found no actionable defect. Source manifests, original failures and unchanged thresholds are retained. No general all-seed/all-operator success guarantee is claimed.
Mechanism, limits and both qualification stages
The plot uses A/repeat0/ordinal15, the largest baseline jump among successful matching-layout pairs. Initial object poses and preceding references match exactly; measured handoff qpos differs by at most 6.56e-7 rad. Blue is before, orange after; solid commands, dashed measurements, gray planned-prefix interval. Velocities are control-grid finite differences, not native instantaneous readings. Raw signals are not smoothed.
Validation
black ., API documentation 5165/5165, context and whitespace checks pass.Type of change
Checklist
Bounded via-point refinement
Native
via_pointsnow shares the deterministic refinement after the existing full-amplitude proposal budget is exhausted. It tries up to eight halvings on the closest motion-limit rejection and checks each materialized trajectory against the original limits and minimum delta. The selected trajectory retains the same time grid and protected samples, then follows the existing reconstruction, collision, and grasp/release acceptance.The UR5 open pick-place baseline scan used five existing seeds with the original 64-proposal budget and persisted 18/20. The two seed-27 rejections were Pick planning and Place stop-gate timeout. The deterministic one-proposal regression covers candidate-budget exhaustion directly. Its fixed via knot is rejected before the change at 2.898 times the acceleration cap and accepted at quarter scale under the same cap.
The matched baseline is
26cc8ddd5. All native accepted draws used scale 1. Seed 7's after trials were 22.17, 37.17 and 23.09 s. The slow trial includes approximately 10 extra seconds in environment initialization and remains in the results. Seed 7's maximum command acceleration within the handoff window is 0.411 → 0.412 rad/s². Every persisted episode passed the existing collision and lift/release-event checks.Method and results
Validation covers 196 targeted tests and 42 context tests. Deployment preflight, Black 26.10.1, API docs coverage (5165/5165), and whitespace checks passed.