Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make following arm targets in empty_action optional #963

Merged
merged 2 commits into from
Oct 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading