Skip to content

feat(atomic-actions): improve upright grasp selection - #542

Open
skywhite1024 wants to merge 30 commits into
feat/cube-physical-recovery-gatesfrom
ljd/gen-sim-atomic-prerequisite
Open

feat(atomic-actions): improve upright grasp selection#542
skywhite1024 wants to merge 30 commits into
feat/cube-physical-recovery-gatesfrom
ljd/gen-sim-atomic-prerequisite

Conversation

@skywhite1024

@skywhite1024skywhite1024 commented Aug 21, 2026

Copy link
Copy Markdown
Collaborator

Replacement

Supersedes #540. The code is unchanged; this PR moves the head branch from the temporary codex/ namespace to ljd/gen-sim-atomic-prerequisite.

Stack

Description

This PR extracts the reusable Atomic Action prerequisite from GenSim PR #538. It adds object-aware upright grasp ranking before GraspKit top-k truncation, rejects top/bottom clamp poses for upright transport, and checks yaw-equivalent downstream targets without persisting grounded poses in task artifacts.

Dependencies: none. This should land before the rewritten GenSim semantic task-planning stack (#533-#538).

Refs #538

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

Validation

  • black ./
  • python docs/scripts/check_api_docs.py
  • pytest tests/docs/test_check_api_docs.py -q --confcutdir=tests/docs
  • pytest tests/sim/atomic_actions/test_affordance.py tests/sim/atomic_actions/test_primitives_helpers.py tests/sim/atomic_actions/test_actions.py tests/toolkits/test_grasp_pose_generator.py -q --disable-warnings --maxfail=1 (120 passed, 1 deselected)

Checklist

  • I have run Black.
  • Public API documentation coverage is aligned.
  • I have added focused regression tests.
  • No task-engine, controller, simulator-step, or duplicate runtime code is included.

skywhite1024and others added 29 commits August 21, 2026 15:40
@skywhite1024skywhite1024 added the enhancement New feature or request label Aug 21, 2026
@skywhite1024skywhite1024 added motion gen Things related to motion generation for robot toolkit Stand along tools collection. atomic action atomic action related functionality labels Aug 21, 2026
…mic-prerequisite
# Conflicts:
#	agent_context/MAP.yaml
#	agent_context/topics/atomic-actions/atomic-actions.md
#	docs/design/declarative_expert_program_plan.md
#	docs/design/expert_program_rollout_report.md
#	docs/design/gen_sim_semantic_skill_integration_plan.md
#	docs/source/api_reference/embodichain/embodichain.lab.gym.envs.expert_program.rst
#	docs/source/api_reference/embodichain/embodichain.lab.sim.atomic_actions.rst
#	docs/source/api_reference/embodichain/embodichain.lab.sim.skills.rst
#	docs/source/api_reference/public_api.rst
#	docs/source/overview/sim/atomic_actions/builtin_actions.md
#	docs/source/overview/sim/atomic_actions/expert_programs.md
#	docs/source/overview/sim/atomic_actions/index.md
#	docs/source/overview/sim/atomic_actions/robot_skill_profiles.md
#	docs/source/overview/sim/index.rst
#	docs/source/overview/sim/scene_registry.md
#	docs/source/tutorial/atomic_actions.rst
#	embodichain/agents/mllm/expert_program.py
#	embodichain/lab/gym/envs/__init__.py
#	embodichain/lab/gym/envs/demo.py
#	embodichain/lab/gym/envs/embodied_env.py
#	embodichain/lab/gym/envs/expert_program/__init__.py
#	embodichain/lab/gym/envs/expert_program/bridge.py
#	embodichain/lab/gym/envs/expert_program/catalog.py
#	embodichain/lab/gym/envs/expert_program/cfg.py
#	embodichain/lab/gym/envs/expert_program/compiler.py
#	embodichain/lab/gym/envs/expert_program/decoder.py
#	embodichain/lab/gym/envs/expert_program/environment.py
#	embodichain/lab/gym/envs/expert_program/extensions.py
#	embodichain/lab/gym/envs/expert_program/loader.py
#	embodichain/lab/gym/envs/expert_program/simulation.py
#	embodichain/lab/gym/envs/expert_program/simulation_environment.py
#	embodichain/lab/gym/envs/expert_program/simulation_handover.py
#	embodichain/lab/gym/envs/expert_program/simulation_policies.py
#	embodichain/lab/gym/envs/managers/_event_functors/dynamic_settling.py
#	embodichain/lab/gym/utils/gym_utils.py
#	embodichain/lab/sim/atomic_actions/__init__.py
#	embodichain/lab/sim/atomic_actions/affordance.py
#	embodichain/lab/sim/atomic_actions/bindings.py
#	embodichain/lab/sim/atomic_actions/core.py
#	embodichain/lab/sim/atomic_actions/engine.py
#	embodichain/lab/sim/atomic_actions/execution.py
#	embodichain/lab/sim/atomic_actions/goals.py
#	embodichain/lab/sim/atomic_actions/invocation.py
#	embodichain/lab/sim/atomic_actions/plans.py
#	embodichain/lab/sim/atomic_actions/primitives/_helpers.py
#	embodichain/lab/sim/atomic_actions/primitives/coordinated_pickment.py
#	embodichain/lab/sim/atomic_actions/primitives/coordinated_placement.py
#	embodichain/lab/sim/atomic_actions/primitives/hand_over.py
#	embodichain/lab/sim/atomic_actions/primitives/pick_up.py
#	embodichain/lab/sim/atomic_actions/primitives/place.py
#	embodichain/lab/sim/atomic_actions/runtime.py
#	embodichain/lab/sim/atomic_actions/state.py
#	embodichain/lab/sim/planners/base_planner.py
#	embodichain/lab/sim/planners/curobo/curobo_planner.py
#	embodichain/lab/sim/skills/__init__.py
#	embodichain/lab/sim/skills/calls.py
#	embodichain/lab/sim/skills/compiler.py
#	embodichain/lab/sim/skills/integration.py
#	embodichain/lab/sim/skills/profiles.py
#	embodichain/lab/sim/skills/runtime.py
#	embodichain/lab/sim/skills/scene.py
#	embodichain/toolkits/graspkit/pg_grasp/_antipodal_backend.py
#	embodichain_tasks/configs/gym/expert_program/repeated_pick_place.json
#	embodichain_tasks/configs/gym/open_drawer/cobot_magic_3cam.json
#	embodichain_tasks/embodichain_tasks/multi_segments/cube_pick_place.py
#	embodichain_tasks/embodichain_tasks/tableware/__init__.py
#	embodichain_tasks/embodichain_tasks/tableware/open_drawer.py
#	scripts/benchmark/expert_program/demo_success.py
#	scripts/tools/expert_program_rollout_report.py
#	tests/agents/mllm/test_expert_program.py
#	tests/benchmark/expert_program/test_cube_physical_recovery_sim.py
#	tests/benchmark/expert_program/test_demo_success_cube_sim.py
#	tests/benchmark/expert_program/test_demo_success_open_drawer_sim.py
#	tests/gym/envs/expert_program/test_bridge.py
#	tests/gym/envs/expert_program/test_catalog.py
#	tests/gym/envs/expert_program/test_compiler.py
#	tests/gym/envs/expert_program/test_completion_metadata.py
#	tests/gym/envs/expert_program/test_decoder.py
#	tests/gym/envs/expert_program/test_environment.py
#	tests/gym/envs/expert_program/test_extensions.py
#	tests/gym/envs/expert_program/test_loader.py
#	tests/gym/envs/expert_program/test_parallel_compiler.py
#	tests/gym/envs/expert_program/test_parallel_schema.py
#	tests/gym/envs/expert_program/test_simulation.py
#	tests/gym/envs/expert_program/test_simulation_environment.py
#	tests/gym/envs/expert_program/test_simulation_policies.py
#	tests/gym/envs/expert_program/test_task_vertical_slices.py
#	tests/gym/envs/tasks/test_multi_segments_cube_pick_place.py
#	tests/gym/envs/test_demo.py
#	tests/gym/envs/test_embodied_env_expert_program.py
#	tests/gym/utils/test_gym_utils.py
#	tests/lab/scripts/test_run_env.py
#	tests/scripts/tools/test_expert_program_rollout_report.py
#	tests/sim/atomic_actions/test_actions.py
#	tests/sim/atomic_actions/test_affordance.py
#	tests/sim/atomic_actions/test_core.py
#	tests/sim/atomic_actions/test_engine_per_env.py
#	tests/sim/skills/test_compiler.py
#	tests/sim/skills/test_curobo_semantic_runtime_dynamic_recovery_gpu.py
#	tests/sim/skills/test_effects.py
#	tests/sim/skills/test_evidence.py
#	tests/sim/skills/test_integration.py
#	tests/sim/skills/test_profiles.py
#	tests/sim/skills/test_runtime.py
#	tests/test_expert_program_package_data.py
@greptile-apps

Copy link
Copy Markdown

Greptile Summary

The PR adds object-aware upright grasp reranking, rejects top/bottom clamp poses, and samples yaw-equivalent downstream targets during feasibility checks.

  • Adds a pre-truncation pose-cost callback to the grasp-generator API and antipodal backend.
  • Ranks upright side grasps using closing-axis alignment and normalized grasp height.
  • Extends downstream IK checks with configurable world-Z yaw variants.
  • Adds focused callback, validation, and pose-variant tests.

Confidence Score: 4/5

The PR appears safe to merge, with a non-blocking need to document the newly exposed action option and grasp-generator callback.

The changed grasp-ranking and downstream feasibility paths are internally consistent, while the remaining accepted concern is limited to missing user-facing documentation for public API additions.

Files Needing Attention: embodichain/toolkits/graspkit/pose_generator.py; embodichain/lab/sim/atomic_actions/primitives/pick_up.py

Important Files Changed

FilenameOverview
embodichain/lab/sim/atomic_actions/primitives/pick_up.pyAdds upright side-grasp ranking, compatibility filtering, normalized upright directions, and yaw-equivalent downstream feasibility checks.
embodichain/toolkits/graspkit/pg_grasp/_antipodal_backend.pyApplies an optional validated cost callback before limiting collision-free grasps to the top candidates.
embodichain/toolkits/graspkit/pg_grasp/pose_generator.pyForwards object-aware pose-cost callbacks from the batched generator to each backend invocation.
embodichain/toolkits/graspkit/pose_generator.pyExpands the public abstract grasp-generator interface, but the public documentation was not updated for implementors.
tests/sim/atomic_actions/test_actions.pyUpdates the test generator stub to support object-aware pose-cost callbacks.
tests/sim/atomic_actions/test_primitives_helpers.pyTests yaw-variant translation preservation and positive sample-count validation.
tests/toolkits/test_parallel_jaw_grasp_pose_generator.pyVerifies that object-aware costs are applied and returned by the antipodal generator.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart LR
A[Antipodal grasp candidates] --> B[Collision filtering and base costs]
B --> C[Object-aware upright cost callback]
C --> D[Top-k candidate truncation]
D --> E[Pickup path IK checks]
E --> F[Yaw-variant downstream IK checks]
F --> G[Selected feasible grasp]
Loading

Fix all with GreploopFix All in CodexFix All in Claude Code

Prompt To Fix All With AI
### Issue 1
embodichain/toolkits/graspkit/pose_generator.py:128-130
**Document the expanded public APIs**
The public `GraspPoseGenerator` interface now accepts `pose_cost_fn`, and `PickUpOptions` also exposes `upright_yaw_samples`, but the user-facing documentation does not describe either addition. This leaves callers unable to discover the new configuration and gives custom generator implementors no migration guidance for the expanded interface.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Reviews (1): Last reviewed commit: "Merge branch 'feat/cube-physical-recover..." | Re-trigger Greptile

Comment on lines +128 to +130
pose_cost_fn: (
Callable[[torch.Tensor, torch.Tensor, torch.Tensor], torch.Tensor] | None
) = None,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2Document the expanded public APIs

The public GraspPoseGenerator interface now accepts pose_cost_fn, and PickUpOptions also exposes upright_yaw_samples, but the user-facing documentation does not describe either addition. This leaves callers unable to discover the new configuration and gives custom generator implementors no migration guidance for the expanded interface.

Context Used: AGENTS.md (source)

Prompt To Fix With AI
This is a comment left during a code review.
Path: embodichain/toolkits/graspkit/pose_generator.py
Line: 128-130
Comment:
**Document the expanded public APIs**
The public `GraspPoseGenerator` interface now accepts `pose_cost_fn`, and `PickUpOptions` also exposes `upright_yaw_samples`, but the user-facing documentation does not describe either addition. This leaves callers unable to discover the new configuration and gives custom generator implementors no migration guidance for the expanded interface.
**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.

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!

Fix in CodexFix in Claude Code

An error occurred while trying to automatically change base from feat/cube-physical-recovery-gates to mainAugust 25, 2026 13:10
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

atomic actionatomic action related functionalityenhancementNew feature or requestmotion genThings related to motion generation for robottoolkitStand along tools collection.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@skywhite1024@yuecideng