Skip to content

enhance atom action - #559

Open
matafela wants to merge 4 commits into
mainfrom
cj/enhance-atom-action
Open

enhance atom action#559
matafela wants to merge 4 commits into
mainfrom
cj/enhance-atom-action

Conversation

@matafela

@matafela matafela commented Aug 27, 2026

Copy link
Copy Markdown
Collaborator

Description

TODO:

  • Less motion_generator.generate in one atom action.
  • Fix failed example
  • Remove unused configure.

Type of change

  • Enhancement (non-breaking change which improves an existing functionality)

Checklist

  • I have run the black . command to format the code base.
  • I have made corresponding changes to the documentation
  • Public API changes are reflected in the API docs (python docs/scripts/check_api_docs.py), if applicable
  • I have added tests that prove my fix is effective or that my feature works
  • Dependencies have been updated, if applicable.

Copilot AI lite review requested due to automatic review settings August 27, 2026 10:32
@greptile-apps

greptile-apps Bot commented Aug 27, 2026

Copy link
Copy Markdown

Greptile Summary

The PR combines the approach and follow-up portions of PickUp and Place into one planner request, then splits and resamples the resulting joint trajectory around the grasp or release pose.

  • Adds invocation-level tracking-policy configuration.
  • Adds batched pose-based trajectory splitting and updates action tests.
  • Adjusts grasp sampling thresholds and several atomic-action tutorials.

Confidence Score: 4/5

The PR is not yet safe to merge because TOPP-RA-backed PickUp and Place actions still receive an invalid default quantity and fail planning.

The attempted sampling fix clears the requested count before the configured TOPP-RA planner is invoked; TOPP-RA consequently uses its quantity default of 0.01, rejects it as below two, and returns a failed plan.

Files Needing Attention: embodichain/lab/sim/atomic_actions/primitives/pick_up.py and embodichain/lab/sim/atomic_actions/primitives/place.py

Important Files Changed

Filename Overview
embodichain/lab/sim/atomic_actions/primitives/pick_up.py Combines approach and lift planning, but the strategy-based sample-count override leaves the previously reported TOPP-RA failure outstanding.
embodichain/lab/sim/atomic_actions/primitives/place.py Combines descent and retraction planning and repeats the outstanding TOPP-RA sample-count failure.
embodichain/lab/sim/atomic_actions/primitives/_helpers.py Adds batched FK-based trajectory splitting and distance resampling around a target pose.
embodichain/lab/sim/atomic_actions/engine.py Allows callers to provide an invocation tracking policy while preserving joint-position tracking as the default.

Reviews (3): Last reviewed commit: "update" | Re-trigger Greptile

Comment on lines +317 to +318
if motion_policy.strategy == "motion_gen":
motion_options.sample_count = 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.

P1 TOPP-RA sampling becomes invalid

When PickUp or Place uses the TOPP-RA motion_gen backend with default plan options, clearing sample_count leaves quantity sampling at 0.01; TOPP-RA rejects quantities below two and returns an empty failed plan, so the action cannot be planned.

Knowledge Base Used: Simulation lab

Prompt To Fix With AI
This is a comment left during a code review.
Path: embodichain/lab/sim/atomic_actions/primitives/pick_up.py
Line: 317-318

Comment:
**TOPP-RA sampling becomes invalid**

When PickUp or Place uses the TOPP-RA `motion_gen` backend with default plan options, clearing `sample_count` leaves quantity sampling at `0.01`; TOPP-RA rejects quantities below two and returns an empty failed plan, so the action cannot be planned.

**Knowledge Base Used:** [Simulation lab](https://app.greptile.com/dexforce/-/custom-context/knowledge-base/dexforce/embodichain/-/docs/simulation-lab.md)

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Fix in Codex Fix in Claude Code

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 PickUp and Place atomic actions to reduce per-action motion-planner calls by generating a single combined joint trajectory and then splitting it back into logical segments for hand command timing and segment bookkeeping.

Changes:

  • Combine multi-stage motion planning into a single motion_generator.generate(...) call for PickUp and Place, then split the resulting joint trajectory at a target pose.
  • Add split_joint_trajectory_at_pose(...) to split + resample joint trajectories using per-environment FK-based boundary detection.
  • Update tests and the Place tutorial script to reflect the new planning/splitting behavior.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tests/sim/atomic_actions/test_trajectory_ops.py Adds coverage for the new split/resample helper, including per-environment boundary selection.
tests/sim/atomic_actions/test_actions.py Updates motion-generator monkeypatching and asserts single-call planning + option semantics.
scripts/tutorials/atomic_action/place.py Provides an explicit SceneSnapshot when creating the initial planning context for the demo.
embodichain/lab/sim/atomic_actions/primitives/place.py Plans approach+retract in one motion-gen call and splits at the place pose.
embodichain/lab/sim/atomic_actions/primitives/pick_up.py Plans approach+lift in one motion-gen call and splits at the grasp pose.
embodichain/lab/sim/atomic_actions/primitives/_helpers.py Introduces split_joint_trajectory_at_pose(...) and exports it.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +202 to +206
expected_index = round(
(trajectory.shape[1] - 1)
* first_sample_count
/ (first_sample_count + second_sample_count)
)
Comment on lines +184 to +188
trajectory_xpos = robot.compute_batch_fk(
qpos=trajectory,
name=control_part,
to_matrix=True,
)
Copilot AI review requested due to automatic review settings August 28, 2026 02:27

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

Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.

Suppressed comments (1)

embodichain/lab/sim/atomic_actions/primitives/_helpers.py:188

  • split_joint_trajectory_at_pose assumes robot.compute_batch_fk(...) returns a pose tensor, but Robot.compute_batch_fk can return None on solver/shape errors. That would currently fail later with a confusing TypeError during tensor indexing/gather. Add an explicit return-type/shape check here and raise a clear error early.
    trajectory_xpos = robot.compute_batch_fk(
        qpos=trajectory,
        name=control_part,
        to_matrix=True,
    )

Comment on lines +172 to +176
failed = [
f"{plan.skill_id}: {plan.diagnostics.messages or ('planning failed',)}"
for plan in compiled.action_plans
if not plan.plan_success.all()
]
Copilot AI review requested due to automatic review settings August 28, 2026 02:42

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

Copilot reviewed 15 out of 15 changed files in this pull request and generated 2 comments.

Suppressed comments (1)

scripts/tutorials/atomic_action/tutorial_utils.py:1059

  • create_ur10_robotiq_robot_cfg accepts **kwargs but does not consume them. This makes it easy for callers to pass unsupported parameters without noticing. Consider validating kwargs (or removing it).
def create_ur10_robotiq_robot_cfg(
    init_pos: Sequence[float] = (0.0, 0.0, 0.0),
    init_qpos: Sequence[float] | None = None,
    **kwargs,
) -> RobotCfg:

Comment on lines 992 to 996
def create_franka_panda_robot_cfg(
init_pos: Sequence[float] = (0.0, 0.0, 0.0),
init_qpos: Sequence[float] | None = None,
**kwargs,
) -> RobotCfg:
Comment on lines 1132 to 1137
if robot_type == "ur5":
return create_ur5_gripper_robot_cfg(
init_pos=init_pos,
init_qpos=init_qpos,
**kwargs,
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants