-
Notifications
You must be signed in to change notification settings - Fork 240
/
hit_ball_with_queue.py
29 lines (23 loc) · 993 Bytes
/
hit_ball_with_queue.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
from typing import List
from pyrep.objects.shape import Shape
from pyrep.objects.proximity_sensor import ProximitySensor
from rlbench.backend.task import Task
from rlbench.backend.conditions import DetectedCondition, GraspedCondition, \
ConditionSet
class HitBallWithQueue(Task):
def init_task(self) -> None:
queue = Shape('queue')
success_sensor = ProximitySensor('success')
ball = Shape('ball')
self.register_graspable_objects([queue])
cond_set = ConditionSet([
GraspedCondition(self.robot.gripper, queue),
DetectedCondition(ball, success_sensor)
], order_matters=True)
self.register_success_conditions([cond_set])
def init_episode(self, index: int) -> List[str]:
return ['hit ball with queue in to the goal',
'pot the ball in the goal',
'pick up the que and use it to pot the ball into the goal']
def variation_count(self) -> int:
return 1