Simplify atomic action tutorials#371
Merged
Merged
Conversation
Extract shared tutorial setup and replay helpers, support explicit PickUp grasp poses, and route coordinated demos through the atomic action engine.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors the atomic-action tutorial scripts to reduce duplicated simulation boilerplate while preserving the typed-target + action-configuration workflow they demonstrate. It also extends the GraspTarget target type to optionally carry an explicit TCP grasp pose, allowing PickUp to consume externally-selected grasps without re-sampling.
Changes:
- Added optional
grasp_xpostoGraspTargetand updatedPickUpto use it when provided. - Centralized tutorial setup, antipodal semantics construction, and replay/record helpers in
tutorial_utils.py; updated tutorials to reuse these helpers and run throughAtomicActionEngine. - Added/updated tests and docs to cover the explicit-grasp flow and revised tutorial utilities.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/sim/atomic_actions/test_tutorial_utils.py | Adds a unit test for the new antipodal-semantics helper behavior. |
| tests/sim/atomic_actions/test_actions.py | Adds a unit test ensuring PickUp accepts an explicit grasp pose and skips affordance sampling. |
| scripts/tutorials/atomic_action/tutorial_utils.py | Introduces shared tutorial simulation setup, antipodal semantics builder, and replay/record helpers. |
| scripts/tutorials/atomic_action/press.py | Reworks Press tutorial to use shared helpers and engine-driven execution/replay. |
| scripts/tutorials/atomic_action/place.py | Reworks Place tutorial to use shared helpers, shared antipodal semantics, and unified replay. |
| scripts/tutorials/atomic_action/pickup.py | Reworks PickUp tutorial to use shared setup/semantics and unified replay. |
| scripts/tutorials/atomic_action/move_joints.py | Reworks MoveJoints tutorial to use shared setup and unified replay. |
| scripts/tutorials/atomic_action/move_held_object.py | Reworks MoveHeldObject tutorial to use shared setup/semantics and unified replay. |
| scripts/tutorials/atomic_action/move_end_effector.py | Reworks MoveEndEffector tutorial to use shared setup and unified replay. |
| scripts/tutorials/atomic_action/coordinated_placement.py | Updates coordinated placement demo to reuse PickUp, run coordinated action through AtomicActionEngine, and reuse replay helper. |
| scripts/tutorials/atomic_action/coordinated_pickment.py | Updates coordinated pickment demo to run through AtomicActionEngine and reuse replay helper. |
| embodichain/lab/sim/atomic_actions/primitives/pick_up.py | Updates PickUp.execute() to accept an explicit grasp_xpos in GraspTarget. |
| embodichain/lab/sim/atomic_actions/core.py | Extends GraspTarget dataclass with optional grasp_xpos and documents its intended shapes/behavior. |
| docs/source/overview/sim/atomic_actions/index.md | Updates docs to reflect the extended GraspTarget signature and semantics. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+135
to
+139
| else: | ||
| grasp_xpos = self.builder.resolve_pose_target( | ||
| target.grasp_xpos, n_envs=self.n_envs | ||
| ) | ||
| is_success = torch.ones(self.n_envs, dtype=torch.bool, device=self.device) |
Comment on lines
+395
to
+399
| sim.update(step=trajectory_sim_steps) | ||
| if on_trajectory_step is not None: | ||
| on_trajectory_step(step_idx, total_steps) | ||
| time.sleep(1e-2) | ||
|
|
Comment on lines
+406
to
+407
| sim.update(step=hold_sim_steps) | ||
| time.sleep(1e-2) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR simplifies the atomic-action tutorials while preserving the action configuration and typed-target flow that the examples are intended to teach.
It adds an optional explicit TCP grasp pose to
GraspTarget, allowingPickUpto consume geometry- or perception-selected grasps without duplicating pickup trajectory construction. Shared tutorial setup, antipodal semantics, recording, and replay helpers remove repeated simulation boilerplate. The coordinated demos now execute throughAtomicActionEngine, and coordinated placement reusesPickUpinstead of a tutorial-local planner.Dependencies: None.
Issue reference: N/A.
Type of change
Screenshots
Headless
--auto_playruns generated MP4 recordings for all eight atomic-action tutorials.Checklist