From 5b6ac5ae84471c37f65b61ae49f843b0a7213c2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cem=20G=C3=B6kmen?= Date: Thu, 10 Oct 2024 16:24:29 -0700 Subject: [PATCH] Make following arm targets in empty_action optional --- .../starter_semantic_action_primitives.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/omnigibson/action_primitives/starter_semantic_action_primitives.py b/omnigibson/action_primitives/starter_semantic_action_primitives.py index 7bd5e6878..05fa48131 100644 --- a/omnigibson/action_primitives/starter_semantic_action_primitives.py +++ b/omnigibson/action_primitives/starter_semantic_action_primitives.py @@ -1450,17 +1450,20 @@ def _get_head_goal_q(self, target_obj_pose): return [head1_joint_goal, head2_joint_goal] - def _empty_action(self): + def _empty_action(self, follow_arm_targets=True): """ Generate a no-op action that will keep the robot still but aim to move the arms to the saved pose targets, if possible + Args: + follow_arm_targets (bool): Whether to move the arms to the saved pose targets or keep them still. + Returns: th.tensor or None: Action array for one step for the robot to do nothing """ action = th.zeros(self.robot.action_dim) for name, controller in self.robot._controllers.items(): # if desired arm targets are available, generate an action that moves the arms to the saved pose targets - if name in self._arm_targets: + if follow_arm_targets and name in self._arm_targets: if isinstance(controller, InverseKinematicsController): arm = name.replace("arm_", "") target_pos, target_orn_axisangle = self._arm_targets[name]