This repository was archived by the owner on Jan 6, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 53
This repository was archived by the owner on Jan 6, 2026. It is now read-only.
A bug when using randomize_hand_positions #25
Copy link
Copy link
Open
Description
When using the augmentation randomize_hand_positions, there is a bug for the state of the physics.
robopianist/robopianist/suite/tasks/piano_with_shadow_hands.py
Lines 447 to 455 in d9cde23
| def _randomize_initial_hand_positions( | |
| self, physics: mjcf.Physics, random_state: np.random.RandomState | |
| ) -> None: | |
| """Randomize the initial position of the hands.""" | |
| if not self._randomize_hand_positions: | |
| return | |
| offset = random_state.uniform(low=-_POSITION_OFFSET, high=_POSITION_OFFSET) | |
| for hand in [self.right_hand, self.left_hand]: | |
| hand.shift_pose(physics, (0, offset, 0)) |
randomize_hand_positions=True.
I fix this issue in a hacky way by recording the previously applied offset and adding the offset back before applying a new offset. So the _randomize_initial_hand_positions changes to:
def _randomize_initial_hand_positions(
self, physics: mjcf.Physics, random_state: np.random.RandomState
) -> None:
"""Randomize the initial position of the hands."""
if not self._randomize_hand_positions:
return
offset = random_state.uniform(low=-_POSITION_OFFSET, high=_POSITION_OFFSET)
for hand in [self.right_hand, self.left_hand]:
hand.shift_pose(physics, (0, -self._last_offset, 0)) # to correct the offset.
hand.shift_pose(physics, (0, offset, 0))
self._last_offset = offsetHope you have a better solution. Or I can open a PR.
Best,
Yi
Metadata
Metadata
Assignees
Labels
No labels