Skip to content

Commit

Permalink
adding an offset for wine tasks (#59)
Browse files Browse the repository at this point in the history
  • Loading branch information
beneisner authored Jun 5, 2024
1 parent 915bbb3 commit a9e4e83
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions configs/eval_rlbench.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ policy_spec:
add_random_jitter: True
include_wrist_cam: True
gripper_in_first_phase: False
placement_offset: 0.03


# Usually only a single checkpoint, but we could have multiple for each phase.
Expand Down
15 changes: 15 additions & 0 deletions scripts/eval_rlbench.py
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,21 @@ def predict(self, obs, phase: str) -> Tuple[np.ndarray, Dict[str, Any]]:

pred_points = preds["pred_points_action"][0].cpu().numpy()

# This is hacky. We should have a more principled approach to this.
if (
self.policy_spec.placement_offset != 0.0
and phase in {"place", "preplace"}
and self.task_name == "stack_wine"
):
T_offset = np.eye(4)

# add some offset in the z direction.
T_offset[2, 3] = self.policy_spec.placement_offset
T_gripperfinal_world = T_offset @ T_gripperfinal_world

# Also apply the same offset to the predicted points.
pred_points += T_offset[:3, 3]

# If we've already attempted this phase, then we should add some random jitter.
if self.phase_attempt_counts[phase] > 0 and self.policy_spec.add_random_jitter:
# Add some random motion in the positive z
Expand Down

0 comments on commit a9e4e83

Please sign in to comment.