Uh oh!
There was an error while loading. Please reload this page.
Refactor atomic actions into primitives package - #346
Merged
Conversation
Move built-in atomic action implementations into atomic_actions.primitives while preserving existing package-level and actions.py imports. Update tutorial, API reference, overview docs, and the add-atomic-action skill to reflect the new layout.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR reorganizes EmbodiChain’s built-in atomic action implementations into a dedicated embodichain.lab.sim.atomic_actions.primitives subpackage while keeping existing public and legacy import paths working, and updates the docs/skill guidance accordingly.
Changes:
- Split each built-in atomic action into its own module under
atomic_actions/primitives/and added aprimitivespackage export surface. - Converted
atomic_actions/actions.pyinto a backward-compatible re-export facade and updatedatomic_actions/__init__.pyto import fromprimitives. - Extended Sphinx API reference and tutorial/overview docs (plus the
add-atomic-actionskill) to reflect the new layout.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| embodichain/lab/sim/atomic_actions/primitives/place.py | New Place primitive module. |
| embodichain/lab/sim/atomic_actions/primitives/pick_up.py | New PickUp primitive module (grasp planning + held-object state). |
| embodichain/lab/sim/atomic_actions/primitives/move_joints.py | New MoveJoints primitive module (joint-space planning). |
| embodichain/lab/sim/atomic_actions/primitives/move_held_object.py | New MoveHeldObject primitive module (object-pose target while holding). |
| embodichain/lab/sim/atomic_actions/primitives/move_end_effector.py | New MoveEndEffector primitive module (EEF pose planning). |
| embodichain/lab/sim/atomic_actions/primitives/_helpers.py | Shared internal helpers extracted for primitives. |
| embodichain/lab/sim/atomic_actions/primitives/init.py | New primitives package exports. |
| embodichain/lab/sim/atomic_actions/actions.py | Replaced concrete implementations with compatibility re-exports. |
| embodichain/lab/sim/atomic_actions/init.py | Public API now imports built-ins from primitives. |
| docs/source/tutorial/atomic_actions.rst | Tutorial updated to describe new primitives layout and export steps. |
| docs/source/overview/sim/atomic_actions/index.md | Overview updated to mention primitives and legacy facade. |
| docs/source/api_reference/embodichain/embodichain.lab.sim.atomic_actions.rst | API reference updated with layout notes + hidden toctree to primitives. |
| docs/source/api_reference/embodichain/embodichain.lab.sim.atomic_actions.primitives.rst | New API reference page documenting primitive modules. |
| .agents/skills/add-atomic-action/SKILL.md | Skill guidance updated to scaffold built-ins under primitives/ and docs paths. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| third_phase_name="back", | ||
| ) | ||
| lift_offset = torch.tensor([0, 0, 1], device=self.device) * self.cfg.lift_height |
Comment on lines
+158
to
+161
| lift_xpos = self.builder.apply_local_offset( | ||
| grasp_xpos, | ||
| torch.tensor([0, 0, 1], device=self.device) * self.cfg.lift_height, | ||
| ) |
Comment on lines
+82
to
+85
| def should_wait_for_tutorial_input(args: argparse.Namespace) -> bool: | ||
| """Return whether the tutorial should pause for terminal input.""" | ||
| return not getattr(args, "auto_play", False) | ||
Comment on lines
+36
to
+39
| logger.log_error( | ||
| f"object_target_pose must be (4, 4) or ({n_envs}, 4, 4), but got {target.shape}", | ||
| ValueError, | ||
| ) |
Uh oh!
There was an error while loading. Please reload this page.
Comment on lines
+254
to
+257
| next_state=WorldState( | ||
| last_qpos=full[:, -1, :].clone(), | ||
| held_object=support_held_object, | ||
| ), |
| ) | ||
| ) | ||
| is False | ||
| ) |
Uh oh!
There was an error while loading. Please reload this page.
yuecideng added a commit
that referenced
this pull request
Jul 28, 2026
Sync the demo-base feature with the latest main (44 commits), which refactored atomic actions in parallel: - #346 refactor atomic actions into a primitives package - #349 env-batched parallel motion generation (AtomicActionEngine.run now returns a (B,) success tensor; compute_ik returns a batched success tensor) - #371 simplify atomic action tutorials (extract helpers into tutorial_utils.py, flat style) Conflict resolution (7 files: 6 atomic_action tutorials + tutorial_utils.py): - tutorial_utils.py: take main's version. It is a strict superset of the PR's (keeps create_ur5_gripper_robot_cfg, make_ur5_solver_cfg, draw_axis_marker, start/stop_auto_play_recording and adds create_tutorial_simulation, add_ur5_gripper_robot, create_toppra_motion_generator, prepare_tutorial_scene, env-batched replay_trajectory, broadcast_pose_batch, etc.). - 6 tutorials: keep the PR's DemoBase migration and adapt to main's env-batched API. engine.run success changed from a scalar is_success to a (B,) tensor, so the guard is now 'if not success.all():' (compute_ik already used torch.all). Target constructor params (qpos/name/xpos/semantics/object_target_pose) match main's core.py. This also restores the sim.destroy() cleanup that main's flat tutorials lack (DemoBase.main try/finally), avoiding the exit-time segfault. Verified: 19 unit tests pass; move_joints and pickup run headless --auto_play end-to-end with a clean exit (exit 0). Co-Authored-By: Claude <noreply@anthropic.com>
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 freeto 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 refactors the built-in atomic action implementations into a dedicated
embodichain.lab.sim.atomic_actions.primitivessubpackage while preserving existing public imports.Summary:
atomic_actions/primitives/.embodichain.lab.sim.atomic_actionsas the recommended public API andatomic_actions.actionsas a backward-compatible re-export facade.add-atomic-actionskill to point future built-ins at the new layout.Dependencies: None.
Fixes: N/A
Type of change
Screenshots
N/A
Verification
black .black --check --diff --color ./git diff --checkpython -m compileall -q embodichain/lab/sim/atomic_actionspytest tests/sim/atomic_actions -q(93 passed)python -m sphinx -b html docs/source /tmp/embodichain-docs-atomic-actions(succeeded with existing project-wide warnings)--headless --auto_play --device cpuChecklist
black .command to format the code base.