Skip to content

Commit 706c601

Browse files
committed
chore(gripper): backward compatibility non list action
1 parent 2a7eea6 commit 706c601

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

python/rcs/envs/base.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -724,7 +724,11 @@ def action(self, action: dict[str, Any]) -> dict[str, Any]:
724724
action = copy.deepcopy(action)
725725
assert self.gripper_key in action, "Gripper action not found."
726726

727-
gripper_action = np.round(action[self.gripper_key]) if self.binary else action[self.gripper_key]
727+
gripper_action = action[self.gripper_key]
728+
if isinstance(gripper_action, int | float):
729+
gripper_action = [gripper_action] # type: ignore
730+
if self.binary:
731+
gripper_action = np.round(gripper_action)
728732
gripper_action = np.clip(gripper_action, 0.0, 1.0)
729733

730734
if self.binary:

0 commit comments

Comments
 (0)