Add OpenDoor benchmark and repair the atomic-action benchmark suite - #619
Add OpenDoor benchmark and repair the atomic-action benchmark suite#619Yuan-Xinyi wants to merge 1 commit into
Conversation
Add scripts/benchmark/atomic_action/open_door_benchmark.py, the first articulated-skill benchmark in the suite: it plans the microwave-door opening across hinge targets, physically replays the trajectory, and gates success on the replayed hinge angle reaching the target within 0.15 rad. Registered in run_benchmark.py so `embodichain benchmark atomic-action --action open_door` dispatches it. Full-sample run (Franka/PGI UR5, n_sample=10000, CUDA): plan 7.7 s, door opened with 0.022 rad hinge error. The five existing atomic-action benchmarks could not run as shipped; fixed as prerequisites (open_door reuses the same helpers): - The tutorial modules never exported create_robot / initialize_simulation (and pickup/place/move_held_object also needed compute_pick_close_end_step, make_pre_pick_eef_pose), so every benchmark failed at import. Added them plus a shared initialize_benchmark_simulation that adapts a benchmark namespace to create_tutorial_simulation. - move_joints / move_end_effector compiled without a planning context; they now pass initial_context(control_dt=sim.sim_config.physics_dt). - No benchmark released its SimulationManager, so every run (success or failure) hung the process at exit; entry points now wrap main() in run_tutorial for deterministic top-level teardown. - pickup / place / move_held_object called the old get_hand_open_close_qpos(robot, device) two-arg signature. - move_end_effector's 0.01 m success tolerance sat exactly on the resampled-endpoint error (0.0100 m) and failed by micrometres; widened to 0.015 m with a comment. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
| """ | ||
| if compiled is not None: | ||
| return int(compiled.segment(invocation_index, "lift").start) | ||
| return 120 + 12 |
There was a problem hiding this comment.
The fallback claims to return the end of PickUp's close segment, but 120 + 12 is beyond the entire 120-waypoint trajectory. With the benchmark's sample_count=120 and hand_interp_steps=12, the compiled lift segment starts at waypoint 77. Both callbacks using this fallback therefore never call obj.clear_dynamics(), so physical PickUp validation and recorded replays omit the intended post-grasp dynamics transition and can produce invalid results. Pass the available compiled result to this helper or derive the boundary using PickUp's segment construction.
Prompt To Fix With AI
This is a comment left during a code review.
Path: scripts/tutorials/atomic_action/tutorial_utils.py
Line: 1206
Comment:
**Unreachable PickUp Boundary**
The fallback claims to return the end of PickUp's close segment, but `120 + 12` is beyond the entire 120-waypoint trajectory. With the benchmark's `sample_count=120` and `hand_interp_steps=12`, the compiled lift segment starts at waypoint 77. Both callbacks using this fallback therefore never call `obj.clear_dynamics()`, so physical PickUp validation and recorded replays omit the intended post-grasp dynamics transition and can produce invalid results. Pass the available compiled result to this helper or derive the boundary using PickUp's segment construction.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.| initialize_benchmark_simulation, | ||
| ) | ||
|
|
||
| cases = _select_cases(args.door_cases) |
There was a problem hiding this comment.
Aggregate in-process dispatch constructs a child namespace without door_cases, but this benchmark unconditionally reads args.door_cases. Running embodichain benchmark atomic-action --action open_door --in_process, or reaching OpenDoor through --action all --in_process, therefore raises AttributeError before writing a report. Add the OpenDoor default to _make_child_args or apply the normal default when this attribute is absent.
Prompt To Fix With AI
This is a comment left during a code review.
Path: scripts/benchmark/atomic_action/open_door_benchmark.py
Line: 279
Comment:
**In-Process Dispatch Crashes**
Aggregate in-process dispatch constructs a child namespace without `door_cases`, but this benchmark unconditionally reads `args.door_cases`. Running `embodichain benchmark atomic-action --action open_door --in_process`, or reaching OpenDoor through `--action all --in_process`, therefore raises `AttributeError` before writing a report. Add the OpenDoor default to `_make_child_args` or apply the normal default when this attribute is absent.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.| return perf_rows, metric_rows | ||
|
|
||
|
|
||
| def run_all_benchmarks(args: argparse.Namespace | None = None) -> Path: |
There was a problem hiding this comment.
This feature and the accompanying benchmark repairs add no focused automated tests, despite the repository requirement that new fixes and features include tests proving their behavior. Before merging, add coverage for OpenDoor case selection and physical hinge success, aggregate in-process dispatch, and the new PickUp segment-boundary behavior. Executable benchmark scripts and manually reported smoke runs do not provide regression coverage.
Context Used: CLAUDE.md (source)
Prompt To Fix With AI
This is a comment left during a code review.
Path: scripts/benchmark/atomic_action/open_door_benchmark.py
Line: 258
Comment:
**Focused Tests Are Missing**
This feature and the accompanying benchmark repairs add no focused automated tests, despite the repository requirement that new fixes and features include tests proving their behavior. Before merging, add coverage for OpenDoor case selection and physical hinge success, aggregate in-process dispatch, and the new PickUp segment-boundary behavior. Executable benchmark scripts and manually reported smoke runs do not provide regression coverage.
**Context Used:** CLAUDE.md ([source](https://github.com/dexforce/embodichain/blob/main/CLAUDE.md))
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
| ] | ||
|
|
||
|
|
||
| def initialize_benchmark_simulation(args) -> "SimulationManager": |
There was a problem hiding this comment.
The new public helper leaves args unannotated, contrary to the repository requirement to fully annotate public APIs. This requirement must be satisfied before merging by adding an appropriate namespace or protocol annotation. The same new unannotated adapter parameters occur in move_held_object.py and pickup.py, with the pattern also present in the other tutorial adapters.
Context Used: AGENTS.md (source)
Prompt To Fix With AI
This is a comment left during a code review.
Path: scripts/tutorials/atomic_action/tutorial_utils.py
Line: 1169
Comment:
**Public API Lacks Annotation**
The new public helper leaves `args` unannotated, contrary to the repository requirement to fully annotate public APIs. This requirement must be satisfied before merging by adding an appropriate namespace or protocol annotation. The same new unannotated adapter parameters occur in `move_held_object.py` and `pickup.py`, with the pattern also present in the other tutorial adapters.
**Context Used:** AGENTS.md ([source](https://github.com/dexforce/embodichain/blob/main/AGENTS.md))
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.| ] | ||
|
|
||
|
|
||
| def initialize_benchmark_simulation(args) -> "SimulationManager": |
There was a problem hiding this comment.
The module's explicit public surface omits both newly added helpers, contrary to the repository requirement to define __all__ for public modules. This requirement must be satisfied before merging by exporting initialize_benchmark_simulation and compute_pick_close_end_step. The new OpenDoor benchmark also lacks __all__, and the newly exposed tutorial adapter APIs follow the same pattern elsewhere.
Context Used: AGENTS.md (source)
Prompt To Fix With AI
This is a comment left during a code review.
Path: scripts/tutorials/atomic_action/tutorial_utils.py
Line: 1169
Comment:
**Public Exports Are Incomplete**
The module's explicit public surface omits both newly added helpers, contrary to the repository requirement to define `__all__` for public modules. This requirement must be satisfied before merging by exporting `initialize_benchmark_simulation` and `compute_pick_close_end_step`. The new OpenDoor benchmark also lacks `__all__`, and the newly exposed tutorial adapter APIs follow the same pattern elsewhere.
**Context Used:** AGENTS.md ([source](https://github.com/dexforce/embodichain/blob/main/AGENTS.md))
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.| from scripts.tutorials.atomic_action.tutorial_utils import ( | ||
| compute_pick_close_end_step, | ||
| initialize_benchmark_simulation, | ||
| make_eef_pose_at, | ||
| ) |
There was a problem hiding this comment.
make_eef_pose_at is imported in both adjacent import blocks introduced by this change. This redundant binding increases maintenance noise and can trigger duplicate-import lint failures. Remove the second occurrence.
| from scripts.tutorials.atomic_action.tutorial_utils import ( | |
| compute_pick_close_end_step, | |
| initialize_benchmark_simulation, | |
| make_eef_pose_at, | |
| ) | |
| from scripts.tutorials.atomic_action.tutorial_utils import ( | |
| compute_pick_close_end_step, | |
| initialize_benchmark_simulation, | |
| ) |
Prompt To Fix With AI
This is a comment left during a code review.
Path: scripts/tutorials/atomic_action/move_held_object.py
Line: 62-66
Comment:
**Duplicate Helper Import**
`make_eef_pose_at` is imported in both adjacent import blocks introduced by this change. This redundant binding increases maintenance noise and can trigger duplicate-import lint failures. Remove the second occurrence.
```suggestion
from scripts.tutorials.atomic_action.tutorial_utils import (
compute_pick_close_end_step,
initialize_benchmark_simulation,
)
```
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Description
Adds an OpenDoor benchmark — the first articulated-skill benchmark in
scripts/benchmark/atomic_action/— and repairs the five existing atomic-action benchmarks, which could not run as shipped.New: OpenDoor benchmark
open_door_benchmark.pyplans the tutorial microwave-door opening across hinge targets (30°/60°/90°), physically replays the compiled trajectory, and gates success on the replayed hinge angle reaching the target within 0.15 rad — not merely on plan success. Registered inrun_benchmark.py, soembodichain benchmark atomic-action --action open_doordispatches it, and it emits the three required Markdown tables (Time & Memory / Success & Metrics / Leaderboard).Full-sample result (UR5 + PGI gripper,
n_sample=10000, CUDA):(Planning time is dominated by antipodal grasp-pose generation + NMS on the handle; the smoke profile uses
n_sample=1000and is a "runs without crashing" gate, matching the other benchmarks' smoke semantics.)Prerequisite repairs to the existing suite
All five shipped benchmarks (move_joints, move_end_effector, pick_up, place, move_held_object) failed to run; OpenDoor reuses the same helpers, so these were fixed first:
create_robot/initialize_simulation(and pickup/place/move_held_object also referencedcompute_pick_close_end_step/make_pre_pick_eef_pose), so every benchmark raisedImportErrorat startup. Added them, plus a sharedinitialize_benchmark_simulationthat adapts a benchmark argument namespace tocreate_tutorial_simulation.compile()without a context and hitIK interpolation requires explicit interpolation_dt; they now passinitial_context(control_dt=sim.sim_config.physics_dt).main()inrun_tutorialfor deterministic top-level teardown.get_hand_open_close_qpos(robot, device).After the repairs,
move_jointspasses end-to-end (316 ms plan, success, report written, clean exit); the mesh-object benchmarks import, plan, replay, and report correctly.Dependencies: none. (
pick_upand grasp-sampling skills still require cuRobo for the full profile, unchanged.)Type of change
Screenshots
N/A
Checklist
black .command to format the code base.Validation