Skip to content

Refactor assisted grasping and state restoration flow#1982

Open
cgokmen wants to merge 2 commits intomainfrom
assisted-grasp-refactor
Open

Refactor assisted grasping and state restoration flow#1982
cgokmen wants to merge 2 commits intomainfrom
assisted-grasp-refactor

Conversation

@cgokmen
Copy link
Member

@cgokmen cgokmen commented Feb 26, 2026

Summary

  • refactor robot assisted-grasp internals around explicit target object/link names, including joint creation helpers and grasp decision flow
  • simplify assisted-grasp contact and release handling, remove cloth-specific AG pathways, and drop obsolete AG cloth macro / entity attachment-point logic
  • update AG state dump/load serialization, including legacy state conversion support and symbolic semantic grasp callsite updates to the new grasp API

Test plan

  • Run assisted and sticky grasp regression scenarios for manipulation robots
  • Verify save/load round-trip restores active assisted grasps for each arm
  • Verify symbolic semantic primitive grasp still succeeds on representative objects
  • Smoke test that physical grasp mode behavior is unchanged

Made with Cursor

Copilot AI review requested due to automatic review settings February 26, 2026 00:27
@github-actions
Copy link

github-actions bot commented Feb 26, 2026

Profiling Report

Baselines (GPU dynamics, flatcache)

Scenario FPS Load (s) Isaac (ms) Non-Isaac (ms) Mem (GB) VRAM (GB)
Empty scene 32.3 (-4.5% ⚪) 67.8 (-2.9% ⚪) 30.15 (+4.6% ⚪) 0.86 (+8.1% 🔴) 5.50 (+0.4% ⚪) 5.07 (-0.0% ⚪)
Empty scene + 1 Robot 9.9 (+2.2% ⚪) 142.6 (-3.4% ⚪) 96.28 (-2.4% ⚪) 4.71 (+2.3% ⚪) 6.29 (-0.3% ⚪) 5.36 (+0.0% ⚪)
Rs_int 10.2 (-6.0% 🔴) 164.3 (-9.4% 🟢) 84.66 (+8.5% 🔴) 12.97 (-5.9% 🟢) 6.17 (+1.0% ⚪) 7.36 (-0.0% ⚪)
Rs_int + 1 Robot 6.3 (+6.1% 🟢) 227.4 (-2.7% ⚪) 143.17 (+6.7% 🔴) 15.66 (-54.3% 🟢) 6.88 (-0.4% ⚪) 7.59 (-0.8% ⚪)

Scenes

Scenario FPS Load (s) Isaac (ms) Non-Isaac (ms) Mem (GB) VRAM (GB)
house_single_floor + 1 Robot 7.7 (-2.7% ⚪) 461.9 (+3.1% ⚪) 93.05 (+4.9% ⚪) 37.51 (-2.2% ⚪) 7.90 (-0.8% ⚪) 9.31 (-3.4% ⚪)
house_single_floor + 1 Robot (no FC) 7.2 (+1.2% ⚪) 912.4 (+16.7% 🔴) 98.97 (-2.8% ⚪) 39.95 (+3.1% ⚪) 8.12 (-0.1% ⚪) 9.62 (+0.9% ⚪)

Non-physics features (GPU dynamics, flatcache)

Scenario FPS Load (s) Isaac (ms) Non-Isaac (ms) Mem (GB) VRAM (GB)
1 Robot + fluids 6.7 (-9.0% 🔴) 164.4 (+1.1% ⚪) 144.55 (+9.5% 🔴) 5.11 (+22.0% 🔴) 6.69 (+0.3% ⚪) 7.00 (-0.0% ⚪)
1 Robot + cloth 6.3 (-2.4% ⚪) 168.3 (-4.8% ⚪) 152.97 (+2.3% ⚪) 4.59 (+9.9% 🔴) 6.59 (-0.3% ⚪) 7.24 (-0.0% ⚪)
1 Robot + macro particles 5.4 (-7.9% 🔴) 133.8 (-10.4% 🟢) 132.88 (+11.3% 🔴) 53.34 (+2.4% ⚪) 6.49 (-0.9% ⚪) 5.47 (-0.0% ⚪)
Legend
  • 🟢 Improvement >= 5%
  • 🔴 Regression >= 5%
  • ⚪ Change < 5%
  • For FPS, higher is better. For all other metrics, lower is better.

Copy link
Contributor

Copilot AI left a comment

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 assisted grasping system in OmniGibson, moving from implicit cloth-specific pathways to a unified flow based on explicit target object/link names. The refactoring simplifies state management, removes obsolete cloth-specific AG logic, and updates serialization to support both new and legacy state formats.

Changes:

  • Refactored assisted grasp internals to use explicit target object and link names, replacing the old (object, link) tuple pattern with (object_name, link_name) strings
  • Removed cloth-specific assisted grasping pathways including the AG_CLOTH macro, create_attachment_point_link(), and cloth-specific grasp establishment methods
  • Updated state dump/load to serialize constraint params with object names (instead of references) and added legacy state conversion support for backward compatibility

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.

File Description
OmniGibson/omnigibson/robots/robot.py Core refactoring: removed gripper freezing mechanism, removed cloth-specific AG methods, updated constraint parameter structure, refactored grasp establishment flow to use explicit object/link names, and added legacy state conversion logic
OmniGibson/omnigibson/prims/entity_prim.py Removed cloth attachment point creation logic that was previously called during cloth entity initialization
OmniGibson/omnigibson/macros.py Removed the AG_CLOTH global flag that controlled cloth-specific assisted grasping behavior
OmniGibson/omnigibson/action_primitives/symbolic_semantic_action_primitives.py Updated symbolic semantic grasp to use the new _establish_grasp API with explicit parameters

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

target_link_prim_path = target_obj.links[target_link_name].prim_path
finger_paths = {link.prim_path for link in self.finger_links[arm]}
contact_pos_world = None
for finger_path in finger_paths:
Copy link

Copilot AI Feb 26, 2026

Choose a reason for hiding this comment

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

The code uses a different contact detection method (og.sim.contact_sensor.get_rigid_body_raw_data) compared to the previous _find_gripper_contacts method that uses GripperRigidContactAPI. This change in contact detection strategy could lead to different behavior. If the new contact sensor API doesn't return the same contacts as the old API, grasps that previously succeeded might fail, or vice versa. Consider verifying that both approaches detect the same contacts, or document why the new approach is preferred.

Suggested change
for finger_path in finger_paths:
for finger_path in finger_paths:
# NOTE: We intentionally query contacts via og.sim.contact_sensor instead of the
# legacy GripperRigidContactAPI / _find_gripper_contacts helper. This uses the
# unified simulator contact sensor data for assisted grasps, keeping contact
# queries consistent with the rest of the simulation and avoiding duplicate
# contact-detection code paths that must be kept in sync.

Copilot uses AI. Check for mistakes.
Comment on lines 3214 to 3216
assert self.is_manipulation
arm = self.default_arm if arm == "default" else arm
base_link_quat = self.get_position_orientation()[1]
Copy link

Copilot AI Feb 26, 2026

Choose a reason for hiding this comment

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

The docstring for the Returns section is incomplete. Based on the function implementation, it should document that it returns either None or a 2-tuple of (BaseObject, str) representing the target object and link name.

Copilot uses AI. Check for mistakes.
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f5d0017b60

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +2982 to +2983
if eef_def is not None and eef_def.ag_start_points is not None:
return self._convert_to_grasping_points(eef_def.ag_start_points)

Choose a reason for hiding this comment

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

P1 Badge Return arm-indexed AG points for end-effector configs

When an end-effector definition provides ag_start_points, this branch now returns a plain list, but the assisted-grasp pipeline expects a dict keyed by arm name (e.g., _find_gripper_raycast_collisions indexes self.assisted_grasp_start_points[arm]). For end-effector-variant robots like Franka, this causes a runtime TypeError (list indices must be integers or slices, not str) as soon as assisted grasping runs; the matching ag_end_points branch has the same shape mismatch.

Useful? React with 👍 / 👎.

@yinhang-oai
Copy link

yinhang-oai commented Feb 26, 2026

Very tangentially related, we never serialize AG state unfortunately. We used to have a comment in manipulation_robot that says something like "TODO: serialize AG", but even that is gone after the robot class refactoring.

def serialize(self, state):

Copy link
Contributor

@wensi-ai wensi-ai left a comment

Choose a reason for hiding this comment

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

lgtm

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.

4 participants