Skip to content

Commit

Permalink
Merge pull request #963 from StanfordVL/empty-action
Browse files Browse the repository at this point in the history
Make following arm targets in empty_action optional
  • Loading branch information
cgokmen authored Oct 18, 2024
2 parents a35b5cc + 99c575e commit 599489a
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down

0 comments on commit 599489a

Please sign in to comment.