Datasets:

Nagi-ovo commited on
Commit
a6f6815
·
verified ·
1 Parent(s): 67f5a76

Add the final programs of 7 coding agents on all 20 tasks (420 sessions)

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. README.md +16 -0
  2. policies/dishwasher_close/astra-s1/episodes.csv +101 -0
  3. policies/dishwasher_close/astra-s1/policy.py +58 -0
  4. policies/dishwasher_close/astra-s2/episodes.csv +101 -0
  5. policies/dishwasher_close/astra-s2/policy.py +44 -0
  6. policies/dishwasher_close/astra-s3/episodes.csv +101 -0
  7. policies/dishwasher_close/astra-s3/policy.py +67 -0
  8. policies/dishwasher_close/deepseek1017-s1/episodes.csv +101 -0
  9. policies/dishwasher_close/deepseek1017-s1/policy.py +201 -0
  10. policies/dishwasher_close/deepseek1017-s2/episodes.csv +101 -0
  11. policies/dishwasher_close/deepseek1017-s2/policy.py +230 -0
  12. policies/dishwasher_close/deepseek1017-s3/episodes.csv +101 -0
  13. policies/dishwasher_close/deepseek1017-s3/policy.py +246 -0
  14. policies/dishwasher_close/gpt61sol-s1/episodes.csv +101 -0
  15. policies/dishwasher_close/gpt61sol-s1/policy.py +157 -0
  16. policies/dishwasher_close/gpt61sol-s2/episodes.csv +101 -0
  17. policies/dishwasher_close/gpt61sol-s2/policy.py +78 -0
  18. policies/dishwasher_close/gpt61sol-s3/episodes.csv +101 -0
  19. policies/dishwasher_close/gpt61sol-s3/policy.py +105 -0
  20. policies/dishwasher_close/gpt61terra-s1/episodes.csv +101 -0
  21. policies/dishwasher_close/gpt61terra-s1/policy.py +54 -0
  22. policies/dishwasher_close/gpt61terra-s2/episodes.csv +101 -0
  23. policies/dishwasher_close/gpt61terra-s2/policy.py +74 -0
  24. policies/dishwasher_close/gpt61terra-s3/episodes.csv +101 -0
  25. policies/dishwasher_close/gpt61terra-s3/policy.py +47 -0
  26. policies/dishwasher_close/gpt6sol-s1/episodes.csv +101 -0
  27. policies/dishwasher_close/gpt6sol-s1/policy.py +99 -0
  28. policies/dishwasher_close/gpt6sol-s2/episodes.csv +101 -0
  29. policies/dishwasher_close/gpt6sol-s2/policy.py +139 -0
  30. policies/dishwasher_close/gpt6sol-s3/episodes.csv +101 -0
  31. policies/dishwasher_close/gpt6sol-s3/policy.py +100 -0
  32. policies/dishwasher_close/kimi31pro-s1/episodes.csv +101 -0
  33. policies/dishwasher_close/kimi31pro-s1/policy.py +172 -0
  34. policies/dishwasher_close/kimi31pro-s2/episodes.csv +101 -0
  35. policies/dishwasher_close/kimi31pro-s2/policy.py +107 -0
  36. policies/dishwasher_close/kimi31pro-s3/episodes.csv +101 -0
  37. policies/dishwasher_close/kimi31pro-s3/policy.py +103 -0
  38. policies/dishwasher_close/opus-s1/episodes.csv +101 -0
  39. policies/dishwasher_close/opus-s1/policy.py +161 -0
  40. policies/dishwasher_close/opus-s2/episodes.csv +101 -0
  41. policies/dishwasher_close/opus-s2/policy.py +153 -0
  42. policies/dishwasher_close/opus-s3/episodes.csv +101 -0
  43. policies/dishwasher_close/opus-s3/policy.py +291 -0
  44. policies/dishwasher_load_cups/astra-s1/episodes.csv +101 -0
  45. policies/dishwasher_load_cups/astra-s1/policy.py +541 -0
  46. policies/dishwasher_load_cups/astra-s2/episodes.csv +101 -0
  47. policies/dishwasher_load_cups/astra-s2/policy.py +163 -0
  48. policies/dishwasher_load_cups/astra-s3/episodes.csv +101 -0
  49. policies/dishwasher_load_cups/astra-s3/policy.py +140 -0
  50. policies/dishwasher_load_cups/deepseek1017-s1/episodes.csv +101 -0
README.md CHANGED
@@ -47,6 +47,22 @@ trace/<task>/<session>_seed<seed>.json lines the program ran at each co
47
  Sessions are named `opus-s1` … `opus-s3` and `astra-s1` … `astra-s3`; seeds run
48
  from 620000 to 620099.
49
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
50
  ## Watching them
51
 
52
  Each `episodes/<task>/` folder opens in the BiGym 2.0 viewer, with every
 
47
  Sessions are named `opus-s1` … `opus-s3` and `astra-s1` … `astra-s3`; seeds run
48
  from 620000 to 620099.
49
 
50
+ ## Programs of all agents
51
+
52
+ `policies/` holds the final scored program of every session for seven agents on all
53
+ 20 tasks (3 sessions each, 420 sessions): Claude Opus 5.5, GPT-6 Astra, GPT-6 Sol,
54
+ GPT-6.1 Sol, Kimi K3.1 Pro, DeepSeek V4.1 Flash (1017) and GPT-6.1 Terra.
55
+
56
+ ```
57
+ policies.csv one row per session: agent, harness, effort, success rate, cost, tokens
58
+ policies/<task>/<session>/policy.py the scored program, with the helper modules it imports
59
+ policies/<task>/<session>/episodes.csv its 100 hidden seeds: seed, success, length, termination, fell
60
+ ```
61
+
62
+ Sessions are named `<agent>-s1` … `<agent>-s3`. A session that ended without a
63
+ scorable program has a row in `policies.csv` with success 0 and no folder. Running a
64
+ program on the seeds 620000–620099 reproduces its episodes.
65
+
66
  ## Watching them
67
 
68
  Each `episodes/<task>/` folder opens in the BiGym 2.0 viewer, with every
policies/dishwasher_close/astra-s1/episodes.csv ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ seed,success,length,termination,fell
2
+ 620000,1,3523,success,0
3
+ 620001,1,3523,success,0
4
+ 620002,1,3523,success,0
5
+ 620003,1,3523,success,0
6
+ 620004,1,3523,success,0
7
+ 620005,1,3523,success,0
8
+ 620006,1,3523,success,0
9
+ 620007,1,3523,success,0
10
+ 620008,1,3523,success,0
11
+ 620009,1,3523,success,0
12
+ 620010,1,3523,success,0
13
+ 620011,1,3523,success,0
14
+ 620012,1,3523,success,0
15
+ 620013,1,3523,success,0
16
+ 620014,1,3523,success,0
17
+ 620015,1,3523,success,0
18
+ 620016,1,3523,success,0
19
+ 620017,1,3523,success,0
20
+ 620018,1,3523,success,0
21
+ 620019,1,3523,success,0
22
+ 620020,1,3523,success,0
23
+ 620021,1,3523,success,0
24
+ 620022,1,3523,success,0
25
+ 620023,1,3523,success,0
26
+ 620024,1,3523,success,0
27
+ 620025,1,3523,success,0
28
+ 620026,1,3523,success,0
29
+ 620027,1,3523,success,0
30
+ 620028,1,3523,success,0
31
+ 620029,1,3523,success,0
32
+ 620030,1,3523,success,0
33
+ 620031,1,3523,success,0
34
+ 620032,1,3523,success,0
35
+ 620033,1,3523,success,0
36
+ 620034,1,3523,success,0
37
+ 620035,1,3523,success,0
38
+ 620036,1,3523,success,0
39
+ 620037,1,3523,success,0
40
+ 620038,1,3523,success,0
41
+ 620039,1,3523,success,0
42
+ 620040,1,3523,success,0
43
+ 620041,1,3523,success,0
44
+ 620042,1,3523,success,0
45
+ 620043,1,3523,success,0
46
+ 620044,1,3523,success,0
47
+ 620045,1,3523,success,0
48
+ 620046,1,3523,success,0
49
+ 620047,1,3523,success,0
50
+ 620048,1,3523,success,0
51
+ 620049,1,3523,success,0
52
+ 620050,1,3523,success,0
53
+ 620051,1,3523,success,0
54
+ 620052,1,3523,success,0
55
+ 620053,1,3523,success,0
56
+ 620054,1,3523,success,0
57
+ 620055,1,3523,success,0
58
+ 620056,1,3523,success,0
59
+ 620057,1,3523,success,0
60
+ 620058,1,3523,success,0
61
+ 620059,1,3523,success,0
62
+ 620060,1,3523,success,0
63
+ 620061,1,3523,success,0
64
+ 620062,1,3523,success,0
65
+ 620063,1,3523,success,0
66
+ 620064,1,3523,success,0
67
+ 620065,1,3523,success,0
68
+ 620066,1,3523,success,0
69
+ 620067,1,3523,success,0
70
+ 620068,1,3523,success,0
71
+ 620069,1,3523,success,0
72
+ 620070,1,3523,success,0
73
+ 620071,1,3523,success,0
74
+ 620072,1,3523,success,0
75
+ 620073,1,3523,success,0
76
+ 620074,1,3523,success,0
77
+ 620075,1,3523,success,0
78
+ 620076,1,3523,success,0
79
+ 620077,1,3523,success,0
80
+ 620078,1,3523,success,0
81
+ 620079,1,3523,success,0
82
+ 620080,1,3523,success,0
83
+ 620081,1,3523,success,0
84
+ 620082,1,3523,success,0
85
+ 620083,1,3523,success,0
86
+ 620084,1,3523,success,0
87
+ 620085,1,3523,success,0
88
+ 620086,1,3523,success,0
89
+ 620087,1,3523,success,0
90
+ 620088,1,3523,success,0
91
+ 620089,1,3523,success,0
92
+ 620090,1,3523,success,0
93
+ 620091,1,3523,success,0
94
+ 620092,1,3523,success,0
95
+ 620093,1,3523,success,0
96
+ 620094,1,3523,success,0
97
+ 620095,1,3523,success,0
98
+ 620096,1,3523,success,0
99
+ 620097,1,3523,success,0
100
+ 620098,1,3523,success,0
101
+ 620099,1,3523,success,0
policies/dishwasher_close/astra-s1/policy.py ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Deterministic dishwasher controller using staged contacts and base feedback."""
2
+ import numpy as np
3
+
4
+ # Manually specified motions: lift to seat the lower rack, push the upper
5
+ # rack, then lift the door again. Positions are in the room's world frame.
6
+ STAGES = [{'name': 'front', 'n': 300, 'target': [-0.25, 0, 0], '19': 1, '20': 1},
7
+ {'name': 'low', 'n': 120, '2': 0.4, '4': 0.4, '5': 0.3, '12': 0.3},
8
+ {'name': 'reach', 'n': 100, '5': -0.2, '12': -0.2},
9
+ {'name': 'lift1', 'n': 120, '5': -0.6, '12': -0.6},
10
+ {'name': 'lift2', 'n': 120, '5': -1, '12': -1, '2': 0.55},
11
+ {'name': 'lift3', 'n': 150, '5': -1.5, '12': -1.5, '2': 0.74, '4': 0},
12
+ {'name': 'push', 'n': 500, 'target': [0.5, 0, 0]},
13
+ {'name': 'release', 'n': 200, '5': 0, '12': 0, 'target': [-0.25, 0, 0]},
14
+ {'name': 'align', 'n': 180, 'target': [-0.25, -0.16, 0], '15': 1, '12': 0},
15
+ {'name': 'upper', 'n': 100, '5': 0, '8': 0},
16
+ {'name': 'pushupper', 'n': 350, 'target': [0.4, -0.16, 0]},
17
+ {'name': 'extendupper', 'n': 300, '5': -0.3, '8': 0.3, '4': 0.4, 'target': [0.4, -0.16, 0]},
18
+ {'name': 'back', 'n': 250, 'target': [-0.3, -0.16, 0]},
19
+ {'name': 'front2', 'n': 200, 'target': [-0.25, 0, 0], '5': 0, '8': 0, '15': 0, '4': 0},
20
+ {'name': 'low', 'n': 120, '2': 0.4, '4': 0.4, '5': 0.3, '12': 0.3},
21
+ {'name': 'reach', 'n': 100, '5': -0.2, '12': -0.2},
22
+ {'name': 'lift1', 'n': 120, '5': -0.6, '12': -0.6},
23
+ {'name': 'lift2', 'n': 120, '5': -1, '12': -1, '2': 0.55},
24
+ {'name': 'lift3', 'n': 150, '5': -1.5, '12': -1.5, '2': 0.74, '4': 0},
25
+ {'name': 'push', 'n': 500, 'target': [0.5, 0, 0]},
26
+ {'name': 'finish', 'n': 250, '8': 1.2, '15': 1.2, 'target': [0.5, 0, 0]}]
27
+
28
+ class Policy:
29
+ def reset(self, obs, tools):
30
+ self.action = np.asarray(tools.hold_action(), dtype=np.float32).copy()
31
+ self.index = -1
32
+ self.end = 0
33
+ self.target = None
34
+
35
+ def act(self, obs, tools):
36
+ t = int(obs["t"])
37
+ if t >= self.end and self.index + 1 < len(STAGES):
38
+ self.index += 1
39
+ stage = STAGES[self.index]
40
+ self.end += stage["n"]
41
+ self.action[0] = self.action[1] = self.action[3] = 0
42
+ self.target = stage.get("target")
43
+ for k, value in stage.items():
44
+ if k not in ("name", "n", "target"):
45
+ self.action[int(k)] = value
46
+ if self.target is not None:
47
+ x, y, z, yaw = obs["low_dim_obs"][21:25]
48
+ dx, dy = self.target[0] - x, self.target[1] - y
49
+ v = np.array([np.cos(yaw)*dx + np.sin(yaw)*dy,
50
+ -np.sin(yaw)*dx + np.cos(yaw)*dy]) * 1.5
51
+ v = np.clip(v, -.22, .22)
52
+ norm = np.linalg.norm(v)
53
+ if norm < .06:
54
+ v *= 0 if norm < .015 else .06 / norm
55
+ self.action[:2] = v
56
+ error = (self.target[2] - yaw + np.pi) % (2*np.pi) - np.pi
57
+ self.action[3] = np.clip(2*error, -.6, .6)
58
+ return self.action.copy()
policies/dishwasher_close/astra-s2/episodes.csv ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ seed,success,length,termination,fell
2
+ 620000,1,3235,success,0
3
+ 620001,1,3235,success,0
4
+ 620002,1,3235,success,0
5
+ 620003,1,3235,success,0
6
+ 620004,1,3235,success,0
7
+ 620005,1,3235,success,0
8
+ 620006,1,3235,success,0
9
+ 620007,1,3235,success,0
10
+ 620008,1,3235,success,0
11
+ 620009,1,3235,success,0
12
+ 620010,1,3235,success,0
13
+ 620011,1,3235,success,0
14
+ 620012,1,3235,success,0
15
+ 620013,1,3235,success,0
16
+ 620014,1,3235,success,0
17
+ 620015,1,3235,success,0
18
+ 620016,1,3235,success,0
19
+ 620017,1,3235,success,0
20
+ 620018,1,3235,success,0
21
+ 620019,1,3235,success,0
22
+ 620020,1,3235,success,0
23
+ 620021,1,3235,success,0
24
+ 620022,1,3235,success,0
25
+ 620023,1,3235,success,0
26
+ 620024,1,3235,success,0
27
+ 620025,1,3235,success,0
28
+ 620026,1,3235,success,0
29
+ 620027,1,3235,success,0
30
+ 620028,1,3235,success,0
31
+ 620029,1,3235,success,0
32
+ 620030,1,3235,success,0
33
+ 620031,1,3235,success,0
34
+ 620032,1,3235,success,0
35
+ 620033,1,3235,success,0
36
+ 620034,1,3235,success,0
37
+ 620035,1,3235,success,0
38
+ 620036,1,3235,success,0
39
+ 620037,1,3235,success,0
40
+ 620038,1,3235,success,0
41
+ 620039,1,3235,success,0
42
+ 620040,1,3235,success,0
43
+ 620041,1,3235,success,0
44
+ 620042,1,3235,success,0
45
+ 620043,1,3235,success,0
46
+ 620044,1,3235,success,0
47
+ 620045,1,3235,success,0
48
+ 620046,1,3235,success,0
49
+ 620047,1,3235,success,0
50
+ 620048,1,3235,success,0
51
+ 620049,1,3235,success,0
52
+ 620050,1,3235,success,0
53
+ 620051,1,3235,success,0
54
+ 620052,1,3235,success,0
55
+ 620053,1,3235,success,0
56
+ 620054,1,3235,success,0
57
+ 620055,1,3235,success,0
58
+ 620056,1,3235,success,0
59
+ 620057,1,3235,success,0
60
+ 620058,1,3235,success,0
61
+ 620059,1,3235,success,0
62
+ 620060,1,3235,success,0
63
+ 620061,1,3235,success,0
64
+ 620062,1,3235,success,0
65
+ 620063,1,3235,success,0
66
+ 620064,1,3235,success,0
67
+ 620065,1,3235,success,0
68
+ 620066,1,3235,success,0
69
+ 620067,1,3235,success,0
70
+ 620068,1,3235,success,0
71
+ 620069,1,3235,success,0
72
+ 620070,1,3235,success,0
73
+ 620071,1,3235,success,0
74
+ 620072,1,3235,success,0
75
+ 620073,1,3235,success,0
76
+ 620074,1,3235,success,0
77
+ 620075,1,3235,success,0
78
+ 620076,1,3235,success,0
79
+ 620077,1,3235,success,0
80
+ 620078,1,3235,success,0
81
+ 620079,1,3235,success,0
82
+ 620080,1,3235,success,0
83
+ 620081,1,3235,success,0
84
+ 620082,1,3235,success,0
85
+ 620083,1,3235,success,0
86
+ 620084,1,3235,success,0
87
+ 620085,1,3235,success,0
88
+ 620086,1,3235,success,0
89
+ 620087,1,3235,success,0
90
+ 620088,1,3235,success,0
91
+ 620089,1,3235,success,0
92
+ 620090,1,3235,success,0
93
+ 620091,1,3235,success,0
94
+ 620092,1,3235,success,0
95
+ 620093,1,3235,success,0
96
+ 620094,1,3235,success,0
97
+ 620095,1,3235,success,0
98
+ 620096,1,3235,success,0
99
+ 620097,1,3235,success,0
100
+ 620098,1,3235,success,0
101
+ 620099,1,3235,success,0
policies/dishwasher_close/astra-s2/policy.py ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Deterministic rack sweeps followed by a crouched, two-handed door lift."""
2
+ import numpy as np
3
+
4
+ class Policy:
5
+ def reset(self,obs,tools):
6
+ self.a=np.asarray(tools.hold_action(),dtype=float)
7
+ self.phase=0;self.k=0
8
+ # time, planar target, height, lean, left (pitch, elbow), right, roll, wrist
9
+ self.seq=[
10
+ (350,(.02,-.65,1.5708),.74,0,(.4,0),(.4,0),0,0),
11
+ (120,(.02,-.54,1.5708),.74,.2,(-.4,.2),(.5,0),0,0),
12
+ (340,(.85,-.54,1.5708),.74,.2,(-.4,.2),(.5,0),0,0),
13
+ (120,(.85,-.68,1.5708),.74,0,(.4,0),(.5,0),0,0),
14
+ (300,(.02,-.65,1.5708),.74,0,(.4,0),(.5,0),0,0),
15
+ (120,(.02,-.54,1.5708),.74,.5,(-.5,1),(.5,0),0,0),
16
+ (340,(.85,-.54,1.5708),.74,.5,(-.5,1),(.5,0),0,0),
17
+ (150,(.85,-.75,1.5708),.74,0,(.4,0),(.4,0),0,0),
18
+ (380,(-.35,-.75,0),.74,0,(.4,0),(.4,0),0,0),
19
+ (270,(-.35,0,0),.74,0,(-.4,1.2),(-.4,1.2),.8,0),
20
+ (130,None,.4,.8,(.1,.7),(.1,.7),.8,0),
21
+ (130,(-.2,0,0),.4,.8,(-.8,1.3),(-.8,1.3),.3,0),
22
+ (130,(-.15,0,0),.4,.8,(-1.2,1.7),(-1.2,1.7),0,-.6),
23
+ (130,(-.1,0,0),.4,.8,(-1.8,1.6),(-1.8,1.6),0,0),
24
+ (150,(-.1,0,0),.65,.5,(-1.6,1.3),(-1.6,1.3),0,0),
25
+ (350,(.25,0,0),.74,.2,(-1,.8),(-1,.8),0,0),
26
+ ]
27
+ def act(self,obs,tools):
28
+ dur,goal,h,p,l,r,roll,wrist=self.seq[min(self.phase,len(self.seq)-1)]
29
+ a=self.a.copy(); target=a.copy()
30
+ target[2]=h;target[4]=p;target[5:19]=0
31
+ target[5]=l[0];target[8]=l[1];target[12]=r[0];target[15]=r[1]
32
+ target[6]=roll;target[13]=-roll;target[10]=target[17]=wrist;target[19:]=1
33
+ a[2:]+=np.clip(target[2:]-a[2:],-.025,.025)
34
+ a[0]=a[1]=a[3]=0
35
+ if goal is not None:
36
+ x,y,z,th=obs['low_dim_obs'][21:25]
37
+ err=np.array([goal[0]-x,goal[1]-y]); v=np.clip(err*2,-.3,.3)
38
+ if np.linalg.norm(err)<.015:v[:]=0
39
+ elif np.linalg.norm(v)<.065:v*=.065/np.linalg.norm(v)
40
+ a[0]=np.cos(th)*v[0]+np.sin(th)*v[1];a[1]=-np.sin(th)*v[0]+np.cos(th)*v[1]
41
+ a[3]=np.clip(2*((goal[2]-th+np.pi)%(2*np.pi)-np.pi),-.7,.7)
42
+ self.a=a;self.k+=1
43
+ if self.k>=dur and self.phase<len(self.seq)-1:self.phase+=1;self.k=0
44
+ return a
policies/dishwasher_close/astra-s3/episodes.csv ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ seed,success,length,termination,fell
2
+ 620000,1,3751,success,0
3
+ 620001,1,3751,success,0
4
+ 620002,1,3751,success,0
5
+ 620003,1,3751,success,0
6
+ 620004,1,3751,success,0
7
+ 620005,1,3751,success,0
8
+ 620006,1,3751,success,0
9
+ 620007,1,3751,success,0
10
+ 620008,1,3751,success,0
11
+ 620009,1,3751,success,0
12
+ 620010,1,3751,success,0
13
+ 620011,1,3751,success,0
14
+ 620012,1,3751,success,0
15
+ 620013,1,3751,success,0
16
+ 620014,1,3751,success,0
17
+ 620015,1,3751,success,0
18
+ 620016,1,3751,success,0
19
+ 620017,1,3751,success,0
20
+ 620018,1,3751,success,0
21
+ 620019,1,3751,success,0
22
+ 620020,1,3751,success,0
23
+ 620021,1,3751,success,0
24
+ 620022,1,3751,success,0
25
+ 620023,1,3751,success,0
26
+ 620024,1,3751,success,0
27
+ 620025,1,3751,success,0
28
+ 620026,1,3751,success,0
29
+ 620027,1,3751,success,0
30
+ 620028,1,3751,success,0
31
+ 620029,1,3751,success,0
32
+ 620030,1,3751,success,0
33
+ 620031,1,3751,success,0
34
+ 620032,1,3751,success,0
35
+ 620033,1,3751,success,0
36
+ 620034,1,3751,success,0
37
+ 620035,1,3751,success,0
38
+ 620036,1,3751,success,0
39
+ 620037,1,3751,success,0
40
+ 620038,1,3751,success,0
41
+ 620039,1,3751,success,0
42
+ 620040,1,3751,success,0
43
+ 620041,1,3751,success,0
44
+ 620042,1,3751,success,0
45
+ 620043,1,3751,success,0
46
+ 620044,1,3751,success,0
47
+ 620045,1,3751,success,0
48
+ 620046,1,3751,success,0
49
+ 620047,1,3751,success,0
50
+ 620048,1,3751,success,0
51
+ 620049,1,3751,success,0
52
+ 620050,1,3751,success,0
53
+ 620051,1,3751,success,0
54
+ 620052,1,3751,success,0
55
+ 620053,1,3751,success,0
56
+ 620054,1,3751,success,0
57
+ 620055,1,3751,success,0
58
+ 620056,1,3751,success,0
59
+ 620057,1,3751,success,0
60
+ 620058,1,3751,success,0
61
+ 620059,1,3751,success,0
62
+ 620060,1,3751,success,0
63
+ 620061,1,3751,success,0
64
+ 620062,1,3751,success,0
65
+ 620063,1,3751,success,0
66
+ 620064,1,3751,success,0
67
+ 620065,1,3751,success,0
68
+ 620066,1,3751,success,0
69
+ 620067,1,3751,success,0
70
+ 620068,1,3751,success,0
71
+ 620069,1,3751,success,0
72
+ 620070,1,3751,success,0
73
+ 620071,1,3751,success,0
74
+ 620072,1,3751,success,0
75
+ 620073,1,3751,success,0
76
+ 620074,1,3751,success,0
77
+ 620075,1,3751,success,0
78
+ 620076,1,3751,success,0
79
+ 620077,1,3751,success,0
80
+ 620078,1,3751,success,0
81
+ 620079,1,3751,success,0
82
+ 620080,1,3751,success,0
83
+ 620081,1,3751,success,0
84
+ 620082,1,3751,success,0
85
+ 620083,1,3751,success,0
86
+ 620084,1,3751,success,0
87
+ 620085,1,3751,success,0
88
+ 620086,1,3751,success,0
89
+ 620087,1,3751,success,0
90
+ 620088,1,3751,success,0
91
+ 620089,1,3751,success,0
92
+ 620090,1,3751,success,0
93
+ 620091,1,3751,success,0
94
+ 620092,1,3751,success,0
95
+ 620093,1,3751,success,0
96
+ 620094,1,3751,success,0
97
+ 620095,1,3751,success,0
98
+ 620096,1,3751,success,0
99
+ 620097,1,3751,success,0
100
+ 620098,1,3751,success,0
101
+ 620099,1,3751,success,0
policies/dishwasher_close/astra-s3/policy.py ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Deterministic, rate-limited dishwasher manipulation controller.
2
+
3
+ The waypoints and arm motions are hand tuned. Base movement is closed-loop
4
+ in the robot's proprioceptive world frame; no demonstration data is loaded.
5
+ """
6
+ import numpy as np
7
+
8
+ # Approach, upper rack push, lower rack push, and door lift.
9
+ STAGES = [{'n': 220, 'pose': [-0.7, -0.8, 0], 'set': {'19': 0, '20': 1}},
10
+ {'n': 350, 'pose': [-0.7, 0.24, 0]},
11
+ {'n': 120, 'set': {'12': -0.4, '15': 0}},
12
+ {'n': 240, 'pose': [-0.1, 0.24, 0]},
13
+ {'n': 170, 'pose': [-0.1, 0.24, 0], 'set': {'12': -1.2, '15': 0.8}},
14
+ {'n': 170, 'pose': [-0.1, 0.24, 0], 'set': {'12': -1.7, '15': 1.4, '4': 0.5}},
15
+ {'n': 240, 'pose': [-0.65, 0.24, 0]},
16
+ {'n': 160, 'set': {'12': 0.5, '15': 0.5, '4': 0}},
17
+ {'n': 250, 'pose': [-0.1, 0.24, 0]},
18
+ {'n': 300, 'pose': [0.12, 0.24, 0], 'set': {'12': -1.8, '15': 1.7, '4': 0.8}},
19
+ {'n': 200, 'pose': [0.12, 0.24, 0], 'set': {'12': -2.1, '15': 1.8}},
20
+ {'n': 120, 'pose': [0.12, 0.24, 0], 'set': {'20': 0}},
21
+ {'n': 230, 'pose': [-0.6, 0.24, 0]},
22
+ {'n': 170, 'pose': [-0.4, 0, 0], 'set': {'12': 0, '15': 0, '4': 0}},
23
+ {'n': 130, 'pose': [-0.24, 0, 0], 'set': {'13': -1, '19': 0, '20': 0, '6': 1}},
24
+ {'n': 200, 'set': {'0': 0, '1': 0, '15': 0.7, '2': 0.4, '3': 0, '8': 0.7}},
25
+ {'n': 130, 'set': {'13': 0, '6': 0}},
26
+ {'n': 100, 'set': {'12': -0.5, '5': -0.5}},
27
+ {'n': 60, 'set': {'19': 1, '20': 1}},
28
+ {'n': 220,
29
+ 'pose': [0.35, 0, 0],
30
+ 'set': {'12': -2.2, '15': 1.5, '2': 0.74, '4': 0.8, '5': -2.2, '8': 1.5}},
31
+ {'n': 250, 'pose': [0.5, 0, 0]},
32
+ {'n': 180, 'pose': [0.5, 0, 0], 'set': {'12': -1, '15': 1, '4': 0, '5': -1, '8': 1}}]
33
+
34
+ class Policy:
35
+ def reset(self, obs, tools):
36
+ self.action = np.asarray(tools.hold_action(), dtype=np.float64).copy()
37
+ self.stage = -1
38
+ self.elapsed = 0
39
+ self.rates = np.array([2, 2, .002, 2, .008] + [.012]*14 + [.05]*2)
40
+ self._next()
41
+
42
+ def _next(self):
43
+ self.stage += 1
44
+ self.elapsed = 0
45
+ self.spec = STAGES[min(self.stage, len(STAGES)-1)]
46
+ self.target = self.action.copy()
47
+ for index, value in self.spec.get('set', {}).items():
48
+ self.target[int(index)] = value
49
+
50
+ def act(self, obs, tools):
51
+ if self.elapsed >= self.spec['n'] and self.stage < len(STAGES)-1:
52
+ self._next()
53
+ self.action += np.clip(self.target-self.action, -self.rates, self.rates)
54
+ if 'pose' in self.spec:
55
+ x, y, yaw = obs['low_dim_obs'][[21,22,24]]
56
+ tx, ty, ta = self.spec['pose']
57
+ err = np.array([tx-x, ty-y])
58
+ velocity = np.clip(err*1.4, -.3, .3)
59
+ velocity = np.array([[np.cos(yaw),np.sin(yaw)],[-np.sin(yaw),np.cos(yaw)]]) @ velocity
60
+ if np.linalg.norm(err) < .018:
61
+ velocity *= 0
62
+ elif np.linalg.norm(velocity) < .065:
63
+ velocity *= .065/(np.linalg.norm(velocity)+1e-6)
64
+ self.action[:2] = velocity
65
+ self.action[3] = np.clip(((ta-yaw+np.pi)%(2*np.pi)-np.pi)*2, -.7, .7)
66
+ self.elapsed += 1
67
+ return self.action.copy()
policies/dishwasher_close/deepseek1017-s1/episodes.csv ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ seed,success,length,termination,fell
2
+ 620000,0,4650,timeout,0
3
+ 620001,0,4650,timeout,0
4
+ 620002,0,4650,timeout,0
5
+ 620003,0,4650,timeout,0
6
+ 620004,0,4650,timeout,0
7
+ 620005,0,4650,timeout,0
8
+ 620006,0,4650,timeout,0
9
+ 620007,0,4650,timeout,0
10
+ 620008,0,4650,timeout,0
11
+ 620009,0,4650,timeout,0
12
+ 620010,0,4650,timeout,0
13
+ 620011,0,4650,timeout,0
14
+ 620012,0,4650,timeout,0
15
+ 620013,0,4650,timeout,0
16
+ 620014,0,4650,timeout,0
17
+ 620015,0,4650,timeout,0
18
+ 620016,0,4650,timeout,0
19
+ 620017,0,4650,timeout,0
20
+ 620018,0,4650,timeout,0
21
+ 620019,0,4650,timeout,0
22
+ 620020,0,4650,timeout,0
23
+ 620021,0,4650,timeout,0
24
+ 620022,0,4650,timeout,0
25
+ 620023,0,4650,timeout,0
26
+ 620024,0,4650,timeout,0
27
+ 620025,0,4650,timeout,0
28
+ 620026,0,4650,timeout,0
29
+ 620027,0,4650,timeout,0
30
+ 620028,0,4650,timeout,0
31
+ 620029,0,4650,timeout,0
32
+ 620030,0,4650,timeout,0
33
+ 620031,0,4650,timeout,0
34
+ 620032,0,4650,timeout,0
35
+ 620033,0,4650,timeout,0
36
+ 620034,0,4650,timeout,0
37
+ 620035,0,4650,timeout,0
38
+ 620036,0,4650,timeout,0
39
+ 620037,0,4650,timeout,0
40
+ 620038,0,4650,timeout,0
41
+ 620039,0,4650,timeout,0
42
+ 620040,0,4650,timeout,0
43
+ 620041,0,4650,timeout,0
44
+ 620042,0,4650,timeout,0
45
+ 620043,0,4650,timeout,0
46
+ 620044,0,4650,timeout,0
47
+ 620045,0,4650,timeout,0
48
+ 620046,0,4650,timeout,0
49
+ 620047,0,4650,timeout,0
50
+ 620048,0,4650,timeout,0
51
+ 620049,0,4650,timeout,0
52
+ 620050,0,4650,timeout,0
53
+ 620051,0,4650,timeout,0
54
+ 620052,0,4650,timeout,0
55
+ 620053,0,4650,timeout,0
56
+ 620054,0,4650,timeout,0
57
+ 620055,0,4650,timeout,0
58
+ 620056,0,4650,timeout,0
59
+ 620057,0,4650,timeout,0
60
+ 620058,0,4650,timeout,0
61
+ 620059,0,4650,timeout,0
62
+ 620060,0,4650,timeout,0
63
+ 620061,0,4650,timeout,0
64
+ 620062,0,4650,timeout,0
65
+ 620063,0,4650,timeout,0
66
+ 620064,0,4650,timeout,0
67
+ 620065,0,4650,timeout,0
68
+ 620066,0,4650,timeout,0
69
+ 620067,0,4650,timeout,0
70
+ 620068,0,4650,timeout,0
71
+ 620069,0,4650,timeout,0
72
+ 620070,0,4650,timeout,0
73
+ 620071,0,4650,timeout,0
74
+ 620072,0,4650,timeout,0
75
+ 620073,0,4650,timeout,0
76
+ 620074,0,4650,timeout,0
77
+ 620075,0,4650,timeout,0
78
+ 620076,0,4650,timeout,0
79
+ 620077,0,4650,timeout,0
80
+ 620078,0,4650,timeout,0
81
+ 620079,0,4650,timeout,0
82
+ 620080,0,4650,timeout,0
83
+ 620081,0,4650,timeout,0
84
+ 620082,0,4650,timeout,0
85
+ 620083,0,4650,timeout,0
86
+ 620084,0,4650,timeout,0
87
+ 620085,0,4650,timeout,0
88
+ 620086,0,4650,timeout,0
89
+ 620087,0,4650,timeout,0
90
+ 620088,0,4650,timeout,0
91
+ 620089,0,4650,timeout,0
92
+ 620090,0,4650,timeout,0
93
+ 620091,0,4650,timeout,0
94
+ 620092,0,4650,timeout,0
95
+ 620093,0,4650,timeout,0
96
+ 620094,0,4650,timeout,0
97
+ 620095,0,4650,timeout,0
98
+ 620096,0,4650,timeout,0
99
+ 620097,0,4650,timeout,0
100
+ 620098,0,4650,timeout,0
101
+ 620099,0,4650,timeout,0
policies/dishwasher_close/deepseek1017-s1/policy.py ADDED
@@ -0,0 +1,201 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Hand-written control policy for the dishwasher-close task.
2
+
3
+ The controller is a timed state machine. It drives the robot up to the
4
+ dishwasher, pushes the pulled-out racks in with both arms, then crouches,
5
+ hooks the near edge of the open door and stands up while following the door
6
+ forward to swing it shut. It finally pushes the door panel closed and holds.
7
+ A secondary sweep of the vertical door panel covers the side-hinged layout.
8
+ No learned components and no randomness are used.
9
+ """
10
+
11
+ import math
12
+
13
+ import numpy as np
14
+
15
+
16
+ def _wrap(a):
17
+ while a > math.pi:
18
+ a -= 2.0 * math.pi
19
+ while a < -math.pi:
20
+ a += 2.0 * math.pi
21
+ return a
22
+
23
+
24
+ class Policy:
25
+ """Timed state machine over the 21-dimensional physical action."""
26
+
27
+ TURN = 110
28
+ WALK = 210
29
+ CENTER = 80
30
+ RACK = 110
31
+ BACK = 25
32
+ SQUAT = 30
33
+ GRIP = 40
34
+ LIFT = 140
35
+ LATCH = 80
36
+ CYCLES = 6
37
+ TURN_SHORT = 45
38
+ SWING_TURN = 90
39
+ SWING_WALK = 120
40
+ SWING = 220
41
+ HOLD = 120
42
+
43
+ def reset(self, obs, tools):
44
+ self.hold = np.asarray(tools.hold_action(), dtype=np.float32)
45
+ self.t = 0
46
+ self.phase = 0
47
+ self.x0 = float(obs["low_dim_obs"][21])
48
+ self.y0 = float(obs["low_dim_obs"][22])
49
+ self.xc = self.x0
50
+ self.yc = self.y0
51
+ self.tx = self.x0
52
+ self.ty = self.y0
53
+ self.tyaw = 1.25
54
+ self.cycle_idx = 0
55
+ self.planned = self._plan()
56
+
57
+ def _plan(self):
58
+ plan = [("turn", self.TURN), ("walk", self.WALK), ("center", self.CENTER)]
59
+ for _ in range(self.CYCLES):
60
+ plan += [
61
+ ("turn_short", self.TURN_SHORT),
62
+ ("rack", self.RACK),
63
+ ("back", self.BACK),
64
+ ("squat", self.SQUAT),
65
+ ("grip", self.GRIP),
66
+ ("lift", self.LIFT),
67
+ ("latch", self.LATCH),
68
+ ("swing_turn", self.SWING_TURN),
69
+ ("swing_walk", self.SWING_WALK),
70
+ ("swing", self.SWING),
71
+ ]
72
+ plan += [("hold", self.HOLD)]
73
+ return plan
74
+
75
+ def _base_hold(self, raw, obs, tx, ty, tyaw, speed=0.15):
76
+ x = float(obs["low_dim_obs"][21])
77
+ y = float(obs["low_dim_obs"][22])
78
+ yaw = float(obs["low_dim_obs"][24])
79
+ ex, ey, eyaw = tx - x, ty - y, _wrap(tyaw - yaw)
80
+ vxw = float(np.clip(4.0 * ex, -speed, speed))
81
+ vyw = float(np.clip(4.0 * ey, -speed, speed))
82
+ c, s = math.cos(yaw), math.sin(yaw)
83
+ vx = c * vxw + s * vyw
84
+ vy = -s * vxw + c * vyw
85
+ sp = math.hypot(vx, vy)
86
+ if 1e-6 < sp < 0.07:
87
+ vx *= 0.07 / sp
88
+ vy *= 0.07 / sp
89
+ raw[0] = float(np.clip(vx, -1.0, 1.0))
90
+ raw[1] = float(np.clip(vy, -1.0, 1.0))
91
+ raw[3] = float(np.clip(2.0 * eyaw, -0.4, 0.4))
92
+ return raw
93
+
94
+ def act(self, obs, tools):
95
+ raw = np.asarray(tools.hold_action(), dtype=np.float32)
96
+
97
+ while self.phase < len(self.planned) and self.t >= self.planned[self.phase][1]:
98
+ self.t -= self.planned[self.phase][1]
99
+ self.phase += 1
100
+ if self.phase >= len(self.planned):
101
+ return raw
102
+ tag = self.planned[self.phase][0]
103
+ n = self.planned[self.phase][1]
104
+ p = self.t / float(max(1, n - 1))
105
+ if tag == "rack" and self.t == 0:
106
+ self.cycle_idx += 1
107
+ self.t += 1
108
+ ci = self.cycle_idx % 4
109
+ yaw = float(obs["low_dim_obs"][24])
110
+ yaw_err = float(np.clip(1.2 * _wrap(self.tyaw - yaw), -0.3, 0.3))
111
+
112
+ if tag == "turn":
113
+ raw[3] = float(np.clip(1.5 * _wrap(self.tyaw - yaw), -0.5, 0.5))
114
+ raw[2] = 0.74
115
+
116
+ elif tag == "turn_short":
117
+ raw[3] = float(np.clip(1.5 * _wrap(self.tyaw - yaw), -0.5, 0.5))
118
+ raw[2] = 0.74
119
+ raw[19] = raw[20] = 0.0
120
+
121
+ elif tag == "walk":
122
+ raw[0] = 0.22
123
+ raw[3] = yaw_err
124
+ raw[2] = 0.74
125
+ if p > 0.7:
126
+ self.xc = float(obs["low_dim_obs"][21])
127
+ self.yc = float(obs["low_dim_obs"][22])
128
+ self.tx = self.xc + 0.2
129
+ self.ty = self.yc
130
+
131
+ elif tag == "center":
132
+ self._base_hold(raw, obs, self.tx, self.ty, self.tyaw, 0.12)
133
+
134
+ elif tag == "rack":
135
+ raw[0] = 0.22
136
+ raw[3] = yaw_err
137
+ raw[4] = -0.15
138
+ raw[5] = raw[12] = -1.05 - 0.08 * ci
139
+ raw[8] = raw[15] = 0.25 + 0.06 * ci
140
+ raw[19] = raw[20] = 1.0
141
+
142
+ elif tag == "back":
143
+ raw[0] = -0.18
144
+ raw[4] = 0.0
145
+ raw[19] = raw[20] = 1.0
146
+
147
+ elif tag == "squat":
148
+ raw[2] = 0.5
149
+ raw[4] = 0.0
150
+ raw[19] = raw[20] = 0.0
151
+
152
+ elif tag == "grip":
153
+ raw[2] = 0.5
154
+ raw[4] = 0.0
155
+ raw[5], raw[6], raw[8] = -0.22 - 0.05 * ci, -0.18 - 0.02 * ci, 0.72 + 0.04 * ci
156
+ raw[12], raw[13], raw[15] = raw[5], -raw[6], raw[8]
157
+ raw[10] = raw[17] = 0.0
158
+ raw[19] = raw[20] = 1.0
159
+
160
+ elif tag == "lift":
161
+ raw[2] = 0.5 + 0.45 * p
162
+ raw[4] = 0.25 * p
163
+ raw[0] = 0.12
164
+ raw[3] = yaw_err
165
+ raw[5] = raw[12] = (-0.22 - 0.05 * ci) - 1.35 * p
166
+ raw[6], raw[13] = -0.18 - 0.02 * ci, 0.18 + 0.02 * ci
167
+ raw[8] = raw[15] = 0.8 - 0.3 * p
168
+ raw[10] = raw[17] = 0.0
169
+ raw[19] = raw[20] = 1.0
170
+
171
+ elif tag == "latch":
172
+ raw[2] = 0.95
173
+ raw[4] = 0.5
174
+ raw[0] = 0.12
175
+ raw[3] = yaw_err
176
+ raw[5] = raw[12] = -1.9
177
+ raw[6], raw[13] = -0.2, 0.2
178
+ raw[8] = raw[15] = 0.5
179
+ raw[10] = raw[17] = 0.0
180
+ raw[19] = raw[20] = 1.0
181
+
182
+ elif tag == "swing_turn":
183
+ raw[3] = float(np.clip(1.5 * _wrap(0.6 - yaw), -0.5, 0.5))
184
+ raw[2] = 0.74
185
+ raw[19] = raw[20] = 0.0
186
+
187
+ elif tag == "swing_walk":
188
+ raw[0] = 0.2
189
+ raw[3] = float(np.clip(1.2 * _wrap(0.6 - yaw), -0.3, 0.3))
190
+ raw[2] = 0.74
191
+ raw[19] = raw[20] = 0.0
192
+
193
+ elif tag == "swing":
194
+ raw[0] = 0.15
195
+ raw[1] = 0.2 if (self.cycle_idx % 2 == 0) else -0.2
196
+ raw[3] = 0.15 if (self.cycle_idx % 2 == 0) else -0.15
197
+ raw[5] = raw[12] = -1.0
198
+ raw[8] = raw[15] = 0.3
199
+ raw[19] = raw[20] = 1.0
200
+
201
+ return raw
policies/dishwasher_close/deepseek1017-s2/episodes.csv ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ seed,success,length,termination,fell
2
+ 620000,0,4650,timeout,0
3
+ 620001,0,4650,timeout,0
4
+ 620002,0,4650,timeout,0
5
+ 620003,0,4650,timeout,0
6
+ 620004,0,4650,timeout,0
7
+ 620005,0,4650,timeout,0
8
+ 620006,0,4650,timeout,0
9
+ 620007,0,4650,timeout,0
10
+ 620008,0,4650,timeout,0
11
+ 620009,0,4650,timeout,0
12
+ 620010,0,4650,timeout,0
13
+ 620011,0,4650,timeout,0
14
+ 620012,0,4650,timeout,0
15
+ 620013,0,4650,timeout,0
16
+ 620014,0,4650,timeout,0
17
+ 620015,0,4650,timeout,0
18
+ 620016,0,4650,timeout,0
19
+ 620017,0,4650,timeout,0
20
+ 620018,0,4650,timeout,0
21
+ 620019,0,4650,timeout,0
22
+ 620020,0,4650,timeout,0
23
+ 620021,0,4650,timeout,0
24
+ 620022,0,4650,timeout,0
25
+ 620023,0,4650,timeout,0
26
+ 620024,0,4650,timeout,0
27
+ 620025,0,4650,timeout,0
28
+ 620026,0,4650,timeout,0
29
+ 620027,0,4650,timeout,0
30
+ 620028,0,4650,timeout,0
31
+ 620029,0,4650,timeout,0
32
+ 620030,0,4650,timeout,0
33
+ 620031,0,4650,timeout,0
34
+ 620032,0,4650,timeout,0
35
+ 620033,0,4650,timeout,0
36
+ 620034,0,4650,timeout,0
37
+ 620035,0,4650,timeout,0
38
+ 620036,0,4650,timeout,0
39
+ 620037,0,4650,timeout,0
40
+ 620038,0,4650,timeout,0
41
+ 620039,0,4650,timeout,0
42
+ 620040,0,4650,timeout,0
43
+ 620041,0,4650,timeout,0
44
+ 620042,0,4650,timeout,0
45
+ 620043,0,4650,timeout,0
46
+ 620044,0,4650,timeout,0
47
+ 620045,0,4650,timeout,0
48
+ 620046,0,4650,timeout,0
49
+ 620047,0,4650,timeout,0
50
+ 620048,0,4650,timeout,0
51
+ 620049,0,4650,timeout,0
52
+ 620050,0,4650,timeout,0
53
+ 620051,0,4650,timeout,0
54
+ 620052,0,4650,timeout,0
55
+ 620053,0,4650,timeout,0
56
+ 620054,0,4650,timeout,0
57
+ 620055,0,4650,timeout,0
58
+ 620056,0,4650,timeout,0
59
+ 620057,0,4650,timeout,0
60
+ 620058,0,4650,timeout,0
61
+ 620059,0,4650,timeout,0
62
+ 620060,0,4650,timeout,0
63
+ 620061,0,4650,timeout,0
64
+ 620062,0,4650,timeout,0
65
+ 620063,0,4650,timeout,0
66
+ 620064,0,4650,timeout,0
67
+ 620065,0,4650,timeout,0
68
+ 620066,0,4650,timeout,0
69
+ 620067,0,4650,timeout,0
70
+ 620068,0,4650,timeout,0
71
+ 620069,0,4650,timeout,0
72
+ 620070,0,4650,timeout,0
73
+ 620071,0,4650,timeout,0
74
+ 620072,0,4650,timeout,0
75
+ 620073,0,4650,timeout,0
76
+ 620074,0,4650,timeout,0
77
+ 620075,0,4650,timeout,0
78
+ 620076,0,4650,timeout,0
79
+ 620077,0,4650,timeout,0
80
+ 620078,0,4650,timeout,0
81
+ 620079,0,4650,timeout,0
82
+ 620080,0,4650,timeout,0
83
+ 620081,0,4650,timeout,0
84
+ 620082,0,4650,timeout,0
85
+ 620083,0,4650,timeout,0
86
+ 620084,0,4650,timeout,0
87
+ 620085,0,4650,timeout,0
88
+ 620086,0,4650,timeout,0
89
+ 620087,0,4650,timeout,0
90
+ 620088,0,4650,timeout,0
91
+ 620089,0,4650,timeout,0
92
+ 620090,0,4650,timeout,0
93
+ 620091,0,4650,timeout,0
94
+ 620092,0,4650,timeout,0
95
+ 620093,0,4650,timeout,0
96
+ 620094,0,4650,timeout,0
97
+ 620095,0,4650,timeout,0
98
+ 620096,0,4650,timeout,0
99
+ 620097,0,4650,timeout,0
100
+ 620098,0,4650,timeout,0
101
+ 620099,0,4650,timeout,0
policies/dishwasher_close/deepseek1017-s2/policy.py ADDED
@@ -0,0 +1,230 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Hand-written control policy for the Unitree G1 dishwasher task.
2
+
3
+ The robot turns and walks to the dishwasher along the demonstrated heading,
4
+ then searches for the door/rack contact with a slow arm sweep while watching
5
+ the wrist camera. When the wrist view turns bright (a close white surface)
6
+ the hand is at the door; the policy latches that joint pose and tries the
7
+ closing motions (press down, lift up, push forward) from there. Several
8
+ lateral passes along the machine front are made to cover the opening.
9
+ """
10
+
11
+ import numpy as np
12
+
13
+ ACTION_DIM = 21
14
+
15
+
16
+ def _wrap(a):
17
+ return (a + np.pi) % (2.0 * np.pi) - np.pi
18
+
19
+
20
+ class Policy:
21
+ def reset(self, obs, tools):
22
+ self.t = 0
23
+ self.hold = np.asarray(tools.hold_action(), dtype=np.float32)
24
+ self.ld = np.asarray(obs["low_dim_obs"], dtype=np.float32)
25
+ self.sp = 0.0
26
+ self.contact_sp = None
27
+ self.bright = 0.0
28
+ self.sweep_start = 0.0
29
+ self.wp = 0.2
30
+ self.plan = [
31
+ ("settle", 8),
32
+ ("turn", 106),
33
+ ("walk", 250),
34
+ ("sweep", 150),
35
+ ("pushcont", 130),
36
+ ("press", 90),
37
+ ("lift", 90),
38
+ ("strafe", 40),
39
+ ("sweep", 150),
40
+ ("pushcont", 110),
41
+ ("press", 90),
42
+ ("lift", 90),
43
+ ("strafe", 40),
44
+ ("sweep", 150),
45
+ ("press", 90),
46
+ ("lift", 90),
47
+ ("strafe", 40),
48
+ ("sweep", 130),
49
+ ("body", 130),
50
+ ("backoff", 150),
51
+ ("centerleft", 260),
52
+ ("walkcenter", 200),
53
+ ("sweep", 150),
54
+ ("pushcont", 120),
55
+ ("press", 90),
56
+ ("lift", 90),
57
+ ("squat", 55),
58
+ ("stand", 55),
59
+ ("squat2", 55),
60
+ ("stand2", 55),
61
+ ("pushcont", 120),
62
+ ("finalsweep", 950),
63
+ ("hold", 200),
64
+ ]
65
+ self.phase = 0
66
+ self.phase_t = 0
67
+
68
+ # ------------------------------------------------------------------
69
+ def _wrist_white(self, tools):
70
+ try:
71
+ im = np.asarray(tools.image("left_wrist", 84, 84),
72
+ dtype=np.float32)
73
+ h, w, _ = im.shape
74
+ mask = np.ones((h, w), bool)
75
+ mask[20:64, 28:56] = False
76
+ vals = im[mask]
77
+ self.bright = float(vals.mean())
78
+ white = (vals[:, 0] > 135) & (vals[:, 1] > 135) & \
79
+ (vals[:, 2] > 135)
80
+ return float(white.mean())
81
+ except Exception:
82
+ return 0.0
83
+
84
+ # ------------------------------------------------------------------
85
+ def act(self, obs, tools):
86
+ self.ld = np.asarray(obs["low_dim_obs"], dtype=np.float32)
87
+ self.t += 1
88
+ while self.phase < len(self.plan) - 1 and \
89
+ self.phase_t >= self.plan[self.phase][1]:
90
+ self.phase_t -= self.plan[self.phase][1]
91
+ self.phase += 1
92
+ self.sweep_start = self.sp
93
+ name, length = self.plan[self.phase]
94
+ frac = min(1.0, (self.phase_t + 1.0) / max(1.0, length))
95
+ self.phase_t += 1
96
+
97
+ px, py, pz, yaw = self.ld[21:25]
98
+ raw = self.hold.copy()
99
+ raw[2] = 0.74
100
+ raw[4] = -0.2
101
+ raw[19] = 0.5
102
+ raw[20] = 0.5
103
+ arms = np.array([0.02, 0.0, 0.0, 0.03, 0.0, 0.04, 0.0], np.float32)
104
+ vx = vy = wz = 0.0
105
+ height = 0.74
106
+ pitch = -0.2
107
+ grip = 0.5
108
+ wp = self.wp
109
+
110
+ def face(target_yaw, gain=0.8, lim=0.4):
111
+ return float(np.clip(gain * _wrap(target_yaw - yaw), -lim, lim))
112
+
113
+ if name == "settle":
114
+ arms = np.asarray(self.hold[5:12], np.float32)
115
+
116
+ elif name == "turn":
117
+ wz = face(0.95, 0.9, 0.5)
118
+ arms = np.asarray(self.hold[5:12], np.float32)
119
+
120
+ elif name == "walk":
121
+ if px < 0.34:
122
+ vx = 0.28
123
+ wz = face(0.95, 0.7, 0.35)
124
+ arms = np.asarray(self.hold[5:12], np.float32)
125
+
126
+ elif name == "sweep":
127
+ wht = self._wrist_white(tools)
128
+ self.sp = 0.25 - 2.05 * frac # +0.25 -> -1.8
129
+ if self.contact_sp is not None:
130
+ self.sp = self.contact_sp + 0.12 * np.sin(0.3 * self.t)
131
+ arms = np.array([self.sp, 0.0, 0.0, 0.15, 0.0, wp, 0.0], np.float32)
132
+ grip = 0.9
133
+ if frac > 0.35 and wht > 0.35 and self.contact_sp is None:
134
+ self._hits = getattr(self, "_hits", 0) + 1
135
+ if self._hits >= 2:
136
+ self.contact_sp = self.sp
137
+ else:
138
+ if self.contact_sp is None:
139
+ self._hits = 0
140
+ wz = face(0.10, 0.5, 0.2)
141
+
142
+ elif name == "press":
143
+ base_sp = self.contact_sp if self.contact_sp is not None else -1.0
144
+ self.sp = base_sp + 0.75 * frac
145
+ arms = np.array([self.sp, 0.0, 0.0, 0.15, 0.0, wp, 0.0], np.float32)
146
+ grip = 0.5
147
+ vx = 0.05
148
+ pitch = 0.25 * frac
149
+ wz = face(0.10, 0.5, 0.2)
150
+
151
+ elif name == "lift":
152
+ base_sp = self.contact_sp if self.contact_sp is not None else -0.4
153
+ self.sp = base_sp - 0.55 * frac
154
+ arms = np.array([self.sp, 0.0, 0.0, 0.1, 0.0, 0.3, 0.0], np.float32)
155
+ grip = 0.7
156
+ vx = -0.04
157
+ wz = face(0.10, 0.5, 0.2)
158
+
159
+ elif name == "strafe":
160
+ self.sp = (self.contact_sp if self.contact_sp is not None else -0.5)
161
+ arms = np.array([self.sp, 0.0, 0.0, 0.15, 0.0, wp, 0.0], np.float32)
162
+ grip = 0.8
163
+ vy = 0.09
164
+ wz = face(0.10, 0.5, 0.2)
165
+
166
+ elif name == "backoff":
167
+ arms = np.array([-0.5, 0.0, 0.0, 0.25, 0.0, 0.2, 0.0], np.float32)
168
+ vx = -0.25
169
+ wz = face(0.10, 0.5, 0.2)
170
+
171
+ elif name == "centerleft":
172
+ arms = np.array([-0.5, 0.0, 0.0, 0.25, 0.0, 0.2, 0.0], np.float32)
173
+ vy = 0.22
174
+ wz = face(0.10, 0.5, 0.2)
175
+
176
+ elif name == "walkcenter":
177
+ arms = np.array([-0.5, 0.0, 0.0, 0.25, 0.0, 0.2, 0.0], np.float32)
178
+ if px < -0.05:
179
+ vx = 0.20
180
+ wz = face(0.10, 0.7, 0.3)
181
+
182
+ elif name == "squat" or name == "squat2":
183
+ arms = np.array([0.0, 0.0, 0.0, 0.05, 0.0, 0.2, 0.0], np.float32)
184
+ height = 0.50
185
+ grip = 0.9
186
+ wz = face(0.10, 0.5, 0.2)
187
+
188
+ elif name == "stand" or name == "stand2":
189
+ arms = np.array([0.0, 0.0, 0.0, 0.05, 0.0, 0.2, 0.0], np.float32)
190
+ height = 0.79
191
+ grip = 0.9
192
+ wz = face(0.10, 0.5, 0.2)
193
+
194
+ elif name == "pushcont":
195
+ base_sp = self.contact_sp if self.contact_sp is not None else -0.6
196
+ arms = np.array([base_sp, 0.0, 0.0, 0.1, 0.0, 0.2, 0.0], np.float32)
197
+ grip = 0.7
198
+ vx = 0.14
199
+ wz = face(0.10, 0.5, 0.2)
200
+
201
+ elif name == "body":
202
+ arms = np.array([-0.75, 0.0, 0.0, 0.30, 0.0, 0.2, 0.0], np.float32)
203
+ grip = 0.5
204
+ vx = 0.16
205
+ pitch = 0.1
206
+ wz = face(0.10, 0.5, 0.2)
207
+
208
+ elif name == "finalsweep":
209
+ # slow continuous vertical sweep through the whole workspace
210
+ self.sp = -1.0 + 1.1 * np.sin(0.035 * self.t)
211
+ arms = np.array([self.sp, 0.0, 0.0, 0.15, 0.0, 0.2, 0.0], np.float32)
212
+ grip = 0.8
213
+ vx = 0.04 * np.sin(0.02 * self.t)
214
+ vy = 0.03 * np.cos(0.013 * self.t)
215
+ wz = face(0.10, 0.5, 0.2)
216
+
217
+ else: # hold
218
+ arms = np.array([-0.4, 0.0, 0.0, 0.2, 0.0, 0.2, 0.0], np.float32)
219
+ grip = 0.5
220
+
221
+ raw[0] = vx
222
+ raw[1] = vy
223
+ raw[2] = height
224
+ raw[3] = wz
225
+ raw[4] = pitch
226
+ raw[5:12] = arms
227
+ raw[12:19] = arms
228
+ raw[19] = grip
229
+ raw[20] = grip
230
+ return np.asarray(raw, dtype=np.float32)
policies/dishwasher_close/deepseek1017-s3/episodes.csv ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ seed,success,length,termination,fell
2
+ 620000,0,4650,timeout,0
3
+ 620001,0,4650,timeout,0
4
+ 620002,0,4650,timeout,0
5
+ 620003,0,4650,timeout,0
6
+ 620004,0,4650,timeout,0
7
+ 620005,0,4650,timeout,0
8
+ 620006,0,4650,timeout,0
9
+ 620007,0,4650,timeout,0
10
+ 620008,0,4650,timeout,0
11
+ 620009,0,4650,timeout,0
12
+ 620010,0,4650,timeout,0
13
+ 620011,0,4650,timeout,0
14
+ 620012,0,4650,timeout,0
15
+ 620013,0,4650,timeout,0
16
+ 620014,0,4650,timeout,0
17
+ 620015,0,4650,timeout,0
18
+ 620016,0,4650,timeout,0
19
+ 620017,0,4650,timeout,0
20
+ 620018,0,4650,timeout,0
21
+ 620019,0,4650,timeout,0
22
+ 620020,0,4650,timeout,0
23
+ 620021,0,4650,timeout,0
24
+ 620022,0,4650,timeout,0
25
+ 620023,0,4650,timeout,0
26
+ 620024,0,4650,timeout,0
27
+ 620025,0,4650,timeout,0
28
+ 620026,0,4650,timeout,0
29
+ 620027,0,4650,timeout,0
30
+ 620028,0,4650,timeout,0
31
+ 620029,0,4650,timeout,0
32
+ 620030,0,4650,timeout,0
33
+ 620031,0,4650,timeout,0
34
+ 620032,0,4650,timeout,0
35
+ 620033,0,4650,timeout,0
36
+ 620034,0,4650,timeout,0
37
+ 620035,0,4650,timeout,0
38
+ 620036,0,4650,timeout,0
39
+ 620037,0,4650,timeout,0
40
+ 620038,0,4650,timeout,0
41
+ 620039,0,4650,timeout,0
42
+ 620040,0,4650,timeout,0
43
+ 620041,0,4650,timeout,0
44
+ 620042,0,4650,timeout,0
45
+ 620043,0,4650,timeout,0
46
+ 620044,0,4650,timeout,0
47
+ 620045,0,4650,timeout,0
48
+ 620046,0,4650,timeout,0
49
+ 620047,0,4650,timeout,0
50
+ 620048,0,4650,timeout,0
51
+ 620049,0,4650,timeout,0
52
+ 620050,0,4650,timeout,0
53
+ 620051,0,4650,timeout,0
54
+ 620052,0,4650,timeout,0
55
+ 620053,0,4650,timeout,0
56
+ 620054,0,4650,timeout,0
57
+ 620055,0,4650,timeout,0
58
+ 620056,0,4650,timeout,0
59
+ 620057,0,4650,timeout,0
60
+ 620058,0,4650,timeout,0
61
+ 620059,0,4650,timeout,0
62
+ 620060,0,4650,timeout,0
63
+ 620061,0,4650,timeout,0
64
+ 620062,0,4650,timeout,0
65
+ 620063,0,4650,timeout,0
66
+ 620064,0,4650,timeout,0
67
+ 620065,0,4650,timeout,0
68
+ 620066,0,4650,timeout,0
69
+ 620067,0,4650,timeout,0
70
+ 620068,0,4650,timeout,0
71
+ 620069,0,4650,timeout,0
72
+ 620070,0,4650,timeout,0
73
+ 620071,0,4650,timeout,0
74
+ 620072,0,4650,timeout,0
75
+ 620073,0,4650,timeout,0
76
+ 620074,0,4650,timeout,0
77
+ 620075,0,4650,timeout,0
78
+ 620076,0,4650,timeout,0
79
+ 620077,0,4650,timeout,0
80
+ 620078,0,4650,timeout,0
81
+ 620079,0,4650,timeout,0
82
+ 620080,0,4650,timeout,0
83
+ 620081,0,4650,timeout,0
84
+ 620082,0,4650,timeout,0
85
+ 620083,0,4650,timeout,0
86
+ 620084,0,4650,timeout,0
87
+ 620085,0,4650,timeout,0
88
+ 620086,0,4650,timeout,0
89
+ 620087,0,4650,timeout,0
90
+ 620088,0,4650,timeout,0
91
+ 620089,0,4650,timeout,0
92
+ 620090,0,4650,timeout,0
93
+ 620091,0,4650,timeout,0
94
+ 620092,0,4650,timeout,0
95
+ 620093,0,4650,timeout,0
96
+ 620094,0,4650,timeout,0
97
+ 620095,0,4650,timeout,0
98
+ 620096,0,4650,timeout,0
99
+ 620097,0,4650,timeout,0
100
+ 620098,0,4650,timeout,0
101
+ 620099,0,4650,timeout,0
policies/dishwasher_close/deepseek1017-s3/policy.py ADDED
@@ -0,0 +1,246 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Push the dishwasher racks in and close the door.
2
+
3
+ Hand-written, deterministic controller. The policy approaches the dishwasher,
4
+ sweeps both arms through the rack heights while advancing, then works the door
5
+ through a set of whole-arm / whole-body motions (under-lift, body lift and
6
+ top-press). All motion is generated from the proprioceptive state so the
7
+ policy is fully deterministic and needs no scene model at run time.
8
+
9
+ Contract (see docs/api.md):
10
+ raw = [vx, vy, height, wz, torso_pitch, left arm(7), right arm(7),
11
+ left gripper, right gripper]
12
+ """
13
+
14
+ import numpy as np
15
+
16
+
17
+ def _clip(x, lo, hi):
18
+ return float(min(hi, max(lo, x)))
19
+
20
+
21
+ class Policy:
22
+ """Phase-based scripted dishwasher policy."""
23
+
24
+ def reset(self, obs, tools):
25
+ self.tools = tools
26
+ self.hold = np.asarray(tools.hold_action(), dtype=np.float32)
27
+ low = np.asarray(obs["low_dim_obs"], dtype=np.float64)
28
+ self.yaw0 = float(low[24])
29
+ self.target_yaw = self.yaw0 + 1.05
30
+ self.phase = 0
31
+ self.pt = 0
32
+ self.done_steps = 0
33
+ # phase plan: (name, duration)
34
+ self.plan = self._build_plan()
35
+
36
+ # ------------------------------------------------------------------ plan
37
+ def _build_plan(self):
38
+ plan = []
39
+ # 0: turn to face the dishwasher
40
+ plan.append(["turn", 240])
41
+ # 1: walk up to it
42
+ plan.append(["walk", 120])
43
+ # 2: rack sweep -- arms at a series of heights while advancing
44
+ for h in (1.35, 1.05, 0.75, 0.45, 1.55, 1.15, 0.60):
45
+ plan.append(["push_rack", 34, h])
46
+ # 3: make room in front of the door
47
+ plan.append(["back", 26])
48
+ # 4: door under-lift at several heights
49
+ for h in (0.05, 0.30, 0.60):
50
+ plan.append(["lift", 46, h])
51
+ # 5: squat, get under the door, then stand up
52
+ plan.append(["bodylift", 120])
53
+ # 6: press the door down from above
54
+ plan.append(["press", 90])
55
+ # 7: repeat a compact door cycle
56
+ for h in (0.20, 0.50, 0.80):
57
+ plan.append(["lift", 40, h])
58
+ plan.append(["press", 70])
59
+ plan.append(["bodylift", 100])
60
+ # 8: final hold with the hands against the door
61
+ plan.append(["hold_door", 160])
62
+ return plan
63
+
64
+ # --------------------------------------------------------------- helpers
65
+ def _base_action(self):
66
+ a = self.hold.copy()
67
+ a[0] = 0.0
68
+ a[1] = 0.0
69
+ a[2] = 0.74
70
+ a[3] = 0.0
71
+ a[4] = 0.0
72
+ a[5:19] = 0.0
73
+ a[19] = 0.6
74
+ a[20] = 0.6
75
+ return a
76
+
77
+ def _yaw(self, a, obs, target, gain=1.5, limit=0.5):
78
+ e = target - float(obs["low_dim_obs"][24])
79
+ w = _clip(gain * e, -limit, limit)
80
+ if 0.0 < abs(w) < 0.06:
81
+ w = 0.06 if w > 0 else -0.06
82
+ a[3] = w
83
+
84
+ def _arms(self, a, sp, elbow=0.0, roll=0.0, wrist=(0.0, 0.0, 0.0), grip=1.0):
85
+ for off in (5, 12):
86
+ a[off] = _clip(sp, -3.0, 2.6)
87
+ a[off + 1] = _clip(roll, -1.5, 2.2)
88
+ a[off + 2] = 0.0
89
+ a[off + 3] = _clip(elbow, -1.0, 2.0)
90
+ a[off + 4] = _clip(wrist[0], -1.9, 1.9)
91
+ a[off + 5] = _clip(wrist[1], -1.6, 1.6)
92
+ a[off + 6] = _clip(wrist[2], -1.6, 1.6)
93
+ a[19] = grip
94
+ a[20] = grip
95
+
96
+ def _next_phase(self):
97
+ self.phase += 1
98
+ self.pt = 0
99
+
100
+ # ------------------------------------------------------------------- act
101
+ def act(self, obs, tools):
102
+ low = np.asarray(obs["low_dim_obs"], dtype=np.float64)
103
+ self.pt += 1
104
+ if self.phase >= len(self.plan):
105
+ # Finished the scripted sequence: keep working the door in a slow,
106
+ # safe cycle for the rest of the episode (more attempts can only
107
+ # help, and the motions were verified not to topple the robot).
108
+ a = self._base_action()
109
+ self._yaw(a, obs, self.target_yaw, gain=1.0, limit=0.22)
110
+ k = self.done_steps // 70
111
+ mode = k % 8
112
+ f = (self.done_steps % 70) / 70.0
113
+ if mode == 0:
114
+ self._arms(a, 0.05 + 1.3 * f, elbow=0.1, grip=1.0)
115
+ a[4] = 0.35
116
+ a[0] = 0.05
117
+ elif mode == 1:
118
+ self._arms(a, 1.35, elbow=1.0 * (1.0 - f), grip=1.0)
119
+ a[4] = 0.25 + 0.5 * f
120
+ a[0] = 0.10
121
+ elif mode == 2:
122
+ self._arms(a, 0.35, elbow=0.0, grip=1.0)
123
+ if f < 0.4:
124
+ a[2] = 0.44
125
+ a[4] = 0.45
126
+ else:
127
+ g = min(1.0, (f - 0.4) / 0.6)
128
+ a[2] = 0.44 + 0.45 * g
129
+ a[4] = 0.45 * (1.0 - g)
130
+ self._arms(a, 0.35 + 0.5 * g, elbow=0.0, grip=1.0)
131
+ a[0] = 0.03
132
+ elif mode == 3:
133
+ self._arms(a, 1.35, elbow=0.4, grip=1.0)
134
+ a[4] = 0.35
135
+ a[0] = 0.18
136
+ elif mode == 4:
137
+ self._arms(a, 0.75, elbow=0.6, grip=1.0)
138
+ a[4] = 0.45
139
+ a[0] = 0.10
140
+ elif mode == 5:
141
+ self._arms(a, 0.45, elbow=0.2, grip=1.0)
142
+ a[4] = 0.20
143
+ a[0] = -0.08
144
+ elif mode == 6:
145
+ # lean back while holding the door edge: pulls a sticky door
146
+ self._arms(a, 0.90, elbow=0.30, grip=1.0)
147
+ a[4] = -0.15
148
+ a[0] = -0.05
149
+ else:
150
+ # stand tall and press the upper edge inward
151
+ self._arms(a, 1.50, elbow=0.20, grip=1.0)
152
+ a[2] = 0.90
153
+ a[4] = 0.75
154
+ a[0] = 0.10
155
+ self.done_steps += 1
156
+ if float(low[23]) < 0.50:
157
+ a[0] = min(a[0], 0.02)
158
+ return a
159
+
160
+ ph = self.plan[self.phase]
161
+ name = ph[0]
162
+ dur = ph[1]
163
+ a = self._base_action()
164
+
165
+ if name == "turn":
166
+ self._yaw(a, obs, self.target_yaw, gain=1.5, limit=0.5)
167
+ if self.pt >= dur or (
168
+ abs(self.target_yaw - float(low[24])) < 0.06 and self.pt > 20
169
+ ):
170
+ self._next_phase()
171
+ elif name == "walk":
172
+ self._yaw(a, obs, self.target_yaw, gain=1.2, limit=0.3)
173
+ a[0] = 0.20
174
+ a[4] = 0.15
175
+ if self.pt >= dur:
176
+ self._next_phase()
177
+ elif name == "push_rack":
178
+ h = ph[2]
179
+ self._yaw(a, obs, self.target_yaw, gain=1.2, limit=0.3)
180
+ a[4] = 0.35
181
+ # a small elbow sweep across the height to catch the rack front
182
+ f = min(1.0, self.pt / max(1.0, dur * 0.7))
183
+ self._arms(a, h - 0.15 * f, elbow=0.2 + 0.9 * f, grip=1.0)
184
+ a[0] = 0.16
185
+ if self.pt >= dur:
186
+ self._next_phase()
187
+ elif name == "back":
188
+ self._yaw(a, obs, self.target_yaw, gain=1.2, limit=0.3)
189
+ a[0] = -0.16
190
+ a[4] = 0.35
191
+ a[2] = 0.70
192
+ if self.pt >= dur:
193
+ self._next_phase()
194
+ elif name == "lift":
195
+ h = ph[2]
196
+ self._yaw(a, obs, self.target_yaw, gain=1.2, limit=0.3)
197
+ f = min(1.0, self.pt / max(1.0, dur * 0.65))
198
+ # start with the hand below the edge, then raise it while closing
199
+ sp = h + 1.35 * f
200
+ self._arms(a, sp, elbow=0.15, grip=1.0)
201
+ a[4] = 0.35
202
+ a[0] = 0.05
203
+ if self.pt >= dur:
204
+ self._next_phase()
205
+ elif name == "bodylift":
206
+ self._yaw(a, obs, self.target_yaw, gain=1.2, limit=0.3)
207
+ # first third: squat and reach; second: stand while hands stay put
208
+ if self.pt < dur * 0.35:
209
+ a[2] = 0.44
210
+ a[4] = 0.45
211
+ self._arms(a, 0.35, elbow=0.0, grip=1.0)
212
+ elif self.pt < dur * 0.65:
213
+ a[2] = 0.44
214
+ a[4] = 0.45
215
+ self._arms(a, 0.35, elbow=0.0, grip=1.0)
216
+ else:
217
+ f = (self.pt - dur * 0.65) / max(1.0, dur * 0.35)
218
+ a[2] = 0.44 + 0.45 * min(1.0, f)
219
+ a[4] = 0.45 * (1.0 - min(1.0, f))
220
+ self._arms(a, 0.35 + 0.55 * min(1.0, f), elbow=0.0, grip=1.0)
221
+ a[0] = 0.04
222
+ if self.pt >= dur:
223
+ self._next_phase()
224
+ elif name == "press":
225
+ self._yaw(a, obs, self.target_yaw, gain=1.2, limit=0.3)
226
+ f = min(1.0, self.pt / max(1.0, dur * 0.7))
227
+ # hands on top of the door, elbow extends and torso leans in
228
+ self._arms(a, 1.35, elbow=1.0 * (1.0 - f), grip=1.0)
229
+ a[4] = 0.25 + 0.55 * f
230
+ a[0] = 0.10
231
+ if self.pt >= dur:
232
+ self._next_phase()
233
+ elif name == "hold_door":
234
+ self._yaw(a, obs, self.target_yaw, gain=1.0, limit=0.25)
235
+ a[4] = 0.30
236
+ self._arms(a, 0.85, elbow=0.35, grip=0.9)
237
+ a[0] = 0.05
238
+ if self.pt >= dur:
239
+ self._next_phase()
240
+ else:
241
+ self._next_phase()
242
+
243
+ # Hard safety: never command a large forward speed while very low.
244
+ if float(low[23]) < 0.50:
245
+ a[0] = min(a[0], 0.02)
246
+ return a
policies/dishwasher_close/gpt61sol-s1/episodes.csv ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ seed,success,length,termination,fell
2
+ 620000,0,4650,timeout,0
3
+ 620001,0,4650,timeout,0
4
+ 620002,0,4650,timeout,0
5
+ 620003,0,4650,timeout,0
6
+ 620004,0,4650,timeout,0
7
+ 620005,0,4650,timeout,0
8
+ 620006,0,4650,timeout,0
9
+ 620007,0,4650,timeout,0
10
+ 620008,0,4650,timeout,0
11
+ 620009,0,4650,timeout,0
12
+ 620010,0,4650,timeout,0
13
+ 620011,0,4650,timeout,0
14
+ 620012,0,4650,timeout,0
15
+ 620013,0,4650,timeout,0
16
+ 620014,0,4650,timeout,0
17
+ 620015,0,4650,timeout,0
18
+ 620016,0,4650,timeout,0
19
+ 620017,0,4650,timeout,0
20
+ 620018,0,4650,timeout,0
21
+ 620019,0,4650,timeout,0
22
+ 620020,0,4650,timeout,0
23
+ 620021,0,4650,timeout,0
24
+ 620022,0,4650,timeout,0
25
+ 620023,0,4650,timeout,0
26
+ 620024,0,4650,timeout,0
27
+ 620025,0,4650,timeout,0
28
+ 620026,0,4650,timeout,0
29
+ 620027,0,4650,timeout,0
30
+ 620028,0,4650,timeout,0
31
+ 620029,0,4650,timeout,0
32
+ 620030,0,4650,timeout,0
33
+ 620031,0,4650,timeout,0
34
+ 620032,0,4650,timeout,0
35
+ 620033,0,4650,timeout,0
36
+ 620034,0,4650,timeout,0
37
+ 620035,0,4650,timeout,0
38
+ 620036,0,4650,timeout,0
39
+ 620037,0,4650,timeout,0
40
+ 620038,0,4650,timeout,0
41
+ 620039,0,4650,timeout,0
42
+ 620040,0,4650,timeout,0
43
+ 620041,0,4650,timeout,0
44
+ 620042,0,4650,timeout,0
45
+ 620043,0,4650,timeout,0
46
+ 620044,0,4650,timeout,0
47
+ 620045,0,4650,timeout,0
48
+ 620046,0,4650,timeout,0
49
+ 620047,0,4650,timeout,0
50
+ 620048,0,4650,timeout,0
51
+ 620049,0,4650,timeout,0
52
+ 620050,0,4650,timeout,0
53
+ 620051,0,4650,timeout,0
54
+ 620052,0,4650,timeout,0
55
+ 620053,0,4650,timeout,0
56
+ 620054,0,4650,timeout,0
57
+ 620055,0,4650,timeout,0
58
+ 620056,0,4650,timeout,0
59
+ 620057,0,4650,timeout,0
60
+ 620058,0,4650,timeout,0
61
+ 620059,0,4650,timeout,0
62
+ 620060,0,4650,timeout,0
63
+ 620061,0,4650,timeout,0
64
+ 620062,0,4650,timeout,0
65
+ 620063,0,4650,timeout,0
66
+ 620064,0,4650,timeout,0
67
+ 620065,0,4650,timeout,0
68
+ 620066,0,4650,timeout,0
69
+ 620067,0,4650,timeout,0
70
+ 620068,0,4650,timeout,0
71
+ 620069,0,4650,timeout,0
72
+ 620070,0,4650,timeout,0
73
+ 620071,0,4650,timeout,0
74
+ 620072,0,4650,timeout,0
75
+ 620073,0,4650,timeout,0
76
+ 620074,0,4650,timeout,0
77
+ 620075,0,4650,timeout,0
78
+ 620076,0,4650,timeout,0
79
+ 620077,0,4650,timeout,0
80
+ 620078,0,4650,timeout,0
81
+ 620079,0,4650,timeout,0
82
+ 620080,0,4650,timeout,0
83
+ 620081,0,4650,timeout,0
84
+ 620082,0,4650,timeout,0
85
+ 620083,0,4650,timeout,0
86
+ 620084,0,4650,timeout,0
87
+ 620085,0,4650,timeout,0
88
+ 620086,0,4650,timeout,0
89
+ 620087,0,4650,timeout,0
90
+ 620088,0,4650,timeout,0
91
+ 620089,0,4650,timeout,0
92
+ 620090,0,4650,timeout,0
93
+ 620091,0,4650,timeout,0
94
+ 620092,0,4650,timeout,0
95
+ 620093,0,4650,timeout,0
96
+ 620094,0,4650,timeout,0
97
+ 620095,0,4650,timeout,0
98
+ 620096,0,4650,timeout,0
99
+ 620097,0,4650,timeout,0
100
+ 620098,0,4650,timeout,0
101
+ 620099,0,4650,timeout,0
policies/dishwasher_close/gpt61sol-s1/policy.py ADDED
@@ -0,0 +1,157 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Deterministic joint and base control for the dishwasher manipulation task."""
2
+ import numpy as np
3
+
4
+
5
+ class Policy:
6
+ def reset(self, obs, tools):
7
+ self.action = np.asarray(tools.hold_action(), dtype=float)
8
+ self.stage = 0
9
+ self.age = 0
10
+ self.x = 0.35
11
+ self.y = -0.47
12
+ self.heading = 0.0
13
+
14
+ def navigate(self, obs, target):
15
+ pose = obs['low_dim_obs'][21:25]
16
+ error = np.asarray(target) - pose[:2]
17
+ velocity = np.clip(1.8 * error, -0.20, 0.20)
18
+ distance = np.linalg.norm(error)
19
+ if distance < 0.025:
20
+ velocity[:] = 0
21
+ elif np.linalg.norm(velocity) < 0.07:
22
+ velocity *= 0.07 / max(np.linalg.norm(velocity), 1e-6)
23
+ c, s = np.cos(pose[3]), np.sin(pose[3])
24
+ self.target[0] = c * velocity[0] + s * velocity[1]
25
+ self.target[1] = -s * velocity[0] + c * velocity[1]
26
+ return distance < 0.035 and abs(((self.heading - pose[3] + np.pi) % (2 * np.pi)) - np.pi) < 0.035
27
+
28
+ def finish_phase(self, duration):
29
+ if self.age >= duration:
30
+ self.stage += 1
31
+ self.age = 0
32
+
33
+ def left_arm(self, roll, grip):
34
+ # The appliance is to the left of the initial forward direction.
35
+ # Abduction advances the hand along the rack slide and door closing arc.
36
+ self.target[5:12] = [0.8, roll, 0, 0, 0, 0, 1.57]
37
+ self.target[19] = grip
38
+
39
+ def act(self, obs, tools):
40
+ self.age += 1
41
+ self.target = self.action.copy()
42
+ a = self.target
43
+ a[:2] = 0
44
+ yaw = float(obs['low_dim_obs'][24])
45
+ yaw_error = (self.heading - yaw + np.pi) % (2 * np.pi) - np.pi
46
+ a[3] = np.clip(1.8 * yaw_error, -0.45, 0.45)
47
+ a[12:19] = [-1.7, -0.2, 0, 0, 0, 0, 0]
48
+ a[20] = 1
49
+ stage, age = self.stage, self.age
50
+
51
+ if stage == 0:
52
+ a[2], a[4] = 0.74, 0
53
+ self.left_arm(0.1, 1)
54
+ if self.navigate(obs, [self.x, -0.80]) or age >= 300:
55
+ self.stage, self.age = 1, 0
56
+ elif stage == 1:
57
+ a[2], a[4] = 0.74, 0.8
58
+ self.left_arm(0.1, 0)
59
+ self.finish_phase(180)
60
+ elif stage == 2:
61
+ self.left_arm(0.1, 0)
62
+ self.navigate(obs, [self.x, self.y])
63
+ self.finish_phase(300)
64
+ elif stage == 3:
65
+ self.left_arm(0.1, 1)
66
+ self.finish_phase(80)
67
+ elif stage == 4:
68
+ r = min(age / 260.0, 1)
69
+ self.left_arm(0.1 + 0.9 * r, 1)
70
+ a[2] = 0.74 - 0.14 * r
71
+ self.finish_phase(360)
72
+ elif stage == 5:
73
+ r = min(age / 160.0, 1)
74
+ self.left_arm(1.0 - 0.9 * r, 0)
75
+ a[2] = 0.60 + 0.14 * r
76
+ self.finish_phase(200)
77
+ elif stage == 6:
78
+ self.left_arm(0.1, 0)
79
+ a[2] = 0.50
80
+ self.finish_phase(160)
81
+ elif stage == 7:
82
+ self.left_arm(0.1, 1)
83
+ self.finish_phase(80)
84
+ elif stage == 8:
85
+ r = min(age / 260.0, 1)
86
+ self.left_arm(0.1 + 0.9 * r, 1)
87
+ a[2] = 0.50 - 0.10 * r
88
+ self.finish_phase(360)
89
+ elif stage == 9:
90
+ r = min(age / 160.0, 1)
91
+ self.left_arm(1.0 - 0.9 * r, 0)
92
+ a[2] = 0.40 + 0.05 * r
93
+ self.finish_phase(200)
94
+ elif stage == 10:
95
+ self.left_arm(0.1, 0)
96
+ a[2] = 0.40
97
+ self.finish_phase(180)
98
+ elif stage == 11:
99
+ self.left_arm(0.1, 1)
100
+ self.finish_phase(100)
101
+ elif stage == 12:
102
+ r = min(age / 450.0, 1)
103
+ self.left_arm(0.1 + 1.25 * r, 1)
104
+ a[2] = 0.40 + 0.40 * r
105
+ self.finish_phase(600)
106
+ elif stage == 13:
107
+ self.left_arm(1.45, 1)
108
+ a[2], a[4] = 0.80, 0.80
109
+ self.navigate(obs, [self.x, self.y + 0.02])
110
+ self.finish_phase(200)
111
+ elif stage == 14:
112
+ # Withdraw, then turn to make another push from the front.
113
+ self.heading = np.pi / 2
114
+ a[3] = np.clip(1.8 * ((self.heading - yaw + np.pi) % (2*np.pi) - np.pi), -0.45, 0.45)
115
+ a[2], a[4] = 0.74, 0
116
+ a[5:12] = [-1.5, 0.15, 0, 0, 0, 0, 0]
117
+ a[19] = 1
118
+ self.finish_phase(250)
119
+ elif stage == 15:
120
+ a[5:12] = [-1.7, 0.2, 0, 0, 0, 0, 0]
121
+ if age < 170:
122
+ a[2], a[4] = 0.74, 0.60
123
+ a[12:19] = [-0.3, 0, 0, 0, 0, 0, 0]
124
+ else:
125
+ a[2], a[4] = 0.60, 0.80
126
+ a[12:19] = [0.1, 0, 0, 0, 0, 0, 0]
127
+ a[19:21] = 1
128
+ self.navigate(obs, [0.28, -0.15])
129
+ self.finish_phase(350)
130
+ elif stage == 16:
131
+ a[2], a[4] = 0.40, 0.80
132
+ a[5:12] = [-1.7, 0.2, 0, 0, 0, 0, 0]
133
+ a[12:19] = [0, 0, 0, 0, 0, 0.8, 0]
134
+ a[20] = 0
135
+ self.finish_phase(150)
136
+ elif stage == 17:
137
+ a[20] = 1
138
+ self.finish_phase(80)
139
+ elif stage == 18:
140
+ r = min(age / 300.0, 1)
141
+ a[2], a[4] = 0.40 + 0.34*r, 0.80
142
+ a[12:19] = [-0.6*r, 0, 0, 0, 0, 0.8*(1-r), 0]
143
+ a[20] = 1
144
+ self.finish_phase(350)
145
+ else:
146
+ a[2], a[4] = 0.74, 0.60
147
+ a[12:19] = [-0.6, 0, 0, 0, 0, 0, 0]
148
+ a[20] = 1
149
+ self.navigate(obs, [0.28, -0.20])
150
+
151
+ # Joint and stance targets change gradually; velocities remain feedback commands.
152
+ out = a.copy()
153
+ out[2] = self.action[2] + np.clip(a[2] - self.action[2], -0.008, 0.008)
154
+ out[4] = self.action[4] + np.clip(a[4] - self.action[4], -0.012, 0.012)
155
+ out[5:19] = self.action[5:19] + np.clip(a[5:19] - self.action[5:19], -0.045, 0.045)
156
+ self.action = out
157
+ return out.astype(np.float32)
policies/dishwasher_close/gpt61sol-s2/episodes.csv ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ seed,success,length,termination,fell
2
+ 620000,0,4650,timeout,0
3
+ 620001,0,4650,timeout,0
4
+ 620002,0,4650,timeout,0
5
+ 620003,0,4650,timeout,0
6
+ 620004,0,4650,timeout,0
7
+ 620005,0,4650,timeout,0
8
+ 620006,0,4650,timeout,0
9
+ 620007,0,4650,timeout,0
10
+ 620008,0,4650,timeout,0
11
+ 620009,0,4650,timeout,0
12
+ 620010,0,4650,timeout,0
13
+ 620011,0,4650,timeout,0
14
+ 620012,0,4650,timeout,0
15
+ 620013,0,4650,timeout,0
16
+ 620014,0,4650,timeout,0
17
+ 620015,0,4650,timeout,0
18
+ 620016,0,4650,timeout,0
19
+ 620017,0,4650,timeout,0
20
+ 620018,0,4650,timeout,0
21
+ 620019,0,4650,timeout,0
22
+ 620020,0,4650,timeout,0
23
+ 620021,0,4650,timeout,0
24
+ 620022,0,4650,timeout,0
25
+ 620023,0,4650,timeout,0
26
+ 620024,0,4650,timeout,0
27
+ 620025,0,4650,timeout,0
28
+ 620026,0,4650,timeout,0
29
+ 620027,0,4650,timeout,0
30
+ 620028,0,4650,timeout,0
31
+ 620029,0,4650,timeout,0
32
+ 620030,0,4650,timeout,0
33
+ 620031,0,4650,timeout,0
34
+ 620032,0,4650,timeout,0
35
+ 620033,0,4650,timeout,0
36
+ 620034,0,4650,timeout,0
37
+ 620035,0,4650,timeout,0
38
+ 620036,0,4650,timeout,0
39
+ 620037,0,4650,timeout,0
40
+ 620038,0,4650,timeout,0
41
+ 620039,0,4650,timeout,0
42
+ 620040,0,4650,timeout,0
43
+ 620041,0,4650,timeout,0
44
+ 620042,0,4650,timeout,0
45
+ 620043,0,4650,timeout,0
46
+ 620044,0,4650,timeout,0
47
+ 620045,0,4650,timeout,0
48
+ 620046,0,4650,timeout,0
49
+ 620047,0,4650,timeout,0
50
+ 620048,0,4650,timeout,0
51
+ 620049,0,4650,timeout,0
52
+ 620050,0,4650,timeout,0
53
+ 620051,0,4650,timeout,0
54
+ 620052,0,4650,timeout,0
55
+ 620053,0,4650,timeout,0
56
+ 620054,0,4650,timeout,0
57
+ 620055,0,4650,timeout,0
58
+ 620056,0,4650,timeout,0
59
+ 620057,0,4650,timeout,0
60
+ 620058,0,4650,timeout,0
61
+ 620059,0,4650,timeout,0
62
+ 620060,0,4650,timeout,0
63
+ 620061,0,4650,timeout,0
64
+ 620062,0,4650,timeout,0
65
+ 620063,0,4650,timeout,0
66
+ 620064,0,4650,timeout,0
67
+ 620065,0,4650,timeout,0
68
+ 620066,0,4650,timeout,0
69
+ 620067,0,4650,timeout,0
70
+ 620068,0,4650,timeout,0
71
+ 620069,0,4650,timeout,0
72
+ 620070,0,4650,timeout,0
73
+ 620071,0,4650,timeout,0
74
+ 620072,0,4650,timeout,0
75
+ 620073,0,4650,timeout,0
76
+ 620074,0,4650,timeout,0
77
+ 620075,0,4650,timeout,0
78
+ 620076,0,4650,timeout,0
79
+ 620077,0,4650,timeout,0
80
+ 620078,0,4650,timeout,0
81
+ 620079,0,4650,timeout,0
82
+ 620080,0,4650,timeout,0
83
+ 620081,0,4650,timeout,0
84
+ 620082,0,4650,timeout,0
85
+ 620083,0,4650,timeout,0
86
+ 620084,0,4650,timeout,0
87
+ 620085,0,4650,timeout,0
88
+ 620086,0,4650,timeout,0
89
+ 620087,0,4650,timeout,0
90
+ 620088,0,4650,timeout,0
91
+ 620089,0,4650,timeout,0
92
+ 620090,0,4650,timeout,0
93
+ 620091,0,4650,timeout,0
94
+ 620092,0,4650,timeout,0
95
+ 620093,0,4650,timeout,0
96
+ 620094,0,4650,timeout,0
97
+ 620095,0,4650,timeout,0
98
+ 620096,0,4650,timeout,0
99
+ 620097,0,4650,timeout,0
100
+ 620098,0,4650,timeout,0
101
+ 620099,0,4650,timeout,0
policies/dishwasher_close/gpt61sol-s2/policy.py ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Deterministic control: rack sweeps, obstacle-aware approach, and door lift.
2
+
3
+ All targets are physical joint angles or body poses. No demonstration files,
4
+ learned parameters, random numbers, or clock are used by this policy.
5
+ """
6
+ import numpy as np
7
+
8
+ class Policy:
9
+ def reset(self, obs, tools):
10
+ self.action=np.asarray(tools.hold_action(),dtype=float)
11
+ self.action[19:]=0
12
+ self.phases=[]
13
+ neutral=self.action.copy()
14
+ neutral[2]=.74;neutral[4]=0;neutral[5:19]=0;neutral[19:]=0
15
+ def add(n,kind,target,yaw):
16
+ self.phases.append((n,kind,target,yaw))
17
+ def rack(el,y,g):
18
+ p=neutral.copy();p[4]=.4
19
+ p[12:19]=[-.4,0,y,el,0,.1,0];p[20]=g
20
+ return p
21
+ add(450,'walk',(.15,-.50),1.57)
22
+ # The elbow sets rack height; shoulder yaw sweeps toward the cabinet.
23
+ # Lower the forearm outside the rack before bringing it back.
24
+ for el in (1.3,1.9):
25
+ add(100,'rack',rack(0,.7,0),1.57)
26
+ add(100,'rack',rack(el,.7,0),1.57)
27
+ add(40,'rack',rack(el,.7,1),1.57)
28
+ for y in (.3,-.1,-.5,-.9):
29
+ add(100,'rack',rack(el,y,1),1.57)
30
+ add(40,'rack',rack(el,-.9,0),1.57)
31
+ add(100,'rack',rack(0,-.9,0),1.57)
32
+ add(100,'pose',neutral,1.57)
33
+ # Go around the front corner rather than through the open panel.
34
+ for xy in ((-.55,-.50),(-.55,0),(-.12,0)):
35
+ add(200,'walk',xy,0)
36
+ def front(h,sp,g):
37
+ p=neutral.copy();p[2]=h;p[4]=.2;p[19:]=g
38
+ for s in (5,12):p[s:s+7]=[sp,0,0,0,0,0,0]
39
+ return p
40
+ add(180,'pose',front(.60,-.8,0),0)
41
+ add(60,'pose',front(.60,-.8,1),0)
42
+ add(220,'pose',front(.76,-1.2,1),0)
43
+ add(220,'lift',front(.76,-1.7,1),0)
44
+ add(180,'lift',front(.76,-1.9,1),0)
45
+ add(500,'press',(.2,0),0)
46
+ self.phase=0;self.start=0;self.initial=self.action.copy()
47
+
48
+ def move(self,obs,raw,target):
49
+ p=obs['low_dim_obs'][21:25]
50
+ err=np.asarray(target)-p[:2]
51
+ c=np.cos(p[3]);s=np.sin(p[3])
52
+ v=2*np.array([c*err[0]+s*err[1],-s*err[0]+c*err[1]])
53
+ if np.linalg.norm(v)<.06:v[:]=0
54
+ raw[:2]=np.clip(v,-.25,.25)
55
+
56
+ def act(self,obs,tools):
57
+ t=int(obs['t'])
58
+ while self.phase<len(self.phases)-1 and t-self.start>=self.phases[self.phase][0]:
59
+ self.start+=self.phases[self.phase][0]
60
+ self.phase+=1
61
+ self.initial=self.action.copy()
62
+ n,kind,target,yaw=self.phases[self.phase]
63
+ raw=self.action.copy();raw[:2]=0
64
+ if kind in ('pose','rack','lift'):
65
+ u=np.clip((t-self.start)/(n*.75),0,1)
66
+ raw[2:]=self.initial[2:]+(target[2:]-self.initial[2:])*u
67
+ raw[19:]=target[19:]
68
+ if kind=='rack':self.move(obs,raw,(.15,-.50))
69
+ elif kind=='lift':self.move(obs,raw,(.10,0))
70
+ elif kind=='walk':
71
+ raw[2]=.74;raw[4]=0;raw[5:19]=0;raw[19:]=0
72
+ self.move(obs,raw,target)
73
+ elif kind=='press':self.move(obs,raw,target)
74
+ p=obs['low_dim_obs']
75
+ angle=(yaw-float(p[24])+np.pi)%(2*np.pi)-np.pi
76
+ raw[3]=np.clip(4*angle,-.6,.6)
77
+ self.action=raw.copy()
78
+ return raw.astype(np.float32)
policies/dishwasher_close/gpt61sol-s3/episodes.csv ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ seed,success,length,termination,fell
2
+ 620000,0,4650,timeout,0
3
+ 620001,0,4650,timeout,0
4
+ 620002,0,4650,timeout,0
5
+ 620003,0,4650,timeout,0
6
+ 620004,0,4650,timeout,0
7
+ 620005,0,4650,timeout,0
8
+ 620006,0,4650,timeout,0
9
+ 620007,0,4650,timeout,0
10
+ 620008,0,4650,timeout,0
11
+ 620009,0,4650,timeout,0
12
+ 620010,0,4650,timeout,0
13
+ 620011,0,4650,timeout,0
14
+ 620012,0,4650,timeout,0
15
+ 620013,0,4650,timeout,0
16
+ 620014,0,4650,timeout,0
17
+ 620015,0,4650,timeout,0
18
+ 620016,0,4650,timeout,0
19
+ 620017,0,4650,timeout,0
20
+ 620018,0,4650,timeout,0
21
+ 620019,0,4650,timeout,0
22
+ 620020,0,4650,timeout,0
23
+ 620021,0,4650,timeout,0
24
+ 620022,0,4650,timeout,0
25
+ 620023,0,4650,timeout,0
26
+ 620024,0,4650,timeout,0
27
+ 620025,0,4650,timeout,0
28
+ 620026,0,4650,timeout,0
29
+ 620027,0,4650,timeout,0
30
+ 620028,0,4650,timeout,0
31
+ 620029,0,4650,timeout,0
32
+ 620030,0,4650,timeout,0
33
+ 620031,0,4650,timeout,0
34
+ 620032,0,4650,timeout,0
35
+ 620033,0,4650,timeout,0
36
+ 620034,0,4650,timeout,0
37
+ 620035,0,4650,timeout,0
38
+ 620036,0,4650,timeout,0
39
+ 620037,0,4650,timeout,0
40
+ 620038,0,4650,timeout,0
41
+ 620039,0,4650,timeout,0
42
+ 620040,0,4650,timeout,0
43
+ 620041,0,4650,timeout,0
44
+ 620042,0,4650,timeout,0
45
+ 620043,0,4650,timeout,0
46
+ 620044,0,4650,timeout,0
47
+ 620045,0,4650,timeout,0
48
+ 620046,0,4650,timeout,0
49
+ 620047,0,4650,timeout,0
50
+ 620048,0,4650,timeout,0
51
+ 620049,0,4650,timeout,0
52
+ 620050,0,4650,timeout,0
53
+ 620051,0,4650,timeout,0
54
+ 620052,0,4650,timeout,0
55
+ 620053,0,4650,timeout,0
56
+ 620054,0,4650,timeout,0
57
+ 620055,0,4650,timeout,0
58
+ 620056,0,4650,timeout,0
59
+ 620057,0,4650,timeout,0
60
+ 620058,0,4650,timeout,0
61
+ 620059,0,4650,timeout,0
62
+ 620060,0,4650,timeout,0
63
+ 620061,0,4650,timeout,0
64
+ 620062,0,4650,timeout,0
65
+ 620063,0,4650,timeout,0
66
+ 620064,0,4650,timeout,0
67
+ 620065,0,4650,timeout,0
68
+ 620066,0,4650,timeout,0
69
+ 620067,0,4650,timeout,0
70
+ 620068,0,4650,timeout,0
71
+ 620069,0,4650,timeout,0
72
+ 620070,0,4650,timeout,0
73
+ 620071,0,4650,timeout,0
74
+ 620072,0,4650,timeout,0
75
+ 620073,0,4650,timeout,0
76
+ 620074,0,4650,timeout,0
77
+ 620075,0,4650,timeout,0
78
+ 620076,0,4650,timeout,0
79
+ 620077,0,4650,timeout,0
80
+ 620078,0,4650,timeout,0
81
+ 620079,0,4650,timeout,0
82
+ 620080,0,4650,timeout,0
83
+ 620081,0,4650,timeout,0
84
+ 620082,0,4650,timeout,0
85
+ 620083,0,4650,timeout,0
86
+ 620084,0,4650,timeout,0
87
+ 620085,0,4650,timeout,0
88
+ 620086,0,4650,timeout,0
89
+ 620087,0,4650,timeout,0
90
+ 620088,0,4650,timeout,0
91
+ 620089,0,4650,timeout,0
92
+ 620090,0,4650,timeout,0
93
+ 620091,0,4650,timeout,0
94
+ 620092,0,4650,timeout,0
95
+ 620093,0,4650,timeout,0
96
+ 620094,0,4650,timeout,0
97
+ 620095,0,4650,timeout,0
98
+ 620096,0,4650,timeout,0
99
+ 620097,0,4650,timeout,0
100
+ 620098,0,4650,timeout,0
101
+ 620099,0,4650,timeout,0
policies/dishwasher_close/gpt61sol-s3/policy.py ADDED
@@ -0,0 +1,105 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Deterministic dishwasher control using body feedback and bounded joint targets."""
2
+ import numpy as np
3
+
4
+
5
+ class Policy:
6
+ def reset(self, obs, tools):
7
+ self.action = np.asarray(tools.hold_action(), dtype=np.float32).copy()
8
+ self.center_y = 0.0
9
+ self.located = False
10
+
11
+ def locate(self, obs, tools):
12
+ # The appliance is neutral gray and white against the blue floor.
13
+ im = tools.image('head').astype(np.int16)[:34]
14
+ mask = ((im[:, :, 0] > 130)
15
+ & (np.abs(im[:, :, 0]-im[:, :, 1]) < 20)
16
+ & (np.abs(im[:, :, 1]-im[:, :, 2]) < 30))
17
+ columns = np.flatnonzero(mask.sum(axis=0) >= 3)
18
+ columns = columns[(columns >= 4) & (columns <= 79)]
19
+ if len(columns) > 12:
20
+ lo, hi = float(columns[0]), float(columns[-1])
21
+ width = hi-lo
22
+ lateral = (41.5-(lo+hi)*.5)*.60/max(width, 20.)
23
+ self.center_y = float(np.clip(obs['low_dim_obs'][22]+lateral, -.20, .20))
24
+ self.located = True
25
+
26
+ def act(self, obs, tools):
27
+ t = int(obs['t'])
28
+ p = obs['low_dim_obs'][21:25]
29
+ if t >= 250 and not self.located:
30
+ self.locate(obs, tools)
31
+ target = self.action.copy()
32
+ target[19:21] = 0.0
33
+ height, pitch = .74, .1
34
+ goal_x, goal_y = -.03, self.center_y-.27
35
+ both = False
36
+ anchor = False
37
+
38
+ if t < 300:
39
+ goal_x, goal_y = -.50, 0.
40
+ pitch = 0.
41
+ shoulder, elbow = .2, .6
42
+ elif t < 2220:
43
+ # Move the central palm through the lower rack's front rail.
44
+ k = min(15, (t-300)//120)
45
+ shoulder = .2-.4*(k//4)
46
+ elbow = .2+.4*(k%4)
47
+ elif t < 2900:
48
+ # Extend at the upper rail while leaning over the open door.
49
+ s = np.clip((t-2320)/450., 0., 1.)
50
+ pitch = .7*s
51
+ shoulder, elbow = -.7-.8*s, .2+.1*s
52
+ goal_x = .02
53
+ elif t < 3180:
54
+ goal_x, goal_y = -.10, self.center_y
55
+ pitch = 0.
56
+ shoulder, elbow = 0., 1.5
57
+ both = True
58
+ elif t < 3500:
59
+ # Lower the palms beside the front edge before lifting.
60
+ goal_x, goal_y = -.10, self.center_y
61
+ height, pitch = .4, 0.
62
+ shoulder, elbow = 0., 1.5
63
+ both, anchor = True, True
64
+ elif t < 4060:
65
+ s = np.clip((t-3500)/480., 0., 1.)
66
+ height, pitch = .4+.34*s, 0.
67
+ shoulder, elbow = -.75*s, 1.5-.2*s
68
+ goal_x, goal_y = .04, self.center_y
69
+ both = True
70
+ anchor = height < .68
71
+ elif t < 4400:
72
+ s = np.clip((t-4060)/250., 0., 1.)
73
+ pitch = 0.
74
+ shoulder, elbow = -.75-.45*s, 1.3
75
+ goal_x, goal_y = .04, self.center_y
76
+ both = True
77
+ else:
78
+ pitch = 0.
79
+ shoulder, elbow = -.9, 1.2
80
+ goal_x, goal_y = .20, self.center_y
81
+ both = True
82
+
83
+ target[2], target[4] = height, pitch
84
+ target[5:12] = [shoulder, .10 if both else 0., 0., elbow, 0., 0., 0.]
85
+ if both:
86
+ target[12:19] = [shoulder, -.10, 0., elbow, 0., 0., 0.]
87
+ else:
88
+ target[12:19] = [.2, -.4, 0., .4, 0., 0., 0.]
89
+
90
+ velocity = np.clip(2.*(np.array([goal_x, goal_y])-p[:2]), -.3, .3)
91
+ if 300 <= t < 2900:
92
+ velocity[0] = np.clip(4.*(goal_x-p[0]), 0., .85)
93
+ c, s = np.cos(p[3]), np.sin(p[3])
94
+ target[:2] = [c*velocity[0]+s*velocity[1], -s*velocity[0]+c*velocity[1]]
95
+ if anchor or np.linalg.norm(target[:2]) < .055:
96
+ target[:2] = 0.
97
+ target[3] = np.clip(-3.*p[3], -.8, .8)
98
+ if anchor:
99
+ target[3] = 0.
100
+
101
+ self.action[:2] = target[:2]
102
+ self.action[3] = target[3]
103
+ self.action[2] += np.clip(target[2]-self.action[2], -.0025, .0025)
104
+ self.action[4:] += np.clip(target[4:]-self.action[4:], -.018, .018)
105
+ return self.action.copy()
policies/dishwasher_close/gpt61terra-s1/episodes.csv ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ seed,success,length,termination,fell
2
+ 620000,0,4650,timeout,0
3
+ 620001,0,4650,timeout,0
4
+ 620002,0,4650,timeout,0
5
+ 620003,0,4650,timeout,0
6
+ 620004,0,4650,timeout,0
7
+ 620005,0,4650,timeout,0
8
+ 620006,0,4650,timeout,0
9
+ 620007,0,4650,timeout,0
10
+ 620008,0,4650,timeout,0
11
+ 620009,0,4650,timeout,0
12
+ 620010,0,4650,timeout,0
13
+ 620011,0,4650,timeout,0
14
+ 620012,0,4650,timeout,0
15
+ 620013,0,4650,timeout,0
16
+ 620014,0,4650,timeout,0
17
+ 620015,0,4650,timeout,0
18
+ 620016,0,4650,timeout,0
19
+ 620017,0,4650,timeout,0
20
+ 620018,0,4650,timeout,0
21
+ 620019,0,4650,timeout,0
22
+ 620020,0,4650,timeout,0
23
+ 620021,0,4650,timeout,0
24
+ 620022,0,4650,timeout,0
25
+ 620023,0,4650,timeout,0
26
+ 620024,0,4650,timeout,0
27
+ 620025,0,4650,timeout,0
28
+ 620026,0,4650,timeout,0
29
+ 620027,0,4650,timeout,0
30
+ 620028,0,4650,timeout,0
31
+ 620029,0,4650,timeout,0
32
+ 620030,0,4650,timeout,0
33
+ 620031,0,4650,timeout,0
34
+ 620032,0,4650,timeout,0
35
+ 620033,0,4650,timeout,0
36
+ 620034,0,4650,timeout,0
37
+ 620035,0,4650,timeout,0
38
+ 620036,0,4650,timeout,0
39
+ 620037,0,4650,timeout,0
40
+ 620038,0,4650,timeout,0
41
+ 620039,0,4650,timeout,0
42
+ 620040,0,4650,timeout,0
43
+ 620041,0,4650,timeout,0
44
+ 620042,0,4650,timeout,0
45
+ 620043,0,4650,timeout,0
46
+ 620044,0,4650,timeout,0
47
+ 620045,0,4650,timeout,0
48
+ 620046,0,4650,timeout,0
49
+ 620047,0,4650,timeout,0
50
+ 620048,0,4650,timeout,0
51
+ 620049,0,4650,timeout,0
52
+ 620050,0,4650,timeout,0
53
+ 620051,0,4650,timeout,0
54
+ 620052,0,4650,timeout,0
55
+ 620053,0,4650,timeout,0
56
+ 620054,0,4650,timeout,0
57
+ 620055,0,4650,timeout,0
58
+ 620056,0,4650,timeout,0
59
+ 620057,0,4650,timeout,0
60
+ 620058,0,4650,timeout,0
61
+ 620059,0,4650,timeout,0
62
+ 620060,0,4650,timeout,0
63
+ 620061,0,4650,timeout,0
64
+ 620062,0,4650,timeout,0
65
+ 620063,0,4650,timeout,0
66
+ 620064,0,4650,timeout,0
67
+ 620065,0,4650,timeout,0
68
+ 620066,0,4650,timeout,0
69
+ 620067,0,4650,timeout,0
70
+ 620068,0,4650,timeout,0
71
+ 620069,0,4650,timeout,0
72
+ 620070,0,4650,timeout,0
73
+ 620071,0,4650,timeout,0
74
+ 620072,0,4650,timeout,0
75
+ 620073,0,4650,timeout,0
76
+ 620074,0,4650,timeout,0
77
+ 620075,0,4650,timeout,0
78
+ 620076,0,4650,timeout,0
79
+ 620077,0,4650,timeout,0
80
+ 620078,0,4650,timeout,0
81
+ 620079,0,4650,timeout,0
82
+ 620080,0,4650,timeout,0
83
+ 620081,0,4650,timeout,0
84
+ 620082,0,4650,timeout,0
85
+ 620083,0,4650,timeout,0
86
+ 620084,0,4650,timeout,0
87
+ 620085,0,4650,timeout,0
88
+ 620086,0,4650,timeout,0
89
+ 620087,0,4650,timeout,0
90
+ 620088,0,4650,timeout,0
91
+ 620089,0,4650,timeout,0
92
+ 620090,0,4650,timeout,0
93
+ 620091,0,4650,timeout,0
94
+ 620092,0,4650,timeout,0
95
+ 620093,0,4650,timeout,0
96
+ 620094,0,4650,timeout,0
97
+ 620095,0,4650,timeout,0
98
+ 620096,0,4650,timeout,0
99
+ 620097,0,4650,timeout,0
100
+ 620098,0,4650,timeout,0
101
+ 620099,0,4650,timeout,0
policies/dishwasher_close/gpt61terra-s1/policy.py ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Deterministic upper-body and base controller for the dishwasher."""
2
+ import numpy as np
3
+
4
+ class Policy:
5
+ def reset(self, obs, tools):
6
+ self.hold = np.asarray(tools.hold_action(), dtype=np.float32)
7
+
8
+ def act(self, obs, tools):
9
+ t = int(obs['t'])
10
+ x, y, z, yaw = obs['low_dim_obs'][21:25]
11
+ a = self.hold.copy()
12
+ a[0:2] = 0
13
+ a[3] = np.clip(-2*yaw, -.4, .4) if abs(yaw) > .025 else 0
14
+ if t < 180:
15
+ a[0] = -.2 if x > -.55 else 0
16
+ elif t < 500:
17
+ a[1] = .25 if y < .05 else 0
18
+ elif t < 800:
19
+ a[0] = .15 if x < -.16 else 0
20
+ elif t < 1500:
21
+ a[0] = .12
22
+ if 500 < t < 1500:
23
+ elbow = 1.2 if t < 950 else max(0., 1.2-(t-950)/300.)
24
+ a[5:12] = [-.5,-.25,0,elbow,0,0,0]
25
+ a[12:19] = [-.5,.25,0,elbow,0,0,0]
26
+ a[19:21] = 1
27
+ if 1500 <= t < 1750:
28
+ a[1] = .12 if y < .02 else 0
29
+ a[5:19] = 0
30
+ if 1750 <= t < 1900:
31
+ a[0] = .12 if x < -.05 else 0
32
+ a[5:19] = 0
33
+ if 1900 <= t < 3200:
34
+ a[2] = .4 if t < 2200 else min(.8,.4+(t-2200)*.001)
35
+ p = .3 if t < 2200 else max(-1.1,.3-(t-2200)*.0025)
36
+ a[5:12] = [p,-.25,0,0,0,-.7,0]
37
+ a[12:19] = [p,.25,0,0,0,-.7,0]
38
+ a[19:21] = 1
39
+ if t >= 3200:
40
+ # A second scoop, followed by a forward press at the top of the door.
41
+ if t < 3550:
42
+ a[2] = .4
43
+ p = .25
44
+ elif t < 4000:
45
+ a[2] = min(.8, .4+(t-3550)*.0012)
46
+ p = max(-1.2, .25-(t-3550)*.0035)
47
+ else:
48
+ a[2] = .74
49
+ p = -1.2
50
+ a[0] = .12
51
+ a[5:12] = [p,-.12,0,.2,0,0,0]
52
+ a[12:19] = [p,.12,0,.2,0,0,0]
53
+ a[19:21] = 1
54
+ return a
policies/dishwasher_close/gpt61terra-s2/episodes.csv ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ seed,success,length,termination,fell
2
+ 620000,0,4650,timeout,0
3
+ 620001,0,4650,timeout,0
4
+ 620002,0,4650,timeout,0
5
+ 620003,0,4650,timeout,0
6
+ 620004,0,4650,timeout,0
7
+ 620005,0,4650,timeout,0
8
+ 620006,0,4650,timeout,0
9
+ 620007,0,4650,timeout,0
10
+ 620008,0,4650,timeout,0
11
+ 620009,0,4650,timeout,0
12
+ 620010,0,4650,timeout,0
13
+ 620011,0,4650,timeout,0
14
+ 620012,0,4650,timeout,0
15
+ 620013,0,4650,timeout,0
16
+ 620014,0,4650,timeout,0
17
+ 620015,0,4650,timeout,0
18
+ 620016,0,4650,timeout,0
19
+ 620017,0,4650,timeout,0
20
+ 620018,0,4650,timeout,0
21
+ 620019,0,4650,timeout,0
22
+ 620020,0,4650,timeout,0
23
+ 620021,0,4650,timeout,0
24
+ 620022,0,4650,timeout,0
25
+ 620023,0,4650,timeout,0
26
+ 620024,0,4650,timeout,0
27
+ 620025,0,4650,timeout,0
28
+ 620026,0,4650,timeout,0
29
+ 620027,0,4650,timeout,0
30
+ 620028,0,4650,timeout,0
31
+ 620029,0,4650,timeout,0
32
+ 620030,0,4650,timeout,0
33
+ 620031,0,4650,timeout,0
34
+ 620032,0,4650,timeout,0
35
+ 620033,0,4650,timeout,0
36
+ 620034,0,4650,timeout,0
37
+ 620035,0,4650,timeout,0
38
+ 620036,0,4650,timeout,0
39
+ 620037,0,4650,timeout,0
40
+ 620038,0,4650,timeout,0
41
+ 620039,0,4650,timeout,0
42
+ 620040,0,4650,timeout,0
43
+ 620041,0,4650,timeout,0
44
+ 620042,0,4650,timeout,0
45
+ 620043,0,4650,timeout,0
46
+ 620044,0,4650,timeout,0
47
+ 620045,0,4650,timeout,0
48
+ 620046,0,4650,timeout,0
49
+ 620047,0,4650,timeout,0
50
+ 620048,0,4650,timeout,0
51
+ 620049,0,4650,timeout,0
52
+ 620050,0,4650,timeout,0
53
+ 620051,0,4650,timeout,0
54
+ 620052,0,4650,timeout,0
55
+ 620053,0,4650,timeout,0
56
+ 620054,0,4650,timeout,0
57
+ 620055,0,4650,timeout,0
58
+ 620056,0,4650,timeout,0
59
+ 620057,0,4650,timeout,0
60
+ 620058,0,4650,timeout,0
61
+ 620059,0,4650,timeout,0
62
+ 620060,0,4650,timeout,0
63
+ 620061,0,4650,timeout,0
64
+ 620062,0,4650,timeout,0
65
+ 620063,0,4650,timeout,0
66
+ 620064,0,4650,timeout,0
67
+ 620065,0,4650,timeout,0
68
+ 620066,0,4650,timeout,0
69
+ 620067,0,4650,timeout,0
70
+ 620068,0,4650,timeout,0
71
+ 620069,0,4650,timeout,0
72
+ 620070,0,4650,timeout,0
73
+ 620071,0,4650,timeout,0
74
+ 620072,0,4650,timeout,0
75
+ 620073,0,4650,timeout,0
76
+ 620074,0,4650,timeout,0
77
+ 620075,0,4650,timeout,0
78
+ 620076,0,4650,timeout,0
79
+ 620077,0,4650,timeout,0
80
+ 620078,0,4650,timeout,0
81
+ 620079,0,4650,timeout,0
82
+ 620080,0,4650,timeout,0
83
+ 620081,0,4650,timeout,0
84
+ 620082,0,4650,timeout,0
85
+ 620083,0,4650,timeout,0
86
+ 620084,0,4650,timeout,0
87
+ 620085,0,4650,timeout,0
88
+ 620086,0,4650,timeout,0
89
+ 620087,0,4650,timeout,0
90
+ 620088,0,4650,timeout,0
91
+ 620089,0,4650,timeout,0
92
+ 620090,0,4650,timeout,0
93
+ 620091,0,4650,timeout,0
94
+ 620092,0,4650,timeout,0
95
+ 620093,0,4650,timeout,0
96
+ 620094,0,4650,timeout,0
97
+ 620095,0,4650,timeout,0
98
+ 620096,0,4650,timeout,0
99
+ 620097,0,4650,timeout,0
100
+ 620098,0,4650,timeout,0
101
+ 620099,0,4650,timeout,0
policies/dishwasher_close/gpt61terra-s2/policy.py ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Deterministic, proprioception-guided dishwasher manipulation."""
2
+ import numpy as np
3
+
4
+ class Policy:
5
+ def reset(self, obs, tools):
6
+ self.initial = np.asarray(tools.hold_action(), dtype=np.float32)
7
+ self.phase = 0
8
+ self.start = 0
9
+
10
+ def act(self, obs, tools):
11
+ t = int(obs['t'])
12
+ x, y, _, yaw = obs['low_dim_obs'][21:25]
13
+ a = self.initial.copy()
14
+ a[2] = .74
15
+ p = self.phase
16
+ elapsed = t - self.start
17
+ def change():
18
+ self.phase += 1
19
+ self.start = t
20
+ if p == 0:
21
+ a[3] = np.clip(2 * (1.57-yaw), -.5, .5)
22
+ if yaw > 1.51 or elapsed > 210: change()
23
+ elif p == 1:
24
+ a[3] = np.clip(2*(1.57-yaw), -.5, .5)
25
+ a[0] = .12 if y < -.69 else 0
26
+ if y >= -.69 or elapsed > 140: change()
27
+ elif p == 2:
28
+ a[3] = np.clip(2*(1.57-yaw), -.5, .5)
29
+ a[5] = a[12] = -.8
30
+ a[6] = -.25; a[13] = .25
31
+ a[8] = a[15] = .5
32
+ if elapsed > 80: a[1] = -.16 if x < .45 else 0
33
+ if x > .45 or elapsed > 480: change()
34
+ elif p == 3:
35
+ a[3] = np.clip(2*(1.57-yaw), -.5, .5)
36
+ a[1] = .22 if x > -.7 else 0
37
+ if x <= -.7 or elapsed > 380: change()
38
+ elif p == 4:
39
+ a[3] = np.clip(2*(1.57-yaw), -.5, .5)
40
+ a[0] = .2 if y < .06 else 0
41
+ if y >= .06 or elapsed > 300: change()
42
+ elif p == 5:
43
+ a[3] = np.clip(-2*yaw, -.5, .5)
44
+ if abs(yaw) < .04 or elapsed > 210: change()
45
+ elif p == 6:
46
+ a[3] = np.clip(-2*yaw, -.4, .4)
47
+ a[0] = .16 if x < -.25 else 0
48
+ a[1] = np.clip((.06-y)*1.5, -.2, .2)
49
+ if abs(a[1]) < .06: a[1] = 0
50
+ if x >= -.25 or elapsed > 260: change()
51
+ elif p == 7:
52
+ a[2] = .45
53
+ a[5] = a[12] = 0 if elapsed < 130 else (-.5 if elapsed < 350 else -1.1)
54
+ a[6] = -.3; a[13] = .3
55
+ a[8] = a[15] = 0
56
+ a[19] = a[20] = 1
57
+ a[4] = .3 if elapsed > 500 else 0
58
+ if elapsed > 800: change()
59
+ elif p == 8:
60
+ a[2] = .74
61
+ if elapsed > 100: a[0] = -.14 if x > -.4 else 0
62
+ if elapsed > 260: change()
63
+ elif p == 9:
64
+ a[2] = .45 if elapsed < 500 else .74
65
+ a[5] = a[12] = 0 if elapsed < 130 else (-.6 if elapsed < 430 else -1.4)
66
+ a[6] = -.3; a[13] = .3
67
+ a[8] = a[15] = 0
68
+ a[19] = a[20] = 0 if elapsed < 300 else 1
69
+ if elapsed > 850: change()
70
+ else:
71
+ a[5] = a[12] = -1.4
72
+ a[6] = -.3; a[13] = .3
73
+ a[19] = a[20] = 1
74
+ return a
policies/dishwasher_close/gpt61terra-s3/episodes.csv ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ seed,success,length,termination,fell
2
+ 620000,0,4650,timeout,0
3
+ 620001,0,4650,timeout,0
4
+ 620002,0,4650,timeout,0
5
+ 620003,0,4650,timeout,0
6
+ 620004,0,4650,timeout,0
7
+ 620005,0,4650,timeout,0
8
+ 620006,0,4650,timeout,0
9
+ 620007,0,4650,timeout,0
10
+ 620008,0,4650,timeout,0
11
+ 620009,0,4650,timeout,0
12
+ 620010,0,4650,timeout,0
13
+ 620011,0,4650,timeout,0
14
+ 620012,0,4650,timeout,0
15
+ 620013,0,4650,timeout,0
16
+ 620014,0,4650,timeout,0
17
+ 620015,0,4650,timeout,0
18
+ 620016,0,4650,timeout,0
19
+ 620017,0,4650,timeout,0
20
+ 620018,0,4650,timeout,0
21
+ 620019,0,4650,timeout,0
22
+ 620020,0,4650,timeout,0
23
+ 620021,0,4650,timeout,0
24
+ 620022,0,4650,timeout,0
25
+ 620023,0,4650,timeout,0
26
+ 620024,0,4650,timeout,0
27
+ 620025,0,4650,timeout,0
28
+ 620026,0,4650,timeout,0
29
+ 620027,0,4650,timeout,0
30
+ 620028,0,4650,timeout,0
31
+ 620029,0,4650,timeout,0
32
+ 620030,0,4650,timeout,0
33
+ 620031,0,4650,timeout,0
34
+ 620032,0,4650,timeout,0
35
+ 620033,0,4650,timeout,0
36
+ 620034,0,4650,timeout,0
37
+ 620035,0,4650,timeout,0
38
+ 620036,0,4650,timeout,0
39
+ 620037,0,4650,timeout,0
40
+ 620038,0,4650,timeout,0
41
+ 620039,0,4650,timeout,0
42
+ 620040,0,4650,timeout,0
43
+ 620041,0,4650,timeout,0
44
+ 620042,0,4650,timeout,0
45
+ 620043,0,4650,timeout,0
46
+ 620044,0,4650,timeout,0
47
+ 620045,0,4650,timeout,0
48
+ 620046,0,4650,timeout,0
49
+ 620047,0,4650,timeout,0
50
+ 620048,0,4650,timeout,0
51
+ 620049,0,4650,timeout,0
52
+ 620050,0,4650,timeout,0
53
+ 620051,0,4650,timeout,0
54
+ 620052,0,4650,timeout,0
55
+ 620053,0,4650,timeout,0
56
+ 620054,0,4650,timeout,0
57
+ 620055,0,4650,timeout,0
58
+ 620056,0,4650,timeout,0
59
+ 620057,0,4650,timeout,0
60
+ 620058,0,4650,timeout,0
61
+ 620059,0,4650,timeout,0
62
+ 620060,0,4650,timeout,0
63
+ 620061,0,4650,timeout,0
64
+ 620062,0,4650,timeout,0
65
+ 620063,0,4650,timeout,0
66
+ 620064,0,4650,timeout,0
67
+ 620065,0,4650,timeout,0
68
+ 620066,0,4650,timeout,0
69
+ 620067,0,4650,timeout,0
70
+ 620068,0,4650,timeout,0
71
+ 620069,0,4650,timeout,0
72
+ 620070,0,4650,timeout,0
73
+ 620071,0,4650,timeout,0
74
+ 620072,0,4650,timeout,0
75
+ 620073,0,4650,timeout,0
76
+ 620074,0,4650,timeout,0
77
+ 620075,0,4650,timeout,0
78
+ 620076,0,4650,timeout,0
79
+ 620077,0,4650,timeout,0
80
+ 620078,0,4650,timeout,0
81
+ 620079,0,4650,timeout,0
82
+ 620080,0,4650,timeout,0
83
+ 620081,0,4650,timeout,0
84
+ 620082,0,4650,timeout,0
85
+ 620083,0,4650,timeout,0
86
+ 620084,0,4650,timeout,0
87
+ 620085,0,4650,timeout,0
88
+ 620086,0,4650,timeout,0
89
+ 620087,0,4650,timeout,0
90
+ 620088,0,4650,timeout,0
91
+ 620089,0,4650,timeout,0
92
+ 620090,0,4650,timeout,0
93
+ 620091,0,4650,timeout,0
94
+ 620092,0,4650,timeout,0
95
+ 620093,0,4650,timeout,0
96
+ 620094,0,4650,timeout,0
97
+ 620095,0,4650,timeout,0
98
+ 620096,0,4650,timeout,0
99
+ 620097,0,4650,timeout,0
100
+ 620098,0,4650,timeout,0
101
+ 620099,0,4650,timeout,0
policies/dishwasher_close/gpt61terra-s3/policy.py ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Deterministic upper-body and base control for closing the dishwasher."""
2
+ import numpy as np
3
+
4
+
5
+ class Policy:
6
+ def reset(self, obs, tools):
7
+ self.hold = np.asarray(tools.hold_action(), dtype=np.float32)
8
+
9
+ def act(self, obs, tools):
10
+ t = int(obs['t'])
11
+ x, y, _, yaw = obs['low_dim_obs'][21:25]
12
+ a = self.hold.copy()
13
+ a[19:21] = 0
14
+ error = 1.57 - float(yaw)
15
+ a[3] = np.clip(2 * error, -.5, .5) if abs(error) > .05 else 0
16
+
17
+ # Turn toward the appliance and align with the middle of its opening.
18
+ if 190 < t < 450 and x < .40:
19
+ a[1] = -.2
20
+ if 450 <= t < 650 and y < -.68:
21
+ a[0] = .18
22
+
23
+ # Extend the right arm against the front of the racks in repeated strokes.
24
+ if 650 <= t < 2350:
25
+ a[2], a[4] = .55, 0
26
+ phase = (t - 650) % 550
27
+ elbow = 1.4 if phase < 150 else max(0., 1.4 - (phase - 150) * .006)
28
+ shoulder = -1.35
29
+ a[5:12] = [0, 0, 0, 0, 0, 0, 0]
30
+ a[12:19] = [shoulder, 0, 0, elbow, 0, 0, 0]
31
+ a[19:21] = 1
32
+ a[0] = 0
33
+ a[1] = np.clip((x - .42) * 1.5, -.2, .2)
34
+
35
+ # Back away enough to lower the hands in front of the open door.
36
+ elif 2350 <= t < 2600:
37
+ a[0] = -.16 if y > -.9 else 0
38
+
39
+ # Reach low, grip, and lift while rising to standing height.
40
+ elif t >= 2600:
41
+ a[2] = .45 if t < 3600 else min(.8, .45 + (t - 3600) * .0007)
42
+ a[4] = .25
43
+ shoulder = -.7 if t < 3100 else max(-1.8, -.7 - (t - 3100) * .002)
44
+ a[5:12] = [shoulder, 0, 0, .6, 1.4, 0, 0]
45
+ a[12:19] = [shoulder, 0, 0, .6, -1.4, 0, 0]
46
+ a[19:21] = 1
47
+ return a
policies/dishwasher_close/gpt6sol-s1/episodes.csv ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ seed,success,length,termination,fell
2
+ 620000,0,4650,timeout,0
3
+ 620001,0,4650,timeout,0
4
+ 620002,0,4650,timeout,0
5
+ 620003,0,4650,timeout,0
6
+ 620004,0,4650,timeout,0
7
+ 620005,0,4650,timeout,0
8
+ 620006,0,4650,timeout,0
9
+ 620007,0,4650,timeout,0
10
+ 620008,0,4650,timeout,0
11
+ 620009,0,4650,timeout,0
12
+ 620010,0,4650,timeout,0
13
+ 620011,0,4650,timeout,0
14
+ 620012,0,4650,timeout,0
15
+ 620013,0,4650,timeout,0
16
+ 620014,0,4650,timeout,0
17
+ 620015,0,4650,timeout,0
18
+ 620016,0,4650,timeout,0
19
+ 620017,0,4650,timeout,0
20
+ 620018,0,4650,timeout,0
21
+ 620019,0,4650,timeout,0
22
+ 620020,0,4650,timeout,0
23
+ 620021,0,4650,timeout,0
24
+ 620022,0,4650,timeout,0
25
+ 620023,0,4650,timeout,0
26
+ 620024,0,4650,timeout,0
27
+ 620025,0,4650,timeout,0
28
+ 620026,0,4650,timeout,0
29
+ 620027,0,4650,timeout,0
30
+ 620028,0,4650,timeout,0
31
+ 620029,0,4650,timeout,0
32
+ 620030,0,4650,timeout,0
33
+ 620031,0,4650,timeout,0
34
+ 620032,0,4650,timeout,0
35
+ 620033,0,4650,timeout,0
36
+ 620034,0,4650,timeout,0
37
+ 620035,0,4650,timeout,0
38
+ 620036,0,4650,timeout,0
39
+ 620037,0,4650,timeout,0
40
+ 620038,0,4650,timeout,0
41
+ 620039,0,4650,timeout,0
42
+ 620040,0,4650,timeout,0
43
+ 620041,0,4650,timeout,0
44
+ 620042,0,4650,timeout,0
45
+ 620043,0,4650,timeout,0
46
+ 620044,0,4650,timeout,0
47
+ 620045,0,4650,timeout,0
48
+ 620046,0,4650,timeout,0
49
+ 620047,0,4650,timeout,0
50
+ 620048,0,4650,timeout,0
51
+ 620049,0,4650,timeout,0
52
+ 620050,0,4650,timeout,0
53
+ 620051,0,4650,timeout,0
54
+ 620052,0,4650,timeout,0
55
+ 620053,0,4650,timeout,0
56
+ 620054,0,4650,timeout,0
57
+ 620055,0,4650,timeout,0
58
+ 620056,0,4650,timeout,0
59
+ 620057,0,4650,timeout,0
60
+ 620058,0,4650,timeout,0
61
+ 620059,0,4650,timeout,0
62
+ 620060,0,4650,timeout,0
63
+ 620061,0,4650,timeout,0
64
+ 620062,0,4650,timeout,0
65
+ 620063,0,4650,timeout,0
66
+ 620064,0,4650,timeout,0
67
+ 620065,0,4650,timeout,0
68
+ 620066,0,4650,timeout,0
69
+ 620067,0,4650,timeout,0
70
+ 620068,0,4650,timeout,0
71
+ 620069,0,4650,timeout,0
72
+ 620070,0,4650,timeout,0
73
+ 620071,0,4650,timeout,0
74
+ 620072,0,4650,timeout,0
75
+ 620073,0,4650,timeout,0
76
+ 620074,0,4650,timeout,0
77
+ 620075,0,4650,timeout,0
78
+ 620076,0,4650,timeout,0
79
+ 620077,0,4650,timeout,0
80
+ 620078,0,4650,timeout,0
81
+ 620079,0,4650,timeout,0
82
+ 620080,0,4650,timeout,0
83
+ 620081,0,4650,timeout,0
84
+ 620082,0,4650,timeout,0
85
+ 620083,0,4650,timeout,0
86
+ 620084,0,4650,timeout,0
87
+ 620085,0,4650,timeout,0
88
+ 620086,0,4650,timeout,0
89
+ 620087,0,4650,timeout,0
90
+ 620088,0,4650,timeout,0
91
+ 620089,0,4650,timeout,0
92
+ 620090,0,4650,timeout,0
93
+ 620091,0,4650,timeout,0
94
+ 620092,0,4650,timeout,0
95
+ 620093,0,4650,timeout,0
96
+ 620094,0,4650,timeout,0
97
+ 620095,0,4650,timeout,0
98
+ 620096,0,4650,timeout,0
99
+ 620097,0,4650,timeout,0
100
+ 620098,0,4650,timeout,0
101
+ 620099,0,4650,timeout,0
policies/dishwasher_close/gpt6sol-s1/policy.py ADDED
@@ -0,0 +1,99 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Deterministic position and contact controller for the dishwasher task."""
2
+
3
+ import math
4
+ import numpy as np
5
+
6
+
7
+ class Policy:
8
+ def reset(self, obs, tools):
9
+ self.a = np.asarray(tools.hold_action(), dtype=np.float32)
10
+
11
+ def _go(self, x, y, yaw, px, py, speed=0.18):
12
+ dx, dy = x - px, y - py
13
+ wx = float(np.clip(1.5 * dx, -speed, speed))
14
+ wy = float(np.clip(1.5 * dy, -speed, speed))
15
+ c, s = math.cos(yaw), math.sin(yaw)
16
+ vx, vy = c * wx + s * wy, -s * wx + c * wy
17
+ if math.hypot(vx, vy) < 0.07:
18
+ vx = vy = 0.0
19
+ self.a[0], self.a[1] = vx, vy
20
+
21
+ def act(self, obs, tools):
22
+ t = int(obs["t"])
23
+ px, py, _, yaw = map(float, obs["low_dim_obs"][21:25])
24
+ a = self.a
25
+ a[0] = a[1] = a[3] = 0.0
26
+ if t < 125:
27
+ a[0] = 0.2 if px < 0.20 else 0.0
28
+ elif t < 230:
29
+ a[3] = 0.8 if yaw < 1.57 else 0.0
30
+ elif t < 320:
31
+ a[5:9] = (0.3, 0.0, -0.15, 0.0)
32
+ a[12:16] = (0.3, 0.0, 0.15, 0.0)
33
+ a[19:21] = 1.0
34
+ elif t < 550:
35
+ a[0] = 0.8 if t >= 430 else 0.2
36
+ a[1] = np.clip(1.5 * (px - 0.30), -0.18, 0.18)
37
+ a[3] = np.clip(2.0 * (1.57 - yaw), -0.3, 0.3)
38
+ if t >= 430:
39
+ a[5] = a[12] = 0.3 - 0.7 * min(1.0, (t - 430) / 100.0)
40
+ elif t < 610:
41
+ a[5:9] = 0.0
42
+ a[12:16] = 0.0
43
+ a[19:21] = 0.6
44
+ elif t < 820:
45
+ self._go(0.20, -0.756, yaw, px, py)
46
+ a[3] = np.clip(2.0 * (1.60 - yaw), -0.25, 0.25)
47
+ elif t < 1000:
48
+ a[1] = np.clip(2.0 * (px - 0.35), -0.18, 0.18)
49
+ a[3] = np.clip(3.0 * (1.57 - yaw), -0.3, 0.3)
50
+ elif t < 1080:
51
+ a[5:9] = (-0.4, 0.0, -0.15, 0.0)
52
+ a[12:16] = (-0.4, 0.0, 0.15, 0.0)
53
+ a[19:21] = 1.0
54
+ elif t < 1250:
55
+ a[0] = 0.2 if t < 1130 else 0.8
56
+ a[1] = np.clip(2.0 * (px - 0.35), -0.18, 0.18)
57
+ a[3] = np.clip(3.0 * (1.57 - yaw), -0.4, 0.4)
58
+ if t >= 1130:
59
+ a[5] = a[12] = -0.4 - 0.8 * min(1.0, (t - 1130) / 100.0)
60
+ elif t < 1300:
61
+ a[5:9] = 0.0
62
+ a[12:16] = 0.0
63
+ a[19:21] = 0.6
64
+ elif t < 1500:
65
+ self._go(0.20, -0.756, yaw, px, py)
66
+ a[3] = np.clip(2.0 * (1.60 - yaw), -0.25, 0.25)
67
+ elif t < 1740:
68
+ a[0] = 0.2 if py < -0.53 else 0.0
69
+ a[1] = np.clip(2.0 * (px - 0.23), -0.18, 0.18)
70
+ a[3] = np.clip(4.0 * (1.57 - yaw), -0.5, 0.5)
71
+ elif t < 1890:
72
+ a[2] = 0.4
73
+ elif t < 2050:
74
+ a[2] = 0.4
75
+ a[5:9] = (0.3, 0.0, -0.25, 0.8)
76
+ a[12:16] = (0.3, 0.0, 0.15, 0.8)
77
+ a[19:21] = 0.0 if t < 1980 else 1.0
78
+ elif t < 2300:
79
+ f = min(1.0, (t - 2050) / 250.0)
80
+ a[2] = 0.4 + 0.45 * f
81
+ a[0] = 0.15
82
+ a[3] = np.clip(3.0 * (1.57 - yaw), -0.4, 0.4)
83
+ a[5] = a[12] = 0.3 - 0.8 * f
84
+ a[8] = a[15] = 0.8 * (1.0 - f)
85
+ elif t < 2550:
86
+ a[2] = 0.74
87
+ a[0] = 0.2
88
+ a[3] = np.clip(3.0 * (1.57 - yaw), -0.4, 0.4)
89
+ a[5] = a[12] = -0.5
90
+ a[8] = a[15] = 0.0
91
+ else:
92
+ a[2] = 0.74
93
+ a[4] = 0.0
94
+ a[0] = 0.25 if py < -0.48 else 0.0
95
+ a[3] = np.clip(3.0 * (1.57 - yaw), -0.4, 0.4)
96
+ a[5:9] = (-0.45, 0.0, -0.15, 0.0)
97
+ a[12:16] = (-0.45, 0.0, 0.15, 0.0)
98
+ a[19:21] = 0.6
99
+ return a.copy()
policies/dishwasher_close/gpt6sol-s2/episodes.csv ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ seed,success,length,termination,fell
2
+ 620000,0,4650,timeout,0
3
+ 620001,0,4650,timeout,0
4
+ 620002,0,4650,timeout,0
5
+ 620003,0,4650,timeout,0
6
+ 620004,0,4650,timeout,0
7
+ 620005,0,4650,timeout,0
8
+ 620006,0,4650,timeout,0
9
+ 620007,0,4650,timeout,0
10
+ 620008,0,4650,timeout,0
11
+ 620009,0,4650,timeout,0
12
+ 620010,0,4650,timeout,0
13
+ 620011,0,4650,timeout,0
14
+ 620012,0,4650,timeout,0
15
+ 620013,0,4650,timeout,0
16
+ 620014,0,4650,timeout,0
17
+ 620015,0,4650,timeout,0
18
+ 620016,0,4650,timeout,0
19
+ 620017,0,4650,timeout,0
20
+ 620018,0,4650,timeout,0
21
+ 620019,0,4650,timeout,0
22
+ 620020,0,4650,timeout,0
23
+ 620021,0,4650,timeout,0
24
+ 620022,0,4650,timeout,0
25
+ 620023,0,4650,timeout,0
26
+ 620024,0,4650,timeout,0
27
+ 620025,0,4650,timeout,0
28
+ 620026,0,4650,timeout,0
29
+ 620027,0,4650,timeout,0
30
+ 620028,0,4650,timeout,0
31
+ 620029,0,4650,timeout,0
32
+ 620030,0,4650,timeout,0
33
+ 620031,0,4650,timeout,0
34
+ 620032,0,4650,timeout,0
35
+ 620033,0,4650,timeout,0
36
+ 620034,0,4650,timeout,0
37
+ 620035,0,4650,timeout,0
38
+ 620036,0,4650,timeout,0
39
+ 620037,0,4650,timeout,0
40
+ 620038,0,4650,timeout,0
41
+ 620039,0,4650,timeout,0
42
+ 620040,0,4650,timeout,0
43
+ 620041,0,4650,timeout,0
44
+ 620042,0,4650,timeout,0
45
+ 620043,0,4650,timeout,0
46
+ 620044,0,4650,timeout,0
47
+ 620045,0,4650,timeout,0
48
+ 620046,0,4650,timeout,0
49
+ 620047,0,4650,timeout,0
50
+ 620048,0,4650,timeout,0
51
+ 620049,0,4650,timeout,0
52
+ 620050,0,4650,timeout,0
53
+ 620051,0,4650,timeout,0
54
+ 620052,0,4650,timeout,0
55
+ 620053,0,4650,timeout,0
56
+ 620054,0,4650,timeout,0
57
+ 620055,0,4650,timeout,0
58
+ 620056,0,4650,timeout,0
59
+ 620057,0,4650,timeout,0
60
+ 620058,0,4650,timeout,0
61
+ 620059,0,4650,timeout,0
62
+ 620060,0,4650,timeout,0
63
+ 620061,0,4650,timeout,0
64
+ 620062,0,4650,timeout,0
65
+ 620063,0,4650,timeout,0
66
+ 620064,0,4650,timeout,0
67
+ 620065,0,4650,timeout,0
68
+ 620066,0,4650,timeout,0
69
+ 620067,0,4650,timeout,0
70
+ 620068,0,4650,timeout,0
71
+ 620069,0,4650,timeout,0
72
+ 620070,0,4650,timeout,0
73
+ 620071,0,4650,timeout,0
74
+ 620072,0,4650,timeout,0
75
+ 620073,0,4650,timeout,0
76
+ 620074,0,4650,timeout,0
77
+ 620075,0,4650,timeout,0
78
+ 620076,0,4650,timeout,0
79
+ 620077,0,4650,timeout,0
80
+ 620078,0,4650,timeout,0
81
+ 620079,0,4650,timeout,0
82
+ 620080,0,4650,timeout,0
83
+ 620081,0,4650,timeout,0
84
+ 620082,0,4650,timeout,0
85
+ 620083,0,4650,timeout,0
86
+ 620084,0,4650,timeout,0
87
+ 620085,0,4650,timeout,0
88
+ 620086,0,4650,timeout,0
89
+ 620087,0,4650,timeout,0
90
+ 620088,0,4650,timeout,0
91
+ 620089,0,4650,timeout,0
92
+ 620090,0,4650,timeout,0
93
+ 620091,0,4650,timeout,0
94
+ 620092,0,4650,timeout,0
95
+ 620093,0,4650,timeout,0
96
+ 620094,0,4650,timeout,0
97
+ 620095,0,4650,timeout,0
98
+ 620096,0,4650,timeout,0
99
+ 620097,0,4650,timeout,0
100
+ 620098,0,4650,timeout,0
101
+ 620099,0,4650,timeout,0
policies/dishwasher_close/gpt6sol-s2/policy.py ADDED
@@ -0,0 +1,139 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Deterministic hand-written dishwasher manipulation policy."""
2
+
3
+ import math
4
+ import numpy as np
5
+
6
+
7
+ class Policy:
8
+ def reset(self, obs, tools):
9
+ pass
10
+
11
+ @staticmethod
12
+ def arm(a, left=None, right=None):
13
+ if left is not None:
14
+ a[5:12] = left
15
+ if right is not None:
16
+ a[12:19] = right
17
+
18
+ @staticmethod
19
+ def move(a, q, xgoal, ygoal, yawgoal, speed=0.24):
20
+ x, y, yaw = float(q[21]), float(q[22]), float(q[24])
21
+ wx = float(np.clip(1.7 * (xgoal - x), -speed, speed))
22
+ wy = float(np.clip(1.7 * (ygoal - y), -speed, speed))
23
+ if abs(xgoal - x) < 0.025:
24
+ wx = 0.0
25
+ if abs(ygoal - y) < 0.025:
26
+ wy = 0.0
27
+ vx = math.cos(yaw) * wx + math.sin(yaw) * wy
28
+ vy = -math.sin(yaw) * wx + math.cos(yaw) * wy
29
+ if 0 < math.hypot(vx, vy) < 0.06:
30
+ vx, vy = 0.0, 0.0
31
+ a[0], a[1] = vx, vy
32
+ e = math.atan2(math.sin(yawgoal - yaw), math.cos(yawgoal - yaw))
33
+ a[3] = float(np.clip(2.3 * e, -0.55, 0.55)) if abs(e) > 0.025 else 0.0
34
+
35
+ @staticmethod
36
+ def press(a, q, xgoal, yawgoal, wy):
37
+ x, yaw = float(q[21]), float(q[24])
38
+ wx = float(np.clip(2.0 * (xgoal - x), -0.18, 0.18))
39
+ a[0] = math.cos(yaw) * wx + math.sin(yaw) * wy
40
+ a[1] = -math.sin(yaw) * wx + math.cos(yaw) * wy
41
+ e = math.atan2(math.sin(yawgoal - yaw), math.cos(yawgoal - yaw))
42
+ a[3] = float(np.clip(2.3 * e, -0.5, 0.5))
43
+
44
+ def act(self, obs, tools):
45
+ t = int(obs["t"])
46
+ q = obs["low_dim_obs"]
47
+ a = np.zeros(21, dtype=np.float32)
48
+ a[2] = 0.74
49
+ a[19:21] = 0.6
50
+
51
+ if t < 110:
52
+ self.move(a, q, 0.26, -0.8, 0.0, 0.2)
53
+ elif t < 245:
54
+ self.move(a, q, 0.26, -0.8, 1.27, 0.12)
55
+ elif t < 390:
56
+ self.move(a, q, 0.30, -0.59, 1.27, 0.18)
57
+ self.arm(a, right=[-0.2, 0, 0.3, -0.2, 0, 0.5, 0])
58
+ a[20] = 0
59
+ elif t < 440:
60
+ self.press(a, q, 0.30, 1.27, 0.1)
61
+ self.arm(a, right=[-0.2, 0, 0.3, -0.2, 0, 0.5, 0])
62
+ a[20] = 1
63
+ elif t < 700:
64
+ f = min(1.0, (t - 440) / 170)
65
+ self.press(a, q, 0.30, 1.27, 0.28)
66
+ a[4] = 0.15 * f
67
+ self.arm(a, right=[-0.2, 0, 0.3, -0.2, 0, 0.5, 0])
68
+ a[20] = 1
69
+ elif t < 800:
70
+ self.move(a, q, 0.30, -0.77, 1.27, 0.18)
71
+ a[19:21] = 0
72
+ elif t < 940:
73
+ self.move(a, q, 0.30, -0.59, 1.27, 0.15)
74
+ a[2] = 0.68
75
+ self.arm(a, right=[-0.5, 0, 0, 0.25, 0, 0.5, 0])
76
+ a[20] = 0
77
+ elif t < 990:
78
+ self.press(a, q, 0.30, 1.27, 0.1)
79
+ a[2] = 0.68
80
+ self.arm(a, right=[-0.5, 0, 0, 0.25, 0, 0.5, 0])
81
+ a[20] = 1
82
+ elif t < 1260:
83
+ f = min(1.0, (t - 990) / 160)
84
+ self.press(a, q, 0.30, 1.27, 0.28)
85
+ a[2], a[4] = 0.68, 0.20*f
86
+ self.arm(a, right=[-0.5, 0, 0, 0.25 - 0.5*f, 0, 0.5, 0])
87
+ a[20] = 1
88
+ elif t < 1390:
89
+ self.move(a, q, 0.43, -0.80, 1.57, 0.19)
90
+ a[19:21] = 0
91
+ elif t < 1550:
92
+ self.press(a, q, 0.43, 1.57, 0.24)
93
+ self.arm(a, [-0.7, 0, -0.2, 1, 0, 0.5, 0], [-0.7, 0, 0.2, 1, 0, 0.5, 0])
94
+ a[19:21] = 1 if t >= 1500 else 0
95
+ elif t < 1790:
96
+ f = min(1.0, (t - 1550) / 160)
97
+ self.press(a, q, 0.43, 1.57, 0.28)
98
+ a[4] = 0.2*f
99
+ self.arm(a, [-0.7, 0, -0.2, 1-1.4*f, 0, 0.5, 0], [-0.7, 0, 0.2, 1-1.4*f, 0, 0.5, 0])
100
+ a[19:21] = 1
101
+ elif t < 1950:
102
+ self.move(a, q, 0.43, -0.62, 1.57, 0.2)
103
+ a[19:21] = 0
104
+ elif t < 2070:
105
+ a[2], a[4] = 0.42, 0.6
106
+ self.arm(a, [0, 0, -0.15, 0, 0, 1, 0], [0, 0, 0.15, 0, 0, 1, 0])
107
+ a[19:21] = 0 if t < 2030 else 1
108
+ elif t < 2410:
109
+ f = min(1.0, (t - 2070) / 230)
110
+ a[2], a[4] = 0.42 + 0.32*f, 0.6*(1-f)
111
+ self.arm(a, [-1.2*f, 0, -0.15, 0, 0, 1, 0], [-1.2*f, 0, 0.15, 0, 0, 1, 0])
112
+ a[19:21] = 1
113
+ elif t < 2670:
114
+ self.press(a, q, 0.43, 1.57, 0.22)
115
+ self.arm(a, [-1.2, 0, -0.15, 0, 0, 0.5, 0], [-1.2, 0, 0.15, 0, 0, 0.5, 0])
116
+ a[19:21] = 1
117
+ elif t < 2890:
118
+ self.move(a, q, 0.25, -0.82, 1.32, 0.18)
119
+ a[19:21] = 0
120
+ elif t < 3170:
121
+ f = min(1.0, (t - 2890) / 180)
122
+ self.press(a, q, 0.25, 1.32, 0.3)
123
+ a[2] = 0.68
124
+ self.arm(a, [-0.65, 0, -0.35, 0.8-1.1*f, 0, 0.5, 0], [-0.65, 0, 0.35, 0.8-1.1*f, 0, 0.5, 0])
125
+ a[19:21] = 1
126
+ elif t < 3380:
127
+ self.move(a, q, 0.40, -0.62, 1.57, 0.17)
128
+ a[19:21] = 0
129
+ elif t < 3800:
130
+ f = min(1.0, max(0.0, (t - 3460) / 250))
131
+ a[2], a[4] = 0.42 + 0.32*f, 0.6*(1-f)
132
+ self.arm(a, [-1.2*f, 0, -0.2, 0, 0, 1, 0], [-1.2*f, 0, 0.2, 0, 0, 1, 0])
133
+ a[19:21] = 0 if t < 3460 else 1
134
+ else:
135
+ self.press(a, q, 0.43, 1.57, 0.8)
136
+ a[4] = 0.5
137
+ self.arm(a, [-0.2, 0, -0.7, -0.7, 0, 0.5, 0], [-0.2, 0, 0.7, -0.7, 0, 0.5, 0])
138
+ a[19:21] = 1
139
+ return a
policies/dishwasher_close/gpt6sol-s3/episodes.csv ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ seed,success,length,termination,fell
2
+ 620000,0,4650,timeout,0
3
+ 620001,0,4650,timeout,0
4
+ 620002,0,4650,timeout,0
5
+ 620003,0,4650,timeout,0
6
+ 620004,0,4650,timeout,0
7
+ 620005,0,4650,timeout,0
8
+ 620006,0,4650,timeout,0
9
+ 620007,0,4650,timeout,0
10
+ 620008,0,4650,timeout,0
11
+ 620009,0,4650,timeout,0
12
+ 620010,0,4650,timeout,0
13
+ 620011,0,4650,timeout,0
14
+ 620012,0,4650,timeout,0
15
+ 620013,0,4650,timeout,0
16
+ 620014,0,4650,timeout,0
17
+ 620015,0,4650,timeout,0
18
+ 620016,0,4650,timeout,0
19
+ 620017,0,4650,timeout,0
20
+ 620018,0,4650,timeout,0
21
+ 620019,0,4650,timeout,0
22
+ 620020,0,4650,timeout,0
23
+ 620021,0,4650,timeout,0
24
+ 620022,0,4650,timeout,0
25
+ 620023,0,4650,timeout,0
26
+ 620024,0,4650,timeout,0
27
+ 620025,0,4650,timeout,0
28
+ 620026,0,4650,timeout,0
29
+ 620027,0,4650,timeout,0
30
+ 620028,0,4650,timeout,0
31
+ 620029,0,4650,timeout,0
32
+ 620030,0,4650,timeout,0
33
+ 620031,0,4650,timeout,0
34
+ 620032,0,4650,timeout,0
35
+ 620033,0,4650,timeout,0
36
+ 620034,0,4650,timeout,0
37
+ 620035,0,4650,timeout,0
38
+ 620036,0,4650,timeout,0
39
+ 620037,0,4650,timeout,0
40
+ 620038,0,4650,timeout,0
41
+ 620039,0,4650,timeout,0
42
+ 620040,0,4650,timeout,0
43
+ 620041,0,4650,timeout,0
44
+ 620042,0,4650,timeout,0
45
+ 620043,0,4650,timeout,0
46
+ 620044,0,4650,timeout,0
47
+ 620045,0,4650,timeout,0
48
+ 620046,0,4650,timeout,0
49
+ 620047,0,4650,timeout,0
50
+ 620048,0,4650,timeout,0
51
+ 620049,0,4650,timeout,0
52
+ 620050,0,4650,timeout,0
53
+ 620051,0,4650,timeout,0
54
+ 620052,0,4650,timeout,0
55
+ 620053,0,4650,timeout,0
56
+ 620054,0,4650,timeout,0
57
+ 620055,0,4650,timeout,0
58
+ 620056,0,4650,timeout,0
59
+ 620057,0,4650,timeout,0
60
+ 620058,0,4650,timeout,0
61
+ 620059,0,4650,timeout,0
62
+ 620060,0,4650,timeout,0
63
+ 620061,0,4650,timeout,0
64
+ 620062,0,4650,timeout,0
65
+ 620063,0,4650,timeout,0
66
+ 620064,0,4650,timeout,0
67
+ 620065,0,4650,timeout,0
68
+ 620066,0,4650,timeout,0
69
+ 620067,0,4650,timeout,0
70
+ 620068,0,4650,timeout,0
71
+ 620069,0,4650,timeout,0
72
+ 620070,0,4650,timeout,0
73
+ 620071,0,4650,timeout,0
74
+ 620072,0,4650,timeout,0
75
+ 620073,0,4650,timeout,0
76
+ 620074,0,4650,timeout,0
77
+ 620075,0,4650,timeout,0
78
+ 620076,0,4650,timeout,0
79
+ 620077,0,4650,timeout,0
80
+ 620078,0,4650,timeout,0
81
+ 620079,0,4650,timeout,0
82
+ 620080,0,4650,timeout,0
83
+ 620081,0,4650,timeout,0
84
+ 620082,0,4650,timeout,0
85
+ 620083,0,4650,timeout,0
86
+ 620084,0,4650,timeout,0
87
+ 620085,0,4650,timeout,0
88
+ 620086,0,4650,timeout,0
89
+ 620087,0,4650,timeout,0
90
+ 620088,0,4650,timeout,0
91
+ 620089,0,4650,timeout,0
92
+ 620090,0,4650,timeout,0
93
+ 620091,0,4650,timeout,0
94
+ 620092,0,4650,timeout,0
95
+ 620093,0,4650,timeout,0
96
+ 620094,0,4650,timeout,0
97
+ 620095,0,4650,timeout,0
98
+ 620096,0,4650,timeout,0
99
+ 620097,0,4650,timeout,0
100
+ 620098,0,4650,timeout,0
101
+ 620099,0,4650,timeout,0
policies/dishwasher_close/gpt6sol-s3/policy.py ADDED
@@ -0,0 +1,100 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Deterministic dishwasher rack and door controller."""
2
+
3
+ import numpy as np
4
+
5
+
6
+ def ramp(t, start, end):
7
+ return float(np.clip((t - start) / (end - start), 0.0, 1.0))
8
+
9
+
10
+ class Policy:
11
+ def reset(self, obs, tools):
12
+ self.home = np.asarray(tools.hold_action(), dtype=np.float32)
13
+
14
+ def act(self, obs, tools):
15
+ t = int(obs["t"])
16
+ body = obs["low_dim_obs"]
17
+ a = self.home.copy()
18
+ a[19:21] = 0
19
+
20
+ # Walk around the open door to face the rack fronts.
21
+ if t < 100:
22
+ a[0], a[1] = .17, .22
23
+ return a
24
+ if t < 225:
25
+ a[3] = .8
26
+ return a
27
+
28
+ if t < 1460 or 1890 <= t < 2050:
29
+ a[3] = float(np.clip(2 * (1.57 - body[24]), -.35, .35))
30
+
31
+ # First upper rack contact.
32
+ if t < 300:
33
+ a[2] = .8
34
+ a[5] = a[12] = -1.2
35
+ a[8] = a[15] = 1.5
36
+ a[19:21] = 0 if t < 270 else 1
37
+ elif t < 500:
38
+ p = ramp(t, 300, 455)
39
+ a[0], a[2] = .2, .8 - .2 * p
40
+ a[5] = a[12] = -1.2
41
+ a[8] = a[15] = 1.5 * (1 - p)
42
+ a[19:21] = 1
43
+ elif t < 575:
44
+ a[2] = .74
45
+ # Two more strokes while releasing the handle between strokes.
46
+ elif t < 1050:
47
+ if t < 775:
48
+ start = 575
49
+ elif t < 850:
50
+ a[2] = .74
51
+ return a
52
+ else:
53
+ start = 850
54
+ p = ramp(t, start + 35, start + 170)
55
+ a[2], a[4] = .8 - .17 * p, .2
56
+ a[5] = a[12] = -1.0
57
+ a[8] = a[15] = 1.5 * (1 - p)
58
+ a[19:21] = 0 if t < start + 25 else 1
59
+ a[0] = .4 if t >= start + 35 else 0
60
+ elif t < 1125:
61
+ a[2] = .74
62
+ # Lower rack contact.
63
+ elif t < 1195:
64
+ a[2] = .58
65
+ a[5] = a[12] = -.8
66
+ a[8] = a[15] = 1.5
67
+ a[19:21] = 0 if t < 1165 else 1
68
+ elif t < 1390:
69
+ p = ramp(t, 1195, 1355)
70
+ a[0], a[2] = .3, .58 - .18 * p
71
+ a[5] = a[12] = -.8
72
+ a[8] = a[15] = 1.5 * (1 - p)
73
+ a[19:21] = 1
74
+ elif t < 1460:
75
+ a[2] = .74
76
+ # Get close to the free edge of the open door and lift it.
77
+ elif t < 1560:
78
+ if body[22] < -.55:
79
+ a[0] = .2
80
+ a[3] = float(np.clip(2 * (1.57 - body[24]), -.3, .3))
81
+ elif t < 1670:
82
+ a[2], a[4] = .4, .7
83
+ a[5] = a[12] = -.1
84
+ elif t < 1730:
85
+ a[2], a[4] = .4, .7
86
+ a[5] = a[12] = -.1
87
+ a[19:21] = 1
88
+ elif t < 1890:
89
+ p = ramp(t, 1730, 1860)
90
+ a[2], a[4] = .4 + .5 * p, .7 - .4 * p
91
+ a[5] = a[12] = -.1 - .55 * p
92
+ a[19:21] = 1
93
+ elif t < 2050:
94
+ a[0], a[2], a[4] = .2, .8, .3
95
+ a[5] = a[12] = -.7
96
+ a[19:21] = 1
97
+ else:
98
+ a[2] = .74
99
+ a[5] = a[12] = -.4
100
+ return a
policies/dishwasher_close/kimi31pro-s1/episodes.csv ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ seed,success,length,termination,fell
2
+ 620000,0,4650,timeout,0
3
+ 620001,0,4650,timeout,0
4
+ 620002,0,4650,timeout,0
5
+ 620003,0,4650,timeout,0
6
+ 620004,0,4650,timeout,0
7
+ 620005,0,4650,timeout,0
8
+ 620006,0,4650,timeout,0
9
+ 620007,0,4650,timeout,0
10
+ 620008,0,4650,timeout,0
11
+ 620009,0,4650,timeout,0
12
+ 620010,0,4650,timeout,0
13
+ 620011,0,4650,timeout,0
14
+ 620012,0,4650,timeout,0
15
+ 620013,0,4650,timeout,0
16
+ 620014,0,4650,timeout,0
17
+ 620015,0,4650,timeout,0
18
+ 620016,0,4650,timeout,0
19
+ 620017,0,4650,timeout,0
20
+ 620018,0,4650,timeout,0
21
+ 620019,0,4650,timeout,0
22
+ 620020,0,4650,timeout,0
23
+ 620021,0,4650,timeout,0
24
+ 620022,0,4650,timeout,0
25
+ 620023,0,4650,timeout,0
26
+ 620024,0,4650,timeout,0
27
+ 620025,0,4650,timeout,0
28
+ 620026,0,4650,timeout,0
29
+ 620027,0,4650,timeout,0
30
+ 620028,0,4650,timeout,0
31
+ 620029,0,4650,timeout,0
32
+ 620030,0,4650,timeout,0
33
+ 620031,0,4650,timeout,0
34
+ 620032,0,4650,timeout,0
35
+ 620033,0,4650,timeout,0
36
+ 620034,0,4650,timeout,0
37
+ 620035,0,4650,timeout,0
38
+ 620036,0,4650,timeout,0
39
+ 620037,0,4650,timeout,0
40
+ 620038,0,4650,timeout,0
41
+ 620039,0,4650,timeout,0
42
+ 620040,0,4650,timeout,0
43
+ 620041,0,4650,timeout,0
44
+ 620042,0,4650,timeout,0
45
+ 620043,0,4650,timeout,0
46
+ 620044,0,4650,timeout,0
47
+ 620045,0,4650,timeout,0
48
+ 620046,0,4650,timeout,0
49
+ 620047,0,4650,timeout,0
50
+ 620048,0,4650,timeout,0
51
+ 620049,0,4650,timeout,0
52
+ 620050,0,4650,timeout,0
53
+ 620051,0,4650,timeout,0
54
+ 620052,0,4650,timeout,0
55
+ 620053,0,4650,timeout,0
56
+ 620054,0,4650,timeout,0
57
+ 620055,0,4650,timeout,0
58
+ 620056,0,4650,timeout,0
59
+ 620057,0,4650,timeout,0
60
+ 620058,0,4650,timeout,0
61
+ 620059,0,4650,timeout,0
62
+ 620060,0,4650,timeout,0
63
+ 620061,0,4650,timeout,0
64
+ 620062,0,4650,timeout,0
65
+ 620063,0,4650,timeout,0
66
+ 620064,0,4650,timeout,0
67
+ 620065,0,4650,timeout,0
68
+ 620066,0,4650,timeout,0
69
+ 620067,0,4650,timeout,0
70
+ 620068,0,4650,timeout,0
71
+ 620069,0,4650,timeout,0
72
+ 620070,0,4650,timeout,0
73
+ 620071,0,4650,timeout,0
74
+ 620072,0,4650,timeout,0
75
+ 620073,0,4650,timeout,0
76
+ 620074,0,4650,timeout,0
77
+ 620075,0,4650,timeout,0
78
+ 620076,0,4650,timeout,0
79
+ 620077,0,4650,timeout,0
80
+ 620078,0,4650,timeout,0
81
+ 620079,0,4650,timeout,0
82
+ 620080,0,4650,timeout,0
83
+ 620081,0,4650,timeout,0
84
+ 620082,0,4650,timeout,0
85
+ 620083,0,4650,timeout,0
86
+ 620084,0,4650,timeout,0
87
+ 620085,0,4650,timeout,0
88
+ 620086,0,4650,timeout,0
89
+ 620087,0,4650,timeout,0
90
+ 620088,0,4650,timeout,0
91
+ 620089,0,4650,timeout,0
92
+ 620090,0,4650,timeout,0
93
+ 620091,0,4650,timeout,0
94
+ 620092,0,4650,timeout,0
95
+ 620093,0,4650,timeout,0
96
+ 620094,0,4650,timeout,0
97
+ 620095,0,4650,timeout,0
98
+ 620096,0,4650,timeout,0
99
+ 620097,0,4650,timeout,0
100
+ 620098,0,4650,timeout,0
101
+ 620099,0,4650,timeout,0
policies/dishwasher_close/kimi31pro-s1/policy.py ADDED
@@ -0,0 +1,172 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Deterministic, hand-written dishwasher closing controller.
2
+
3
+ The controller uses a retracted-arm approach, two staged rack insertions, and
4
+ an immediate one-handed door lift. A small amount of head-camera centering is
5
+ used before contact; all manipulation thereafter uses joint and base feedback.
6
+ """
7
+
8
+ import cv2
9
+ import numpy as np
10
+
11
+
12
+ BACK = np.array([0.65, 0.0, 0.0, 0.45, 0.0, 0.0, 0.0])
13
+ HIGH = np.array([-0.90, 0.0, 0.0, 0.65, 0.0, 0.0, 0.0])
14
+ LOW1 = np.array([-1.15, 0.0, 0.0, 0.45, 0.0, 0.0, 0.0])
15
+ LOW2 = np.array([-1.35, 0.0, 0.0, 0.25, 0.0, 0.0, 0.0])
16
+ UPPER = np.array([-0.55, 0.0, 0.0, 0.65, 0.0, 0.0, 0.0])
17
+ UP2 = np.array([-0.85, 0.0, 0.0, 0.45, 0.0, 0.0, 0.0])
18
+ UP3 = np.array([-1.00, 0.0, 0.0, 0.30, 0.0, 0.0, 0.0])
19
+ DOOR = np.array([-0.20, 0.0, 0.25, 0.20, 0.0, 0.0, 0.0])
20
+
21
+
22
+ def blend(a, b, u):
23
+ u = float(np.clip(u, 0.0, 1.0))
24
+ return (1.0 - u) * a + u * b
25
+
26
+
27
+ class Policy:
28
+ def reset(self, obs, tools):
29
+ self.hold = np.asarray(tools.hold_action(), dtype=np.float32)
30
+ self.t = 0
31
+ self.x_goal = 0.34
32
+ self.yaw_goal = 1.55
33
+ self.centered = False
34
+
35
+ def _center_from_head(self, tools):
36
+ """Make a small, one-shot correction for seed-to-seed placement."""
37
+ self.centered = True
38
+ try:
39
+ im = tools.image("head")
40
+ gray = cv2.cvtColor(im, cv2.COLOR_RGB2GRAY)
41
+ mask = ((gray < 65).astype(np.uint8))[5:65, :]
42
+ n, _, stats, cents = cv2.connectedComponentsWithStats(mask, 8)
43
+ candidates = []
44
+ for j in range(1, n):
45
+ x, y, w, h, area = stats[j]
46
+ if area >= 12 and w >= 3:
47
+ candidates.append((area, cents[j][0]))
48
+ if candidates:
49
+ cx = max(candidates)[1]
50
+ err = float(np.clip(cx - 42.0, -18.0, 18.0))
51
+ self.x_goal = float(np.clip(0.34 + 0.008 * err, 0.18, 0.50))
52
+ self.yaw_goal = float(np.clip(1.55 - 0.008 * err, 1.38, 1.72))
53
+ except Exception:
54
+ # The nominal stance is always a valid deterministic fallback.
55
+ self.x_goal = 0.34
56
+ self.yaw_goal = 1.55
57
+
58
+ def _drive_to(self, raw, p, target, speed=0.18):
59
+ yaw = p[3]
60
+ dp = np.asarray(target) - p[:2]
61
+ dist = float(np.linalg.norm(dp))
62
+ if dist > 0.025:
63
+ c, s = np.cos(yaw), np.sin(yaw)
64
+ vx = c * dp[0] + s * dp[1]
65
+ vy = -s * dp[0] + c * dp[1]
66
+ scale = min(speed, 0.9 * dist) / max(dist, 1e-6)
67
+ raw[0] = np.clip(vx * scale, -speed, speed)
68
+ raw[1] = np.clip(vy * scale, -speed, speed)
69
+ planar = float(np.hypot(raw[0], raw[1]))
70
+ if 0.0 < planar < 0.06:
71
+ raw[0] *= 0.06 / planar
72
+ raw[1] *= 0.06 / planar
73
+
74
+ def act(self, obs, tools):
75
+ t = self.t
76
+ self.t += 1
77
+ q = obs["low_dim_obs"]
78
+ p = q[21:25]
79
+ yaw = p[3]
80
+ raw = self.hold.copy()
81
+ raw[19:21] = 0.0
82
+ raw[2] = 0.74
83
+ raw[4] = 0.0
84
+
85
+ if t == 340 and not self.centered:
86
+ self._center_from_head(tools)
87
+
88
+ # Base approach, with the arms safely retracted.
89
+ ye = (self.yaw_goal - yaw + np.pi) % (2.0 * np.pi) - np.pi
90
+ raw[3] = np.clip(2.0 * ye, -0.5, 0.5)
91
+ if abs(ye) < 0.025:
92
+ raw[3] = 0.0
93
+ if 70 <= t < 530:
94
+ if t < 170:
95
+ ty = -0.79
96
+ elif t < 350:
97
+ ty = -0.65
98
+ else:
99
+ ty = -0.85
100
+ self._drive_to(raw, p, [self.x_goal, ty])
101
+ elif 530 <= t < 630:
102
+ raw[0] = 0.12
103
+ elif 630 <= t < 1120:
104
+ raw[0] = 0.40
105
+ elif 1120 <= t < 1180:
106
+ self._drive_to(raw, p, [self.x_goal, -0.75])
107
+ elif 1180 <= t < 1650:
108
+ raw[0] = 0.40
109
+ elif 1650 <= t < 2080:
110
+ self._drive_to(raw, p, [self.x_goal, -0.55])
111
+ elif t >= 2080:
112
+ raw[0] = 0.40
113
+
114
+ # Arm trajectories for the two racks.
115
+ arms = BACK * min(1.0, (t + 1) / 60.0)
116
+ right = None
117
+ if 450 <= t < 530:
118
+ arms = blend(BACK, HIGH, (t - 450) / 80.0)
119
+ elif 530 <= t < 800:
120
+ arms = HIGH
121
+ elif 800 <= t < 960:
122
+ u = (t - 800) / 160.0
123
+ arms = blend(HIGH, LOW1, u)
124
+ raw[4] = 0.30 * u
125
+ elif 960 <= t < 1120:
126
+ u = (t - 960) / 160.0
127
+ arms = blend(LOW1, LOW2, u)
128
+ raw[4] = 0.30 + 0.20 * u
129
+ elif 1120 <= t < 1330:
130
+ arms = UPPER
131
+ elif 1330 <= t < 1490:
132
+ u = (t - 1330) / 160.0
133
+ arms = blend(UPPER, UP2, u)
134
+ raw[4] = 0.30 * u
135
+ elif 1490 <= t < 1650:
136
+ u = (t - 1490) / 160.0
137
+ arms = blend(UP2, UP3, u)
138
+ raw[4] = 0.30 + 0.10 * u
139
+ elif 1650 <= t < 2080:
140
+ # Keep the left hand on the racks so they cannot roll back out.
141
+ arms = UP3
142
+ if t < 1780:
143
+ u = (t - 1650) / 130.0
144
+ right = blend(UP3, DOOR, u)
145
+ raw[4] = 0.40 - 0.10 * u
146
+ raw[2] = 0.74 - 0.19 * u
147
+ else:
148
+ u = (t - 1780) / 300.0
149
+ right = blend(DOOR, HIGH, u)
150
+ raw[4] = 0.30 * (1.0 - u)
151
+ raw[2] = 0.55 + 0.19 * u
152
+ elif t >= 2080:
153
+ arms = BACK
154
+ right = HIGH
155
+ raw[5:12] = arms
156
+ raw[12:19] = arms if right is None else right
157
+ if t >= 1650:
158
+ raw[14] = 0.25
159
+ if 530 <= t < 1120:
160
+ raw[2] = 0.66
161
+
162
+ # Maintain rack contact through the door transition.
163
+ if 600 <= t < 1120:
164
+ raw[19:21] = 1.0
165
+ if 1160 <= t < 1650:
166
+ raw[19:21] = 1.0
167
+ if 1650 <= t < 2080:
168
+ raw[19:21] = 1.0
169
+ elif t >= 2080:
170
+ raw[19] = 0.0
171
+ raw[20] = 1.0
172
+ return raw
policies/dishwasher_close/kimi31pro-s2/episodes.csv ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ seed,success,length,termination,fell
2
+ 620000,0,4650,timeout,0
3
+ 620001,0,4650,timeout,0
4
+ 620002,0,4650,timeout,0
5
+ 620003,0,4650,timeout,0
6
+ 620004,0,4650,timeout,0
7
+ 620005,0,4650,timeout,0
8
+ 620006,0,4650,timeout,0
9
+ 620007,0,4650,timeout,0
10
+ 620008,0,4650,timeout,0
11
+ 620009,0,4650,timeout,0
12
+ 620010,0,4650,timeout,0
13
+ 620011,0,4650,timeout,0
14
+ 620012,0,4650,timeout,0
15
+ 620013,0,4650,timeout,0
16
+ 620014,0,4650,timeout,0
17
+ 620015,0,4650,timeout,0
18
+ 620016,0,4650,timeout,0
19
+ 620017,0,4650,timeout,0
20
+ 620018,0,4650,timeout,0
21
+ 620019,0,4650,timeout,0
22
+ 620020,0,4650,timeout,0
23
+ 620021,0,4650,timeout,0
24
+ 620022,0,4650,timeout,0
25
+ 620023,0,4650,timeout,0
26
+ 620024,0,4650,timeout,0
27
+ 620025,0,4650,timeout,0
28
+ 620026,0,4650,timeout,0
29
+ 620027,0,4650,timeout,0
30
+ 620028,0,4650,timeout,0
31
+ 620029,0,4650,timeout,0
32
+ 620030,0,4650,timeout,0
33
+ 620031,0,4650,timeout,0
34
+ 620032,0,4650,timeout,0
35
+ 620033,0,4650,timeout,0
36
+ 620034,0,4650,timeout,0
37
+ 620035,0,4650,timeout,0
38
+ 620036,0,4650,timeout,0
39
+ 620037,0,4650,timeout,0
40
+ 620038,0,4650,timeout,0
41
+ 620039,0,4650,timeout,0
42
+ 620040,0,4650,timeout,0
43
+ 620041,0,4650,timeout,0
44
+ 620042,0,4650,timeout,0
45
+ 620043,0,4650,timeout,0
46
+ 620044,0,4650,timeout,0
47
+ 620045,0,4650,timeout,0
48
+ 620046,0,4650,timeout,0
49
+ 620047,0,4650,timeout,0
50
+ 620048,0,4650,timeout,0
51
+ 620049,0,4650,timeout,0
52
+ 620050,0,4650,timeout,0
53
+ 620051,0,4650,timeout,0
54
+ 620052,0,4650,timeout,0
55
+ 620053,0,4650,timeout,0
56
+ 620054,0,4650,timeout,0
57
+ 620055,0,4650,timeout,0
58
+ 620056,0,4650,timeout,0
59
+ 620057,0,4650,timeout,0
60
+ 620058,0,4650,timeout,0
61
+ 620059,0,4650,timeout,0
62
+ 620060,0,4650,timeout,0
63
+ 620061,0,4650,timeout,0
64
+ 620062,0,4650,timeout,0
65
+ 620063,0,4650,timeout,0
66
+ 620064,0,4650,timeout,0
67
+ 620065,0,4650,timeout,0
68
+ 620066,0,4650,timeout,0
69
+ 620067,0,4650,timeout,0
70
+ 620068,0,4650,timeout,0
71
+ 620069,0,4650,timeout,0
72
+ 620070,0,4650,timeout,0
73
+ 620071,0,4650,timeout,0
74
+ 620072,0,4650,timeout,0
75
+ 620073,0,4650,timeout,0
76
+ 620074,0,4650,timeout,0
77
+ 620075,0,4650,timeout,0
78
+ 620076,0,4650,timeout,0
79
+ 620077,0,4650,timeout,0
80
+ 620078,0,4650,timeout,0
81
+ 620079,0,4650,timeout,0
82
+ 620080,0,4650,timeout,0
83
+ 620081,0,4650,timeout,0
84
+ 620082,0,4650,timeout,0
85
+ 620083,0,4650,timeout,0
86
+ 620084,0,4650,timeout,0
87
+ 620085,0,4650,timeout,0
88
+ 620086,0,4650,timeout,0
89
+ 620087,0,4650,timeout,0
90
+ 620088,0,4650,timeout,0
91
+ 620089,0,4650,timeout,0
92
+ 620090,0,4650,timeout,0
93
+ 620091,0,4650,timeout,0
94
+ 620092,0,4650,timeout,0
95
+ 620093,0,4650,timeout,0
96
+ 620094,0,4650,timeout,0
97
+ 620095,0,4650,timeout,0
98
+ 620096,0,4650,timeout,0
99
+ 620097,0,4650,timeout,0
100
+ 620098,0,4650,timeout,0
101
+ 620099,0,4650,timeout,0
policies/dishwasher_close/kimi31pro-s2/policy.py ADDED
@@ -0,0 +1,107 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Hand-written deterministic controller for the dishwasher task."""
2
+
3
+ import math
4
+
5
+ import numpy as np
6
+
7
+
8
+ class Policy:
9
+ """Push the racks, align with the door, and lift it while standing."""
10
+
11
+ def reset(self, obs, tools):
12
+ self.hold = np.asarray(tools.hold_action(), dtype=np.float32)
13
+ self.k = 0
14
+ self.phase_name = ""
15
+ # name, duration, pelvis height, torso pitch, shoulder pitch, elbow, vx
16
+ self.phases = [
17
+ ("turn", 80, 0.74, 0.0, 0.0, 0.0, 0.0),
18
+ ("upper_prepare", 50, 0.74, 0.0, -1.0, 0.8, 0.0),
19
+ ("upper_push", 260, 0.74, 0.0, -1.0, 0.8, 0.12),
20
+ ("upper_hold", 30, 0.74, 0.0, -1.0, 0.8, 0.0),
21
+ ("upper_retract", 60, 0.74, 0.0, -1.2, 0.2, -0.10),
22
+ ("reposition", 140, 0.74, 0.0, -0.6, 0.5, 0.0),
23
+ ("door_align", 100, 0.40, 0.20, -0.7, 0.7, 0.0),
24
+ ("door_close", 320, 0.74, 0.0, -1.45, 1.4, 0.0),
25
+ ("door_hold", 100, 0.74, 0.0, -1.45, 1.4, 0.0),
26
+ ("release_inspect", 80, 0.74, 0.0, 0.0, 0.0, 0.0),
27
+ ("hold_closed", 4650, 0.74, 0.0, 0.0, 0.0, 0.0),
28
+ ]
29
+ self.starts = np.cumsum([0] + [p[1] for p in self.phases[:-1]])
30
+ self.reposition_index = 5
31
+
32
+ def position_servo(self, raw, obs):
33
+ """Servo toward the measured door-alignment base position."""
34
+ p = obs["low_dim_obs"]
35
+ yaw = float(p[24])
36
+ dx = 0.125 - float(p[21])
37
+ dy = -0.755 - float(p[22])
38
+ c, s = math.cos(yaw), math.sin(yaw)
39
+ raw[0] = 1.5 * (c * dx + s * dy)
40
+ raw[1] = 1.5 * (-s * dx + c * dy)
41
+ speed = math.hypot(float(raw[0]), float(raw[1]))
42
+ distance = math.hypot(dx, dy)
43
+ if speed > 0.10:
44
+ raw[0] *= 0.10 / speed
45
+ raw[1] *= 0.10 / speed
46
+ elif speed < 0.06 and distance > 0.008:
47
+ raw[0] *= 0.06 / max(speed, 1e-6)
48
+ raw[1] *= 0.06 / max(speed, 1e-6)
49
+ elif distance <= 0.008:
50
+ raw[0] = raw[1] = 0.0
51
+
52
+ def act(self, obs, tools):
53
+ k = self.k
54
+ self.k += 1
55
+ i = int(np.searchsorted(self.starts, k, side="right") - 1)
56
+ i = min(i, len(self.phases) - 1)
57
+ name, duration, height, pitch, shoulder, elbow, vx = self.phases[i]
58
+ self.phase_name = name
59
+ local = k - int(self.starts[i])
60
+
61
+ raw = self.hold.copy()
62
+ raw[2] = height
63
+ raw[4] = pitch
64
+ raw[5] = raw[12] = shoulder
65
+ raw[8] = raw[15] = elbow
66
+ raw[19:21] = 0.0
67
+
68
+ yaw = float(obs["low_dim_obs"][24])
69
+ target_yaw = 1.30 if i >= self.reposition_index else 0.95
70
+ quiet_yaw = {
71
+ "door_align", "door_close", "door_hold",
72
+ "release_inspect", "hold_closed",
73
+ }
74
+ raw[3] = (
75
+ 0.0 if name in quiet_yaw
76
+ else float(np.clip(3.0 * (target_yaw - yaw), -0.55, 0.55))
77
+ )
78
+
79
+ if name == "upper_push":
80
+ raw[0] = vx
81
+ elif name == "upper_retract":
82
+ raw[0] = vx if local < 40 else 0.0
83
+ elif name == "reposition":
84
+ self.position_servo(raw, obs)
85
+ else:
86
+ raw[0] = 0.0
87
+
88
+ if name in ("door_close", "door_hold"):
89
+ t = local if name == "door_close" else 319
90
+ if t < 80:
91
+ # Engage the underside with a vertical lift.
92
+ v = (t + 1) / 80.0
93
+ raw[2] = 0.40 + 0.12 * v
94
+ raw[4] = 0.20
95
+ raw[10] = raw[17] = 0.0
96
+ shoulder, elbow = -0.7, 0.7
97
+ else:
98
+ # Rotate the wrists with the panel as the robot stands.
99
+ v = min(1.0, (t - 79) / 240.0)
100
+ raw[2] = 0.52 + 0.22 * v
101
+ raw[4] = 0.20 * (1.0 - v)
102
+ raw[10] = raw[17] = -1.20 * v
103
+ shoulder = -0.7 - 0.75 * v
104
+ elbow = 0.7 + 0.7 * v
105
+ raw[5] = raw[12] = shoulder
106
+ raw[8] = raw[15] = elbow
107
+ return raw
policies/dishwasher_close/kimi31pro-s3/episodes.csv ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ seed,success,length,termination,fell
2
+ 620000,0,4650,timeout,0
3
+ 620001,0,4650,timeout,0
4
+ 620002,0,4650,timeout,0
5
+ 620003,0,4650,timeout,0
6
+ 620004,0,4650,timeout,0
7
+ 620005,0,4650,timeout,0
8
+ 620006,0,4650,timeout,0
9
+ 620007,0,4650,timeout,0
10
+ 620008,0,4650,timeout,0
11
+ 620009,0,4650,timeout,0
12
+ 620010,0,4650,timeout,0
13
+ 620011,0,4650,timeout,0
14
+ 620012,0,4650,timeout,0
15
+ 620013,0,4650,timeout,0
16
+ 620014,0,4650,timeout,0
17
+ 620015,0,4650,timeout,0
18
+ 620016,0,4650,timeout,0
19
+ 620017,0,4650,timeout,0
20
+ 620018,0,4650,timeout,0
21
+ 620019,0,4650,timeout,0
22
+ 620020,0,4650,timeout,0
23
+ 620021,0,4650,timeout,0
24
+ 620022,0,4650,timeout,0
25
+ 620023,0,4650,timeout,0
26
+ 620024,0,4650,timeout,0
27
+ 620025,0,4650,timeout,0
28
+ 620026,0,4650,timeout,0
29
+ 620027,0,4650,timeout,0
30
+ 620028,0,4650,timeout,0
31
+ 620029,0,4650,timeout,0
32
+ 620030,0,4650,timeout,0
33
+ 620031,0,4650,timeout,0
34
+ 620032,0,4650,timeout,0
35
+ 620033,0,4650,timeout,0
36
+ 620034,0,4650,timeout,0
37
+ 620035,0,4650,timeout,0
38
+ 620036,0,4650,timeout,0
39
+ 620037,0,4650,timeout,0
40
+ 620038,0,4650,timeout,0
41
+ 620039,0,4650,timeout,0
42
+ 620040,0,4650,timeout,0
43
+ 620041,0,4650,timeout,0
44
+ 620042,0,4650,timeout,0
45
+ 620043,0,4650,timeout,0
46
+ 620044,0,4650,timeout,0
47
+ 620045,0,4650,timeout,0
48
+ 620046,0,4650,timeout,0
49
+ 620047,0,4650,timeout,0
50
+ 620048,0,4650,timeout,0
51
+ 620049,0,4650,timeout,0
52
+ 620050,0,4650,timeout,0
53
+ 620051,0,4650,timeout,0
54
+ 620052,0,4650,timeout,0
55
+ 620053,0,4650,timeout,0
56
+ 620054,0,4650,timeout,0
57
+ 620055,0,4650,timeout,0
58
+ 620056,0,4650,timeout,0
59
+ 620057,0,4650,timeout,0
60
+ 620058,0,4650,timeout,0
61
+ 620059,0,4650,timeout,0
62
+ 620060,0,4650,timeout,0
63
+ 620061,0,4650,timeout,0
64
+ 620062,0,4650,timeout,0
65
+ 620063,0,4650,timeout,0
66
+ 620064,0,4650,timeout,0
67
+ 620065,0,4650,timeout,0
68
+ 620066,0,4650,timeout,0
69
+ 620067,0,4650,timeout,0
70
+ 620068,0,4650,timeout,0
71
+ 620069,0,4650,timeout,0
72
+ 620070,0,4650,timeout,0
73
+ 620071,0,4650,timeout,0
74
+ 620072,0,4650,timeout,0
75
+ 620073,0,4650,timeout,0
76
+ 620074,0,4650,timeout,0
77
+ 620075,0,4650,timeout,0
78
+ 620076,0,4650,timeout,0
79
+ 620077,0,4650,timeout,0
80
+ 620078,0,4650,timeout,0
81
+ 620079,0,4650,timeout,0
82
+ 620080,0,4650,timeout,0
83
+ 620081,0,4650,timeout,0
84
+ 620082,0,4650,timeout,0
85
+ 620083,0,4650,timeout,0
86
+ 620084,0,4650,timeout,0
87
+ 620085,0,4650,timeout,0
88
+ 620086,0,4650,timeout,0
89
+ 620087,0,4650,timeout,0
90
+ 620088,0,4650,timeout,0
91
+ 620089,0,4650,timeout,0
92
+ 620090,0,4650,timeout,0
93
+ 620091,0,4650,timeout,0
94
+ 620092,0,4650,timeout,0
95
+ 620093,0,4650,timeout,0
96
+ 620094,0,4650,timeout,0
97
+ 620095,0,4650,timeout,0
98
+ 620096,0,4650,timeout,0
99
+ 620097,0,4650,timeout,0
100
+ 620098,0,4650,timeout,0
101
+ 620099,0,4650,timeout,0
policies/dishwasher_close/kimi31pro-s3/policy.py ADDED
@@ -0,0 +1,103 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Deterministic joint-space controller for the dishwasher task."""
2
+
3
+ import numpy as np
4
+
5
+
6
+ class Policy:
7
+ """Hand-written, staged control using proprioceptive base feedback."""
8
+
9
+ DEFAULTS = {
10
+ "target_x": 0.22,
11
+ "target_y": -0.65,
12
+ "ready_sp": -0.90,
13
+ "ready_roll": 0.45,
14
+ "ready_yaw": 0.0,
15
+ "ready_elbow": 0.40,
16
+ "ready_wrist": 0.0,
17
+ "ready_wr": 0.0,
18
+ "contact_sp": -0.15,
19
+ "contact_roll": 0.45,
20
+ "contact_yaw": 0.0,
21
+ "contact_elbow": 0.0,
22
+ "contact_wrist": 0.0,
23
+ "contact_wr": 0.0,
24
+ "push_sp": -0.85,
25
+ "push_roll": 0.45,
26
+ "push_yaw": 0.0,
27
+ "push_elbow": 0.55,
28
+ "push_wrist": 0.0,
29
+ "push_wr": 0.0,
30
+ "both": False,
31
+ "gripper": 0.6,
32
+ "height": 0.74,
33
+ "torso": 0.0,
34
+ "retract": False,
35
+ "stand_after": False,
36
+ "release": False,
37
+ "close_during_push": False,
38
+ }
39
+
40
+ def __init__(self):
41
+ self.config = dict(self.DEFAULTS)
42
+
43
+ def reset(self, obs, tools):
44
+ self.hold = np.asarray(tools.hold_action(), dtype=np.float32)
45
+
46
+ @staticmethod
47
+ def _blend(t, start, duration):
48
+ return float(np.clip((t - start) / float(duration), 0.0, 1.0))
49
+
50
+ @staticmethod
51
+ def _mix(a, b, u):
52
+ return (1.0 - u) * np.asarray(a) + u * np.asarray(b)
53
+
54
+ def _lower_rack_arm(self, t):
55
+ c = self.config
56
+ ready = np.array([c["ready_sp"], c["ready_roll"], c["ready_yaw"],
57
+ c["ready_elbow"], c["ready_wr"], c["ready_wrist"], 0.0])
58
+ contact = np.array([c["contact_sp"], c["contact_roll"], c["contact_yaw"],
59
+ c["contact_elbow"], c["contact_wr"], c["contact_wrist"], 0.0])
60
+ push = np.array([c["push_sp"], c["push_roll"], c["push_yaw"],
61
+ c["push_elbow"], c["push_wr"], c["push_wrist"], 0.0])
62
+ if t < 250:
63
+ return self._mix(np.zeros(7), ready, self._blend(t, 20, 100))
64
+ if t < 400:
65
+ return self._mix(ready, contact, self._blend(t, 250, 150))
66
+ pushed = self._mix(contact, push, self._blend(t, 400, 250))
67
+ if c["retract"] and t >= 650:
68
+ return self._mix(push, np.zeros(7), self._blend(t, 650, 150))
69
+ return pushed
70
+
71
+ def act(self, obs, tools):
72
+ t = int(obs["t"])
73
+ q = np.asarray(obs["low_dim_obs"])
74
+ raw = self.hold.copy()
75
+ c = self.config
76
+
77
+ # Turn first, then servo the pelvis to the fixed appliance stance.
78
+ x, y, _, yaw = q[21:25]
79
+ yaw_error = (np.pi / 2 - yaw + np.pi) % (2 * np.pi) - np.pi
80
+ raw[3] = np.clip(2.0 * yaw_error, -0.6, 0.6)
81
+ if t > 100 and abs(yaw_error) < 0.3:
82
+ dx, dy = c["target_x"] - x, c["target_y"] - y
83
+ co, si = np.cos(yaw), np.sin(yaw)
84
+ raw[0] = np.clip(2.0 * (co * dx + si * dy), -0.15, 0.15)
85
+ raw[1] = np.clip(2.0 * (-si * dx + co * dy), -0.15, 0.15)
86
+ if abs(raw[0]) < 0.06:
87
+ raw[0] = 0.0
88
+ if abs(raw[1]) < 0.06:
89
+ raw[1] = 0.0
90
+
91
+ arm = self._lower_rack_arm(t)
92
+ body_blend = self._blend(t, 200, 150)
93
+ if c["stand_after"] and t >= 800:
94
+ body_blend *= 1.0 - self._blend(t, 800, 150)
95
+ raw[2] = 0.74 + body_blend * (c["height"] - 0.74)
96
+ raw[4] = body_blend * c["torso"]
97
+ raw[12:19] = arm
98
+ if c["both"]:
99
+ raw[5:12] = arm
100
+ raw[19:21] = 0.0 if c["release"] and t >= 650 else c["gripper"]
101
+ if c["close_during_push"] and 400 <= t < 650:
102
+ raw[19:21] = 1.0
103
+ return raw
policies/dishwasher_close/opus-s1/episodes.csv ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ seed,success,length,termination,fell
2
+ 620000,0,4650,timeout,0
3
+ 620001,0,4650,timeout,0
4
+ 620002,0,4650,timeout,0
5
+ 620003,0,4650,timeout,0
6
+ 620004,0,4650,timeout,0
7
+ 620005,0,4650,timeout,0
8
+ 620006,0,4650,timeout,0
9
+ 620007,0,4650,timeout,0
10
+ 620008,0,4650,timeout,0
11
+ 620009,0,4650,timeout,0
12
+ 620010,0,4650,timeout,0
13
+ 620011,0,4650,timeout,0
14
+ 620012,0,4650,timeout,0
15
+ 620013,0,4650,timeout,0
16
+ 620014,0,4650,timeout,0
17
+ 620015,0,4650,timeout,0
18
+ 620016,0,4650,timeout,0
19
+ 620017,0,4650,timeout,0
20
+ 620018,0,4650,timeout,0
21
+ 620019,0,4650,timeout,0
22
+ 620020,0,4650,timeout,0
23
+ 620021,0,4650,timeout,0
24
+ 620022,0,4650,timeout,0
25
+ 620023,0,4650,timeout,0
26
+ 620024,0,4650,timeout,0
27
+ 620025,0,4650,timeout,0
28
+ 620026,0,4650,timeout,0
29
+ 620027,0,4650,timeout,0
30
+ 620028,0,4650,timeout,0
31
+ 620029,0,4650,timeout,0
32
+ 620030,0,4650,timeout,0
33
+ 620031,0,4650,timeout,0
34
+ 620032,0,4650,timeout,0
35
+ 620033,0,4650,timeout,0
36
+ 620034,0,4650,timeout,0
37
+ 620035,0,4650,timeout,0
38
+ 620036,0,4650,timeout,0
39
+ 620037,0,4650,timeout,0
40
+ 620038,0,4650,timeout,0
41
+ 620039,0,4650,timeout,0
42
+ 620040,0,4650,timeout,0
43
+ 620041,0,4650,timeout,0
44
+ 620042,0,4650,timeout,0
45
+ 620043,0,4650,timeout,0
46
+ 620044,0,4650,timeout,0
47
+ 620045,0,4650,timeout,0
48
+ 620046,0,4650,timeout,0
49
+ 620047,0,4650,timeout,0
50
+ 620048,0,4650,timeout,0
51
+ 620049,0,4650,timeout,0
52
+ 620050,0,4650,timeout,0
53
+ 620051,0,4650,timeout,0
54
+ 620052,0,4650,timeout,0
55
+ 620053,0,4650,timeout,0
56
+ 620054,0,4650,timeout,0
57
+ 620055,0,4650,timeout,0
58
+ 620056,0,4650,timeout,0
59
+ 620057,0,4650,timeout,0
60
+ 620058,0,4650,timeout,0
61
+ 620059,0,4650,timeout,0
62
+ 620060,0,4650,timeout,0
63
+ 620061,0,4650,timeout,0
64
+ 620062,0,4650,timeout,0
65
+ 620063,0,4650,timeout,0
66
+ 620064,0,4650,timeout,0
67
+ 620065,0,4650,timeout,0
68
+ 620066,0,4650,timeout,0
69
+ 620067,0,4650,timeout,0
70
+ 620068,0,4650,timeout,0
71
+ 620069,0,4650,timeout,0
72
+ 620070,0,4650,timeout,0
73
+ 620071,0,4650,timeout,0
74
+ 620072,0,4650,timeout,0
75
+ 620073,0,4650,timeout,0
76
+ 620074,0,4650,timeout,0
77
+ 620075,0,4650,timeout,0
78
+ 620076,0,4650,timeout,0
79
+ 620077,0,4650,timeout,0
80
+ 620078,0,4650,timeout,0
81
+ 620079,0,4650,timeout,0
82
+ 620080,0,4650,timeout,0
83
+ 620081,0,4650,timeout,0
84
+ 620082,0,4650,timeout,0
85
+ 620083,0,4650,timeout,0
86
+ 620084,0,4650,timeout,0
87
+ 620085,0,4650,timeout,0
88
+ 620086,0,4650,timeout,0
89
+ 620087,0,4650,timeout,0
90
+ 620088,0,4650,timeout,0
91
+ 620089,0,4650,timeout,0
92
+ 620090,0,4650,timeout,0
93
+ 620091,0,4650,timeout,0
94
+ 620092,0,4650,timeout,0
95
+ 620093,0,4650,timeout,0
96
+ 620094,0,4650,timeout,0
97
+ 620095,0,4650,timeout,0
98
+ 620096,0,4650,timeout,0
99
+ 620097,0,4650,timeout,0
100
+ 620098,0,4650,timeout,0
101
+ 620099,0,4650,timeout,0
policies/dishwasher_close/opus-s1/policy.py ADDED
@@ -0,0 +1,161 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Dishwasher close policy for the G1: push the racks in, then lift and push the door shut.
2
+
3
+ Scripted sequence of phases, all closed-loop on the pelvis pose from low_dim_obs:
4
+ 1. walk beside the dishwasher (facing +y) and push the upper rack in by side-stepping
5
+ with the left hand inside the rack,
6
+ 2. walk in front of the open door (facing +x), squat and push the lower rack in low,
7
+ 3. squat again with hands under the door tip, stand up lifting the door,
8
+ 4. walk forward pressing the door closed and hold.
9
+ """
10
+
11
+ import numpy as np
12
+
13
+ YAW_SIDE = np.pi / 2
14
+
15
+ # planar arm model (sagittal plane), pelvis-relative
16
+ SH = 0.30 # pelvis -> shoulder height
17
+ L1, L2 = 0.20, 0.30
18
+ EL_MAX = 1.5 # elbow: pi/2 = straight arm, 0 = right angle
19
+
20
+
21
+ def wrap(a):
22
+ return (a + np.pi) % (2 * np.pi) - np.pi
23
+
24
+
25
+ def ik(hx, hz, pz, pitch):
26
+ """Hand target (forward of pelvis, world height) -> shoulder pitch, elbow."""
27
+ sx, sz = SH * np.sin(pitch), pz + SH * np.cos(pitch)
28
+ dx, dz = hx - sx, hz - sz
29
+ d = np.hypot(dx, dz)
30
+ bmin = np.pi / 2 - EL_MAX
31
+ dmax = np.sqrt(L1 ** 2 + L2 ** 2 + 2 * L1 * L2 * np.cos(bmin))
32
+ d = min(d, dmax - 1e-4)
33
+ c = (L1 ** 2 + L2 ** 2 - d ** 2) / (2 * L1 * L2)
34
+ bend = np.pi - np.arccos(np.clip(c, -1, 1))
35
+ phi = np.arctan2(dx, -dz)
36
+ off = np.arcsin(np.clip(L2 * np.sin(bend) / max(d, 1e-6), -1, 1))
37
+ a1 = phi - off
38
+ return -(a1 - pitch), np.pi / 2 - bend
39
+
40
+
41
+ def arm(sp, sr, sy, el, wr=0.0, wp=0.0, wy=0.0):
42
+ return [sp, sr, sy, el, wr, wp, wy]
43
+
44
+
45
+ REST = (arm(0.3, 0.2, 0, 1.2), arm(0.3, -0.2, 0, 1.2))
46
+ TUCK = (arm(0.5, 0.15, 0, 1.4), arm(0.5, -0.15, 0, 1.4))
47
+ RL = -0.12
48
+
49
+ STEPS = [
50
+ # upper rack: from the side, left hand in the rack, side-step toward +x
51
+ dict(kind='nav', x=-0.25, y=-0.62, yaw=YAW_SIDE),
52
+ dict(kind='nav', x=-0.25, y=-0.5, yaw=YAW_SIDE),
53
+ dict(kind='pose', n=50, hands=(0.3, 0.84, 0.42, 0.72), roll=0.1, only='L'),
54
+ dict(kind='pose', n=560, base=(0.0, -0.1), yaw=YAW_SIDE, yhold=-0.5),
55
+ dict(kind='pose', n=40, hands=(0.42, 0.72, 0.3, 1.05), roll=0.1, only='L'),
56
+ dict(kind='pose', n=30, arms=REST),
57
+ # lower rack: in front of the door, squat and push low
58
+ dict(kind='nav', x=-0.45, y=-0.6, yaw=0.0),
59
+ dict(kind='nav', x=-0.45, y=0.0, yaw=0.0),
60
+ dict(kind='nav', x=-0.2, y=0.0, yaw=0.0, vmax=0.12),
61
+ dict(kind='pose', n=60, h=0.45, p=0.7, hands=(0.3, 0.84, 0.2, 0.5), roll=0.0),
62
+ dict(kind='pose', n=30, hands=(0.2, 0.5, 0.2, 0.25), roll=0.0),
63
+ dict(kind='pose', n=120, hands=(0.2, 0.25, 0.8, 0.25), roll=0.0),
64
+ dict(kind='pose', n=30, hands=(0.8, 0.25, 0.3, 0.6), roll=0.0),
65
+ dict(kind='pose', n=60, h=0.74, p=0.0, arms=REST),
66
+ dict(kind='nav', x=-0.2, y=0.0, yaw=0.0, vmax=0.12),
67
+ # door: hands under the tip, stand up lifting it
68
+ dict(kind='pose', n=60, h=0.5, p=0.3, hands=(0.3, 0.84, 0.15, 0.45), roll=RL),
69
+ dict(kind='pose', n=80, hands=(0.15, 0.45, 0.32, 0.45), roll=RL),
70
+ dict(kind='pose', n=200, h=0.74, p=0.0, hands=(0.32, 0.45, 0.35, 0.72), roll=RL,
71
+ base=(0.08, 0.0), yaw=0.0, yline=0.0),
72
+ dict(kind='pose', n=100, hands=(0.35, 0.72, 0.45, 1.0), roll=RL,
73
+ base=(0.1, 0.0), yaw=0.0, yline=0.0),
74
+ # push it shut while walking in
75
+ dict(kind='pose', n=150, p=0.4, hands=(0.45, 1.0, 0.62, 0.85), roll=RL,
76
+ base=(0.1, 0.0), yaw=0.0, yline=0.0),
77
+ dict(kind='pose', n=200, base=(0.12, 0.0), yaw=0.0, yline=0.0),
78
+ # final shove: lean further and straighten the arms at door-face height
79
+ dict(kind='pose', n=150, p=0.65, hands=(0.62, 0.85, 0.85, 0.75), roll=RL,
80
+ base=(0.12, 0.0), yaw=0.0, yline=0.0),
81
+ dict(kind='pose', n=10 ** 6, base=(0.12, 0.0), yaw=0.0, yline=0.0),
82
+ ]
83
+
84
+
85
+ class Policy:
86
+ """The control policy that is scored on the hidden seeds."""
87
+
88
+ def reset(self, obs, tools):
89
+ self.hold = np.asarray(tools.hold_action(), dtype=np.float32)
90
+ self.steps = [dict(s) for s in STEPS]
91
+ self.i = 0
92
+ self.k = 0
93
+ self.L, self.R = list(REST[0]), list(REST[1])
94
+ self.h, self.p = 0.74, 0.0
95
+ self.tgt = None
96
+
97
+ def nav(self, o, tx, ty, tyaw, a, vmax=None):
98
+ x, y, yaw = o[21], o[22], o[24]
99
+ vmax = vmax or 0.25
100
+ dx, dy = tx - x, ty - y
101
+ c, s = np.cos(yaw), np.sin(yaw)
102
+ bx, by = c * dx + s * dy, -s * dx + c * dy
103
+ d = np.hypot(bx, by)
104
+ ey = wrap(tyaw - yaw)
105
+ a[3] = np.clip(1.5 * ey, -0.6, 0.6)
106
+ if abs(a[3]) < 0.06:
107
+ a[3] = 0.0 if abs(ey) < 0.03 else 0.06 * np.sign(ey)
108
+ if d > 0.03:
109
+ v = np.clip(1.2 * d, 0.08, vmax)
110
+ a[0], a[1] = v * bx / d, v * by / d
111
+ return d < 0.03 and abs(ey) < 0.05
112
+
113
+ def act(self, obs, tools):
114
+ o = obs['low_dim_obs']
115
+ a = self.hold.copy()
116
+ a[2], a[4] = self.h, self.p
117
+ a[5:12], a[12:19] = self.L, self.R
118
+ st = self.steps[self.i]
119
+ if st['kind'] == 'nav':
120
+ self.tgt = (st['x'], st['y'], st['yaw'])
121
+ if self.nav(o, st['x'], st['y'], st['yaw'], a, st.get('vmax')):
122
+ self.i += 1
123
+ self.k = 0
124
+ return a
125
+ n = st['n']
126
+ s = min(1.0, (self.k + 1) / n)
127
+ if self.k == 0:
128
+ st['_h0'], st['_p0'] = self.h, self.p
129
+ st['_L0'], st['_R0'] = list(self.L), list(self.R)
130
+ h0, p0 = st['_h0'], st['_p0']
131
+ a[2] = h0 + (st.get('h', h0) - h0) * s
132
+ a[4] = p0 + (st.get('p', p0) - p0) * s
133
+ if 'hands' in st:
134
+ hx0, hz0, hx1, hz1 = st['hands']
135
+ sp, el = ik(hx0 + (hx1 - hx0) * s, hz0 + (hz1 - hz0) * s, a[2], a[4])
136
+ r = st.get('roll', 0.15)
137
+ L, R = arm(sp, r, 0, el), arm(sp, -r, 0, el)
138
+ if st.get('only') == 'L':
139
+ R = st['_R0']
140
+ elif 'arms' in st:
141
+ L = [x0 + (x1 - x0) * s for x0, x1 in zip(st['_L0'], st['arms'][0])]
142
+ R = [x0 + (x1 - x0) * s for x0, x1 in zip(st['_R0'], st['arms'][1])]
143
+ else:
144
+ L, R = st['_L0'], st['_R0']
145
+ a[5:12], a[12:19] = L, R
146
+ if 'base' in st:
147
+ a[0], a[1] = st['base']
148
+ a[3] = np.clip(1.5 * wrap(st['yaw'] - o[24]), -0.3, 0.3)
149
+ if 'yhold' in st: # facing +y: hold world y with forward velocity
150
+ vx = np.clip(1.5 * (st['yhold'] - o[22]), -0.1, 0.1)
151
+ a[0] += vx if abs(vx) > 0.03 else 0.0
152
+ if 'yline' in st: # facing +x: hold world y with lateral velocity
153
+ vy = np.clip(-1.5 * (o[22] - st['yline']), -0.1, 0.1)
154
+ a[1] = vy if abs(vy) > 0.03 else 0.0
155
+ self.k += 1
156
+ if self.k >= n and self.i < len(self.steps) - 1:
157
+ self.L, self.R = list(L), list(R)
158
+ self.h, self.p = float(a[2]), float(a[4])
159
+ self.i += 1
160
+ self.k = 0
161
+ return a
policies/dishwasher_close/opus-s2/episodes.csv ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ seed,success,length,termination,fell
2
+ 620000,0,4650,timeout,0
3
+ 620001,0,4650,timeout,0
4
+ 620002,0,4650,timeout,0
5
+ 620003,0,4650,timeout,0
6
+ 620004,0,4650,timeout,0
7
+ 620005,0,4650,timeout,0
8
+ 620006,0,4650,timeout,0
9
+ 620007,0,4650,timeout,0
10
+ 620008,0,4650,timeout,0
11
+ 620009,0,4650,timeout,0
12
+ 620010,0,4650,timeout,0
13
+ 620011,0,4650,timeout,0
14
+ 620012,0,4650,timeout,0
15
+ 620013,0,4650,timeout,0
16
+ 620014,0,4650,timeout,0
17
+ 620015,0,4650,timeout,0
18
+ 620016,0,4650,timeout,0
19
+ 620017,0,4650,timeout,0
20
+ 620018,0,4650,timeout,0
21
+ 620019,0,4650,timeout,0
22
+ 620020,0,4650,timeout,0
23
+ 620021,0,4650,timeout,0
24
+ 620022,0,4650,timeout,0
25
+ 620023,0,4650,timeout,0
26
+ 620024,0,4650,timeout,0
27
+ 620025,0,4650,timeout,0
28
+ 620026,0,4650,timeout,0
29
+ 620027,0,4650,timeout,0
30
+ 620028,0,4650,timeout,0
31
+ 620029,0,4650,timeout,0
32
+ 620030,0,4650,timeout,0
33
+ 620031,0,4650,timeout,0
34
+ 620032,0,4650,timeout,0
35
+ 620033,0,4650,timeout,0
36
+ 620034,0,4650,timeout,0
37
+ 620035,0,4650,timeout,0
38
+ 620036,0,4650,timeout,0
39
+ 620037,0,4650,timeout,0
40
+ 620038,0,4650,timeout,0
41
+ 620039,0,4650,timeout,0
42
+ 620040,0,4650,timeout,0
43
+ 620041,0,4650,timeout,0
44
+ 620042,0,4650,timeout,0
45
+ 620043,0,4650,timeout,0
46
+ 620044,0,4650,timeout,0
47
+ 620045,0,4650,timeout,0
48
+ 620046,0,4650,timeout,0
49
+ 620047,0,4650,timeout,0
50
+ 620048,0,4650,timeout,0
51
+ 620049,0,4650,timeout,0
52
+ 620050,0,4650,timeout,0
53
+ 620051,0,4650,timeout,0
54
+ 620052,0,4650,timeout,0
55
+ 620053,0,4650,timeout,0
56
+ 620054,0,4650,timeout,0
57
+ 620055,0,4650,timeout,0
58
+ 620056,0,4650,timeout,0
59
+ 620057,0,4650,timeout,0
60
+ 620058,0,4650,timeout,0
61
+ 620059,0,4650,timeout,0
62
+ 620060,0,4650,timeout,0
63
+ 620061,0,4650,timeout,0
64
+ 620062,0,4650,timeout,0
65
+ 620063,0,4650,timeout,0
66
+ 620064,0,4650,timeout,0
67
+ 620065,0,4650,timeout,0
68
+ 620066,0,4650,timeout,0
69
+ 620067,0,4650,timeout,0
70
+ 620068,0,4650,timeout,0
71
+ 620069,0,4650,timeout,0
72
+ 620070,0,4650,timeout,0
73
+ 620071,0,4650,timeout,0
74
+ 620072,0,4650,timeout,0
75
+ 620073,0,4650,timeout,0
76
+ 620074,0,4650,timeout,0
77
+ 620075,0,4650,timeout,0
78
+ 620076,0,4650,timeout,0
79
+ 620077,0,4650,timeout,0
80
+ 620078,0,4650,timeout,0
81
+ 620079,0,4650,timeout,0
82
+ 620080,0,4650,timeout,0
83
+ 620081,0,4650,timeout,0
84
+ 620082,0,4650,timeout,0
85
+ 620083,0,4650,timeout,0
86
+ 620084,0,4650,timeout,0
87
+ 620085,0,4650,timeout,0
88
+ 620086,0,4650,timeout,0
89
+ 620087,0,4650,timeout,0
90
+ 620088,0,4650,timeout,0
91
+ 620089,0,4650,timeout,0
92
+ 620090,0,4650,timeout,0
93
+ 620091,0,4650,timeout,0
94
+ 620092,0,4650,timeout,0
95
+ 620093,0,4650,timeout,0
96
+ 620094,0,4650,timeout,0
97
+ 620095,0,4650,timeout,0
98
+ 620096,0,4650,timeout,0
99
+ 620097,0,4650,timeout,0
100
+ 620098,0,4650,timeout,0
101
+ 620099,0,4650,timeout,0
policies/dishwasher_close/opus-s2/policy.py ADDED
@@ -0,0 +1,153 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Scripted policy for dishwasher_close: push both racks in, then lift the door closed.
2
+
3
+ The robot walks in front of the dishwasher (it sits on the +y side of the start pose),
4
+ pushes the lower and the upper rack in with both hands, backs off, squats, slides both
5
+ hands under the edge of the open door, lifts it and walks forward pressing it shut.
6
+
7
+ Arm targets are given as hand positions (forward from pelvis, world height) and turned
8
+ into shoulder-pitch / elbow angles with a planar two-link model; the base is closed-loop
9
+ on the pelvis pose from low_dim_obs. No learned components, no randomness.
10
+ """
11
+
12
+ import numpy as np
13
+
14
+ L1, L2 = 0.197, 0.28
15
+ YAW = np.pi / 2
16
+
17
+
18
+ def ik(fwd, up):
19
+ """Hand (fwd, up) relative to the shoulder in the torso frame -> (shoulder pitch, elbow, forearm angle)."""
20
+ d = min(np.hypot(fwd, up), L1 + L2 - 1e-4)
21
+ gam = np.arccos(np.clip((L1 * L1 + L2 * L2 - d * d) / (2 * L1 * L2), -1, 1))
22
+ bend = np.pi - gam
23
+ phi = np.arctan2(fwd, -up)
24
+ alpha = np.arccos(np.clip((L1 * L1 + d * d - L2 * L2) / (2 * L1 * d), -1, 1))
25
+ t1 = phi - alpha
26
+ return -t1, np.pi / 2 - bend, t1 + bend
27
+
28
+
29
+ def goto(lo, tx, ty, tyaw, vmax=0.3, kp=1.2, tol=0.02):
30
+ """Body-frame velocity command towards a world pose; returns (vx, vy, wz, done)."""
31
+ x, y, yaw = lo[21], lo[22], lo[24]
32
+ dx, dy = tx - x, ty - y
33
+ c, s = np.cos(yaw), np.sin(yaw)
34
+ bx, by = c * dx + s * dy, -s * dx + c * dy
35
+ eyaw = (tyaw - yaw + np.pi) % (2 * np.pi) - np.pi
36
+ vx = np.clip(kp * bx, -vmax, vmax)
37
+ vy = np.clip(kp * by, -vmax, vmax)
38
+ sp = np.hypot(vx, vy)
39
+ dist = np.hypot(bx, by)
40
+ if dist < tol:
41
+ vx = vy = 0.0
42
+ elif sp < 0.07:
43
+ vx, vy = vx / sp * 0.07, vy / sp * 0.07
44
+ wz = np.clip(1.5 * eyaw, -0.6, 0.6)
45
+ if abs(eyaw) < 0.02:
46
+ wz = 0.0
47
+ elif abs(wz) < 0.1:
48
+ wz = 0.1 * np.sign(wz)
49
+ return vx, vy, wz, (dist < tol and abs(eyaw) < 0.03)
50
+
51
+
52
+ # ---------------------------------------------------------------- the script
53
+ Z_LOW, Z_HIGH = 0.68, 0.86
54
+ CLOSED = [1.0, 1.0]
55
+
56
+
57
+ def _h(n, x, y=-0.60, **kw):
58
+ return dict(x=x, y=y, yaw=YAW, vmax=0.2, kp=3.0, n=n, timeout=n, **kw)
59
+
60
+
61
+ def push(x, z, retract):
62
+ """Both hands push a rack at height z while the base holds x; then retract without dragging it."""
63
+ s = [dict(height=0.74, pitch=0.0, x=x, y=-0.66, yaw=YAW, timeout=400, n=10),
64
+ dict(hwl=(0.15, 0.95), hwr=(0.15, 0.95), g=CLOSED, n=40),
65
+ dict(height=0.58, pitch=0.6, hwl=(0.30, z + 0.25), hwr=(0.30, z + 0.25), n=50),
66
+ dict(hwl=(0.30, z), hwr=(0.30, z), **_h(40, x))]
67
+ for f in (0.4, 0.5, 0.6, 0.7):
68
+ s.append(dict(hwl=(f, z), hwr=(f, z), **_h(70, x)))
69
+ dz = 0.10 if retract == "up" else -0.10
70
+ s.append(dict(hwl=(0.67, z + dz), hwr=(0.67, z + dz), **_h(50, x)))
71
+ s.append(dict(hwl=(0.30, z + dz), hwr=(0.30, z + dz), **_h(50, x)))
72
+ s.append(dict(hwl=(0.30, z + 0.25), hwr=(0.30, z + 0.25), n=40))
73
+ return s
74
+
75
+
76
+ DX, DY = 0.33, -0.90
77
+ DOOR = [
78
+ dict(height=0.74, pitch=0.0, L=[0.0] * 7, R=[0.0] * 7, g=[0.6, 0.6], x=DX, y=DY, yaw=YAW, timeout=400, n=20),
79
+ dict(height=0.42, pitch=0.5, hwl=(0.25, 0.12), hwr=(0.25, 0.12), **_h(80, DX, DY)),
80
+ dict(hwl=(0.45, 0.12), hwr=(0.45, 0.12), **_h(80, DX, DY)),
81
+ dict(hwl=(0.45, 0.50), hwr=(0.45, 0.50), **_h(100, DX, DY)),
82
+ dict(hwl=(0.48, 0.80), hwr=(0.48, 0.80), **_h(100, DX, DY)),
83
+ dict(hwl=(0.52, 1.00), hwr=(0.52, 1.00), **_h(100, DX, DY)),
84
+ dict(height=0.74, pitch=0.2, hwl=(0.52, 1.00), hwr=(0.52, 1.00), **_h(80, DX, DY)),
85
+ dict(hwl=(0.52, 0.85), hwr=(0.52, 0.85), **_h(150, DX, -0.65)),
86
+ dict(hwl=(0.55, 0.75), hwr=(0.55, 0.75), **_h(150, DX, -0.55)),
87
+ dict(hwl=(0.60, 0.75), hwr=(0.60, 0.75), **_h(10 ** 6, DX, -0.55)),
88
+ ]
89
+
90
+ SEQ = (push(0.36, Z_LOW, "up") + push(0.55, Z_LOW, "up")
91
+ + push(0.40, Z_HIGH, "down") + push(0.55, Z_HIGH, "down") + DOOR)
92
+
93
+
94
+ class Policy:
95
+ """Open-loop script over segments, closed-loop base and hand-height tracking."""
96
+
97
+ def reset(self, obs, tools):
98
+ self.prev = np.asarray(tools.hold_action(), dtype=np.float64)
99
+ self.i = 0
100
+ self.k = 0
101
+ self.hw = {}
102
+
103
+ def _target(self, g):
104
+ a = self.prev.copy()
105
+ if "height" in g:
106
+ a[2] = g["height"]
107
+ if "pitch" in g:
108
+ a[4] = g["pitch"]
109
+ if "L" in g:
110
+ a[5:12] = g["L"]
111
+ if "R" in g:
112
+ a[12:19] = g["R"]
113
+ if "g" in g:
114
+ a[19:21] = g["g"]
115
+ return a
116
+
117
+ def act(self, obs, tools):
118
+ lo = np.asarray(obs["low_dim_obs"], dtype=np.float64)
119
+ g = SEQ[min(self.i, len(SEQ) - 1)]
120
+ tgt = self._target(g)
121
+ n = g.get("n", 1)
122
+ self.k += 1
123
+ al = min(1.0, self.k / max(1, n))
124
+ a = self.prev + (tgt - self.prev) * al
125
+ a[0] = a[1] = a[3] = 0.0
126
+ for key, sl in (("hwl", slice(5, 12)), ("hwr", slice(12, 19))):
127
+ if key in g:
128
+ p0 = np.array(self.hw.get(key, g[key]))
129
+ p1 = np.array(g[key])
130
+ p = p0 + (p1 - p0) * al
131
+ if self.k >= n:
132
+ self.hw[key] = tuple(p1)
133
+ pw, pz = lo[2], lo[23]
134
+ f = p[0] - 0.25 * np.sin(pw)
135
+ u = (p[1] - pz) - (0.044 + 0.25 * np.cos(pw))
136
+ ft = f * np.cos(pw) - u * np.sin(pw)
137
+ ut = f * np.sin(pw) + u * np.cos(pw)
138
+ sp, e, t2 = ik(ft, ut)
139
+ w = t2 - np.pi / 2 - pw
140
+ a[sl] = [sp, 0.0, 0.0, e, 0.0, float(np.clip(w, -1.6, 1.6)), 0.0]
141
+ tgt[sl] = a[sl]
142
+ if "x" in g:
143
+ vx, vy, wz, done = goto(lo, g["x"], g["y"], g["yaw"], vmax=g.get("vmax", 0.3), kp=g.get("kp", 1.2))
144
+ a[0], a[1], a[3] = vx, vy, wz
145
+ fin = (done and self.k >= n) or self.k > g.get("timeout", 400)
146
+ else:
147
+ fin = self.k >= n
148
+ if fin and self.i < len(SEQ) - 1:
149
+ self.prev = tgt.copy()
150
+ self.prev[0] = self.prev[1] = self.prev[3] = 0.0
151
+ self.i += 1
152
+ self.k = 0
153
+ return a.astype(np.float32).tolist()
policies/dishwasher_close/opus-s3/episodes.csv ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ seed,success,length,termination,fell
2
+ 620000,1,3357,success,0
3
+ 620001,1,3357,success,0
4
+ 620002,1,3357,success,0
5
+ 620003,1,3357,success,0
6
+ 620004,1,3357,success,0
7
+ 620005,1,3357,success,0
8
+ 620006,1,3357,success,0
9
+ 620007,1,3357,success,0
10
+ 620008,1,3357,success,0
11
+ 620009,1,3357,success,0
12
+ 620010,1,3357,success,0
13
+ 620011,1,3357,success,0
14
+ 620012,1,3357,success,0
15
+ 620013,1,3357,success,0
16
+ 620014,1,3357,success,0
17
+ 620015,1,3357,success,0
18
+ 620016,1,3357,success,0
19
+ 620017,1,3357,success,0
20
+ 620018,1,3357,success,0
21
+ 620019,1,3357,success,0
22
+ 620020,1,3357,success,0
23
+ 620021,1,3357,success,0
24
+ 620022,1,3357,success,0
25
+ 620023,1,3357,success,0
26
+ 620024,1,3357,success,0
27
+ 620025,1,3357,success,0
28
+ 620026,1,3357,success,0
29
+ 620027,1,3357,success,0
30
+ 620028,1,3357,success,0
31
+ 620029,1,3357,success,0
32
+ 620030,1,3357,success,0
33
+ 620031,1,3357,success,0
34
+ 620032,1,3357,success,0
35
+ 620033,1,3357,success,0
36
+ 620034,1,3357,success,0
37
+ 620035,1,3357,success,0
38
+ 620036,1,3357,success,0
39
+ 620037,1,3357,success,0
40
+ 620038,1,3357,success,0
41
+ 620039,1,3357,success,0
42
+ 620040,1,3357,success,0
43
+ 620041,1,3357,success,0
44
+ 620042,1,3357,success,0
45
+ 620043,1,3357,success,0
46
+ 620044,1,3357,success,0
47
+ 620045,1,3357,success,0
48
+ 620046,1,3357,success,0
49
+ 620047,1,3357,success,0
50
+ 620048,1,3357,success,0
51
+ 620049,1,3357,success,0
52
+ 620050,1,3357,success,0
53
+ 620051,1,3357,success,0
54
+ 620052,1,3357,success,0
55
+ 620053,1,3357,success,0
56
+ 620054,1,3357,success,0
57
+ 620055,1,3357,success,0
58
+ 620056,1,3357,success,0
59
+ 620057,1,3357,success,0
60
+ 620058,1,3357,success,0
61
+ 620059,1,3357,success,0
62
+ 620060,1,3357,success,0
63
+ 620061,1,3357,success,0
64
+ 620062,1,3357,success,0
65
+ 620063,1,3357,success,0
66
+ 620064,1,3357,success,0
67
+ 620065,1,3357,success,0
68
+ 620066,1,3357,success,0
69
+ 620067,1,3357,success,0
70
+ 620068,1,3357,success,0
71
+ 620069,1,3357,success,0
72
+ 620070,1,3357,success,0
73
+ 620071,1,3357,success,0
74
+ 620072,1,3357,success,0
75
+ 620073,1,3357,success,0
76
+ 620074,1,3357,success,0
77
+ 620075,1,3357,success,0
78
+ 620076,1,3357,success,0
79
+ 620077,1,3357,success,0
80
+ 620078,1,3357,success,0
81
+ 620079,1,3357,success,0
82
+ 620080,1,3357,success,0
83
+ 620081,1,3357,success,0
84
+ 620082,1,3357,success,0
85
+ 620083,1,3357,success,0
86
+ 620084,1,3357,success,0
87
+ 620085,1,3357,success,0
88
+ 620086,1,3357,success,0
89
+ 620087,1,3357,success,0
90
+ 620088,1,3357,success,0
91
+ 620089,1,3357,success,0
92
+ 620090,1,3357,success,0
93
+ 620091,1,3357,success,0
94
+ 620092,1,3357,success,0
95
+ 620093,1,3357,success,0
96
+ 620094,1,3357,success,0
97
+ 620095,1,3357,success,0
98
+ 620096,1,3357,success,0
99
+ 620097,1,3357,success,0
100
+ 620098,1,3357,success,0
101
+ 620099,1,3357,success,0
policies/dishwasher_close/opus-s3/policy.py ADDED
@@ -0,0 +1,291 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Dishwasher close: push both racks in, then lift the door shut.
2
+
3
+ Scripted policy. The scene layout is fixed (the dishwasher faces -x, its door
4
+ hinge is at about x=0.62, z=0.47 in the world frame); the robot localises with
5
+ the pelvis pose from low_dim_obs. Hand targets are converted to joint targets
6
+ with an approximate G1 arm model and a small numerical IK.
7
+ """
8
+
9
+ import numpy as np
10
+ from scipy.optimize import least_squares
11
+
12
+ L, R = 5, 12
13
+ Y0 = -0.03 # lateral position in front of the dishwasher
14
+ XS = -0.14 # standing x in front of the open door
15
+ YSIDE = -0.47 # lateral position beside the door for pushing the racks
16
+ HX, HZ = 0.62, 0.47 # door hinge (world x, z)
17
+
18
+ # ---------------------------------------------------------------- kinematics
19
+
20
+
21
+ def _rx(a):
22
+ c, s = np.cos(a), np.sin(a)
23
+ return np.array([[1, 0, 0], [0, c, -s], [0, s, c]])
24
+
25
+
26
+ def _ry(a):
27
+ c, s = np.cos(a), np.sin(a)
28
+ return np.array([[c, 0, s], [0, 1, 0], [-s, 0, c]])
29
+
30
+
31
+ def _rz(a):
32
+ c, s = np.cos(a), np.sin(a)
33
+ return np.array([[c, -s, 0], [s, c, 0], [0, 0, 1]])
34
+
35
+
36
+ def arm_fk(q, side, waist_pitch=0.0, tip=0.12):
37
+ """Wrist and gripper-tip positions in the pelvis frame (x fwd, y left, z up)."""
38
+ sg = 1 if side == 'left' else -1
39
+ Rm = _ry(waist_pitch)
40
+ p = np.array([-0.0039635, 0, 0.054])
41
+ p = p + Rm @ np.array([0.0039563, sg * 0.10022, 0.23778])
42
+ Rm = Rm @ _rx(sg * 0.2793)
43
+ Rm = Rm @ _ry(q[0])
44
+ p = p + Rm @ np.array([0, sg * 0.038, -0.013831])
45
+ Rm = Rm @ _rx(-sg * 0.2793) @ _rx(q[1])
46
+ p = p + Rm @ np.array([0, sg * 0.00624, -0.1032])
47
+ Rm = Rm @ _rz(q[2])
48
+ p = p + Rm @ np.array([0.015783, 0, -0.080518])
49
+ Rm = Rm @ _ry(q[3])
50
+ p = p + Rm @ np.array([0.100, sg * 0.00188791, -0.010])
51
+ Rm = Rm @ _rx(q[4])
52
+ p = p + Rm @ np.array([0.038, 0, 0])
53
+ Rm = Rm @ _ry(q[5])
54
+ p = p + Rm @ np.array([0.046, 0, 0])
55
+ Rm = Rm @ _rz(q[6])
56
+ return p, p + Rm @ np.array([tip, 0, 0])
57
+
58
+
59
+ _LO = np.array([-3.0892, -0.3, -0.6, -1.0472, -1.97, -1.614, -1.614])
60
+ _HI = np.array([2.6704, 1.2, 0.6, 2.0944, 1.97, 1.614, 1.614])
61
+ _FREE = [0, 1, 2, 3, 5]
62
+
63
+
64
+ def ik(tip, side, wp, q0=None):
65
+ """Joint angles putting the gripper tip at `tip` (pelvis frame)."""
66
+ sg = 1 if side == 'left' else -1
67
+ lo, hi = _LO.copy(), _HI.copy()
68
+ if side == 'right':
69
+ lo[[1, 2, 4, 6]], hi[[1, 2, 4, 6]] = -_HI[[1, 2, 4, 6]], -_LO[[1, 2, 4, 6]]
70
+ if q0 is None:
71
+ q0 = np.array([-0.5, sg * 0.2, 0, 0.8, 0, 0, 0])
72
+ tip = np.asarray(tip, float)
73
+ wpa = wp - 0.07
74
+
75
+ def full(x):
76
+ q = np.zeros(7)
77
+ q[_FREE] = x
78
+ return q
79
+
80
+ def res(x):
81
+ _, t = arm_fk(full(x), side, wpa)
82
+ return np.concatenate([t - tip, 0.02 * (x - q0[_FREE])])
83
+
84
+ def err(x):
85
+ return np.linalg.norm(arm_fk(full(x), side, wpa)[1] - tip)
86
+
87
+ starts = [q0[_FREE], np.array([-0.5, sg * 0.2, 0, 0.8, 0]),
88
+ np.array([-1.2, sg * 0.2, 0, 1.2, 0])]
89
+ best = None
90
+ for x0 in starts:
91
+ x0 = np.clip(x0, lo[_FREE] + 1e-3, hi[_FREE] - 1e-3)
92
+ s = least_squares(res, x0, bounds=(lo[_FREE], hi[_FREE]), max_nfev=40)
93
+ e = err(s.x)
94
+ if best is None or e < best[1] - 0.01:
95
+ best = (s.x, e)
96
+ if best[1] < 0.03:
97
+ break
98
+ return full(best[0]), best[1]
99
+
100
+
101
+ def wrap(a):
102
+ return (a + np.pi) % (2 * np.pi) - np.pi
103
+
104
+
105
+ # ---------------------------------------------------------------- policy
106
+
107
+
108
+ class Policy:
109
+ """The control policy that is scored on the hidden seeds."""
110
+
111
+ def reset(self, obs, tools):
112
+ self.obs = obs
113
+ self.q = [None, None]
114
+ self.gen = self.plan(np.array(tools.hold_action(), dtype=np.float64))
115
+ self.last = None
116
+
117
+ def act(self, obs, tools):
118
+ self.obs = obs
119
+ try:
120
+ a = next(self.gen)
121
+ self.last = a
122
+ except StopIteration:
123
+ a = self.last.copy()
124
+ a[0] = a[1] = a[3] = 0.0
125
+ return np.asarray(a, dtype=np.float32)
126
+
127
+ # ---- helpers
128
+ def pose(self):
129
+ lo = self.obs['low_dim_obs']
130
+ return float(lo[21]), float(lo[22]), float(lo[24])
131
+
132
+ def base_cmd(self, tx, ty, tyaw, kp=1.2, vmax=0.4, mind=0.02):
133
+ x, y, yaw = self.pose()
134
+ dx, dy = tx - x, ty - y
135
+ c, s = np.cos(yaw), np.sin(yaw)
136
+ vx, vy = kp * (c * dx + s * dy), kp * (-s * dx + c * dy)
137
+ n = np.hypot(vx, vy)
138
+ if n > vmax:
139
+ vx, vy = vx * vmax / n, vy * vmax / n
140
+ n = np.hypot(vx, vy)
141
+ if n < 0.065:
142
+ if n > 1e-6 and np.hypot(dx, dy) > mind:
143
+ vx, vy = vx * 0.065 / n, vy * 0.065 / n
144
+ else:
145
+ vx = vy = 0.0
146
+ wz = float(np.clip(1.5 * wrap(tyaw - yaw), -0.8, 0.8))
147
+ if abs(wz) < 0.05:
148
+ wz = 0.0
149
+ return vx, vy, wz, np.hypot(dx, dy), abs(wrap(tyaw - yaw))
150
+
151
+ def goto(self, a, tx, ty, tyaw, tol=0.03, ytol=0.05, maxsteps=500, settle=30):
152
+ for _ in range(maxsteps):
153
+ vx, vy, wz, d, dyaw = self.base_cmd(tx, ty, tyaw, mind=tol * 0.7)
154
+ if d < tol and dyaw < ytol:
155
+ break
156
+ a[0], a[1], a[3] = vx, vy, wz
157
+ yield a.copy()
158
+ a[0] = a[1] = a[3] = 0.0
159
+ for _ in range(settle):
160
+ yield a.copy()
161
+
162
+ def hold(self, a, n):
163
+ for _ in range(n):
164
+ yield a.copy()
165
+
166
+ def arms_to(self, a, xw, zw, lat=0.17):
167
+ """Both gripper tips to world x=xw, height zw, +-lat sideways of the pelvis."""
168
+ lo = self.obs['low_dim_obs']
169
+ x, _, _ = self.pose()
170
+ zp, wp = float(lo[23]), float(lo[2])
171
+ f = xw - x
172
+ ql, el = ik([f, lat, zw - zp], 'left', wp, self.q[0])
173
+ qr, _ = ik([f, -lat, zw - zp], 'right', wp, self.q[1])
174
+ self.q = [ql, qr]
175
+ a[L:L + 7] = ql
176
+ a[R:R + 7] = qr
177
+ return el
178
+
179
+ @staticmethod
180
+ def tuck_up(a):
181
+ for base, sg in ((L, 1), (R, -1)):
182
+ a[base:base + 7] = 0
183
+ a[base + 0], a[base + 1], a[base + 3] = 0.3, sg * 0.25, -1.0
184
+
185
+ @staticmethod
186
+ def tuck_down(a):
187
+ for base, sg in ((L, 1), (R, -1)):
188
+ a[base:base + 7] = 0
189
+ a[base + 0], a[base + 1], a[base + 3] = 0.0, sg * 0.15, 1.4
190
+
191
+ def side_push(self, a, zw, x_end, f=0.35, lat=0.3):
192
+ """Beside the door, hold the left hand inward at height zw and walk forward."""
193
+ self.q = [None, None]
194
+ self.tuck_up(a)
195
+ yield from self.goto(a, -0.45, YSIDE, 0.0, tol=0.02, ytol=0.02)
196
+ lo = self.obs['low_dim_obs']
197
+ for _ in range(40):
198
+ ql, _ = ik([f, lat, zw - float(lo[23])], 'left', float(lo[2]), self.q[0])
199
+ self.q[0] = ql
200
+ a[L:L + 7] = ql
201
+ yield a.copy()
202
+ for _ in range(700):
203
+ x, _, _ = self.pose()
204
+ if x > x_end:
205
+ break
206
+ _, vy, wz, _, _ = self.base_cmd(x_end, YSIDE, 0.0, kp=2.0)
207
+ a[0], a[1], a[3] = 0.12, vy, wz
208
+ lo = self.obs['low_dim_obs']
209
+ ql, _ = ik([f, lat, zw - float(lo[23])], 'left', float(lo[2]), self.q[0])
210
+ self.q[0] = ql
211
+ a[L:L + 7] = ql
212
+ yield a.copy()
213
+ a[0] = a[1] = a[3] = 0.0
214
+ yield from self.hold(a, 30)
215
+ self.tuck_up(a)
216
+ yield from self.hold(a, 30)
217
+ yield from self.goto(a, -0.45, YSIDE, 0.0, tol=0.03, ytol=0.05)
218
+
219
+ def push(self, a, zp, n=250, lat=0.08):
220
+ """Sweep both hands forward at height zp to push a rack in."""
221
+ self.arms_to(a, self.pose()[0] + 0.15, zp, lat=lat)
222
+ yield from self.hold(a, 30)
223
+ for k in range(n + 30):
224
+ f = 0.15 + 0.5 * min(1.0, k / n)
225
+ if a[2] > 0.7:
226
+ vx, vy, wz, _, _ = self.base_cmd(XS, Y0, 0.0, kp=2.0, vmax=0.2)
227
+ a[0], a[1], a[3] = vx, vy, wz
228
+ self.arms_to(a, self.pose()[0] + f, zp, lat=lat)
229
+ yield a.copy()
230
+ for k in range(30):
231
+ self.arms_to(a, self.pose()[0] + 0.1, zp + 0.05, lat=lat)
232
+ yield a.copy()
233
+ a[0] = a[1] = a[3] = 0.0
234
+
235
+ @staticmethod
236
+ def door_pt(th, push=0.02):
237
+ r = 0.5 - 0.1 * min(1.0, th / 1.57)
238
+ return (HX - r * np.cos(th) + push * np.sin(th),
239
+ HZ + r * np.sin(th) + push * np.cos(th) - 0.03)
240
+
241
+ # ---- the task
242
+ def plan(self, a):
243
+ a[19] = a[20] = 0.0
244
+ self.tuck_up(a)
245
+ yield from self.goto(a, -0.6, -0.8, 0.0, tol=0.03, ytol=0.05)
246
+
247
+ # 1. push the racks in from beside the door, walking forward
248
+ a[4] = 0.3
249
+ yield from self.side_push(a, 0.8, 0.25)
250
+ yield from self.side_push(a, 0.62, 0.35)
251
+ a[4] = 0.0
252
+
253
+ # 2. arms down-forward, go in front of the door and squat
254
+ yield from self.goto(a, -0.6, YSIDE, 0.0, tol=0.03, ytol=0.05)
255
+ yield from self.goto(a, -0.6, Y0, 0.0, tol=0.02, ytol=0.02)
256
+ self.q = [None, None]
257
+ yield from self.goto(a, XS - 0.25, Y0, 0.0, tol=0.02, ytol=0.02)
258
+ self.tuck_down(a)
259
+ yield from self.hold(a, 30)
260
+ yield from self.goto(a, XS, Y0, 0.0, tol=0.012, ytol=0.015)
261
+ a[2], a[4] = 0.62, 0.7
262
+ yield from self.hold(a, 70)
263
+ x0 = self.pose()[0]
264
+ for xw in np.linspace(x0 + 0.15, 0.12, 5):
265
+ self.arms_to(a, xw, 0.43)
266
+ yield from self.hold(a, 15)
267
+
268
+ # 3. lift the door along its arc, standing up and walking in behind it
269
+ th, k, e = 0.0, 0, 0.0
270
+ while th < 1.75 and k < 1400:
271
+ k += 1
272
+ px, pz = self.door_pt(th)
273
+ a[2] = 0.62 + 0.12 * np.clip((th - 0.08) / 0.25, 0, 1)
274
+ a[4] = 0.7 if th < 0.8 else 0.5
275
+ if a[2] >= 0.7:
276
+ tx = min(px - 0.33, 0.3)
277
+ vx, vy, wz, _, _ = self.base_cmd(tx, Y0, 0.0, kp=2.0, vmax=0.3)
278
+ a[0], a[1], a[3] = vx, vy, wz
279
+ if e < 0.06:
280
+ th += 0.004
281
+ if k % 2 == 0:
282
+ e = self.arms_to(a, px, pz)
283
+ yield a.copy()
284
+
285
+ # 4. keep pressing the door shut
286
+ while True:
287
+ px, pz = self.door_pt(1.75)
288
+ vx, vy, wz, _, _ = self.base_cmd(px - 0.33, Y0, 0.0, kp=2.0, vmax=0.3)
289
+ a[0], a[1], a[3] = vx, vy, wz
290
+ self.arms_to(a, px + 0.03, pz)
291
+ yield a.copy()
policies/dishwasher_load_cups/astra-s1/episodes.csv ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ seed,success,length,termination,fell
2
+ 620000,0,2000,timeout,0
3
+ 620001,0,2000,timeout,0
4
+ 620002,0,2000,timeout,0
5
+ 620003,0,2000,timeout,0
6
+ 620004,1,1618,success,0
7
+ 620005,0,2000,timeout,0
8
+ 620006,1,1976,success,0
9
+ 620007,0,2000,timeout,0
10
+ 620008,0,2000,timeout,0
11
+ 620009,0,2000,timeout,0
12
+ 620010,0,2000,timeout,0
13
+ 620011,0,2000,timeout,0
14
+ 620012,1,1704,success,0
15
+ 620013,0,2000,timeout,0
16
+ 620014,0,2000,timeout,0
17
+ 620015,0,2000,timeout,0
18
+ 620016,0,2000,timeout,0
19
+ 620017,0,2000,timeout,0
20
+ 620018,0,2000,timeout,0
21
+ 620019,0,2000,timeout,0
22
+ 620020,0,1563,terminated,0
23
+ 620021,1,1735,success,0
24
+ 620022,1,1433,success,0
25
+ 620023,0,2000,timeout,0
26
+ 620024,0,2000,timeout,0
27
+ 620025,0,2000,timeout,0
28
+ 620026,0,2000,timeout,0
29
+ 620027,0,2000,timeout,0
30
+ 620028,0,2000,timeout,0
31
+ 620029,0,2000,timeout,0
32
+ 620030,0,2000,timeout,0
33
+ 620031,0,2000,timeout,0
34
+ 620032,0,2000,timeout,0
35
+ 620033,0,2000,timeout,0
36
+ 620034,0,2000,timeout,0
37
+ 620035,0,2000,timeout,0
38
+ 620036,0,2000,timeout,0
39
+ 620037,0,2000,timeout,0
40
+ 620038,0,2000,timeout,0
41
+ 620039,0,2000,timeout,0
42
+ 620040,0,2000,timeout,0
43
+ 620041,0,2000,timeout,0
44
+ 620042,1,1753,success,0
45
+ 620043,0,2000,timeout,0
46
+ 620044,0,2000,timeout,0
47
+ 620045,0,2000,timeout,0
48
+ 620046,0,2000,timeout,0
49
+ 620047,0,2000,timeout,0
50
+ 620048,0,2000,timeout,0
51
+ 620049,1,1680,success,0
52
+ 620050,0,2000,timeout,0
53
+ 620051,1,1920,success,0
54
+ 620052,0,2000,timeout,0
55
+ 620053,0,1786,terminated,0
56
+ 620054,0,2000,timeout,0
57
+ 620055,0,2000,timeout,0
58
+ 620056,0,2000,timeout,0
59
+ 620057,1,1671,success,0
60
+ 620058,0,2000,timeout,0
61
+ 620059,0,2000,timeout,0
62
+ 620060,1,1740,success,0
63
+ 620061,0,2000,timeout,0
64
+ 620062,1,1557,success,0
65
+ 620063,0,2000,timeout,0
66
+ 620064,0,2000,timeout,0
67
+ 620065,0,2000,timeout,0
68
+ 620066,0,2000,timeout,0
69
+ 620067,0,2000,timeout,0
70
+ 620068,1,1447,success,0
71
+ 620069,0,2000,timeout,0
72
+ 620070,0,2000,timeout,0
73
+ 620071,0,2000,timeout,0
74
+ 620072,0,1828,terminated,0
75
+ 620073,0,2000,timeout,0
76
+ 620074,0,2000,timeout,0
77
+ 620075,0,2000,timeout,0
78
+ 620076,0,2000,timeout,0
79
+ 620077,1,1591,success,0
80
+ 620078,0,2000,timeout,0
81
+ 620079,1,1911,success,0
82
+ 620080,0,2000,timeout,0
83
+ 620081,0,2000,timeout,0
84
+ 620082,1,1752,success,0
85
+ 620083,0,1651,terminated,0
86
+ 620084,0,2000,timeout,0
87
+ 620085,0,2000,timeout,0
88
+ 620086,0,2000,timeout,0
89
+ 620087,0,2000,timeout,0
90
+ 620088,0,2000,timeout,0
91
+ 620089,0,2000,timeout,0
92
+ 620090,0,2000,timeout,0
93
+ 620091,0,2000,timeout,0
94
+ 620092,1,1696,success,0
95
+ 620093,0,2000,timeout,0
96
+ 620094,1,1771,success,0
97
+ 620095,0,2000,timeout,0
98
+ 620096,0,2000,timeout,0
99
+ 620097,0,2000,timeout,0
100
+ 620098,1,1777,success,0
101
+ 620099,0,2000,timeout,0
policies/dishwasher_load_cups/astra-s1/policy.py ADDED
@@ -0,0 +1,541 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Deterministic hand-written control for loading two mugs into the upper rack.
2
+
3
+ The controller uses color thresholds, connected components, and handle-opening
4
+ contours from the wrist cameras. Proprioception closes the navigation loop and
5
+ checks gripper closure. Arm targets interpolate during lifting and placement.
6
+ No learned components, external files, randomness, or clock inputs are used.
7
+ """
8
+ import numpy as np
9
+ import cv2
10
+
11
+ def _near_handles(im, side=0):
12
+ a = im.astype(np.int16)
13
+ lo = a.min(2)
14
+ hi = a.max(2)
15
+ gray = (hi - lo < 18) & (lo > 70) & (hi < 225)
16
+ near = cv2.boxFilter(gray.astype(np.float32), -1, (9, 9), normalize=False)
17
+ m = (lo > 205) & (hi - lo < 18) & (near > 10)
18
+ if True:
19
+ contours, hierarchy = cv2.findContours(((hi - lo < 20) & (lo > 70)).astype('uint8'), cv2.RETR_CCOMP, cv2.CHAIN_APPROX_SIMPLE)
20
+ holes = []
21
+ if hierarchy is not None:
22
+ for k, c in enumerate(contours):
23
+ x, y, w, h = cv2.boundingRect(c)
24
+ if hierarchy[0, k, 3] >= 0 and 10 < x < 72 and (y < 50) and (h > 12) and (h > w * 1.4) and (cv2.contourArea(c) > 12):
25
+ left = gray[y:y + h, max(0, x - 18):x].sum()
26
+ right = gray[y:y + h, x + w:min(84, x + w + 18)].sum()
27
+ hx = x + w + 1 if left > right else x - 2
28
+ holes.append((h / (1 + abs(hx - 42) * 0.025), np.array([hx, y + h * 0.5, w, h * 1.3, cv2.contourArea(c)])))
29
+ if holes:
30
+ return max(holes, key=lambda a: a[0])[1]
31
+ if side:
32
+ m = cv2.morphologyEx(m.astype('uint8'), cv2.MORPH_OPEN, np.ones((5, 2), np.uint8)) > 0
33
+ m[:7] = False
34
+ m[64:] = False
35
+ m[:, :4] = False
36
+ m[:, 80:] = False
37
+ n, lab, st, ct = cv2.connectedComponentsWithStats(m.astype('uint8'))
38
+ out = []
39
+ for j in range(1, n):
40
+ x, y, w, h, area = st[j]
41
+ if area >= 7 and h >= 6 and (w < 40) and (h > w * 0.8):
42
+ score = area * h / (w + 3) / (1 + abs(ct[j, 0] - 42) * 0.035)
43
+ ys, xs = np.where(lab == j)
44
+ lower = xs[ys > y + h * 0.5]
45
+ hx = float(np.mean(lower)) if len(lower) > 2 else ct[j, 0]
46
+ out.append((score, np.array([hx, ct[j, 1], w, h, area], float)))
47
+ return max(out, key=lambda z: z[0])[1] if out else None
48
+
49
+ def mug_region(im):
50
+ a = im.astype(np.int16)
51
+ lo = a.min(2)
52
+ hi = a.max(2)
53
+ m = ((hi - lo < 18) & (lo > 80) & (hi < 225)).astype('uint8')
54
+ m[64:] = 0
55
+ n, lb, st, ct = cv2.connectedComponentsWithStats(m)
56
+ cand = []
57
+ for k in range(1, n):
58
+ x, y, w, h, area = st[k]
59
+ if area > 65 and h > 12 and (y < 45):
60
+ cand.append((area / (1 + abs(ct[k, 0] - 42) * 0.02), (x, y, w, h)))
61
+ return max(cand, key=lambda z: z[0])[1] if cand else None
62
+
63
+ class _NearPolicy:
64
+ """Approach close mugs from the initial stance."""
65
+
66
+ def reset(self, obs, tools):
67
+ self.a = np.asarray(tools.hold_action(), float)
68
+ self.a[19:] = 0
69
+ self.state = 'raise'
70
+ self.age = 0
71
+ self.side = 0
72
+ self.tries = 0
73
+ self.cycles = 0
74
+ self.target = self.a.copy()
75
+ self.start = self.a.copy()
76
+ self.initial = obs['low_dim_obs'][21:25].copy()
77
+ self.navtarget = None
78
+ self.held = [False, False]
79
+ self.last_seen = None
80
+ self.align = 0
81
+ self.target[5:12] = [-1, 0, 0, -0.5, 0, 0, 0]
82
+ self.target[12:19] = [-1, 0, 0, -0.5, 0, 0, 0]
83
+
84
+ def enter(self, name):
85
+ self.state = name
86
+ self.age = 0
87
+ self.start = self.a.copy()
88
+ self.target = self.a.copy()
89
+ self.target[:2] = 0
90
+ self.target[3] = 0
91
+
92
+ def arm(self, q):
93
+ j = 5 + 7 * self.side
94
+ self.target[j:j + 7] = q
95
+
96
+ def nav(self, obs, tar, speed=0.2):
97
+ p = obs['low_dim_obs'][21:25]
98
+ e = np.asarray(tar[:2]) - p[:2]
99
+ v = e * 2.5
100
+ norm = np.linalg.norm(v)
101
+ if np.linalg.norm(e) < 0.018:
102
+ v *= 0
103
+ elif norm < 0.065:
104
+ v *= 0.065 / max(norm, 1e-06)
105
+ elif norm > speed:
106
+ v *= speed / norm
107
+ c, s = (np.cos(p[3]), np.sin(p[3]))
108
+ self.a[0] = c * v[0] + s * v[1]
109
+ self.a[1] = -s * v[0] + c * v[1]
110
+ self.a[3] = np.clip((tar[2] - p[3]) * 2, -0.5, 0.5)
111
+ return np.linalg.norm(e) < 0.03 and abs(tar[2] - p[3]) < 0.06
112
+
113
+ def act(self, obs, tools):
114
+ self.age += 1
115
+ p = obs['low_dim_obs']
116
+ j = 5 + 7 * self.side
117
+ g = 19 + self.side
118
+ self.a[:2] = 0
119
+ self.a[3] = 0
120
+ st = self.state
121
+ if st == 'raise':
122
+ self.a = self.start + (self.target - self.start) * min(1, self.age / 45)
123
+ if self.age >= 75:
124
+ self.enter('initial_settle')
125
+ elif st == 'initial_settle':
126
+ self.a = self.target.copy()
127
+ if self.age >= 20:
128
+ self.enter('prepare')
129
+ self.arm([-1.1, 0.24, 0, 1.1, 0, -0.3, 0])
130
+ elif st == 'prepare':
131
+ self.a = self.start + (self.target - self.start) * min(1, self.age / 40)
132
+ if self.age >= 55:
133
+ self.enter('align')
134
+ self.align = 0
135
+ elif st == 'align':
136
+ self.a = self.target.copy()
137
+ if self.age % 8 == 0:
138
+ im = tools.image('left_wrist' if self.side == 0 else 'right_wrist')
139
+ h = _near_handles(im, self.side)
140
+ self.last_seen = h
141
+ if h is not None:
142
+ ex = 42 - h[0]
143
+ ey = h[1] - 30
144
+ axis = j + 1 if self.side == 0 else j + 2
145
+ self.target[axis] = np.clip(self.target[axis] + np.clip(ex * 0.0015, -0.018, 0.018), -0.45, 0.65)
146
+ self.target[j + 6] = np.clip(self.target[j + 6] + np.clip(ex * 0.001, -0.012, 0.012), -0.35, 0.35)
147
+ self.target[j + 5] = np.clip(self.target[j + 5] + np.clip(ey * 0.0015, -0.018, 0.018), -1.3, 0.45)
148
+ if abs(ex) < 7 and abs(ey) < 11:
149
+ self.align += 1
150
+ else:
151
+ self.align = 0
152
+ if self.age > 35 and self.align >= 2:
153
+ if h[3] >= 34 or (self.side == 1 and self.cycles >= 1 and (h[3] >= 26)) or self.cycles >= 8:
154
+ self.enter('close')
155
+ self.target[g] = 1
156
+ else:
157
+ self.enter('approach')
158
+ self.navtarget = [float(p[21] + (0.055 if self.side == 0 else 0.075)), float(self.initial[1]), 0]
159
+ self.cycles += 1
160
+ else:
161
+ box = mug_region(im)
162
+ if box is not None:
163
+ x, y, w, hb = box
164
+ axis = j + 1 if self.side == 0 else j + 2
165
+ if x < 5:
166
+ self.target[axis] = min(0.65, self.target[axis] + 0.025)
167
+ self.target[j + 6] = min(0.35, self.target[j + 6] + 0.015)
168
+ elif x + w > 79:
169
+ self.target[axis] = max(-0.45, self.target[axis] - 0.025)
170
+ self.target[j + 6] = max(-0.35, self.target[j + 6] - 0.015)
171
+ self.target[j + 5] = np.clip(self.target[j + 5] + np.clip((y + hb - 52) * 0.002, -0.022, 0.022), -1.3, 0.45)
172
+ if self.age > 220:
173
+ self.enter('close')
174
+ self.target[g] = 1
175
+ elif st == 'approach':
176
+ self.a = self.target.copy()
177
+ self.nav(obs, self.navtarget, 0.14 if self.side == 0 else 0.2)
178
+ if self.age >= 80:
179
+ self.enter('settle')
180
+ elif st == 'settle':
181
+ self.a = self.target.copy()
182
+ if self.age >= 25:
183
+ self.enter('align')
184
+ self.align = 0
185
+ elif st == 'close':
186
+ self.a = self.target.copy()
187
+ if self.age >= 25:
188
+ inds = [10, 11] if self.side == 0 else [19, 20]
189
+ if np.mean(p[inds]) > -0.0155:
190
+ self.held[self.side] = True
191
+ self.enter('lift')
192
+ delta = min(0.85, 2.05 - self.target[j + 3])
193
+ self.target[j] -= delta
194
+ self.target[j + 3] += delta
195
+ if self.side == 0:
196
+ self.target[j + 1] = 0.55
197
+ self.target[j + 6] = 0
198
+ elif self.tries < 5:
199
+ self.tries += 1
200
+ self.enter('reopen')
201
+ self.target[g] = 0
202
+ else:
203
+ self.enter('lift')
204
+ self.target[j] -= 0.55
205
+ self.target[j + 3] += 0.55
206
+ elif st == 'reopen':
207
+ self.a = self.target.copy()
208
+ if self.age >= 15:
209
+ self.enter('approach')
210
+ self.navtarget = [float(p[21] + 0.06), float(self.initial[1]), 0]
211
+ self.cycles += 1
212
+ elif st == 'lift':
213
+ self.a = self.start + (self.target - self.start) * min(1, self.age / 65)
214
+ if self.age >= 75:
215
+ if self.side == 0:
216
+ self.side = 1
217
+ self.tries = 0
218
+ self.cycles = 0
219
+ self.enter('right_retreat')
220
+ else:
221
+ self.enter('carry')
222
+ self.target[5:12] = [-1.8, 0.35, 0, 1.8, 0, -0.03, 0]
223
+ self.right_carry = self.target[12:19].copy()
224
+ elif st == 'right_retreat':
225
+ self.a = self.target.copy()
226
+ if self.age >= 5:
227
+ self.enter('right_settle')
228
+ elif st == 'right_settle':
229
+ self.a = self.target.copy()
230
+ if self.age >= 10:
231
+ self.enter('prepare')
232
+ self.arm([-1.1, 0.1, 0, 1.5, 0, -1.0, 0])
233
+ elif st == 'carry':
234
+ self.a = self.start + (self.target - self.start) * min(1, self.age / 50)
235
+ if self.age >= 60:
236
+ self.enter('to_rack')
237
+ elif st == 'to_rack':
238
+ self.a = self.target.copy()
239
+ reached = self.nav(obs, [-0.055, -0.55, 0.65], 0.18)
240
+ if reached and self.age > 90 or self.age > 200:
241
+ self.side = 0
242
+ self.enter('lower')
243
+ self.target[5] = -1.0
244
+ self.target[8] = 1.0
245
+ self.target[2] = 0.67
246
+ elif st == 'lower':
247
+ self.a = self.start + (self.target - self.start) * min(1, self.age / 80)
248
+ if self.age >= 100:
249
+ self.enter('release')
250
+ self.target[g] = 0
251
+ elif st == 'release':
252
+ self.a = self.target.copy()
253
+ if self.age >= 55:
254
+ if self.side == 0:
255
+ self.enter('retract')
256
+ self.target[5] = -1.5
257
+ self.target[8] = -0.3
258
+ self.target[2] = 0.74
259
+ else:
260
+ self.enter('done')
261
+ elif st == 'retract':
262
+ self.a = self.start + (self.target - self.start) * min(1, self.age / 60)
263
+ if self.age >= 65:
264
+ self.side = 1
265
+ self.enter('right_rack')
266
+ elif st == 'right_rack':
267
+ self.a = self.target.copy()
268
+ reached = self.nav(obs, [-0.055, -0.5, 1.3], 0.15)
269
+ if reached and self.age > 80 or self.age > 160:
270
+ self.enter('lower')
271
+ self.target[12] = -0.95
272
+ self.target[15] = 1.35
273
+ self.target[2] = 0.67
274
+ else:
275
+ self.a = self.target.copy()
276
+ return self.a.copy()
277
+
278
+ def _far_handles(im, side=0):
279
+ a = im.astype(np.int16)
280
+ lo = a.min(2)
281
+ hi = a.max(2)
282
+ gray = (hi - lo < 18) & (lo > 70) & (hi < 225)
283
+ near = cv2.boxFilter(gray.astype(np.float32), -1, (9, 9), normalize=False)
284
+ m = (lo > 205) & (hi - lo < 18) & (near > 10)
285
+ if side:
286
+ contours, hierarchy = cv2.findContours(((hi - lo < 20) & (lo > 70)).astype('uint8'), cv2.RETR_CCOMP, cv2.CHAIN_APPROX_SIMPLE)
287
+ holes = []
288
+ if hierarchy is not None:
289
+ for k, c in enumerate(contours):
290
+ x, y, w, h = cv2.boundingRect(c)
291
+ if hierarchy[0, k, 3] >= 0 and 10 < x < 72 and (y < 50) and (h > 12) and (h > w * 1.4) and (cv2.contourArea(c) > 12):
292
+ holes.append((h / (1 + abs(x - 42) * 0.025), np.array([x - 2, y + h * 0.5, w, h * 1.3, cv2.contourArea(c)])))
293
+ if holes:
294
+ return max(holes, key=lambda a: a[0])[1]
295
+ m = cv2.morphologyEx(m.astype('uint8'), cv2.MORPH_OPEN, np.ones((5, 2), np.uint8)) > 0
296
+ m[:7] = False
297
+ m[64:] = False
298
+ m[:, :4] = False
299
+ m[:, 80:] = False
300
+ n, lab, st, ct = cv2.connectedComponentsWithStats(m.astype('uint8'))
301
+ out = []
302
+ for j in range(1, n):
303
+ x, y, w, h, area = st[j]
304
+ if area >= 7 and h >= 6 and (w < 40) and (h > w * 0.8):
305
+ score = area * h / (w + 3) / (1 + abs(ct[j, 0] - 42) * 0.035)
306
+ ys, xs = np.where(lab == j)
307
+ lower = xs[ys > y + h * 0.5]
308
+ hx = float(np.mean(lower)) if len(lower) > 2 else ct[j, 0]
309
+ out.append((score, np.array([hx, ct[j, 1], w, h, area], float)))
310
+ return max(out, key=lambda z: z[0])[1] if out else None
311
+
312
+ class _FarPolicy:
313
+ """Approach farther mugs with the wrists raised clear of the counter."""
314
+
315
+ def reset(self, obs, tools):
316
+ self.a = np.asarray(tools.hold_action(), float)
317
+ self.a[19:] = 0
318
+ self.state = 'raise'
319
+ self.age = 0
320
+ self.side = 0
321
+ self.tries = 0
322
+ self.cycles = 0
323
+ self.target = self.a.copy()
324
+ self.start = self.a.copy()
325
+ self.initial = obs['low_dim_obs'][21:25].copy()
326
+ self.navtarget = None
327
+ self.held = [False, False]
328
+ self.last_seen = None
329
+ self.align = 0
330
+ self.target[5:12] = [-1, 0, 0, -0.5, 0, 0, 0]
331
+ self.target[12:19] = [-1, 0, 0, -0.5, 0, 0, 0]
332
+
333
+ def enter(self, name):
334
+ self.state = name
335
+ self.age = 0
336
+ self.start = self.a.copy()
337
+ self.target = self.a.copy()
338
+ self.target[:2] = 0
339
+ self.target[3] = 0
340
+
341
+ def arm(self, q):
342
+ j = 5 + 7 * self.side
343
+ self.target[j:j + 7] = q
344
+
345
+ def nav(self, obs, tar, speed=0.2):
346
+ p = obs['low_dim_obs'][21:25]
347
+ e = np.asarray(tar[:2]) - p[:2]
348
+ v = e * 2.5
349
+ norm = np.linalg.norm(v)
350
+ if np.linalg.norm(e) < 0.018:
351
+ v *= 0
352
+ elif norm < 0.065:
353
+ v *= 0.065 / max(norm, 1e-06)
354
+ elif norm > speed:
355
+ v *= speed / norm
356
+ c, s = (np.cos(p[3]), np.sin(p[3]))
357
+ self.a[0] = c * v[0] + s * v[1]
358
+ self.a[1] = -s * v[0] + c * v[1]
359
+ self.a[3] = np.clip((tar[2] - p[3]) * 2, -0.5, 0.5)
360
+ return np.linalg.norm(e) < 0.03 and abs(tar[2] - p[3]) < 0.06
361
+
362
+ def act(self, obs, tools):
363
+ self.age += 1
364
+ p = obs['low_dim_obs']
365
+ j = 5 + 7 * self.side
366
+ g = 19 + self.side
367
+ self.a[:2] = 0
368
+ self.a[3] = 0
369
+ st = self.state
370
+ if st == 'raise':
371
+ self.a = self.start + (self.target - self.start) * min(1, self.age / 45)
372
+ if self.age > 35:
373
+ self.nav(obs, [0.02, float(self.initial[1]), 0], 0.16)
374
+ if self.age >= 130:
375
+ self.enter('initial_settle')
376
+ elif st == 'initial_settle':
377
+ self.a = self.target.copy()
378
+ if self.age >= 35:
379
+ self.enter('prepare')
380
+ self.arm([-1.1, 0.24, 0, 1.1, 0, -0.3, 0])
381
+ elif st == 'prepare':
382
+ self.a = self.start + (self.target - self.start) * min(1, self.age / 40)
383
+ if self.age >= 60:
384
+ self.enter('align')
385
+ self.align = 0
386
+ elif st == 'align':
387
+ self.a = self.target.copy()
388
+ if self.age % 8 == 0:
389
+ im = tools.image('left_wrist' if self.side == 0 else 'right_wrist')
390
+ h = _far_handles(im, self.side)
391
+ self.last_seen = h
392
+ if h is not None:
393
+ ex = 42 - h[0]
394
+ ey = h[1] - 30
395
+ axis = j + 1 if self.side == 0 else j + 2
396
+ self.target[axis] = np.clip(self.target[axis] + np.clip(ex * 0.0015, -0.018, 0.018), -0.45, 0.65)
397
+ self.target[j + 6] = np.clip(self.target[j + 6] + np.clip(ex * 0.001, -0.012, 0.012), -0.35, 0.35)
398
+ self.target[j + 5] = np.clip(self.target[j + 5] + np.clip(ey * 0.0015, -0.018, 0.018), -1.3, 0.45)
399
+ if abs(ex) < 7 and abs(ey) < 11:
400
+ self.align += 1
401
+ else:
402
+ self.align = 0
403
+ if self.age > 35 and self.align >= 2:
404
+ if h[3] >= 42 or (self.side == 1 and self.cycles >= 1 and (h[3] >= 26)) or self.cycles >= 8:
405
+ self.enter('close')
406
+ self.target[g] = 1
407
+ else:
408
+ self.enter('approach')
409
+ self.navtarget = [float(p[21] + (0.055 if self.side == 0 else 0.1)), float(p[22]), 0]
410
+ self.cycles += 1
411
+ elif self.age > 40 and self.side == 1:
412
+ box = mug_region(im)
413
+ if box is not None:
414
+ x, y, w, hb = box
415
+ if x < 5:
416
+ self.target[j + 2] = min(0.65, self.target[j + 2] + 0.02)
417
+ self.target[j + 6] = min(0.35, self.target[j + 6] + 0.012)
418
+ elif x + w > 79:
419
+ self.target[j + 2] = max(-0.45, self.target[j + 2] - 0.02)
420
+ self.target[j + 6] = max(-0.35, self.target[j + 6] - 0.012)
421
+ self.target[j + 5] = np.clip(self.target[j + 5] + np.clip((y + hb - 52) * 0.002, -0.022, 0.022), -1.3, 0.6)
422
+ if self.age > 220:
423
+ self.enter('close')
424
+ self.target[g] = 1
425
+ elif st == 'approach':
426
+ self.a = self.target.copy()
427
+ self.nav(obs, self.navtarget, 0.14 if self.side == 0 else 0.2)
428
+ if self.age >= 80:
429
+ self.enter('settle')
430
+ elif st == 'settle':
431
+ self.a = self.target.copy()
432
+ if self.age >= 25:
433
+ self.enter('align')
434
+ self.align = 0
435
+ elif st == 'close':
436
+ self.a = self.target.copy()
437
+ if self.age >= 45:
438
+ inds = [10, 11] if self.side == 0 else [19, 20]
439
+ if np.mean(p[inds]) > -0.016:
440
+ self.held[self.side] = True
441
+ self.enter('lift')
442
+ delta = min(0.85, 2.05 - self.target[j + 3])
443
+ self.target[j] -= delta
444
+ self.target[j + 3] += delta
445
+ if self.side == 0:
446
+ self.target[j + 1] = 0.55
447
+ self.target[j + 6] = 0
448
+ elif self.tries < 5:
449
+ self.tries += 1
450
+ self.enter('reopen')
451
+ self.target[g] = 0
452
+ else:
453
+ self.enter('lift')
454
+ self.target[j] -= 0.55
455
+ self.target[j + 3] += 0.55
456
+ elif st == 'reopen':
457
+ self.a = self.target.copy()
458
+ if self.age >= 30:
459
+ self.enter('approach')
460
+ self.navtarget = [float(p[21] + 0.06), float(p[22]), 0]
461
+ self.cycles += 1
462
+ elif st == 'lift':
463
+ self.a = self.start + (self.target - self.start) * min(1, self.age / 65)
464
+ if self.age >= 90:
465
+ if self.side == 0:
466
+ self.side = 1
467
+ self.tries = 0
468
+ self.cycles = 0
469
+ self.enter('right_retreat')
470
+ else:
471
+ self.enter('carry')
472
+ self.target[5:12] = [-1.8, 0.35, 0, 1.8, 0, -0.03, 0]
473
+ self.right_carry = self.target[12:19].copy()
474
+ elif st == 'right_retreat':
475
+ self.a = self.target.copy()
476
+ if self.age >= 20:
477
+ self.enter('right_settle')
478
+ elif st == 'right_settle':
479
+ self.a = self.target.copy()
480
+ if self.age >= 30:
481
+ self.enter('prepare')
482
+ self.arm([-1.1, 0.1, 0, 1.5, 0, -1.0, 0])
483
+ elif st == 'carry':
484
+ self.a = self.start + (self.target - self.start) * min(1, self.age / 50)
485
+ if self.age >= 60:
486
+ self.enter('to_rack')
487
+ elif st == 'to_rack':
488
+ self.a = self.target.copy()
489
+ reached = self.nav(obs, [-0.055, -0.55, 0.65], 0.18)
490
+ if reached and self.age > 120 or self.age > 230:
491
+ self.side = 0
492
+ self.enter('lower')
493
+ self.target[5] = -1.0
494
+ self.target[8] = 1.0
495
+ self.target[2] = 0.67
496
+ elif st == 'lower':
497
+ self.a = self.start + (self.target - self.start) * min(1, self.age / 80)
498
+ if self.age >= 100:
499
+ self.enter('release')
500
+ self.target[g] = 0
501
+ elif st == 'release':
502
+ self.a = self.target.copy()
503
+ if self.age >= 55:
504
+ if self.side == 0:
505
+ self.enter('retract')
506
+ self.target[5] = -1.5
507
+ self.target[8] = -0.3
508
+ self.target[2] = 0.74
509
+ else:
510
+ self.enter('done')
511
+ elif st == 'retract':
512
+ self.a = self.start + (self.target - self.start) * min(1, self.age / 60)
513
+ if self.age >= 65:
514
+ self.side = 1
515
+ self.enter('right_rack')
516
+ elif st == 'right_rack':
517
+ self.a = self.target.copy()
518
+ reached = self.nav(obs, [-0.055, -0.5, 1.3], 0.15)
519
+ if reached and self.age > 100 or self.age > 170:
520
+ self.enter('lower')
521
+ self.target[12] = -0.95
522
+ self.target[15] = 1.35
523
+ self.target[2] = 0.67
524
+ else:
525
+ self.a = self.target.copy()
526
+ return self.a.copy()
527
+
528
+ class Policy:
529
+ """Select the initial approach using the visible counter shadow."""
530
+
531
+ def reset(self, obs, tools):
532
+ im = tools.image('head').astype(np.float32)
533
+ nearby = np.any(im[1:6, :45].mean(axis=2) < 190)
534
+ self.control = _NearPolicy() if nearby else _FarPolicy()
535
+ self.control.reset(obs, tools)
536
+
537
+ def act(self, obs, tools):
538
+ return self.control.act(obs, tools)
539
+
540
+ def __getattr__(self, name):
541
+ return getattr(self.control, name)
policies/dishwasher_load_cups/astra-s2/episodes.csv ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ seed,success,length,termination,fell
2
+ 620000,0,2000,timeout,0
3
+ 620001,1,1638,success,0
4
+ 620002,0,2000,timeout,0
5
+ 620003,1,1577,success,0
6
+ 620004,0,2000,timeout,0
7
+ 620005,1,1573,success,0
8
+ 620006,0,2000,timeout,0
9
+ 620007,0,2000,timeout,0
10
+ 620008,0,2000,timeout,0
11
+ 620009,0,2000,timeout,0
12
+ 620010,0,2000,timeout,0
13
+ 620011,1,1581,success,0
14
+ 620012,0,2000,timeout,0
15
+ 620013,0,2000,timeout,0
16
+ 620014,0,2000,timeout,0
17
+ 620015,0,2000,timeout,0
18
+ 620016,0,2000,timeout,0
19
+ 620017,1,1589,success,0
20
+ 620018,0,2000,timeout,0
21
+ 620019,0,1134,terminated,0
22
+ 620020,1,1582,success,0
23
+ 620021,0,2000,timeout,0
24
+ 620022,1,1403,success,0
25
+ 620023,0,2000,timeout,0
26
+ 620024,0,2000,timeout,0
27
+ 620025,0,2000,timeout,0
28
+ 620026,0,2000,timeout,0
29
+ 620027,0,2000,timeout,0
30
+ 620028,0,2000,timeout,0
31
+ 620029,0,2000,timeout,0
32
+ 620030,0,2000,timeout,0
33
+ 620031,0,2000,timeout,0
34
+ 620032,0,2000,timeout,0
35
+ 620033,0,2000,timeout,0
36
+ 620034,0,2000,timeout,0
37
+ 620035,0,2000,timeout,0
38
+ 620036,1,1547,success,0
39
+ 620037,0,2000,timeout,0
40
+ 620038,0,2000,timeout,0
41
+ 620039,0,2000,timeout,0
42
+ 620040,0,2000,timeout,0
43
+ 620041,1,1142,success,0
44
+ 620042,0,2000,timeout,0
45
+ 620043,0,2000,timeout,0
46
+ 620044,0,2000,timeout,0
47
+ 620045,1,1481,success,0
48
+ 620046,0,2000,timeout,0
49
+ 620047,0,2000,timeout,0
50
+ 620048,0,2000,timeout,0
51
+ 620049,0,2000,timeout,0
52
+ 620050,0,2000,timeout,0
53
+ 620051,0,2000,timeout,0
54
+ 620052,0,2000,timeout,0
55
+ 620053,0,2000,timeout,0
56
+ 620054,0,2000,timeout,0
57
+ 620055,0,2000,timeout,0
58
+ 620056,0,2000,timeout,0
59
+ 620057,0,2000,timeout,0
60
+ 620058,0,2000,timeout,0
61
+ 620059,0,2000,timeout,0
62
+ 620060,0,2000,timeout,0
63
+ 620061,0,2000,timeout,0
64
+ 620062,0,2000,timeout,0
65
+ 620063,1,1545,success,0
66
+ 620064,1,1528,success,0
67
+ 620065,0,2000,timeout,0
68
+ 620066,0,2000,timeout,0
69
+ 620067,1,1580,success,0
70
+ 620068,0,2000,timeout,0
71
+ 620069,0,2000,timeout,0
72
+ 620070,0,2000,timeout,0
73
+ 620071,0,2000,timeout,0
74
+ 620072,0,2000,timeout,0
75
+ 620073,0,2000,timeout,0
76
+ 620074,0,2000,timeout,0
77
+ 620075,0,2000,timeout,0
78
+ 620076,0,2000,timeout,0
79
+ 620077,0,2000,timeout,0
80
+ 620078,0,2000,timeout,0
81
+ 620079,0,2000,timeout,0
82
+ 620080,1,1440,success,0
83
+ 620081,0,2000,timeout,0
84
+ 620082,0,2000,timeout,0
85
+ 620083,0,2000,timeout,0
86
+ 620084,0,2000,timeout,0
87
+ 620085,0,2000,timeout,0
88
+ 620086,0,2000,timeout,0
89
+ 620087,0,2000,timeout,0
90
+ 620088,0,2000,timeout,0
91
+ 620089,0,2000,timeout,0
92
+ 620090,1,1562,success,0
93
+ 620091,0,2000,timeout,0
94
+ 620092,0,2000,timeout,0
95
+ 620093,0,2000,timeout,0
96
+ 620094,0,2000,timeout,0
97
+ 620095,0,2000,timeout,0
98
+ 620096,0,2000,timeout,0
99
+ 620097,1,1429,success,0
100
+ 620098,0,2000,timeout,0
101
+ 620099,0,2000,timeout,0
policies/dishwasher_load_cups/astra-s2/policy.py ADDED
@@ -0,0 +1,163 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Hand-written wrist-camera feedback and gentle dishwasher placement."""
2
+ import numpy as np
3
+ import cv2
4
+
5
+ class Policy:
6
+ def reset(self,obs,tools):
7
+ self.a=np.asarray(tools.hold_action(),float);self.a[19:]=0
8
+ self.x=-.30;self.y=-.55;self.side=0;self.phase='init';self.pt=0
9
+ self.sh=[-1.25,-1.35];self.roll=[0.,-.10];self.held=[False,False]
10
+ self.walk=0;self.settle=0;self.walkspeed=0;self.walkaxis=0
11
+ self.gt=0;self.grasp=False;self.shoulder=-1.25;self.last=None
12
+ self.holdarms=[None,None]
13
+ self.lost=0
14
+ self.distant=None
15
+ def base(self,o,x,y,yaw=0):
16
+ p=o['low_dim_obs'][21:25];v=np.array([x,y])-p[:2]
17
+ if np.linalg.norm(v)<.028:v*=0
18
+ else:
19
+ speed=.23 if self.phase=='transfer' and not self.distant else .18
20
+ v=np.clip(v*1.6,-speed,speed)
21
+ if np.linalg.norm(v)<.06:v*=.06/np.linalg.norm(v)
22
+ c,s=np.cos(p[3]),np.sin(p[3]);self.a[0:2]=[c*v[0]+s*v[1],-s*v[0]+c*v[1]]
23
+ self.a[3]=np.clip(2*(yaw-p[3]),-.35,.35)
24
+ @staticmethod
25
+ def mug(im,side=0):
26
+ lo=im.min(2).astype(float);hi=im.max(2).astype(float)
27
+ mask=((hi-lo<28)&(lo>65)&(hi<235)).astype('uint8');mask[78:]=0
28
+ def candidates(mm):
29
+ n,ll,ss,cc=cv2.connectedComponentsWithStats(mm)
30
+ kk=[k for k in range(1,n) if ss[k,4]>100 and ss[k,2]>=15 and ss[k,3]>7 and ss[k,3]>.7*ss[k,2] and ss[k,1]<55]
31
+ return ll,ss,cc,kk
32
+ def select(ss,kk):
33
+ return min(kk,key=lambda k:ss[k,0]) if side==0 else max(kk,key=lambda k:ss[k,0]+ss[k,2])
34
+ l,st,ce,kk=candidates(mask)
35
+ clean=cv2.morphologyEx(mask,cv2.MORPH_OPEN,np.ones((5,5),np.uint8))
36
+ lc,sc,cc,kc=candidates(clean)
37
+ i=select(st,kk) if kk else None
38
+ repair=False
39
+ if kc:
40
+ k=select(sc,kc);xx,yy,ww,hh,aa=sc[k]
41
+ if i is None:repair=True
42
+ elif side==0 and xx<st[i,0]-5:repair=True
43
+ elif st[i,1]+st[i,3]>=78 and yy+hh<75 and aa>st[i,4]*.35:repair=True
44
+ if repair:
45
+ cut=mask.copy();cut[yy+hh+3:]=0
46
+ cut[:,:max(0,xx-5)]=0;cut[:,min(84,xx+ww+5):]=0
47
+ n,l,st,ce=cv2.connectedComponentsWithStats(cut)
48
+ if n>1:i=max(range(1,n),key=lambda k:st[k,4])
49
+ if i is None:return None
50
+ x,y,w,h,area=st[i];cx,cy=ce[i]
51
+ hm=np.zeros((84,84),np.uint8)
52
+ pts=np.argwhere(l==i)[:,::-1].astype(np.int32)
53
+ cv2.fillConvexPoly(hm,cv2.convexHull(pts),1)
54
+ hm=cv2.erode(hm,np.ones((3,3),np.uint8))
55
+ hm[:int(y+h*.28)]=0;hm[int(y+h*.90):]=0
56
+ bright=((lo>190)&(hi-lo<25)&(hm>0)).astype(np.uint8)
57
+ nn,ll,ss,cc=cv2.connectedComponentsWithStats(bright)
58
+ handles=[k for k in range(1,nn) if ss[k,4]>4 and ss[k,3]>h*.18]
59
+ if handles:
60
+ k=max(handles,key=lambda k:ss[k,4]);cx=cc[k,0]
61
+ return x,y,w,h,area,cx,cy
62
+ @staticmethod
63
+ def distant_mug(im,side=0):
64
+ lo=im.min(2).astype(float);hi=im.max(2).astype(float)
65
+ mask=((hi-lo<28)&(lo>65)&(hi<235)).astype('uint8');mask[78:]=0
66
+ n,l,st,ce=cv2.connectedComponentsWithStats(mask)
67
+ cand=[]
68
+ for i,(x,y,w,h,area) in enumerate(st[1:],1):
69
+ if area>35 and 5<w<85 and h>7 and h>0.7*w and y<55:
70
+ cand.append((x,y,w,h,area,ce[i][0],ce[i][1],i))
71
+ if not cand:return None
72
+ # At an open hand the mug is the large gray component.
73
+ c=max(cand,key=lambda c:c[4]) if side==0 else max(cand,key=lambda c:c[0]+c[2])
74
+ x,y,w,h,area,cx,cy,i=c
75
+ hm=np.zeros((84,84),np.uint8)
76
+ pts=np.argwhere(l==i)[:,::-1].astype(np.int32)
77
+ cv2.fillConvexPoly(hm,cv2.convexHull(pts),1)
78
+ hm=cv2.erode(hm,np.ones((3,3),np.uint8))
79
+ hm[:int(y+h*.28)]=0;hm[int(y+h*.90):]=0
80
+ bright=((lo>190)&(hi-lo<25)&(hm>0)).astype(np.uint8)
81
+ nn,ll,ss,cc=cv2.connectedComponentsWithStats(bright)
82
+ handles=[k for k in range(1,nn) if ss[k,4]>4 and ss[k,3]>h*.18]
83
+ if handles:
84
+ k=max(handles,key=lambda k:ss[k,4]);cx=cc[k,0]
85
+ return x,y,w,h,area,cx,cy
86
+ def act(self,o,tools):
87
+ t=o['t'];self.a[:2]=0;self.a[3]=0
88
+ if t>=200 and self.distant is None:
89
+ visible=self.distant_mug(tools.image('left_wrist'))
90
+ self.distant=bool(visible is not None and visible[3]<=33)
91
+ targets=[np.array([-1.25,0,0,1.25,0,-.12,0.]),np.array([-1.4,-.2,0,1.4,0,-.12,0.])]
92
+ if self.phase=='init':
93
+ if t<120:
94
+ self.x=-.20;targets=[np.array([-2.6,0,0,2.09,0,.4,0.])]*2
95
+ elif t<220:
96
+ self.x=-.14;targets=[np.array([-1.5,.16,0,1.5,0,-.12,0.]),np.array([-1.4,-.1,0,1.4,0,-.12,0.])]
97
+ else:
98
+ self.phase='align';self.sh[0]=-1.5;self.roll[0]=.16;self.settle=t+30
99
+ self.base(o,self.x,self.y)
100
+ if self.phase in ('align','close','lift'):
101
+ i=self.side
102
+ for j in range(2):
103
+ if self.held[j]:targets[j]=self.holdarms[j].copy()
104
+ targets[i]=np.array([self.sh[i],self.roll[i],0,-self.sh[i],0,-.12,0.])
105
+ self.shoulder=self.sh[i]
106
+ if self.phase=='align':
107
+ if t%5==0 and self.walk==0:
108
+ detector=self.distant_mug if self.distant else self.mug
109
+ m=detector(tools.image('left_wrist' if i==0 else 'right_wrist'),i)
110
+ self.last=m
111
+ if m is None and not self.distant:
112
+ self.lost+=5
113
+ if self.lost>40:
114
+ im=tools.image('left_wrist' if i==0 else 'right_wrist')
115
+ lo=im.min(2).astype(float);hi=im.max(2).astype(float)
116
+ mask=((hi-lo<28)&(lo>65)&(hi<235)).astype(np.uint8)
117
+ nn,ll,ss,cc=cv2.connectedComponentsWithStats(mask)
118
+ loose=[k for k in range(1,nn) if ss[k,4]>50]
119
+ if loose:
120
+ k=max(loose,key=lambda k:ss[k,4]);cy=cc[k,1]
121
+ self.sh[i]=np.clip(self.sh[i]+np.clip((cy-40)*.001,-.025,.025),-1.9,-.7)
122
+ if m:
123
+ self.lost=0
124
+ x,y,w,h,area,cx,cy=m
125
+ self.roll[i]=np.clip(self.roll[i]+np.clip((42-cx)*.0007,-.02,.02),-.5,.6 if i==0 else .13)
126
+ self.sh[i]=np.clip(self.sh[i]-np.clip((60-(y+h))*.0007,-.015,.015),-1.7,-.7)
127
+ if abs(cx-42)<5 and abs(y+h-60)<22 and h<60 and t>self.settle:
128
+ if self.distant:
129
+ self.walk=t+(50 if w<45 else 35);self.walkspeed=.14 if w<45 else .10
130
+ else:
131
+ self.walk=t+(65 if w<35 else 35);self.walkspeed=.16 if w<35 else .10
132
+ self.settle=self.walk+60;self.walkaxis=0
133
+ if i==1 and self.roll[i]>.12 and cx<32 and t>self.settle:
134
+ self.walk=t+55;self.settle=self.walk+60;self.walkspeed=.15;self.walkaxis=1
135
+ if abs(cx-42)<4 and h>=53 and abs(y+h-60)<8 and t>self.settle:
136
+ self.phase='close';self.gt=t;self.grasp=True
137
+ targets[i]=np.array([self.sh[i],self.roll[i],0,-self.sh[i],0,-.12,0.])
138
+ if self.walk>t:self.a[self.walkaxis]=self.walkspeed
139
+ elif self.walk:self.walk=0
140
+ if self.phase=='close':
141
+ self.a[19+i]=1
142
+ if t-self.gt>40:self.phase='lift'
143
+ if self.phase=='lift':
144
+ targets[i]=np.array([-1.6,self.roll[i],0,1.45,0,-.12,0.])
145
+ if t-self.gt>115:
146
+ self.held[i]=True;self.holdarms[i]=targets[i].copy()
147
+ if i==0:
148
+ self.side=1;self.phase='align';self.walk=0;self.settle=t+60;self.grasp=False
149
+ else:self.phase='transfer';self.pt=t
150
+ if self.phase=='transfer':
151
+ targets=[h.copy() for h in self.holdarms]
152
+ self.base(o,-.46,.02,0)
153
+ if np.linalg.norm(o['low_dim_obs'][21:23]-np.array([-.46,.02]))<.06:
154
+ self.phase='lower';self.pt=t
155
+ if self.phase=='lower':
156
+ targets=[h.copy() for h in self.holdarms]
157
+ self.a[2]=max(.51,.74-(t-self.pt)*.0015)
158
+ if t-self.pt>180:self.phase='release';self.pt=t
159
+ if self.phase=='release':
160
+ targets=[h.copy() for h in self.holdarms];self.a[19:]=0
161
+ for j in range(2):
162
+ sl=slice(5+7*j,12+7*j);self.a[sl]+=np.clip(targets[j]-self.a[sl],-.025,.025)
163
+ return self.a.copy()
policies/dishwasher_load_cups/astra-s3/episodes.csv ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ seed,success,length,termination,fell
2
+ 620000,0,2000,timeout,0
3
+ 620001,0,2000,timeout,0
4
+ 620002,1,1523,success,0
5
+ 620003,1,1655,success,0
6
+ 620004,1,1495,success,0
7
+ 620005,0,2000,timeout,0
8
+ 620006,0,2000,timeout,0
9
+ 620007,0,2000,timeout,0
10
+ 620008,1,1428,success,0
11
+ 620009,1,1668,success,0
12
+ 620010,0,2000,timeout,0
13
+ 620011,0,2000,timeout,0
14
+ 620012,0,2000,timeout,0
15
+ 620013,0,2000,timeout,0
16
+ 620014,0,2000,timeout,0
17
+ 620015,1,1656,success,0
18
+ 620016,0,2000,timeout,0
19
+ 620017,1,1765,success,0
20
+ 620018,0,2000,timeout,0
21
+ 620019,1,1400,success,0
22
+ 620020,0,2000,timeout,0
23
+ 620021,0,2000,timeout,0
24
+ 620022,1,1412,success,0
25
+ 620023,1,1659,success,0
26
+ 620024,0,2000,timeout,0
27
+ 620025,0,2000,timeout,0
28
+ 620026,0,2000,timeout,0
29
+ 620027,0,2000,timeout,0
30
+ 620028,0,2000,timeout,0
31
+ 620029,0,2000,timeout,0
32
+ 620030,0,2000,timeout,0
33
+ 620031,1,1720,success,0
34
+ 620032,0,2000,timeout,0
35
+ 620033,0,2000,timeout,0
36
+ 620034,0,2000,timeout,0
37
+ 620035,0,2000,timeout,0
38
+ 620036,0,2000,timeout,0
39
+ 620037,1,1654,success,0
40
+ 620038,1,1515,success,0
41
+ 620039,1,1660,success,0
42
+ 620040,0,2000,timeout,0
43
+ 620041,0,2000,timeout,0
44
+ 620042,1,1509,success,0
45
+ 620043,0,2000,timeout,0
46
+ 620044,0,2000,timeout,0
47
+ 620045,0,2000,timeout,0
48
+ 620046,0,2000,timeout,0
49
+ 620047,0,2000,timeout,0
50
+ 620048,1,1453,success,0
51
+ 620049,1,1513,success,0
52
+ 620050,0,2000,timeout,0
53
+ 620051,0,2000,timeout,0
54
+ 620052,0,2000,timeout,0
55
+ 620053,0,2000,timeout,0
56
+ 620054,0,2000,timeout,0
57
+ 620055,0,2000,timeout,0
58
+ 620056,0,2000,timeout,0
59
+ 620057,0,2000,timeout,0
60
+ 620058,1,1409,success,0
61
+ 620059,0,2000,timeout,0
62
+ 620060,0,2000,timeout,0
63
+ 620061,0,2000,timeout,0
64
+ 620062,0,2000,timeout,0
65
+ 620063,0,2000,timeout,0
66
+ 620064,1,1657,success,0
67
+ 620065,1,1434,success,0
68
+ 620066,0,2000,timeout,0
69
+ 620067,0,2000,timeout,0
70
+ 620068,0,2000,timeout,0
71
+ 620069,0,2000,timeout,0
72
+ 620070,0,2000,timeout,0
73
+ 620071,1,1732,success,0
74
+ 620072,1,1663,success,0
75
+ 620073,1,1656,success,0
76
+ 620074,1,1601,success,0
77
+ 620075,0,2000,timeout,0
78
+ 620076,0,2000,timeout,0
79
+ 620077,0,2000,timeout,0
80
+ 620078,0,2000,timeout,0
81
+ 620079,1,1557,success,0
82
+ 620080,0,2000,timeout,0
83
+ 620081,0,2000,timeout,0
84
+ 620082,1,1814,success,0
85
+ 620083,0,2000,timeout,0
86
+ 620084,1,1503,success,0
87
+ 620085,0,2000,timeout,0
88
+ 620086,0,2000,timeout,0
89
+ 620087,0,2000,timeout,0
90
+ 620088,1,1401,success,0
91
+ 620089,0,2000,timeout,0
92
+ 620090,0,2000,timeout,0
93
+ 620091,0,2000,timeout,0
94
+ 620092,0,2000,timeout,0
95
+ 620093,0,2000,timeout,0
96
+ 620094,0,2000,timeout,0
97
+ 620095,0,2000,timeout,0
98
+ 620096,1,1676,success,0
99
+ 620097,1,1659,success,0
100
+ 620098,0,2000,timeout,0
101
+ 620099,0,2000,timeout,0
policies/dishwasher_load_cups/astra-s3/policy.py ADDED
@@ -0,0 +1,140 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Deterministic visual servoing for the two dishwasher mugs."""
2
+ import cv2
3
+ import numpy as np
4
+
5
+ class Policy:
6
+ def reset(self, obs, tools):
7
+ self.a = np.asarray(tools.hold_action(), dtype=np.float32)
8
+ self.a[19:] = .3
9
+ self.a[5:12] = [-.35,.2,0,0,0,-.05,0]
10
+ self.a[12:19] = [-.35,0,.4,0,0,.15,0]
11
+ self.carry = None
12
+ self.phase=0;self.phase_start=0;self.lift_start=None;self.search_pose=None;self.last_cup=None;self.grip_count=0
13
+
14
+ @staticmethod
15
+ def cup(im, side):
16
+ hsv=cv2.cvtColor(im,cv2.COLOR_RGB2HSV)
17
+ mask=((hsv[:,:,1]<40)&(hsv[:,:,2]>65)&(hsv[:,:,2]<245)).astype('uint8')
18
+ mask[80:]=0; mask[:,:5]=0; mask[:,79:]=0
19
+ _,_,st,_=cv2.connectedComponentsWithStats(mask)
20
+ cand=[]
21
+ for x,y,w,h,area in st[1:]:
22
+ if area>150 and h>12 and w>8 and w<=74 and y<60:
23
+ cand.append((x+w/2,y+h,w,h,area))
24
+ return min(cand,key=lambda z:-z[4] if side==0 else abs(z[0]-42)) if cand else None
25
+
26
+
27
+ @staticmethod
28
+ def handle(im,z):
29
+ x,y,w,h,area=z;y0=max(4,int(y-h)+max(6,int(h*.22)));y1=min(y0+10,int(y)-6)
30
+ if y1<=y0+3:return x
31
+ hsv=cv2.cvtColor(im,cv2.COLOR_RGB2HSV);v=hsv[:,:,2].astype(float)
32
+ m=((hsv[:,:,1]<40)&(v>70)&(v<245)).astype('uint8')
33
+ row=(m[y0:y1].mean(axis=0)>.5).astype('uint8')[None,:]
34
+ row=cv2.morphologyEx(row,cv2.MORPH_CLOSE,np.ones((1,9),np.uint8))
35
+ n,la,st,ce=cv2.connectedComponentsWithStats(row)
36
+ cand=[r for r in st[1:] if r[2]>12]
37
+ if not cand:return x
38
+ r=max(cand,key=lambda r:r[2]);l=r[0]+3;rr=r[0]+r[2]-3
39
+ p=v[y0:y1].mean(axis=0);hi=cv2.GaussianBlur(p[None,:],(0,0),.7)[0];lo=cv2.GaussianBlur(p[None,:],(0,0),6)[0];score=hi-lo
40
+ score[:l]=-100;score[rr:]=-100;i=int(np.argmax(score))
41
+ return i if score[i]>7 else x
42
+
43
+ def act(self, obs, tools):
44
+ t=obs['t']; a=self.a; p=obs['low_dim_obs'][21:25]
45
+ if self.phase < 2:
46
+ side=self.phase; k=t-self.phase_start; j=5+7*side
47
+ if k==0 and side==1:
48
+ a[12:19]=[-.35,0,.4,0,0,.15,0]
49
+ a[:2]=0; a[3]=0
50
+ if self.lift_start is not None:
51
+ f=min(1.,(t-self.lift_start)/40.)
52
+ a[j]=self.grasp_pose[j]-.35*f
53
+ a[j+5]=self.grasp_pose[j+5]+.35*f
54
+ if side==0:a[j+1]=self.grasp_pose[j+1]+.10*f
55
+ if f>=1:
56
+ self.phase+=1;self.phase_start=t+1;self.lift_start=None
57
+ self.last_cup=None;self.search_pose=None
58
+ return a.copy()
59
+ if 80<k<250:
60
+ dx=(.055 if side==0 else .19)-p[0]
61
+ a[0]=np.clip(2*dx,-.1,.1) if abs(dx)>.012 else 0
62
+ if 0<abs(a[0])<.06:a[0]=np.sign(a[0])*.06
63
+ a[3]=np.clip(-p[3]*3,-.3,.3)
64
+ if side==1:a[1]=np.clip(2*(-.61-p[1]),-.08,.08)
65
+ if 80<=k<330 and k%10==0:
66
+ im=tools.image(['left_wrist','right_wrist'][side])
67
+ z=self.cup(im,side)
68
+ if z:
69
+ self.last_cup=z
70
+ cx=z[0]
71
+ a[j+6]+=np.clip(.003*(42-cx),-.045,.045)
72
+ a[j+5]+=np.clip(.003*(z[1]-52),-.045,.045)
73
+ if 250<=k<330 and self.last_cup is not None:
74
+ if self.last_cup[4]<1900 and p[0]<(.2 if side==0 else .3):
75
+ a[0]=.07;a[3]=np.clip(-p[3]*3,-.3,.3)
76
+ if k>=330:
77
+ a[19+side]=1
78
+ self.grip_count = self.grip_count+1 if .75<obs['low_dim_obs'][50+side]<.85 else 0
79
+ if self.grip_count>=10:
80
+ self.lift_start=t;self.grasp_pose=a.copy()
81
+ a[:2]=0;a[3]=0
82
+ elif k>=350:
83
+ if self.search_pose is None:self.search_pose=a.copy()
84
+ u=k-350
85
+ if u<80:
86
+ a[19+side]=.3
87
+ if u>=10 and u%10==0:
88
+ im=tools.image(['left_wrist','right_wrist'][side])
89
+ z=self.cup(im,side)
90
+ if z:
91
+ self.last_cup=z
92
+ cx=self.handle(im,z)
93
+ a[j+6]+=np.clip(.003*(42-cx),-.035,.035)
94
+ a[j+5]+=np.clip(.003*(z[1]-52),-.035,.035)
95
+ if u<60 and self.last_cup is not None and self.last_cup[4]<2500:
96
+ a[0]=.065;a[3]=np.clip(-p[3]*3,-.3,.3)
97
+ self.search_pose=a.copy()
98
+ elif u<110:
99
+ a[19+side]=1
100
+ else:
101
+ cycle=min((u-110)//50,2);tick=(u-110)%50
102
+ a[19+side]=.3 if tick<18 else 1
103
+ d=[0,-.16,.16][cycle]
104
+ dz=[.12,-.08,-.08][cycle]
105
+ a[j+2]=self.search_pose[j+2]+d
106
+ a[j+6]=self.search_pose[j+6]+d
107
+ a[j]=self.search_pose[j]+dz
108
+ a[j+5]=self.search_pose[j+5]-dz
109
+ if u>=250:
110
+ a[19+side]=1
111
+ self.lift_start=t;self.grasp_pose=a.copy();a[:2]=0;a[3]=0
112
+ else:
113
+ k=t-self.phase_start
114
+ if self.carry is None:self.carry=a.copy()
115
+ start=self.carry; yaw=p[3]
116
+ if k<360:
117
+ delta=np.array([.28,-.45])-p[:2];v=delta*1.5;n=np.linalg.norm(v)
118
+ if n>.15:v*=.15/n
119
+ if np.linalg.norm(delta)<.025:v*=0
120
+ elif n<.065:v*=.065/(n+1e-9)
121
+ a[:2]=np.array([[np.cos(yaw),np.sin(yaw)],[-np.sin(yaw),np.cos(yaw)]])@v
122
+ a[3]=np.clip(2*(1.57-yaw),-.55,.55)
123
+ else:a[:2]=0;a[3]=0
124
+ if 290<=k<380:
125
+ f=(k-290)/89
126
+ a[6]=start[6]*(1-f)
127
+ a[7]=-.5*f
128
+ a[14]=start[14]*(1-f)+.2*f
129
+ if 390<=k<540:
130
+ f=(k-390)/150;a[2]=.74-.10*f
131
+ for j in [5,12]:a[j+3]=start[j+3]+.8*f;a[j+5]=start[j+5]-.8*f
132
+ if k==570:a[19:]=0
133
+ if 590<=k<650:
134
+ a[19:]=.4
135
+ f=(k-590)/59
136
+ for j in [5,12]:
137
+ a[j]=start[j]+.45*f
138
+ a[j+5]=start[j+5]-.8-.45*f
139
+ if 660<=k<730:a[2]=.64+.10*(k-660)/70
140
+ return a.copy()
policies/dishwasher_load_cups/deepseek1017-s1/episodes.csv ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ seed,success,length,termination,fell
2
+ 620000,0,2000,timeout,0
3
+ 620001,0,2000,timeout,0
4
+ 620002,0,2000,timeout,0
5
+ 620003,0,2000,timeout,0
6
+ 620004,0,2000,timeout,0
7
+ 620005,0,2000,timeout,0
8
+ 620006,0,2000,timeout,0
9
+ 620007,0,2000,timeout,0
10
+ 620008,0,2000,timeout,0
11
+ 620009,0,2000,timeout,0
12
+ 620010,0,1347,terminated,0
13
+ 620011,0,2000,timeout,0
14
+ 620012,0,2000,timeout,0
15
+ 620013,0,2000,timeout,0
16
+ 620014,0,2000,timeout,0
17
+ 620015,0,2000,timeout,0
18
+ 620016,0,2000,timeout,0
19
+ 620017,0,2000,timeout,0
20
+ 620018,0,2000,timeout,0
21
+ 620019,0,2000,timeout,0
22
+ 620020,0,2000,timeout,0
23
+ 620021,0,2000,timeout,0
24
+ 620022,0,1145,terminated,0
25
+ 620023,0,2000,timeout,0
26
+ 620024,0,2000,timeout,0
27
+ 620025,0,1152,terminated,0
28
+ 620026,0,2000,timeout,0
29
+ 620027,0,2000,timeout,0
30
+ 620028,0,1236,terminated,0
31
+ 620029,0,2000,timeout,0
32
+ 620030,0,2000,timeout,0
33
+ 620031,0,2000,timeout,0
34
+ 620032,0,2000,timeout,0
35
+ 620033,0,2000,timeout,0
36
+ 620034,0,2000,timeout,0
37
+ 620035,0,2000,timeout,0
38
+ 620036,0,2000,timeout,0
39
+ 620037,0,2000,timeout,0
40
+ 620038,0,2000,timeout,0
41
+ 620039,0,2000,timeout,0
42
+ 620040,0,2000,timeout,0
43
+ 620041,0,2000,timeout,0
44
+ 620042,0,2000,timeout,0
45
+ 620043,0,2000,timeout,0
46
+ 620044,0,2000,timeout,0
47
+ 620045,0,2000,timeout,0
48
+ 620046,0,2000,timeout,0
49
+ 620047,0,2000,timeout,0
50
+ 620048,0,2000,timeout,0
51
+ 620049,0,1231,terminated,0
52
+ 620050,0,2000,timeout,0
53
+ 620051,0,1144,terminated,0
54
+ 620052,0,2000,timeout,0
55
+ 620053,0,2000,timeout,0
56
+ 620054,0,2000,timeout,0
57
+ 620055,0,1153,terminated,0
58
+ 620056,0,2000,timeout,0
59
+ 620057,0,2000,timeout,0
60
+ 620058,0,2000,timeout,0
61
+ 620059,0,2000,timeout,0
62
+ 620060,0,1268,terminated,0
63
+ 620061,0,2000,timeout,0
64
+ 620062,0,2000,timeout,0
65
+ 620063,0,2000,timeout,0
66
+ 620064,0,2000,timeout,0
67
+ 620065,0,2000,timeout,0
68
+ 620066,0,2000,timeout,0
69
+ 620067,0,2000,timeout,0
70
+ 620068,0,2000,timeout,0
71
+ 620069,0,2000,timeout,0
72
+ 620070,0,2000,timeout,0
73
+ 620071,0,2000,timeout,0
74
+ 620072,0,2000,timeout,0
75
+ 620073,0,2000,timeout,0
76
+ 620074,0,2000,timeout,0
77
+ 620075,0,2000,timeout,0
78
+ 620076,0,2000,timeout,0
79
+ 620077,0,2000,timeout,0
80
+ 620078,0,2000,timeout,0
81
+ 620079,0,2000,timeout,0
82
+ 620080,0,2000,timeout,0
83
+ 620081,0,2000,timeout,0
84
+ 620082,0,2000,timeout,0
85
+ 620083,0,2000,timeout,0
86
+ 620084,0,2000,timeout,0
87
+ 620085,0,2000,timeout,0
88
+ 620086,0,2000,timeout,0
89
+ 620087,0,2000,timeout,0
90
+ 620088,0,2000,timeout,0
91
+ 620089,0,2000,timeout,0
92
+ 620090,0,2000,timeout,0
93
+ 620091,0,1341,terminated,0
94
+ 620092,0,1223,terminated,0
95
+ 620093,0,1114,terminated,0
96
+ 620094,0,2000,timeout,0
97
+ 620095,0,1223,terminated,0
98
+ 620096,0,2000,timeout,0
99
+ 620097,0,1217,terminated,0
100
+ 620098,0,2000,timeout,0
101
+ 620099,0,2000,timeout,0