Skip to content

Simplify atomic action tutorials#371

Merged
yuecideng merged 1 commit into
mainfrom
enhance/atomic-action-tutorials
Jul 10, 2026
Merged

Simplify atomic action tutorials#371
yuecideng merged 1 commit into
mainfrom
enhance/atomic-action-tutorials

Conversation

@yuecideng

Copy link
Copy Markdown
Contributor

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, allowing PickUp to 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 through AtomicActionEngine, and coordinated placement reuses PickUp instead of a tutorial-local planner.

Dependencies: None.
Issue reference: N/A.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (non-breaking change which improves an existing functionality)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (existing functionality will not work without user modification)
  • Documentation update

Screenshots

Headless --auto_play runs generated MP4 recordings for all eight atomic-action tutorials.

Checklist

  • I have run Black formatting checks.
  • I have made corresponding changes to the documentation.
  • I have added tests that prove the explicit-grasp and tutorial-helper changes work.
  • Dependencies have not changed.

Extract shared tutorial setup and replay helpers, support explicit PickUp grasp poses, and route coordinated demos through the atomic action engine.
Copilot AI review requested due to automatic review settings July 10, 2026 07:07
@yuecideng yuecideng added docs Improvements or additions to documentation enhancement New feature or request atomic action atomic action related functionality labels Jul 10, 2026

Copilot AI left a comment

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.

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_xpos to GraspTarget and updated PickUp to 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 through AtomicActionEngine.
  • 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)
@yuecideng yuecideng merged commit bb4e4b9 into main Jul 10, 2026
6 checks passed
@yuecideng yuecideng deleted the enhance/atomic-action-tutorials branch July 10, 2026 08:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

atomic action atomic action related functionality docs Improvements or additions to documentation enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants