-
Notifications
You must be signed in to change notification settings - Fork 240
/
sweep_to_dustpan.py
31 lines (25 loc) · 1.1 KB
/
sweep_to_dustpan.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
30
31
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
DIRT_NUM = 5
class SweepToDustpan(Task):
def init_task(self) -> None:
broom = Shape('broom')
success_sensor = ProximitySensor('success')
dirts = [Shape('dirt' + str(i)) for i in range(DIRT_NUM)]
conditions = [DetectedCondition(dirt, success_sensor) for dirt in dirts]
self.register_graspable_objects([broom])
self.register_success_conditions(conditions)
def init_episode(self, index: int) -> List[str]:
return ['sweep dirt to dustpan',
'sweep the dirt up',
'use the broom to brush the dirt into the dustpan',
'clean up the dirt',
'pick up the brush and clean up the table',
'grasping the broom by its handle, clear way the dirt from the '
'table',
'leave the table clean']
def variation_count(self) -> int:
return 1