Skip to content

Commit

Permalink
Merge branch 'og-develop' into cloth-prim-view
Browse files Browse the repository at this point in the history
  • Loading branch information
cgokmen authored Dec 13, 2023
2 parents 9d3012c + 2341481 commit 58c1895
Showing 1 changed file with 11 additions and 18 deletions.
29 changes: 11 additions & 18 deletions omnigibson/robots/manipulation_robot.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,19 +331,6 @@ def set_position_orientation(self, position=None, orientation=None):
new_obj_pose = new_eef_pose @ inv_original_eef_pose @ original_obj_pose
self._ag_obj_in_hand[arm].set_position_orientation(*T.mat2pose(hmat=new_obj_pose))

def apply_action(self, action):
# Run super method as normal
super().apply_action(action)

# Then run assisted grasping
if self.grasping_mode != "physical" and not self._disable_grasp_handling:
self._handle_assisted_grasping(action=action)

# Potentially freeze gripper joints
for arm in self.arm_names:
if self._ag_freeze_gripper[arm]:
self._freeze_gripper(arm)

def deploy_control(self, control, control_type, indices=None, normalized=False):
# We intercept the gripper control and replace it with the current joint position if we're freezing our gripper
for arm in self.arm_names:
Expand All @@ -353,6 +340,15 @@ def deploy_control(self, control, control_type, indices=None, normalized=False):

super().deploy_control(control=control, control_type=control_type, indices=indices, normalized=normalized)

# Then run assisted grasping
if self.grasping_mode != "physical" and not self._disable_grasp_handling:
self._handle_assisted_grasping()

# Potentially freeze gripper joints
for arm in self.arm_names:
if self._ag_freeze_gripper[arm]:
self._freeze_gripper(arm)

def _release_grasp(self, arm="default"):
"""
Magic action to release this robot's grasp on an object
Expand Down Expand Up @@ -1155,12 +1151,9 @@ def _establish_grasp_rigid(self, arm="default", ag_data=None, contact_pos=None):
j_val = joint.get_state()[0][0]
self._ag_freeze_joint_pos[arm][joint.joint_name] = j_val

def _handle_assisted_grasping(self, action):
def _handle_assisted_grasping(self):
"""
Handles assisted grasping.
Args:
action (n-array): gripper action to apply. >= 0 is release (open), < 0 is grasp (close).
Handles assisted grasping by creating or removing constraints.
"""
# Loop over all arms
for arm in self.arm_names:
Expand Down

0 comments on commit 58c1895

Please sign in to comment.