Skip to content

Commit 3b9b3ce

Browse files
committed
refactor(env): gripper wrapper non private gripper
1 parent 6e554f2 commit 3b9b3ce

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

python/rcs/envs/base.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -693,15 +693,15 @@ def __init__(self, env, gripper: common.Gripper, binary: bool = True, open_on_re
693693
self.action_space: gym.spaces.Dict
694694
self.action_space.spaces.update(get_space(GripperDictType).spaces)
695695
self.gripper_key = get_space_keys(GripperDictType)[0]
696-
self._gripper = gripper
696+
self.gripper = gripper
697697
self.binary = binary
698698
self._last_gripper_cmd = None
699699
self.open_on_reset = open_on_reset
700700

701701
def reset(self, **kwargs) -> tuple[dict[str, Any], dict[str, Any]]:
702702
if self.open_on_reset:
703703
# resetting opens the gripper
704-
self._gripper.reset()
704+
self.gripper.reset()
705705
self._last_gripper_cmd = None
706706
return super().reset(**kwargs)
707707

@@ -712,7 +712,7 @@ def observation(self, observation: dict[str, Any], info: dict[str, Any]) -> tupl
712712
self._last_gripper_cmd if self._last_gripper_cmd is not None else self.BINARY_GRIPPER_OPEN
713713
)
714714
else:
715-
observation[self.gripper_key] = self._gripper.get_normalized_width()
715+
observation[self.gripper_key] = self.gripper.get_normalized_width()
716716

717717
return observation, info
718718

@@ -725,9 +725,9 @@ def action(self, action: dict[str, Any]) -> dict[str, Any]:
725725
gripper_action = np.clip(gripper_action, 0.0, 1.0)
726726

727727
if self.binary:
728-
self._gripper.grasp() if gripper_action == self.BINARY_GRIPPER_CLOSED else self._gripper.open()
728+
self.gripper.grasp() if gripper_action == self.BINARY_GRIPPER_CLOSED else self.gripper.open()
729729
else:
730-
self._gripper.set_normalized_width(gripper_action)
730+
self.gripper.set_normalized_width(gripper_action)
731731
self._last_gripper_cmd = gripper_action
732732
del action[self.gripper_key]
733733
return action

0 commit comments

Comments
 (0)