Datasets:

Nagi-ovo commited on
Commit
d996b62
·
verified ·
1 Parent(s): c9497a3

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

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. policies.csv +421 -0
  2. policies/stack_blocks/deepseek1017-s2/episodes.csv +101 -0
  3. policies/stack_blocks/deepseek1017-s2/policy.py +303 -0
  4. policies/stack_blocks/deepseek1017-s3/episodes.csv +101 -0
  5. policies/stack_blocks/deepseek1017-s3/policy.py +236 -0
  6. policies/stack_blocks/gpt61sol-s1/episodes.csv +101 -0
  7. policies/stack_blocks/gpt61sol-s1/policy.py +207 -0
  8. policies/stack_blocks/gpt61sol-s2/episodes.csv +101 -0
  9. policies/stack_blocks/gpt61sol-s2/policy.py +123 -0
  10. policies/stack_blocks/gpt61sol-s3/episodes.csv +101 -0
  11. policies/stack_blocks/gpt61sol-s3/policy.py +162 -0
  12. policies/stack_blocks/gpt61terra-s1/episodes.csv +101 -0
  13. policies/stack_blocks/gpt61terra-s1/policy.py +76 -0
  14. policies/stack_blocks/gpt61terra-s2/episodes.csv +101 -0
  15. policies/stack_blocks/gpt61terra-s2/policy.py +108 -0
  16. policies/stack_blocks/gpt61terra-s3/episodes.csv +101 -0
  17. policies/stack_blocks/gpt61terra-s3/policy.py +136 -0
  18. policies/stack_blocks/gpt6sol-s1/episodes.csv +101 -0
  19. policies/stack_blocks/gpt6sol-s1/policy.py +198 -0
  20. policies/stack_blocks/gpt6sol-s2/episodes.csv +101 -0
  21. policies/stack_blocks/gpt6sol-s2/policy.py +156 -0
  22. policies/stack_blocks/gpt6sol-s3/episodes.csv +101 -0
  23. policies/stack_blocks/gpt6sol-s3/policy.py +138 -0
  24. policies/stack_blocks/kimi31pro-s1/episodes.csv +101 -0
  25. policies/stack_blocks/kimi31pro-s1/policy.py +379 -0
  26. policies/stack_blocks/kimi31pro-s2/episodes.csv +101 -0
  27. policies/stack_blocks/kimi31pro-s2/policy.py +243 -0
  28. policies/stack_blocks/kimi31pro-s3/episodes.csv +101 -0
  29. policies/stack_blocks/kimi31pro-s3/policy.py +247 -0
  30. policies/stack_blocks/opus-s1/episodes.csv +101 -0
  31. policies/stack_blocks/opus-s1/g1kin.py +97 -0
  32. policies/stack_blocks/opus-s1/headcam.py +55 -0
  33. policies/stack_blocks/opus-s1/percept.py +33 -0
  34. policies/stack_blocks/opus-s1/policy.py +503 -0
  35. policies/stack_blocks/opus-s2/episodes.csv +101 -0
  36. policies/stack_blocks/opus-s2/policy.py +686 -0
  37. policies/stack_blocks/opus-s3/cam.py +51 -0
  38. policies/stack_blocks/opus-s3/episodes.csv +101 -0
  39. policies/stack_blocks/opus-s3/fk.py +132 -0
  40. policies/stack_blocks/opus-s3/policy.py +718 -0
  41. policies/wall_cupboard_close/astra-s1/episodes.csv +101 -0
  42. policies/wall_cupboard_close/astra-s1/policy.py +37 -0
  43. policies/wall_cupboard_close/astra-s2/episodes.csv +101 -0
  44. policies/wall_cupboard_close/astra-s2/policy.py +32 -0
  45. policies/wall_cupboard_close/astra-s3/episodes.csv +101 -0
  46. policies/wall_cupboard_close/astra-s3/policy.py +34 -0
  47. policies/wall_cupboard_close/deepseek1017-s1/episodes.csv +101 -0
  48. policies/wall_cupboard_close/deepseek1017-s1/policy.py +149 -0
  49. policies/wall_cupboard_close/deepseek1017-s2/episodes.csv +101 -0
  50. policies/wall_cupboard_close/deepseek1017-s2/policy.py +122 -0
policies.csv ADDED
@@ -0,0 +1,421 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ task,task_set,session,agent,model,harness,harness_version,effort,service_tier,success_rate,scored_version,policy_lines,budget_used,cost_usd,tokens_input_uncached,tokens_cached,tokens_output,status,files
2
+ dishwasher_close,core,opus-s1,opus55,Claude Opus 5.5,Claude Code,2.1.280 (Claude Code),high,default,0,5,161,97540,20.5678,1133120,32137793,253846,scored,policies/dishwasher_close/opus-s1/policy.py
3
+ dishwasher_close,core,opus-s2,opus55,Claude Opus 5.5,Claude Code,2.1.280 (Claude Code),high,default,0,2,153,101000,25.0822,1365184,43104886,277080,scored,policies/dishwasher_close/opus-s2/policy.py
4
+ dishwasher_close,core,opus-s3,opus55,Claude Opus 5.5,Claude Code,2.1.280 (Claude Code),high,default,100,10,291,93322,15.1431,566146,32371214,207061,scored,policies/dishwasher_close/opus-s3/policy.py
5
+ dishwasher_load_cups,core,opus-s1,opus55,Claude Opus 5.5,Claude Code,2.1.280 (Claude Code),high,default,83,78,745,100443,35.1785,1026158,96381670,384765,scored,policies/dishwasher_load_cups/opus-s1/policy.py
6
+ dishwasher_load_cups,core,opus-s2,opus55,Claude Opus 5.5,Claude Code,2.1.280 (Claude Code),high,default,1,47,440,93009,20.9347,709428,51484778,245087,scored,policies/dishwasher_load_cups/opus-s2/policy.py
7
+ dishwasher_load_cups,core,opus-s3,opus55,Claude Opus 5.5,Claude Code,2.1.280 (Claude Code),high,default,1,92,897,93571,27.4713,1019723,64438875,321410,scored,policies/dishwasher_load_cups/opus-s3/policy.py;policies/dishwasher_load_cups/opus-s3/g1kin.py;policies/dishwasher_load_cups/opus-s3/vision.py
8
+ drawer_top_close,core,opus-s1,opus55,Claude Opus 5.5,Claude Code,2.1.280 (Claude Code),high,default,100,5,76,76438,1.1959,56304,1645669,20834,scored,policies/drawer_top_close/opus-s1/policy.py
9
+ drawer_top_close,core,opus-s2,opus55,Claude Opus 5.5,Claude Code,2.1.280 (Claude Code),high,default,100,2,102,62872,3.0479,118863,5070562,54170,scored,policies/drawer_top_close/opus-s2/policy.py
10
+ drawer_top_close,core,opus-s3,opus55,Claude Opus 5.5,Claude Code,2.1.280 (Claude Code),high,default,100,2,83,39811,0.7328,41639,683259,13158,scored,policies/drawer_top_close/opus-s3/policy.py
11
+ drawer_top_open,core,opus-s1,opus55,Claude Opus 5.5,Claude Code,2.1.280 (Claude Code),high,default,99,40,280,96255,11.3522,313708,27804385,164149,scored,policies/drawer_top_open/opus-s1/policy.py
12
+ drawer_top_open,core,opus-s2,opus55,Claude Opus 5.5,Claude Code,2.1.280 (Claude Code),high,default,98,23,410,72905,7.3521,251482,15127712,115777,scored,policies/drawer_top_open/opus-s2/policy.py;policies/drawer_top_open/opus-s2/g1kin.py;policies/drawer_top_open/opus-s2/handles.py
13
+ drawer_top_open,core,opus-s3,opus55,Claude Opus 5.5,Claude Code,2.1.280 (Claude Code),high,default,100,67,491,96799,14.276,563764,33987631,148490,scored,policies/drawer_top_open/opus-s3/policy.py;policies/drawer_top_open/opus-s3/headcam.py;policies/drawer_top_open/opus-s3/kin.py
14
+ move_plate,core,opus-s1,opus55,Claude Opus 5.5,Claude Code,2.1.280 (Claude Code),high,default,21,40,648,99896,24.5393,797274,58034979,327799,scored,policies/move_plate/opus-s1/policy.py
15
+ move_plate,core,opus-s2,opus55,Claude Opus 5.5,Claude Code,2.1.280 (Claude Code),high,default,15,20,532,94087,14.3046,369119,35091038,216740,scored,policies/move_plate/opus-s2/policy.py
16
+ move_plate,core,opus-s3,opus55,Claude Opus 5.5,Claude Code,2.1.280 (Claude Code),high,default,23,53,692,95511,44.5888,650252,58262275,273955,scored,policies/move_plate/opus-s3/policy.py;policies/move_plate/opus-s3/ctrl.py;policies/move_plate/opus-s3/fk.py;policies/move_plate/opus-s3/vision.py
17
+ move_two_plates,core,opus-s1,opus55,Claude Opus 5.5,Claude Code,2.1.280 (Claude Code),high,default,8,104,807,98595,21.2487,515493,55727710,299046,scored,policies/move_two_plates/opus-s1/policy.py
18
+ move_two_plates,core,opus-s2,opus55,Claude Opus 5.5,Claude Code,2.1.280 (Claude Code),high,default,15,55,475,99431,25.7318,1021489,52229355,355796,scored,policies/move_two_plates/opus-s2/policy.py
19
+ move_two_plates,core,opus-s3,opus55,Claude Opus 5.5,Claude Code,2.1.280 (Claude Code),high,default,22,71,509,96262,22.1373,471033,63574291,282810,scored,policies/move_two_plates/opus-s3/policy.py
20
+ pick_box,core,opus-s1,opus55,Claude Opus 5.5,Claude Code,2.1.280 (Claude Code),high,default,44,21,435,98066,11.0736,314827,26845900,159349,scored,policies/pick_box/opus-s1/policy.py
21
+ pick_box,core,opus-s2,opus55,Claude Opus 5.5,Claude Code,2.1.280 (Claude Code),high,default,99,19,352,95241,8.6046,294983,18720577,125075,scored,policies/pick_box/opus-s2/policy.py
22
+ pick_box,core,opus-s3,opus55,Claude Opus 5.5,Claude Code,2.1.280 (Claude Code),high,default,71,55,458,87969,12.1171,328279,30767594,162469,scored,policies/pick_box/opus-s3/policy.py
23
+ reach_target_dual,core,opus-s1,opus55,Claude Opus 5.5,Claude Code,2.1.280 (Claude Code),high,default,71,25,600,92723,9.509,284849,19598954,165575,scored,policies/reach_target_dual/opus-s1/policy.py
24
+ reach_target_dual,core,opus-s2,opus55,Claude Opus 5.5,Claude Code,2.1.280 (Claude Code),high,default,99,30,619,78293,8.2644,257355,17205019,138278,scored,policies/reach_target_dual/opus-s2/policy.py;policies/reach_target_dual/opus-s2/g1reach_geom.py;policies/reach_target_dual/opus-s2/g1reach_vision.py
25
+ reach_target_dual,core,opus-s3,opus55,Claude Opus 5.5,Claude Code,2.1.280 (Claude Code),high,default,65,22,586,97748,12.7152,326052,33161318,173800,scored,policies/reach_target_dual/opus-s3/policy.py
26
+ reach_target_multi_modal,core,opus-s1,opus55,Claude Opus 5.5,Claude Code,2.1.280 (Claude Code),high,default,100,25,514,72915,6.2168,217025,11210367,111963,scored,policies/reach_target_multi_modal/opus-s1/policy.py
27
+ reach_target_multi_modal,core,opus-s2,opus55,Claude Opus 5.5,Claude Code,2.1.280 (Claude Code),high,default,100,12,431,63229,11.4473,203072,13483866,96862,scored,policies/reach_target_multi_modal/opus-s2/policy.py
28
+ reach_target_multi_modal,core,opus-s3,opus55,Claude Opus 5.5,Claude Code,2.1.280 (Claude Code),high,default,100,13,416,76234,5.4287,188612,9819067,97836,scored,policies/reach_target_multi_modal/opus-s3/policy.py
29
+ dishwasher_load_cutlery,extended,opus-s1,opus55,Claude Opus 5.5,Claude Code,2.1.280 (Claude Code),high,default,12,23,414,98591,21.7517,632187,55739064,277429,scored,policies/dishwasher_load_cutlery/opus-s1/policy.py
30
+ dishwasher_load_cutlery,extended,opus-s2,opus55,Claude Opus 5.5,Claude Code,2.1.280 (Claude Code),high,default,12,76,653,97562,26.3891,773789,72029314,289764,scored,policies/dishwasher_load_cutlery/opus-s2/policy.py;policies/dishwasher_load_cutlery/opus-s2/g1kin.py
31
+ dishwasher_load_cutlery,extended,opus-s3,opus55,Claude Opus 5.5,Claude Code,2.1.280 (Claude Code),high,default,5,44,719,98242,30.8292,1401407,61153240,369463,scored,policies/dishwasher_load_cutlery/opus-s3/policy.py;policies/dishwasher_load_cutlery/opus-s3/kin.py;policies/dishwasher_load_cutlery/opus-s3/vision.py
32
+ dishwasher_load_plates,extended,opus-s1,opus55,Claude Opus 5.5,Claude Code,2.1.280 (Claude Code),high,default,38,5,504,98993,28.738,802629,78612684,329847,scored,policies/dishwasher_load_plates/opus-s1/policy.py;policies/dishwasher_load_plates/opus-s1/g1lib.py
33
+ dishwasher_load_plates,extended,opus-s2,opus55,Claude Opus 5.5,Claude Code,2.1.280 (Claude Code),high,default,0,108,844,69573,23.0032,717072,53233481,331096,crashed,policies/dishwasher_load_plates/opus-s2/policy.py;policies/dishwasher_load_plates/opus-s2/camgeo.py;policies/dishwasher_load_plates/opus-s2/g1fk.py
34
+ dishwasher_load_plates,extended,opus-s3,opus55,Claude Opus 5.5,Claude Code,2.1.280 (Claude Code),high,default,1,128,778,98474,31.7166,912451,85541156,365562,scored,policies/dishwasher_load_plates/opus-s3/policy.py;policies/dishwasher_load_plates/opus-s3/camera.py;policies/dishwasher_load_plates/opus-s3/g1kin.py;policies/dishwasher_load_plates/opus-s3/vision.py
35
+ flip_cup,extended,opus-s1,opus55,Claude Opus 5.5,Claude Code,2.1.280 (Claude Code),high,default,91,22,457,96178,14.7238,395543,32962244,248415,scored,policies/flip_cup/opus-s1/policy.py;policies/flip_cup/opus-s1/g1kin.py
36
+ flip_cup,extended,opus-s2,opus55,Claude Opus 5.5,Claude Code,2.1.280 (Claude Code),high,default,97,24,379,99151,8.8696,288161,17966606,148595,scored,policies/flip_cup/opus-s2/policy.py
37
+ flip_cup,extended,opus-s3,opus55,Claude Opus 5.5,Claude Code,2.1.280 (Claude Code),high,default,94,15,348,93526,15.6327,420664,38350075,224531,scored,policies/flip_cup/opus-s3/policy.py
38
+ flip_cutlery,extended,opus-s1,opus55,Claude Opus 5.5,Claude Code,2.1.280 (Claude Code),high,default,0,18,892,93601,47.1235,750166,55369141,326445,crashed,policies/flip_cutlery/opus-s1/policy.py;policies/flip_cutlery/opus-s1/g1lib.py
39
+ flip_cutlery,extended,opus-s2,opus55,Claude Opus 5.5,Claude Code,2.1.280 (Claude Code),high,default,70,22,514,98544,29.422,774697,78684158,374504,scored,policies/flip_cutlery/opus-s2/policy.py
40
+ flip_cutlery,extended,opus-s3,opus55,Claude Opus 5.5,Claude Code,2.1.280 (Claude Code),high,default,19,65,965,99477,25.5416,824521,67359092,273780,scored,policies/flip_cutlery/opus-s3/policy.py;policies/flip_cutlery/opus-s3/g1kin.py;policies/flip_cutlery/opus-s3/vision.py
41
+ put_cups,extended,opus-s1,opus55,Claude Opus 5.5,Claude Code,2.1.280 (Claude Code),high,default,14,24,685,100773,23.5961,471030,72129014,270212,scored,policies/put_cups/opus-s1/policy.py
42
+ put_cups,extended,opus-s2,opus55,Claude Opus 5.5,Claude Code,2.1.280 (Claude Code),high,default,0,75,1034,90637,34.0351,1270191,85736420,336430,scored,policies/put_cups/opus-s2/policy.py;policies/put_cups/opus-s2/cupvision.py;policies/put_cups/opus-s2/g1kin.py
43
+ put_cups,extended,opus-s3,opus55,Claude Opus 5.5,Claude Code,2.1.280 (Claude Code),high,default,0,114,1054,94174,28.2013,907163,74850528,298800,scored,policies/put_cups/opus-s3/policy.py;policies/put_cups/opus-s3/g1kin.py;policies/put_cups/opus-s3/vision.py
44
+ reach_target_single,extended,opus-s1,opus55,Claude Opus 5.5,Claude Code,2.1.280 (Claude Code),high,default,100,21,313,75936,5.5224,188338,9945105,101370,scored,policies/reach_target_single/opus-s1/policy.py
45
+ reach_target_single,extended,opus-s2,opus55,Claude Opus 5.5,Claude Code,2.1.280 (Claude Code),high,default,99,6,282,63432,2.6867,110452,3708444,53089,scored,policies/reach_target_single/opus-s2/policy.py
46
+ reach_target_single,extended,opus-s3,opus55,Claude Opus 5.5,Claude Code,2.1.280 (Claude Code),high,default,100,5,304,61465,3.3768,143837,4269392,68634,scored,policies/reach_target_single/opus-s3/policy.py
47
+ sandwich_remove,extended,opus-s1,opus55,Claude Opus 5.5,Claude Code,2.1.280 (Claude Code),high,default,0,41,1452,83741,51.8504,986747,52274058,380705,scored,policies/sandwich_remove/opus-s1/policy.py
48
+ sandwich_remove,extended,opus-s2,opus55,Claude Opus 5.5,Claude Code,2.1.280 (Claude Code),high,default,0,3,577,94323,35.3219,1219015,86497651,413639,scored,policies/sandwich_remove/opus-s2/policy.py;policies/sandwich_remove/opus-s2/g1kin.py
49
+ sandwich_remove,extended,opus-s3,opus55,Claude Opus 5.5,Claude Code,2.1.280 (Claude Code),high,default,1,83,906,86442,19.3325,633358,48405165,229324,scored,policies/sandwich_remove/opus-s3/policy.py;policies/sandwich_remove/opus-s3/camera.py;policies/sandwich_remove/opus-s3/g1kin.py;policies/sandwich_remove/opus-s3/vision.py
50
+ saucepan_to_hob,extended,opus-s1,opus55,Claude Opus 5.5,Claude Code,2.1.280 (Claude Code),high,default,0,2,1181,96315,44.7686,501879,60833144,313099,scored,policies/saucepan_to_hob/opus-s1/policy.py;policies/saucepan_to_hob/opus-s1/g1fk.py;policies/saucepan_to_hob/opus-s1/g1ik.py;policies/saucepan_to_hob/opus-s1/headcam.py;policies/saucepan_to_hob/opus-s1/planner.py;policies/saucepan_to_hob/opus-s1/skills.py;policies/saucepan_to_hob/opus-s1/skills2.py
51
+ saucepan_to_hob,extended,opus-s2,opus55,Claude Opus 5.5,Claude Code,2.1.280 (Claude Code),high,default,25,117,841,96902,33.8742,601773,110019845,352958,scored,policies/saucepan_to_hob/opus-s2/policy.py;policies/saucepan_to_hob/opus-s2/cam.py;policies/saucepan_to_hob/opus-s2/kin.py
52
+ saucepan_to_hob,extended,opus-s3,opus55,Claude Opus 5.5,Claude Code,2.1.280 (Claude Code),high,default,0,27,670,100619,26.2397,670116,73566161,308422,scored,policies/saucepan_to_hob/opus-s3/policy.py;policies/saucepan_to_hob/opus-s3/camera.py;policies/saucepan_to_hob/opus-s3/g1fk.py;policies/saucepan_to_hob/opus-s3/vision.py
53
+ stack_blocks,extended,opus-s1,opus55,Claude Opus 5.5,Claude Code,2.1.280 (Claude Code),high,default,100,60,691,100186,13.3625,311348,35380984,189859,scored,policies/stack_blocks/opus-s1/policy.py;policies/stack_blocks/opus-s1/g1kin.py;policies/stack_blocks/opus-s1/headcam.py;policies/stack_blocks/opus-s1/percept.py
54
+ stack_blocks,extended,opus-s2,opus55,Claude Opus 5.5,Claude Code,2.1.280 (Claude Code),high,default,0,51,686,99747,20.4689,463202,58920920,249056,scored,policies/stack_blocks/opus-s2/policy.py
55
+ stack_blocks,extended,opus-s3,opus55,Claude Opus 5.5,Claude Code,2.1.280 (Claude Code),high,default,1,55,903,98547,18.4384,438427,50722627,239411,scored,policies/stack_blocks/opus-s3/policy.py;policies/stack_blocks/opus-s3/cam.py;policies/stack_blocks/opus-s3/fk.py
56
+ wall_cupboard_close,extended,opus-s1,opus55,Claude Opus 5.5,Claude Code,2.1.280 (Claude Code),high,default,100,8,227,54297,3.8848,145748,7020095,65771,scored,policies/wall_cupboard_close/opus-s1/policy.py
57
+ wall_cupboard_close,extended,opus-s2,opus55,Claude Opus 5.5,Claude Code,2.1.280 (Claude Code),high,default,100,8,215,71831,5.7503,192422,10439327,106194,scored,policies/wall_cupboard_close/opus-s2/policy.py
58
+ wall_cupboard_close,extended,opus-s3,opus55,Claude Opus 5.5,Claude Code,2.1.280 (Claude Code),high,default,100,14,308,83224,12.167,360281,29352788,170771,scored,policies/wall_cupboard_close/opus-s3/policy.py
59
+ wall_cupboard_open,extended,opus-s1,opus55,Claude Opus 5.5,Claude Code,2.1.280 (Claude Code),high,default,100,44,516,58867,16.2642,411076,47936895,169501,scored,policies/wall_cupboard_open/opus-s1/policy.py
60
+ wall_cupboard_open,extended,opus-s2,opus55,Claude Opus 5.5,Claude Code,2.1.280 (Claude Code),high,default,100,67,584,66416,14.4947,382475,36751337,204308,scored,policies/wall_cupboard_open/opus-s2/policy.py;policies/wall_cupboard_open/opus-s2/ctrl.py;policies/wall_cupboard_open/opus-s2/fk.py;policies/wall_cupboard_open/opus-s2/vision.py
61
+ wall_cupboard_open,extended,opus-s3,opus55,Claude Opus 5.5,Claude Code,2.1.280 (Claude Code),high,default,100,42,503,86142,21.2168,488020,60100953,264711,scored,policies/wall_cupboard_open/opus-s3/policy.py
62
+ dishwasher_close,core,astra-s1,astra,GPT-6 Astra,Codex CLI,codex-cli 0.153.4,high,default,100,2,58,93180,8.29,122103,6026112,20770,scored,policies/dishwasher_close/astra-s1/policy.py
63
+ dishwasher_close,core,astra-s2,astra,GPT-6 Astra,Codex CLI,codex-cli 0.153.4,high,default,100,3,44,77778,20.03,165712,16604288,35430,scored,policies/dishwasher_close/astra-s2/policy.py
64
+ dishwasher_close,core,astra-s3,astra,GPT-6 Astra,Codex CLI,codex-cli 0.153.4,high,default,100,2,67,94948,6.91,155149,4026240,26569,scored,policies/dishwasher_close/astra-s3/policy.py
65
+ dishwasher_load_cups,core,astra-s1,astra,GPT-6 Astra,Codex CLI,codex-cli 0.153.4,high,default,18,16,541,100489,31.51,386004,24206464,68817,scored,policies/dishwasher_load_cups/astra-s1/policy.py
66
+ dishwasher_load_cups,core,astra-s2,astra,GPT-6 Astra,Codex CLI,codex-cli 0.153.4,high,default,16,26,163,101000,23.24,238919,17284736,71387,scored,policies/dishwasher_load_cups/astra-s2/policy.py
67
+ dishwasher_load_cups,core,astra-s3,astra,GPT-6 Astra,Codex CLI,codex-cli 0.153.4,high,default,30,11,140,100490,18.38,212694,13128832,62401,scored,policies/dishwasher_load_cups/astra-s3/policy.py
68
+ drawer_top_close,core,astra-s1,astra,GPT-6 Astra,Codex CLI,codex-cli 0.153.4,high,default,96,3,19,44059,1.6,62045,792320,3678,scored,policies/drawer_top_close/astra-s1/policy.py
69
+ drawer_top_close,core,astra-s2,astra,GPT-6 Astra,Codex CLI,codex-cli 0.153.4,high,default,100,4,35,38773,1.34,33861,768384,4667,scored,policies/drawer_top_close/astra-s2/policy.py
70
+ drawer_top_close,core,astra-s3,astra,GPT-6 Astra,Codex CLI,codex-cli 0.153.4,high,default,100,2,33,39653,1.93,42585,1217536,5757,scored,policies/drawer_top_close/astra-s3/policy.py
71
+ drawer_top_open,core,astra-s1,astra,GPT-6 Astra,Codex CLI,codex-cli 0.153.4,high,default,100,13,77,99558,7.51,101607,5139712,27052,scored,policies/drawer_top_open/astra-s1/policy.py
72
+ drawer_top_open,core,astra-s2,astra,GPT-6 Astra,Codex CLI,codex-cli 0.153.4,high,default,97,4,32,100624,5.24,82794,3558144,17174,scored,policies/drawer_top_open/astra-s2/policy.py
73
+ drawer_top_open,core,astra-s3,astra,GPT-6 Astra,Codex CLI,codex-cli 0.153.4,high,default,100,3,34,81799,6.94,136351,4522368,21177,scored,policies/drawer_top_open/astra-s3/policy.py
74
+ move_plate,core,astra-s1,astra,GPT-6 Astra,Codex CLI,codex-cli 0.153.4,high,default,36,8,213,99651,35.27,593640,24072192,105312,scored,policies/move_plate/astra-s1/policy.py
75
+ move_plate,core,astra-s2,astra,GPT-6 Astra,Codex CLI,codex-cli 0.153.4,high,default,2,7,81,100806,10.91,175551,7486976,33294,scored,policies/move_plate/astra-s2/policy.py
76
+ move_plate,core,astra-s3,astra,GPT-6 Astra,Codex CLI,codex-cli 0.153.4,high,default,4,17,135,100950,10.14,165785,6296192,43749,scored,policies/move_plate/astra-s3/policy.py
77
+ move_two_plates,core,astra-s1,astra,GPT-6 Astra,Codex CLI,codex-cli 0.153.4,high,default,0,10,126,101000,10.96,176690,7036288,43192,scored,policies/move_two_plates/astra-s1/policy.py
78
+ move_two_plates,core,astra-s2,astra,GPT-6 Astra,Codex CLI,codex-cli 0.153.4,high,default,38,11,81,101000,9.77,207720,6020096,33412,scored,policies/move_two_plates/astra-s2/policy.py
79
+ move_two_plates,core,astra-s3,astra,GPT-6 Astra,Codex CLI,codex-cli 0.153.4,high,default,9,18,128,99449,16.26,189610,11486720,57476,scored,policies/move_two_plates/astra-s3/policy.py
80
+ pick_box,core,astra-s1,astra,GPT-6 Astra,Codex CLI,codex-cli 0.153.4,high,default,64,10,86,99951,11.94,215735,8406528,27464,scored,policies/pick_box/astra-s1/policy.py
81
+ pick_box,core,astra-s2,astra,GPT-6 Astra,Codex CLI,codex-cli 0.153.4,high,default,85,9,115,100912,13.39,302846,8494592,37243,scored,policies/pick_box/astra-s2/policy.py
82
+ pick_box,core,astra-s3,astra,GPT-6 Astra,Codex CLI,codex-cli 0.153.4,high,default,12,5,98,100989,12.31,152527,8983808,36106,scored,policies/pick_box/astra-s3/policy.py
83
+ reach_target_dual,core,astra-s1,astra,GPT-6 Astra,Codex CLI,codex-cli 0.153.4,high,default,100,16,168,100688,5.61,88871,3438592,25740,scored,policies/reach_target_dual/astra-s1/policy.py
84
+ reach_target_dual,core,astra-s2,astra,GPT-6 Astra,Codex CLI,codex-cli 0.153.4,high,default,93,13,96,100787,6.95,197016,3795840,23626,scored,policies/reach_target_dual/astra-s2/policy.py
85
+ reach_target_dual,core,astra-s3,astra,GPT-6 Astra,Codex CLI,codex-cli 0.153.4,high,default,75,16,118,100505,5.38,131429,2925056,22763,scored,policies/reach_target_dual/astra-s3/policy.py
86
+ reach_target_multi_modal,core,astra-s1,astra,GPT-6 Astra,Codex CLI,codex-cli 0.153.4,high,default,75,11,86,100708,5.1,69649,3254528,22965,scored,policies/reach_target_multi_modal/astra-s1/policy.py
87
+ reach_target_multi_modal,core,astra-s2,astra,GPT-6 Astra,Codex CLI,codex-cli 0.153.4,high,default,97,7,71,91340,3.27,66544,1918336,13633,scored,policies/reach_target_multi_modal/astra-s2/policy.py
88
+ reach_target_multi_modal,core,astra-s3,astra,GPT-6 Astra,Codex CLI,codex-cli 0.153.4,high,default,95,14,120,100790,5.55,145474,2887296,24153,scored,policies/reach_target_multi_modal/astra-s3/policy.py
89
+ dishwasher_load_cutlery,extended,astra-s1,astra,GPT-6 Astra,Codex CLI,codex-cli 0.153.4,high,fast,5,8,187,100425,32.04,537960,23006208,72998,scored,policies/dishwasher_load_cutlery/astra-s1/policy.py
90
+ dishwasher_load_cutlery,extended,astra-s2,astra,GPT-6 Astra,Codex CLI,codex-cli 0.153.4,high,fast,0,19,134,100596,31.93,430713,23540992,81705,scored,policies/dishwasher_load_cutlery/astra-s2/policy.py
91
+ dishwasher_load_cutlery,extended,astra-s3,astra,GPT-6 Astra,Codex CLI,codex-cli 0.153.4,high,default,0,26,92,100292,38.35,568538,28855808,76077,scored,policies/dishwasher_load_cutlery/astra-s3/policy.py
92
+ dishwasher_load_plates,extended,astra-s1,astra,GPT-6 Astra,Codex CLI,codex-cli 0.153.4,high,fast,2,9,76,99944,15.76,231241,10711808,54755,scored,policies/dishwasher_load_plates/astra-s1/policy.py
93
+ dishwasher_load_plates,extended,astra-s2,astra,GPT-6 Astra,Codex CLI,codex-cli 0.153.4,high,default,3,25,141,100093,13.43,312520,7859072,49009,scored,policies/dishwasher_load_plates/astra-s2/policy.py
94
+ dishwasher_load_plates,extended,astra-s3,astra,GPT-6 Astra,Codex CLI,codex-cli 0.153.4,high,default,6,18,72,99930,18.92,234380,13420928,63154,scored,policies/dishwasher_load_plates/astra-s3/policy.py
95
+ flip_cup,extended,astra-s1,astra,GPT-6 Astra,Codex CLI,codex-cli 0.153.4,high,fast,29,14,143,100011,6.02,103289,3514624,29431,scored,policies/flip_cup/astra-s1/policy.py
96
+ flip_cup,extended,astra-s2,astra,GPT-6 Astra,Codex CLI,codex-cli 0.153.4,high,fast,59,17,226,101000,12.81,284696,7709696,45109,scored,policies/flip_cup/astra-s2/policy.py
97
+ flip_cup,extended,astra-s3,astra,GPT-6 Astra,Codex CLI,codex-cli 0.153.4,high,fast,27,8,176,100973,10.42,149383,6733696,43808,scored,policies/flip_cup/astra-s3/policy.py
98
+ flip_cutlery,extended,astra-s1,astra,GPT-6 Astra,Codex CLI,codex-cli 0.153.4,high,fast,3,2,120,100990,18.06,180636,13646336,52123,scored,policies/flip_cutlery/astra-s1/policy.py
99
+ flip_cutlery,extended,astra-s2,astra,GPT-6 Astra,Codex CLI,codex-cli 0.153.4,high,fast,0,7,140,100766,20.99,259702,15024128,67307,scored,policies/flip_cutlery/astra-s2/policy.py
100
+ flip_cutlery,extended,astra-s3,astra,GPT-6 Astra,Codex CLI,codex-cli 0.153.4,high,fast,0,4,84,100995,18.69,291977,12728704,60881,scored,policies/flip_cutlery/astra-s3/policy.py
101
+ put_cups,extended,astra-s1,astra,GPT-6 Astra,Codex CLI,codex-cli 0.153.4,high,fast,0,9,139,100990,31.84,455674,23117824,83221,scored,policies/put_cups/astra-s1/policy.py
102
+ put_cups,extended,astra-s2,astra,GPT-6 Astra,Codex CLI,codex-cli 0.153.4,high,fast,15,7,252,100411,35.41,567932,25012736,94378,scored,policies/put_cups/astra-s2/policy.py
103
+ put_cups,extended,astra-s3,astra,GPT-6 Astra,Codex CLI,codex-cli 0.153.4,high,fast,9,12,185,100779,33.52,419729,25229312,81862,scored,policies/put_cups/astra-s3/policy.py
104
+ reach_target_single,extended,astra-s1,astra,GPT-6 Astra,Codex CLI,codex-cli 0.153.4,high,fast,98,9,93,84355,2.3,50662,1257472,10762,scored,policies/reach_target_single/astra-s1/policy.py
105
+ reach_target_single,extended,astra-s2,astra,GPT-6 Astra,Codex CLI,codex-cli 0.153.4,high,fast,97,2,49,51150,1.95,54615,906880,9890,scored,policies/reach_target_single/astra-s2/policy.py
106
+ reach_target_single,extended,astra-s3,astra,GPT-6 Astra,Codex CLI,codex-cli 0.153.4,high,default,100,7,133,87460,3.57,92040,1680640,19328,scored,policies/reach_target_single/astra-s3/policy.py
107
+ sandwich_remove,extended,astra-s1,astra,GPT-6 Astra,Codex CLI,codex-cli 0.153.4,high,fast,15,23,75,100996,18.82,259718,13591808,52539,scored,policies/sandwich_remove/astra-s1/policy.py
108
+ sandwich_remove,extended,astra-s2,astra,GPT-6 Astra,Codex CLI,codex-cli 0.153.4,high,fast,0,19,109,100987,20.43,292448,15093504,48256,scored,policies/sandwich_remove/astra-s2/policy.py
109
+ sandwich_remove,extended,astra-s3,astra,GPT-6 Astra,Codex CLI,codex-cli 0.153.4,high,fast,0,2,107,100707,23.16,324564,16173568,74811,scored,policies/sandwich_remove/astra-s3/policy.py
110
+ saucepan_to_hob,extended,astra-s1,astra,GPT-6 Astra,Codex CLI,codex-cli 0.153.4,high,fast,14,13,102,100596,40.51,490089,32914048,53973,scored,policies/saucepan_to_hob/astra-s1/policy.py
111
+ saucepan_to_hob,extended,astra-s2,astra,GPT-6 Astra,Codex CLI,codex-cli 0.153.4,high,default,18,10,83,99657,19.9,214314,15634048,42357,scored,policies/saucepan_to_hob/astra-s2/policy.py
112
+ saucepan_to_hob,extended,astra-s3,astra,GPT-6 Astra,Codex CLI,codex-cli 0.153.4,high,fast,47,12,108,99303,31.22,276486,25323136,62661,scored,policies/saucepan_to_hob/astra-s3/policy.py
113
+ stack_blocks,extended,astra-s1,astra,GPT-6 Astra,Codex CLI,codex-cli 0.153.4,high,fast,1,21,190,100921,15.03,214461,9778048,62184,scored,policies/stack_blocks/astra-s1/policy.py
114
+ stack_blocks,extended,astra-s2,astra,GPT-6 Astra,Codex CLI,codex-cli 0.153.4,high,default,2,11,182,100980,9.12,136704,5114624,52802,scored,policies/stack_blocks/astra-s2/policy.py
115
+ stack_blocks,extended,astra-s3,astra,GPT-6 Astra,Codex CLI,codex-cli 0.153.4,high,default,0,12,182,100487,15.61,180803,11342592,49270,scored,policies/stack_blocks/astra-s3/policy.py
116
+ wall_cupboard_close,extended,astra-s1,astra,GPT-6 Astra,Codex CLI,codex-cli 0.153.4,high,fast,100,2,37,58670,2.24,56232,1209216,9328,scored,policies/wall_cupboard_close/astra-s1/policy.py
117
+ wall_cupboard_close,extended,astra-s2,astra,GPT-6 Astra,Codex CLI,codex-cli 0.153.4,high,default,100,1,32,77232,2.89,61133,1617536,13291,scored,policies/wall_cupboard_close/astra-s2/policy.py
118
+ wall_cupboard_close,extended,astra-s3,astra,GPT-6 Astra,Codex CLI,codex-cli 0.153.4,high,default,100,1,34,94540,1.87,43019,1073280,7423,scored,policies/wall_cupboard_close/astra-s3/policy.py
119
+ wall_cupboard_open,extended,astra-s1,astra,GPT-6 Astra,Codex CLI,codex-cli 0.153.4,high,fast,0,2,74,99746,11.56,245305,6689792,48351,scored,policies/wall_cupboard_open/astra-s1/policy.py
120
+ wall_cupboard_open,extended,astra-s2,astra,GPT-6 Astra,Codex CLI,codex-cli 0.153.4,high,fast,100,2,58,95955,5.53,89536,3909248,14555,scored,policies/wall_cupboard_open/astra-s2/policy.py
121
+ wall_cupboard_open,extended,astra-s3,astra,GPT-6 Astra,Codex CLI,codex-cli 0.153.4,high,fast,100,1,97,82617,10.75,148044,6993664,45502,scored,policies/wall_cupboard_open/astra-s3/policy.py
122
+ dishwasher_close,core,gpt6sol-s1,gpt6sol,GPT-6 Sol,Codex CLI,codex-cli 0.157.1,high,default,0,4,99,100190,4.94,222736,19202176,65210,scored,policies/dishwasher_close/gpt6sol-s1/policy.py
123
+ dishwasher_close,core,gpt6sol-s2,gpt6sol,GPT-6 Sol,Codex CLI,codex-cli 0.157.1,high,default,0,4,139,97513,8.34,443554,32466304,96339,scored,policies/dishwasher_close/gpt6sol-s2/policy.py
124
+ dishwasher_close,core,gpt6sol-s3,gpt6sol,GPT-6 Sol,Codex CLI,codex-cli 0.157.1,high,default,0,10,100,100465,7.47,1036477,21887616,101699,scored,policies/dishwasher_close/gpt6sol-s3/policy.py
125
+ dishwasher_load_cups,core,gpt6sol-s1,gpt6sol,GPT-6 Sol,Codex CLI,codex-cli 0.157.1,high,default,2,4,83,100298,8.52,450665,34261120,76388,scored,policies/dishwasher_load_cups/gpt6sol-s1/policy.py
126
+ dishwasher_load_cups,core,gpt6sol-s2,gpt6sol,GPT-6 Sol,Codex CLI,codex-cli 0.157.1,high,default,0,1,108,99186,11.9,467302,49467776,107496,scored,policies/dishwasher_load_cups/gpt6sol-s2/policy.py
127
+ dishwasher_load_cups,core,gpt6sol-s3,gpt6sol,GPT-6 Sol,Codex CLI,codex-cli 0.157.1,high,default,3,18,178,100738,9.84,488716,39528448,95426,scored,policies/dishwasher_load_cups/gpt6sol-s3/policy.py
128
+ drawer_top_close,core,gpt6sol-s1,gpt6sol,GPT-6 Sol,Codex CLI,codex-cli 0.157.1,high,default,98,4,19,98624,0.96,70330,3215232,18033,scored,policies/drawer_top_close/gpt6sol-s1/policy.py
129
+ drawer_top_close,core,gpt6sol-s2,gpt6sol,GPT-6 Sol,Codex CLI,codex-cli 0.157.1,high,default,100,1,22,62982,0.87,84544,2557952,18790,scored,policies/drawer_top_close/gpt6sol-s2/policy.py
130
+ drawer_top_close,core,gpt6sol-s3,gpt6sol,GPT-6 Sol,Codex CLI,codex-cli 0.157.1,high,default,100,2,33,99493,1.89,157670,6451456,28761,scored,policies/drawer_top_close/gpt6sol-s3/policy.py
131
+ drawer_top_open,core,gpt6sol-s1,gpt6sol,GPT-6 Sol,Codex CLI,codex-cli 0.157.1,high,default,55,6,99,100515,4.48,212238,17338368,59253,scored,policies/drawer_top_open/gpt6sol-s1/policy.py
132
+ drawer_top_open,core,gpt6sol-s2,gpt6sol,GPT-6 Sol,Codex CLI,codex-cli 0.157.1,high,default,66,4,46,100451,5.62,355132,21216256,66358,scored,policies/drawer_top_open/gpt6sol-s2/policy.py
133
+ drawer_top_open,core,gpt6sol-s3,gpt6sol,GPT-6 Sol,Codex CLI,codex-cli 0.157.1,high,default,36,7,55,100467,3.87,192760,15085184,46667,scored,policies/drawer_top_open/gpt6sol-s3/policy.py
134
+ move_plate,core,gpt6sol-s1,gpt6sol,GPT-6 Sol,Codex CLI,codex-cli 0.157.1,high,default,1,2,78,100940,4.93,428716,17004800,67518,scored,policies/move_plate/gpt6sol-s1/policy.py
135
+ move_plate,core,gpt6sol-s2,gpt6sol,GPT-6 Sol,Codex CLI,codex-cli 0.157.1,high,default,7,1,46,98450,4.49,153898,18555520,46954,scored,policies/move_plate/gpt6sol-s2/policy.py
136
+ move_plate,core,gpt6sol-s3,gpt6sol,GPT-6 Sol,Codex CLI,codex-cli 0.157.1,high,default,5,4,95,100985,3.16,276824,10279936,54879,scored,policies/move_plate/gpt6sol-s3/policy.py
137
+ move_two_plates,core,gpt6sol-s1,gpt6sol,GPT-6 Sol,Codex CLI,codex-cli 0.157.1,high,default,0,5,125,99976,6.98,250929,28520960,77161,scored,policies/move_two_plates/gpt6sol-s1/policy.py
138
+ move_two_plates,core,gpt6sol-s2,gpt6sol,GPT-6 Sol,Codex CLI,codex-cli 0.157.1,high,default,0,2,111,100919,7.47,272352,31418624,63844,scored,policies/move_two_plates/gpt6sol-s2/policy.py
139
+ move_two_plates,core,gpt6sol-s3,gpt6sol,GPT-6 Sol,Codex CLI,codex-cli 0.157.1,high,default,0,2,41,100719,4.23,300144,15474944,53221,scored,policies/move_two_plates/gpt6sol-s3/policy.py
140
+ pick_box,core,gpt6sol-s1,gpt6sol,GPT-6 Sol,Codex CLI,codex-cli 0.157.1,high,default,0,2,147,98440,8.73,929378,29795200,91495,scored,policies/pick_box/gpt6sol-s1/policy.py
141
+ pick_box,core,gpt6sol-s2,gpt6sol,GPT-6 Sol,Codex CLI,codex-cli 0.157.1,high,default,0,3,81,100242,6.29,432872,23279360,76901,scored,policies/pick_box/gpt6sol-s2/policy.py
142
+ pick_box,core,gpt6sol-s3,gpt6sol,GPT-6 Sol,Codex CLI,codex-cli 0.157.1,high,default,0,2,152,100815,2.67,125885,9573888,50417,scored,policies/pick_box/gpt6sol-s3/policy.py
143
+ reach_target_dual,core,gpt6sol-s1,gpt6sol,GPT-6 Sol,Codex CLI,codex-cli 0.157.1,high,default,33,5,125,100190,4.32,190172,16452480,64887,scored,policies/reach_target_dual/gpt6sol-s1/policy.py
144
+ reach_target_dual,core,gpt6sol-s2,gpt6sol,GPT-6 Sol,Codex CLI,codex-cli 0.157.1,high,default,58,8,119,101000,3.41,182509,12503936,54014,scored,policies/reach_target_dual/gpt6sol-s2/policy.py
145
+ reach_target_dual,core,gpt6sol-s3,gpt6sol,GPT-6 Sol,Codex CLI,codex-cli 0.157.1,high,default,20,9,97,100329,3.66,212669,12790144,67186,scored,policies/reach_target_dual/gpt6sol-s3/policy.py
146
+ reach_target_multi_modal,core,gpt6sol-s1,gpt6sol,GPT-6 Sol,Codex CLI,codex-cli 0.157.1,high,default,73,6,73,100221,1.16,84385,3576320,27682,scored,policies/reach_target_multi_modal/gpt6sol-s1/policy.py
147
+ reach_target_multi_modal,core,gpt6sol-s2,gpt6sol,GPT-6 Sol,Codex CLI,codex-cli 0.157.1,high,default,86,7,88,100444,1.32,83615,4431872,26896,scored,policies/reach_target_multi_modal/gpt6sol-s2/policy.py
148
+ reach_target_multi_modal,core,gpt6sol-s3,gpt6sol,GPT-6 Sol,Codex CLI,codex-cli 0.157.1,high,default,99,11,98,100197,1.22,88363,3609344,31930,scored,policies/reach_target_multi_modal/gpt6sol-s3/policy.py
149
+ dishwasher_load_cutlery,extended,gpt6sol-s1,gpt6sol,GPT-6 Sol,Codex CLI,codex-cli 0.157.1,high,fast,1,4,142,100387,4.0,377518,13077632,63228,scored,policies/dishwasher_load_cutlery/gpt6sol-s1/policy.py
150
+ dishwasher_load_cutlery,extended,gpt6sol-s2,gpt6sol,GPT-6 Sol,Codex CLI,codex-cli 0.157.1,high,fast,0,2,107,100882,4.05,248219,15073152,53917,scored,policies/dishwasher_load_cutlery/gpt6sol-s2/policy.py
151
+ dishwasher_load_cutlery,extended,gpt6sol-s3,gpt6sol,GPT-6 Sol,Codex CLI,codex-cli 0.157.1,high,fast,0,2,97,100909,4.39,384367,14751488,66674,scored,policies/dishwasher_load_cutlery/gpt6sol-s3/policy.py
152
+ dishwasher_load_plates,extended,gpt6sol-s1,gpt6sol,GPT-6 Sol,Codex CLI,codex-cli 0.157.1,high,fast,0,3,115,100717,4.82,227375,18108288,74773,scored,policies/dishwasher_load_plates/gpt6sol-s1/policy.py
153
+ dishwasher_load_plates,extended,gpt6sol-s2,gpt6sol,GPT-6 Sol,Codex CLI,codex-cli 0.157.1,high,fast,0,4,63,100485,3.42,151079,12883840,54030,scored,policies/dishwasher_load_plates/gpt6sol-s2/policy.py
154
+ dishwasher_load_plates,extended,gpt6sol-s3,gpt6sol,GPT-6 Sol,Codex CLI,codex-cli 0.157.1,high,fast,0,6,116,100705,3.69,208885,12863104,69497,scored,policies/dishwasher_load_plates/gpt6sol-s3/policy.py
155
+ flip_cup,extended,gpt6sol-s1,gpt6sol,GPT-6 Sol,Codex CLI,codex-cli 0.157.1,high,fast,0,5,131,100344,7.09,219927,29419136,76484,scored,policies/flip_cup/gpt6sol-s1/policy.py
156
+ flip_cup,extended,gpt6sol-s2,gpt6sol,GPT-6 Sol,Codex CLI,codex-cli 0.157.1,high,fast,1,3,109,100805,6.8,436842,26130688,70005,scored,policies/flip_cup/gpt6sol-s2/policy.py
157
+ flip_cup,extended,gpt6sol-s3,gpt6sol,GPT-6 Sol,Codex CLI,codex-cli 0.157.1,high,fast,1,3,34,100798,2.0,178660,6027392,44013,scored,policies/flip_cup/gpt6sol-s3/policy.py
158
+ flip_cutlery,extended,gpt6sol-s1,gpt6sol,GPT-6 Sol,Codex CLI,codex-cli 0.157.1,high,fast,0,2,119,100806,4.76,411860,15615616,81550,scored,policies/flip_cutlery/gpt6sol-s1/policy.py
159
+ flip_cutlery,extended,gpt6sol-s2,gpt6sol,GPT-6 Sol,Codex CLI,codex-cli 0.157.1,high,fast,2,2,109,100527,4.49,185591,17486592,61752,scored,policies/flip_cutlery/gpt6sol-s2/policy.py
160
+ flip_cutlery,extended,gpt6sol-s3,gpt6sol,GPT-6 Sol,Codex CLI,codex-cli 0.157.1,high,fast,1,3,108,99050,2.53,161526,8312192,54394,scored,policies/flip_cutlery/gpt6sol-s3/policy.py
161
+ put_cups,extended,gpt6sol-s1,gpt6sol,GPT-6 Sol,Codex CLI,codex-cli 0.157.1,high,fast,0,6,97,100128,7.07,458834,26926464,76592,scored,policies/put_cups/gpt6sol-s1/policy.py
162
+ put_cups,extended,gpt6sol-s2,gpt6sol,GPT-6 Sol,Codex CLI,codex-cli 0.157.1,high,fast,0,1,159,100557,6.21,256511,23709184,95621,scored,policies/put_cups/gpt6sol-s2/policy.py
163
+ put_cups,extended,gpt6sol-s3,gpt6sol,GPT-6 Sol,Codex CLI,codex-cli 0.157.1,high,fast,0,3,154,100985,7.04,454176,25980544,93369,scored,policies/put_cups/gpt6sol-s3/policy.py
164
+ reach_target_single,extended,gpt6sol-s1,gpt6sol,GPT-6 Sol,Codex CLI,codex-cli 0.157.1,high,fast,80,4,70,100272,1.74,121422,5645056,36639,scored,policies/reach_target_single/gpt6sol-s1/policy.py
165
+ reach_target_single,extended,gpt6sol-s2,gpt6sol,GPT-6 Sol,Codex CLI,codex-cli 0.157.1,high,fast,53,3,98,100493,1.5,101846,4487552,39586,scored,policies/reach_target_single/gpt6sol-s2/policy.py
166
+ reach_target_single,extended,gpt6sol-s3,gpt6sol,GPT-6 Sol,Codex CLI,codex-cli 0.157.1,high,fast,50,3,83,100972,0.76,64388,1802624,27186,scored,policies/reach_target_single/gpt6sol-s3/policy.py
167
+ sandwich_remove,extended,gpt6sol-s1,gpt6sol,GPT-6 Sol,Codex CLI,codex-cli 0.157.1,high,fast,0,1,81,100644,3.41,199414,12395008,52881,scored,policies/sandwich_remove/gpt6sol-s1/policy.py
168
+ sandwich_remove,extended,gpt6sol-s2,gpt6sol,GPT-6 Sol,Codex CLI,codex-cli 0.157.1,high,fast,0,3,89,100662,10.56,514886,41831680,116536,scored,policies/sandwich_remove/gpt6sol-s2/policy.py
169
+ sandwich_remove,extended,gpt6sol-s3,gpt6sol,GPT-6 Sol,Codex CLI,codex-cli 0.157.1,high,fast,0,3,81,100511,6.89,524306,24896640,86701,scored,policies/sandwich_remove/gpt6sol-s3/policy.py
170
+ saucepan_to_hob,extended,gpt6sol-s1,gpt6sol,GPT-6 Sol,Codex CLI,codex-cli 0.157.1,high,fast,0,4,133,100955,7.94,251222,33142528,81107,scored,policies/saucepan_to_hob/gpt6sol-s1/policy.py
171
+ saucepan_to_hob,extended,gpt6sol-s2,gpt6sol,GPT-6 Sol,Codex CLI,codex-cli 0.157.1,high,fast,0,1,125,100868,2.81,187305,9603968,51104,scored,policies/saucepan_to_hob/gpt6sol-s2/policy.py
172
+ saucepan_to_hob,extended,gpt6sol-s3,gpt6sol,GPT-6 Sol,Codex CLI,codex-cli 0.157.1,high,fast,0,1,87,100990,3.37,161874,12737664,49443,scored,policies/saucepan_to_hob/gpt6sol-s3/policy.py
173
+ stack_blocks,extended,gpt6sol-s1,gpt6sol,GPT-6 Sol,Codex CLI,codex-cli 0.157.1,high,fast,0,8,198,100696,8.83,402316,35649408,89532,scored,policies/stack_blocks/gpt6sol-s1/policy.py
174
+ stack_blocks,extended,gpt6sol-s2,gpt6sol,GPT-6 Sol,Codex CLI,codex-cli 0.157.1,high,fast,0,4,156,99720,4.33,168357,17058048,57992,scored,policies/stack_blocks/gpt6sol-s2/policy.py
175
+ stack_blocks,extended,gpt6sol-s3,gpt6sol,GPT-6 Sol,Codex CLI,codex-cli 0.157.1,high,fast,0,2,138,100906,2.02,122265,6534784,47156,scored,policies/stack_blocks/gpt6sol-s3/policy.py
176
+ wall_cupboard_close,extended,gpt6sol-s1,gpt6sol,GPT-6 Sol,Codex CLI,codex-cli 0.157.1,high,fast,100,1,43,100581,1.53,130902,4572160,35170,scored,policies/wall_cupboard_close/gpt6sol-s1/policy.py
177
+ wall_cupboard_close,extended,gpt6sol-s2,gpt6sol,GPT-6 Sol,Codex CLI,codex-cli 0.157.1,high,fast,100,1,32,54886,0.93,125723,2324480,21411,scored,policies/wall_cupboard_close/gpt6sol-s2/policy.py
178
+ wall_cupboard_close,extended,gpt6sol-s3,gpt6sol,GPT-6 Sol,Codex CLI,codex-cli 0.157.1,high,fast,0,2,95,100325,1.93,131797,6223360,41939,scored,policies/wall_cupboard_close/gpt6sol-s3/policy.py
179
+ wall_cupboard_open,extended,gpt6sol-s1,gpt6sol,GPT-6 Sol,Codex CLI,codex-cli 0.157.1,high,fast,0,2,72,100870,7.85,799166,27047424,84150,scored,policies/wall_cupboard_open/gpt6sol-s1/policy.py
180
+ wall_cupboard_open,extended,gpt6sol-s2,gpt6sol,GPT-6 Sol,Codex CLI,codex-cli 0.157.1,high,fast,0,3,36,101000,3.41,192374,11239040,77915,scored,policies/wall_cupboard_open/gpt6sol-s2/policy.py
181
+ wall_cupboard_open,extended,gpt6sol-s3,gpt6sol,GPT-6 Sol,Codex CLI,codex-cli 0.157.1,high,fast,0,5,17,100975,2.77,150400,9276544,61839,scored,policies/wall_cupboard_open/gpt6sol-s3/policy.py
182
+ dishwasher_close,core,gpt61sol-s1,gpt61sol,GPT-6.1 Sol,Codex CLI,codex-cli 0.160.0,high,default,0,36,157,100835,3.21,403847,14552576,94590,scored,policies/dishwasher_close/gpt61sol-s1/policy.py
183
+ dishwasher_close,core,gpt61sol-s2,gpt61sol,GPT-6.1 Sol,Codex CLI,codex-cli 0.160.0,high,default,0,5,78,100981,2.09,254597,8151936,76960,scored,policies/dishwasher_close/gpt61sol-s2/policy.py
184
+ dishwasher_close,core,gpt61sol-s3,gpt61sol,GPT-6.1 Sol,Codex CLI,codex-cli 0.160.0,high,default,0,5,105,100633,2.06,202973,10248832,63385,scored,policies/dishwasher_close/gpt61sol-s3/policy.py
185
+ dishwasher_load_cups,core,gpt61sol-s1,gpt61sol,GPT-6.1 Sol,Codex CLI,codex-cli 0.160.0,high,default,36,8,77,100347,2.14,288298,9871488,57553,scored,policies/dishwasher_load_cups/gpt61sol-s1/policy.py
186
+ dishwasher_load_cups,core,gpt61sol-s2,gpt61sol,GPT-6.1 Sol,Codex CLI,codex-cli 0.160.0,high,default,2,19,120,100802,1.64,133539,7979264,57502,scored,policies/dishwasher_load_cups/gpt61sol-s2/policy.py
187
+ dishwasher_load_cups,core,gpt61sol-s3,gpt61sol,GPT-6.1 Sol,Codex CLI,codex-cli 0.160.0,high,default,15,17,125,100795,2.65,227970,14738560,71873,scored,policies/dishwasher_load_cups/gpt61sol-s3/policy.py
188
+ drawer_top_close,core,gpt61sol-s1,gpt61sol,GPT-6.1 Sol,Codex CLI,codex-cli 0.160.0,high,default,100,2,19,48565,0.25,53328,903552,5105,scored,policies/drawer_top_close/gpt61sol-s1/policy.py
189
+ drawer_top_close,core,gpt61sol-s2,gpt61sol,GPT-6.1 Sol,Codex CLI,codex-cli 0.160.0,high,default,100,2,22,96213,0.3,57390,1171072,6555,scored,policies/drawer_top_close/gpt61sol-s2/policy.py
190
+ drawer_top_close,core,gpt61sol-s3,gpt61sol,GPT-6.1 Sol,Codex CLI,codex-cli 0.160.0,high,default,100,1,41,60843,0.34,57363,1253760,10196,scored,policies/drawer_top_close/gpt61sol-s3/policy.py
191
+ drawer_top_open,core,gpt61sol-s1,gpt61sol,GPT-6.1 Sol,Codex CLI,codex-cli 0.160.0,high,default,40,13,98,100982,0.82,125696,3659520,20308,scored,policies/drawer_top_open/gpt61sol-s1/policy.py
192
+ drawer_top_open,core,gpt61sol-s2,gpt61sol,GPT-6.1 Sol,Codex CLI,codex-cli 0.160.0,high,default,100,3,66,88613,0.74,98223,3186688,22662,scored,policies/drawer_top_open/gpt61sol-s2/policy.py
193
+ drawer_top_open,core,gpt61sol-s3,gpt61sol,GPT-6.1 Sol,Codex CLI,codex-cli 0.160.0,high,default,34,15,34,101000,1.25,181377,5928320,29194,scored,policies/drawer_top_open/gpt61sol-s3/policy.py
194
+ move_plate,core,gpt61sol-s1,gpt61sol,GPT-6.1 Sol,Codex CLI,codex-cli 0.160.0,high,default,7,4,99,100932,0.96,103511,4179712,33695,scored,policies/move_plate/gpt61sol-s1/policy.py
195
+ move_plate,core,gpt61sol-s2,gpt61sol,GPT-6.1 Sol,Codex CLI,codex-cli 0.160.0,high,default,0,2,151,100960,0.95,103347,3928192,34967,scored,policies/move_plate/gpt61sol-s2/policy.py
196
+ move_plate,core,gpt61sol-s3,gpt61sol,GPT-6.1 Sol,Codex CLI,codex-cli 0.160.0,high,default,17,7,38,101000,0.73,87638,2978176,25286,scored,policies/move_plate/gpt61sol-s3/policy.py
197
+ move_two_plates,core,gpt61sol-s1,gpt61sol,GPT-6.1 Sol,Codex CLI,codex-cli 0.160.0,high,default,0,17,153,100954,2.28,227069,10540800,76836,scored,policies/move_two_plates/gpt61sol-s1/policy.py
198
+ move_two_plates,core,gpt61sol-s2,gpt61sol,GPT-6.1 Sol,Codex CLI,codex-cli 0.160.0,high,default,8,22,144,101000,1.57,152675,7315456,53682,scored,policies/move_two_plates/gpt61sol-s2/policy.py
199
+ move_two_plates,core,gpt61sol-s3,gpt61sol,GPT-6.1 Sol,Codex CLI,codex-cli 0.160.0,high,default,0,34,67,100991,2.15,196180,11639296,58872,scored,policies/move_two_plates/gpt61sol-s3/policy.py
200
+ pick_box,core,gpt61sol-s1,gpt61sol,GPT-6.1 Sol,Codex CLI,codex-cli 0.160.0,high,default,0,2,94,100945,0.88,98715,4099840,27470,scored,policies/pick_box/gpt61sol-s1/policy.py
201
+ pick_box,core,gpt61sol-s2,gpt61sol,GPT-6.1 Sol,Codex CLI,codex-cli 0.160.0,high,default,52,14,92,101000,1.23,162806,5624576,34502,scored,policies/pick_box/gpt61sol-s2/policy.py
202
+ pick_box,core,gpt61sol-s3,gpt61sol,GPT-6.1 Sol,Codex CLI,codex-cli 0.160.0,high,default,0,2,172,100492,2.33,187656,13785088,57426,scored,policies/pick_box/gpt61sol-s3/policy.py
203
+ reach_target_dual,core,gpt61sol-s1,gpt61sol,GPT-6.1 Sol,Codex CLI,codex-cli 0.160.0,high,default,82,12,170,101000,1.09,130332,3925504,44108,scored,policies/reach_target_dual/gpt61sol-s1/policy.py
204
+ reach_target_dual,core,gpt61sol-s2,gpt61sol,GPT-6.1 Sol,Codex CLI,codex-cli 0.160.0,high,default,61,13,140,100760,0.76,103112,2719104,28392,scored,policies/reach_target_dual/gpt61sol-s2/policy.py
205
+ reach_target_dual,core,gpt61sol-s3,gpt61sol,GPT-6.1 Sol,Codex CLI,codex-cli 0.160.0,high,default,66,9,113,99489,0.58,81897,2347776,18214,scored,policies/reach_target_dual/gpt61sol-s3/policy.py
206
+ reach_target_multi_modal,core,gpt61sol-s1,gpt61sol,GPT-6.1 Sol,Codex CLI,codex-cli 0.160.0,high,default,81,11,153,100861,0.93,116455,3386240,35549,scored,policies/reach_target_multi_modal/gpt61sol-s1/policy.py
207
+ reach_target_multi_modal,core,gpt61sol-s2,gpt61sol,GPT-6.1 Sol,Codex CLI,codex-cli 0.160.0,high,default,97,9,152,100752,1.07,179517,3396608,37570,scored,policies/reach_target_multi_modal/gpt61sol-s2/policy.py
208
+ reach_target_multi_modal,core,gpt61sol-s3,gpt61sol,GPT-6.1 Sol,Codex CLI,codex-cli 0.160.0,high,default,100,14,152,100045,0.66,86235,3200128,17112,scored,policies/reach_target_multi_modal/gpt61sol-s3/policy.py
209
+ dishwasher_load_cutlery,extended,gpt61sol-s1,gpt61sol,GPT-6.1 Sol,Codex CLI,codex-cli 0.160.0,high,default,0,21,106,100947,2.45,208559,12400768,79521,scored,policies/dishwasher_load_cutlery/gpt61sol-s1/policy.py
210
+ dishwasher_load_cutlery,extended,gpt61sol-s2,gpt61sol,GPT-6.1 Sol,Codex CLI,codex-cli 0.160.0,high,default,0,12,91,101000,4.03,441517,21943680,94872,scored,policies/dishwasher_load_cutlery/gpt61sol-s2/policy.py
211
+ dishwasher_load_cutlery,extended,gpt61sol-s3,gpt61sol,GPT-6.1 Sol,Codex CLI,codex-cli 0.160.0,high,default,0,11,58,100971,2.22,280522,8884224,77315,scored,policies/dishwasher_load_cutlery/gpt61sol-s3/policy.py
212
+ dishwasher_load_plates,extended,gpt61sol-s1,gpt61sol,GPT-6.1 Sol,Codex CLI,codex-cli 0.160.0,high,default,0,7,98,100875,2.12,186222,10526336,69453,scored,policies/dishwasher_load_plates/gpt61sol-s1/policy.py
213
+ dishwasher_load_plates,extended,gpt61sol-s2,gpt61sol,GPT-6.1 Sol,Codex CLI,codex-cli 0.160.0,high,default,0,8,132,100854,2.08,179783,11737472,54435,scored,policies/dishwasher_load_plates/gpt61sol-s2/policy.py
214
+ dishwasher_load_plates,extended,gpt61sol-s3,gpt61sol,GPT-6.1 Sol,Codex CLI,codex-cli 0.160.0,high,default,2,5,94,100797,2.41,180521,13691776,68193,scored,policies/dishwasher_load_plates/gpt61sol-s3/policy.py
215
+ flip_cup,extended,gpt61sol-s1,gpt61sol,GPT-6.1 Sol,Codex CLI,codex-cli 0.160.0,high,default,23,12,137,100051,1.15,172849,4176384,38683,scored,policies/flip_cup/gpt61sol-s1/policy.py
216
+ flip_cup,extended,gpt61sol-s2,gpt61sol,GPT-6.1 Sol,Codex CLI,codex-cli 0.160.0,high,default,51,16,100,101000,1.69,258739,6592768,51194,scored,policies/flip_cup/gpt61sol-s2/policy.py
217
+ flip_cup,extended,gpt61sol-s3,gpt61sol,GPT-6.1 Sol,Codex CLI,codex-cli 0.160.0,high,default,0,4,70,100916,1.44,150848,6722688,46738,scored,policies/flip_cup/gpt61sol-s3/policy.py
218
+ flip_cutlery,extended,gpt61sol-s1,gpt61sol,GPT-6.1 Sol,Codex CLI,codex-cli 0.160.0,high,default,1,11,115,100998,2.16,187832,12233728,56551,scored,policies/flip_cutlery/gpt61sol-s1/policy.py
219
+ flip_cutlery,extended,gpt61sol-s2,gpt61sol,GPT-6.1 Sol,Codex CLI,codex-cli 0.160.0,high,default,12,9,95,101000,2.92,239592,17344640,70835,scored,policies/flip_cutlery/gpt61sol-s2/policy.py
220
+ flip_cutlery,extended,gpt61sol-s3,gpt61sol,GPT-6.1 Sol,Codex CLI,codex-cli 0.160.0,high,default,1,7,305,100626,2.24,217621,11378816,67081,scored,policies/flip_cutlery/gpt61sol-s3/policy.py
221
+ put_cups,extended,gpt61sol-s1,gpt61sol,GPT-6.1 Sol,Codex CLI,codex-cli 0.160.0,high,default,0,7,155,100990,4.49,611624,22465664,102164,scored,policies/put_cups/gpt61sol-s1/policy.py
222
+ put_cups,extended,gpt61sol-s2,gpt61sol,GPT-6.1 Sol,Codex CLI,codex-cli 0.160.0,high,default,0,15,182,100980,3.17,341232,13551744,112939,scored,policies/put_cups/gpt61sol-s2/policy.py
223
+ put_cups,extended,gpt61sol-s3,gpt61sol,GPT-6.1 Sol,Codex CLI,codex-cli 0.160.0,high,default,0,18,169,101000,3.36,570837,11331072,108346,scored,policies/put_cups/gpt61sol-s3/policy.py
224
+ reach_target_single,extended,gpt61sol-s1,gpt61sol,GPT-6.1 Sol,Codex CLI,codex-cli 0.160.0,high,default,84,9,135,100774,1.23,133084,5763328,38581,scored,policies/reach_target_single/gpt61sol-s1/policy.py
225
+ reach_target_single,extended,gpt61sol-s2,gpt61sol,GPT-6.1 Sol,Codex CLI,codex-cli 0.160.0,high,default,97,6,68,100707,0.72,95406,3347072,19761,scored,policies/reach_target_single/gpt61sol-s2/policy.py
226
+ reach_target_single,extended,gpt61sol-s3,gpt61sol,GPT-6.1 Sol,Codex CLI,codex-cli 0.160.0,high,default,97,9,115,100449,0.7,75292,2892672,25897,scored,policies/reach_target_single/gpt61sol-s3/policy.py
227
+ sandwich_remove,extended,gpt61sol-s1,gpt61sol,GPT-6.1 Sol,Codex CLI,codex-cli 0.160.0,high,default,0,4,78,100969,1.44,170874,5327616,56837,scored,policies/sandwich_remove/gpt61sol-s1/policy.py
228
+ sandwich_remove,extended,gpt61sol-s2,gpt61sol,GPT-6.1 Sol,Codex CLI,codex-cli 0.160.0,high,default,0,8,232,100977,5.8,576813,32899968,136127,scored,policies/sandwich_remove/gpt61sol-s2/policy.py
229
+ sandwich_remove,extended,gpt61sol-s3,gpt61sol,GPT-6.1 Sol,Codex CLI,codex-cli 0.160.0,high,default,1,6,81,100933,3.41,503712,16425600,76320,scored,policies/sandwich_remove/gpt61sol-s3/policy.py
230
+ saucepan_to_hob,extended,gpt61sol-s1,gpt61sol,GPT-6.1 Sol,Codex CLI,codex-cli 0.160.0,high,default,75,12,117,100167,2.41,191107,15502976,47427,scored,policies/saucepan_to_hob/gpt61sol-s1/policy.py
231
+ saucepan_to_hob,extended,gpt61sol-s2,gpt61sol,GPT-6.1 Sol,Codex CLI,codex-cli 0.160.0,high,default,0,19,107,100974,7.23,680154,42682624,160635,scored,policies/saucepan_to_hob/gpt61sol-s2/policy.py
232
+ saucepan_to_hob,extended,gpt61sol-s3,gpt61sol,GPT-6.1 Sol,Codex CLI,codex-cli 0.160.0,high,default,0,13,85,100804,5.08,544349,28178688,117573,scored,policies/saucepan_to_hob/gpt61sol-s3/policy.py
233
+ stack_blocks,extended,gpt61sol-s1,gpt61sol,GPT-6.1 Sol,Codex CLI,codex-cli 0.160.0,high,default,0,19,207,100845,1.25,129108,5636096,42450,scored,policies/stack_blocks/gpt61sol-s1/policy.py
234
+ stack_blocks,extended,gpt61sol-s2,gpt61sol,GPT-6.1 Sol,Codex CLI,codex-cli 0.160.0,high,default,1,8,123,100909,1.29,175139,5038464,43971,scored,policies/stack_blocks/gpt61sol-s2/policy.py
235
+ stack_blocks,extended,gpt61sol-s3,gpt61sol,GPT-6.1 Sol,Codex CLI,codex-cli 0.160.0,high,default,0,18,162,100988,3.53,395041,19723136,77116,scored,policies/stack_blocks/gpt61sol-s3/policy.py
236
+ wall_cupboard_close,extended,gpt61sol-s1,gpt61sol,GPT-6.1 Sol,Codex CLI,codex-cli 0.160.0,high,default,100,2,34,53040,0.38,102671,1021056,6882,scored,policies/wall_cupboard_close/gpt61sol-s1/policy.py
237
+ wall_cupboard_close,extended,gpt61sol-s2,gpt61sol,GPT-6.1 Sol,Codex CLI,codex-cli 0.160.0,high,default,100,1,36,74285,0.37,62738,1461760,10092,scored,policies/wall_cupboard_close/gpt61sol-s2/policy.py
238
+ wall_cupboard_close,extended,gpt61sol-s3,gpt61sol,GPT-6.1 Sol,Codex CLI,codex-cli 0.160.0,high,default,100,1,44,77046,0.61,94356,2283776,19105,scored,policies/wall_cupboard_close/gpt61sol-s3/policy.py
239
+ wall_cupboard_open,extended,gpt61sol-s1,gpt61sol,GPT-6.1 Sol,Codex CLI,codex-cli 0.160.0,high,default,100,9,92,100268,1.4,150676,6042496,49511,scored,policies/wall_cupboard_open/gpt61sol-s1/policy.py
240
+ wall_cupboard_open,extended,gpt61sol-s2,gpt61sol,GPT-6.1 Sol,Codex CLI,codex-cli 0.160.0,high,default,100,16,59,100544,1.52,159271,7363456,46579,scored,policies/wall_cupboard_open/gpt61sol-s2/policy.py
241
+ wall_cupboard_open,extended,gpt61sol-s3,gpt61sol,GPT-6.1 Sol,Codex CLI,codex-cli 0.160.0,high,default,100,23,67,100806,2.97,542669,10807040,80620,scored,policies/wall_cupboard_open/gpt61sol-s3/policy.py
242
+ dishwasher_close,core,kimi31pro-s1,kimi31pro,Kimi K3.1 Pro,Claude Code,2.1.280 (Claude Code),max,default,0,3,172,99479,25.84,2638836,92998447,196433,scored,policies/dishwasher_close/kimi31pro-s1/policy.py
243
+ dishwasher_close,core,kimi31pro-s2,kimi31pro,Kimi K3.1 Pro,Claude Code,2.1.280 (Claude Code),max,default,0,44,107,100834,12.87,1465462,41783683,158143,scored,policies/dishwasher_close/kimi31pro-s2/policy.py
244
+ dishwasher_close,core,kimi31pro-s3,kimi31pro,Kimi K3.1 Pro,Claude Code,2.1.280 (Claude Code),max,default,0,21,103,97720,10.08,1367379,32126991,92343,scored,policies/dishwasher_close/kimi31pro-s3/policy.py
245
+ dishwasher_load_cups,core,kimi31pro-s1,kimi31pro,Kimi K3.1 Pro,Claude Code,2.1.280 (Claude Code),max,default,4,51,258,99173,7.81,1048849,22731868,116620,scored,policies/dishwasher_load_cups/kimi31pro-s1/policy.py
246
+ dishwasher_load_cups,core,kimi31pro-s2,kimi31pro,Kimi K3.1 Pro,Claude Code,2.1.280 (Claude Code),max,default,0,2,120,100826,10.32,1374067,31828546,121017,scored,policies/dishwasher_load_cups/kimi31pro-s2/policy.py
247
+ dishwasher_load_cups,core,kimi31pro-s3,kimi31pro,Kimi K3.1 Pro,Claude Code,2.1.280 (Claude Code),max,default,0,6,191,100984,33.9,2141360,135555878,250753,scored,policies/dishwasher_load_cups/kimi31pro-s3/policy.py
248
+ drawer_top_close,core,kimi31pro-s1,kimi31pro,Kimi K3.1 Pro,Claude Code,2.1.280 (Claude Code),max,default,100,10,37,47126,1.78,171714,5251772,38632,scored,policies/drawer_top_close/kimi31pro-s1/policy.py
249
+ drawer_top_close,core,kimi31pro-s2,kimi31pro,Kimi K3.1 Pro,Claude Code,2.1.280 (Claude Code),max,default,22,1,93,100990,4.2,477519,11684633,90526,scored,policies/drawer_top_close/kimi31pro-s2/policy.py
250
+ drawer_top_close,core,kimi31pro-s3,kimi31pro,Kimi K3.1 Pro,Claude Code,2.1.280 (Claude Code),max,default,47,2,12,27480,2.54,344588,7268434,39595,scored,policies/drawer_top_close/kimi31pro-s3/policy.py
251
+ drawer_top_open,core,kimi31pro-s1,kimi31pro,Kimi K3.1 Pro,Claude Code,2.1.280 (Claude Code),max,default,0,1,143,100160,21.51,1624586,82815037,170160,scored,policies/drawer_top_open/kimi31pro-s1/policy.py
252
+ drawer_top_open,core,kimi31pro-s2,kimi31pro,Kimi K3.1 Pro,Claude Code,2.1.280 (Claude Code),max,default,84,16,178,100740,7.75,1072686,23228374,95990,scored,policies/drawer_top_open/kimi31pro-s2/policy.py
253
+ drawer_top_open,core,kimi31pro-s3,kimi31pro,Kimi K3.1 Pro,Claude Code,2.1.280 (Claude Code),max,default,16,2,67,100090,13.82,1189909,48440339,175430,scored,policies/drawer_top_open/kimi31pro-s3/policy.py
254
+ move_plate,core,kimi31pro-s1,kimi31pro,Kimi K3.1 Pro,Claude Code,2.1.280 (Claude Code),max,default,0,2,169,100456,12.53,1376250,41738450,142781,scored,policies/move_plate/kimi31pro-s1/policy.py
255
+ move_plate,core,kimi31pro-s2,kimi31pro,Kimi K3.1 Pro,Claude Code,2.1.280 (Claude Code),max,default,0,6,145,101000,10.54,2195146,25647472,102360,scored,policies/move_plate/kimi31pro-s2/policy.py
256
+ move_plate,core,kimi31pro-s3,kimi31pro,Kimi K3.1 Pro,Claude Code,2.1.280 (Claude Code),max,default,0,4,137,100505,6.37,692320,19870710,100816,scored,policies/move_plate/kimi31pro-s3/policy.py
257
+ move_two_plates,core,kimi31pro-s1,kimi31pro,Kimi K3.1 Pro,Claude Code,2.1.280 (Claude Code),max,default,0,2,123,100982,19.54,1571399,74601158,147398,scored,policies/move_two_plates/kimi31pro-s1/policy.py
258
+ move_two_plates,core,kimi31pro-s2,kimi31pro,Kimi K3.1 Pro,Claude Code,2.1.280 (Claude Code),max,default,0,3,113,99933,11.74,993052,42926281,116768,scored,policies/move_two_plates/kimi31pro-s2/policy.py
259
+ move_two_plates,core,kimi31pro-s3,kimi31pro,Kimi K3.1 Pro,Claude Code,2.1.280 (Claude Code),max,default,0,14,165,75520,20.12,7076912,29820431,0,scored,policies/move_two_plates/kimi31pro-s3/policy.py
260
+ pick_box,core,kimi31pro-s1,kimi31pro,Kimi K3.1 Pro,Claude Code,2.1.280 (Claude Code),max,default,0,2,175,101000,11.12,1343697,35017296,143024,scored,policies/pick_box/kimi31pro-s1/policy.py
261
+ pick_box,core,kimi31pro-s2,kimi31pro,Kimi K3.1 Pro,Claude Code,2.1.280 (Claude Code),max,default,0,2,302,99306,17.65,1551173,65500939,144739,scored,policies/pick_box/kimi31pro-s2/policy.py
262
+ pick_box,core,kimi31pro-s3,kimi31pro,Kimi K3.1 Pro,Claude Code,2.1.280 (Claude Code),max,default,0,2,196,100770,10.07,1063395,33441344,125604,scored,policies/pick_box/kimi31pro-s3/policy.py
263
+ reach_target_dual,core,kimi31pro-s1,kimi31pro,Kimi K3.1 Pro,Claude Code,2.1.280 (Claude Code),max,default,0,1,176,100996,18.23,578494,75117705,205298,scored,policies/reach_target_dual/kimi31pro-s1/policy.py
264
+ reach_target_dual,core,kimi31pro-s2,kimi31pro,Kimi K3.1 Pro,Claude Code,2.1.280 (Claude Code),max,default,7,2,109,100743,8.68,272686,34333818,126815,scored,policies/reach_target_dual/kimi31pro-s2/policy.py
265
+ reach_target_dual,core,kimi31pro-s3,kimi31pro,Kimi K3.1 Pro,Claude Code,2.1.280 (Claude Code),max,default,48,18,157,96196,10.13,1624501,29532872,97779,scored,policies/reach_target_dual/kimi31pro-s3/policy.py
266
+ reach_target_multi_modal,core,kimi31pro-s1,kimi31pro,Kimi K3.1 Pro,Claude Code,2.1.280 (Claude Code),max,default,100,2,133,61407,3.24,237188,10691400,63080,scored,policies/reach_target_multi_modal/kimi31pro-s1/policy.py
267
+ reach_target_multi_modal,core,kimi31pro-s2,kimi31pro,Kimi K3.1 Pro,Claude Code,2.1.280 (Claude Code),max,default,59,21,134,100592,7.67,698839,24789431,131623,scored,policies/reach_target_multi_modal/kimi31pro-s2/policy.py
268
+ reach_target_multi_modal,core,kimi31pro-s3,kimi31pro,Kimi K3.1 Pro,Claude Code,2.1.280 (Claude Code),max,default,87,18,151,90814,7.98,1040095,24828078,93330,scored,policies/reach_target_multi_modal/kimi31pro-s3/policy.py
269
+ dishwasher_load_cutlery,extended,kimi31pro-s1,kimi31pro,Kimi K3.1 Pro,Claude Code,2.1.280 (Claude Code),max,default,0,,,821,0.1918,42861,219392,6218,"void: the submission is the untouched template, byte for byte",
270
+ dishwasher_load_cutlery,extended,kimi31pro-s2,kimi31pro,Kimi K3.1 Pro,Claude Code,2.1.280 (Claude Code),max,default,1,3,147,100785,12.91,1447603,43324273,134620,scored,policies/dishwasher_load_cutlery/kimi31pro-s2/policy.py
271
+ dishwasher_load_cutlery,extended,kimi31pro-s3,kimi31pro,Kimi K3.1 Pro,Claude Code,2.1.280 (Claude Code),max,default,2,4,97,100494,8.18,1449313,21729425,93508,scored,policies/dishwasher_load_cutlery/kimi31pro-s3/policy.py
272
+ dishwasher_load_plates,extended,kimi31pro-s1,kimi31pro,Kimi K3.1 Pro,Claude Code,2.1.280 (Claude Code),max,default,0,58,147,99711,15.27,1417903,54830037,146869,scored,policies/dishwasher_load_plates/kimi31pro-s1/policy.py
273
+ dishwasher_load_plates,extended,kimi31pro-s2,kimi31pro,Kimi K3.1 Pro,Claude Code,2.1.280 (Claude Code),max,default,0,5,159,100974,13.19,1323105,46738979,119289,scored,policies/dishwasher_load_plates/kimi31pro-s2/policy.py
274
+ dishwasher_load_plates,extended,kimi31pro-s3,kimi31pro,Kimi K3.1 Pro,Claude Code,2.1.280 (Claude Code),max,default,0,24,182,100972,14.39,1497896,51333817,112691,scored,policies/dishwasher_load_plates/kimi31pro-s3/policy.py
275
+ flip_cup,extended,kimi31pro-s1,kimi31pro,Kimi K3.1 Pro,Claude Code,2.1.280 (Claude Code),max,default,16,24,251,100424,23.04,2264885,82605124,199038,scored,policies/flip_cup/kimi31pro-s1/policy.py
276
+ flip_cup,extended,kimi31pro-s2,kimi31pro,Kimi K3.1 Pro,Claude Code,2.1.280 (Claude Code),max,default,0,4,119,100526,8.48,1449193,22994743,98569,scored,policies/flip_cup/kimi31pro-s2/policy.py
277
+ flip_cup,extended,kimi31pro-s3,kimi31pro,Kimi K3.1 Pro,Claude Code,2.1.280 (Claude Code),max,default,0,6,171,100360,16.16,1593746,55952345,178175,scored,policies/flip_cup/kimi31pro-s3/policy.py
278
+ flip_cutlery,extended,kimi31pro-s1,kimi31pro,Kimi K3.1 Pro,Claude Code,2.1.280 (Claude Code),max,default,0,3,77,101000,18.33,1616796,67391437,161848,scored,policies/flip_cutlery/kimi31pro-s1/policy.py
279
+ flip_cutlery,extended,kimi31pro-s2,kimi31pro,Kimi K3.1 Pro,Claude Code,2.1.280 (Claude Code),max,default,0,2,157,100032,16.57,2342684,52061947,147298,scored,policies/flip_cutlery/kimi31pro-s2/policy.py
280
+ flip_cutlery,extended,kimi31pro-s3,kimi31pro,Kimi K3.1 Pro,Claude Code,2.1.280 (Claude Code),max,default,0,4,213,100904,14.76,1638935,52125966,105456,scored,policies/flip_cutlery/kimi31pro-s3/policy.py
281
+ put_cups,extended,kimi31pro-s1,kimi31pro,Kimi K3.1 Pro,Claude Code,2.1.280 (Claude Code),max,default,0,4,160,101000,21.58,2156299,76760386,191187,scored,policies/put_cups/kimi31pro-s1/policy.py
282
+ put_cups,extended,kimi31pro-s2,kimi31pro,Kimi K3.1 Pro,Claude Code,2.1.280 (Claude Code),max,default,0,15,221,100964,33.21,2265763,133290768,201760,scored,policies/put_cups/kimi31pro-s2/policy.py
283
+ put_cups,extended,kimi31pro-s3,kimi31pro,Kimi K3.1 Pro,Claude Code,2.1.280 (Claude Code),max,default,0,,,82240,19.5631,2451637,73299331,0,"void: the submission is the untouched template, byte for byte",
284
+ reach_target_single,extended,kimi31pro-s1,kimi31pro,Kimi K3.1 Pro,Claude Code,2.1.280 (Claude Code),max,default,55,19,98,100554,5.68,468778,18708216,100362,scored,policies/reach_target_single/kimi31pro-s1/policy.py
285
+ reach_target_single,extended,kimi31pro-s2,kimi31pro,Kimi K3.1 Pro,Claude Code,2.1.280 (Claude Code),max,default,82,14,97,101000,4.02,722904,10301131,51849,scored,policies/reach_target_single/kimi31pro-s2/policy.py
286
+ reach_target_single,extended,kimi31pro-s3,kimi31pro,Kimi K3.1 Pro,Claude Code,2.1.280 (Claude Code),max,default,77,41,256,100787,6.74,519030,23842406,93519,scored,policies/reach_target_single/kimi31pro-s3/policy.py
287
+ sandwich_remove,extended,kimi31pro-s1,kimi31pro,Kimi K3.1 Pro,Claude Code,2.1.280 (Claude Code),max,default,0,,,100441,37.3048,3360394,144788284,162634,void: no scorable program,
288
+ sandwich_remove,extended,kimi31pro-s2,kimi31pro,Kimi K3.1 Pro,Claude Code,2.1.280 (Claude Code),max,default,0,3,82,100779,20.24,2248109,71117595,152507,scored,policies/sandwich_remove/kimi31pro-s2/policy.py
289
+ sandwich_remove,extended,kimi31pro-s3,kimi31pro,Kimi K3.1 Pro,Claude Code,2.1.280 (Claude Code),max,default,0,,,23434,10.1799,964302,36613602,92855,"void: the submission is the untouched template, byte for byte",
290
+ saucepan_to_hob,extended,kimi31pro-s1,kimi31pro,Kimi K3.1 Pro,Claude Code,2.1.280 (Claude Code),max,default,0,,,89074,19.8253,1996139,79165191,0,"void: the submission is the untouched template, byte for byte",
291
+ saucepan_to_hob,extended,kimi31pro-s2,kimi31pro,Kimi K3.1 Pro,Claude Code,2.1.280 (Claude Code),max,default,0,,,52447,31.0943,2849385,126977835,0,"void: the submission is the untouched template, byte for byte",
292
+ saucepan_to_hob,extended,kimi31pro-s3,kimi31pro,Kimi K3.1 Pro,Claude Code,2.1.280 (Claude Code),max,default,0,4,174,101000,19.42,1539782,73384258,165937,scored,policies/saucepan_to_hob/kimi31pro-s3/policy.py
293
+ stack_blocks,extended,kimi31pro-s1,kimi31pro,Kimi K3.1 Pro,Claude Code,2.1.280 (Claude Code),max,default,0,20,379,100980,15.31,1857221,52029868,118615,scored,policies/stack_blocks/kimi31pro-s1/policy.py
294
+ stack_blocks,extended,kimi31pro-s2,kimi31pro,Kimi K3.1 Pro,Claude Code,2.1.280 (Claude Code),max,default,0,10,243,100913,11.39,994472,41168132,116345,scored,policies/stack_blocks/kimi31pro-s2/policy.py
295
+ stack_blocks,extended,kimi31pro-s3,kimi31pro,Kimi K3.1 Pro,Claude Code,2.1.280 (Claude Code),max,default,0,20,247,100754,9.52,1438339,26497118,134111,scored,policies/stack_blocks/kimi31pro-s3/policy.py
296
+ wall_cupboard_close,extended,kimi31pro-s1,kimi31pro,Kimi K3.1 Pro,Claude Code,2.1.280 (Claude Code),max,default,100,3,87,101000,10.77,1449393,32198873,143605,scored,policies/wall_cupboard_close/kimi31pro-s1/policy.py
297
+ wall_cupboard_close,extended,kimi31pro-s2,kimi31pro,Kimi K3.1 Pro,Claude Code,2.1.280 (Claude Code),max,default,100,3,107,99527,14.37,1372206,51855060,125606,scored,policies/wall_cupboard_close/kimi31pro-s2/policy.py
298
+ wall_cupboard_close,extended,kimi31pro-s3,kimi31pro,Kimi K3.1 Pro,Claude Code,2.1.280 (Claude Code),max,default,0,5,60,100150,13.85,474662,59318197,103372,scored,policies/wall_cupboard_close/kimi31pro-s3/policy.py
299
+ wall_cupboard_open,extended,kimi31pro-s1,kimi31pro,Kimi K3.1 Pro,Claude Code,2.1.280 (Claude Code),max,default,0,5,211,100988,24.33,1806666,94241616,186347,scored,policies/wall_cupboard_open/kimi31pro-s1/policy.py
300
+ wall_cupboard_open,extended,kimi31pro-s2,kimi31pro,Kimi K3.1 Pro,Claude Code,2.1.280 (Claude Code),max,default,100,2,130,100665,21.41,1649981,83226309,146548,scored,policies/wall_cupboard_open/kimi31pro-s2/policy.py
301
+ wall_cupboard_open,extended,kimi31pro-s3,kimi31pro,Kimi K3.1 Pro,Claude Code,2.1.280 (Claude Code),max,default,0,10,113,100691,19.98,1683608,74864319,163777,scored,policies/wall_cupboard_open/kimi31pro-s3/policy.py
302
+ dishwasher_close,core,deepseek1017-s1,deepseek1017,DeepSeek V4.1 Flash (1017),DeepSeek CLI (dsh),0.2.1-rc.2,max,default,0,5,201,101000,0.39,204589,69002240,255874,scored,policies/dishwasher_close/deepseek1017-s1/policy.py
303
+ dishwasher_close,core,deepseek1017-s2,deepseek1017,DeepSeek V4.1 Flash (1017),DeepSeek CLI (dsh),0.2.1-rc.2,max,default,0,11,230,94732,0.37,184656,57161216,281094,scored,policies/dishwasher_close/deepseek1017-s2/policy.py
304
+ dishwasher_close,core,deepseek1017-s3,deepseek1017,DeepSeek V4.1 Flash (1017),DeepSeek CLI (dsh),0.2.1-rc.2,max,default,0,4,246,100713,0.35,146458,59107200,258764,scored,policies/dishwasher_close/deepseek1017-s3/policy.py
305
+ dishwasher_load_cups,core,deepseek1017-s1,deepseek1017,DeepSeek V4.1 Flash (1017),DeepSeek CLI (dsh),0.2.1-rc.2,max,default,0,5,111,100884,0.54,226126,98663040,346425,scored,policies/dishwasher_load_cups/deepseek1017-s1/policy.py
306
+ dishwasher_load_cups,core,deepseek1017-s2,deepseek1017,DeepSeek V4.1 Flash (1017),DeepSeek CLI (dsh),0.2.1-rc.2,max,default,0,13,168,100957,0.42,198063,70754688,295829,scored,policies/dishwasher_load_cups/deepseek1017-s2/policy.py
307
+ dishwasher_load_cups,core,deepseek1017-s3,deepseek1017,DeepSeek V4.1 Flash (1017),DeepSeek CLI (dsh),0.2.1-rc.2,max,default,0,5,157,99643,0.42,171957,66204928,321972,scored,policies/dishwasher_load_cups/deepseek1017-s3/policy.py
308
+ drawer_top_close,core,deepseek1017-s1,deepseek1017,DeepSeek V4.1 Flash (1017),DeepSeek CLI (dsh),0.2.1-rc.2,max,default,99,6,112,100839,0.1,84497,8438400,105770,scored,policies/drawer_top_close/deepseek1017-s1/policy.py
309
+ drawer_top_close,core,deepseek1017-s2,deepseek1017,DeepSeek V4.1 Flash (1017),DeepSeek CLI (dsh),0.2.1-rc.2,max,default,91,4,141,94881,0.29,126286,35281920,277891,scored,policies/drawer_top_close/deepseek1017-s2/policy.py
310
+ drawer_top_close,core,deepseek1017-s3,deepseek1017,DeepSeek V4.1 Flash (1017),DeepSeek CLI (dsh),0.2.1-rc.2,max,default,99,1,45,75732,0.17,115825,20380800,157577,scored,policies/drawer_top_close/deepseek1017-s3/policy.py
311
+ drawer_top_open,core,deepseek1017-s1,deepseek1017,DeepSeek V4.1 Flash (1017),DeepSeek CLI (dsh),0.2.1-rc.2,max,default,0,5,174,100980,0.28,145982,36591872,252743,scored,policies/drawer_top_open/deepseek1017-s1/policy.py
312
+ drawer_top_open,core,deepseek1017-s2,deepseek1017,DeepSeek V4.1 Flash (1017),DeepSeek CLI (dsh),0.2.1-rc.2,max,default,0,4,187,101000,0.32,178503,44942848,256281,scored,policies/drawer_top_open/deepseek1017-s2/policy.py
313
+ drawer_top_open,core,deepseek1017-s3,deepseek1017,DeepSeek V4.1 Flash (1017),DeepSeek CLI (dsh),0.2.1-rc.2,max,default,0,3,197,100642,0.34,164202,52971518,265152,scored,policies/drawer_top_open/deepseek1017-s3/policy.py
314
+ move_plate,core,deepseek1017-s1,deepseek1017,DeepSeek V4.1 Flash (1017),DeepSeek CLI (dsh),0.2.1-rc.2,max,default,0,5,211,101000,0.4,207672,62723840,303746,scored,policies/move_plate/deepseek1017-s1/policy.py
315
+ move_plate,core,deepseek1017-s2,deepseek1017,DeepSeek V4.1 Flash (1017),DeepSeek CLI (dsh),0.2.1-rc.2,max,default,0,5,182,100180,0.49,567149,76743552,298932,scored,policies/move_plate/deepseek1017-s2/policy.py
316
+ move_plate,core,deepseek1017-s3,deepseek1017,DeepSeek V4.1 Flash (1017),DeepSeek CLI (dsh),0.2.1-rc.2,max,default,0,3,133,96151,0.4,186296,67842048,274474,scored,policies/move_plate/deepseek1017-s3/policy.py
317
+ move_two_plates,core,deepseek1017-s1,deepseek1017,DeepSeek V4.1 Flash (1017),DeepSeek CLI (dsh),0.2.1-rc.2,max,default,0,3,270,76987,0.45,327873,85036416,241065,scored,policies/move_two_plates/deepseek1017-s1/policy.py
318
+ move_two_plates,core,deepseek1017-s2,deepseek1017,DeepSeek V4.1 Flash (1017),DeepSeek CLI (dsh),0.2.1-rc.2,max,default,0,,,40703,0.2219,152753,26107648,201073,"void: the submission is the untouched template, byte for byte",
319
+ move_two_plates,core,deepseek1017-s3,deepseek1017,DeepSeek V4.1 Flash (1017),DeepSeek CLI (dsh),0.2.1-rc.2,max,default,0,3,145,68182,0.38,198103,61976960,266211,scored,policies/move_two_plates/deepseek1017-s3/policy.py
320
+ pick_box,core,deepseek1017-s1,deepseek1017,DeepSeek V4.1 Flash (1017),DeepSeek CLI (dsh),0.2.1-rc.2,max,default,0,5,219,99654,0.38,188495,54425472,313074,scored,policies/pick_box/deepseek1017-s1/policy.py
321
+ pick_box,core,deepseek1017-s2,deepseek1017,DeepSeek V4.1 Flash (1017),DeepSeek CLI (dsh),0.2.1-rc.2,max,default,0,12,393,98395,0.28,182161,32797056,261412,scored,policies/pick_box/deepseek1017-s2/policy.py
322
+ pick_box,core,deepseek1017-s3,deepseek1017,DeepSeek V4.1 Flash (1017),DeepSeek CLI (dsh),0.2.1-rc.2,max,default,0,,,7501,0.0389,44047,3133952,38175,"void: the submission is the untouched template, byte for byte",
323
+ reach_target_dual,core,deepseek1017-s1,deepseek1017,DeepSeek V4.1 Flash (1017),DeepSeek CLI (dsh),0.2.1-rc.2,max,default,0,5,190,98640,0.36,134260,44014208,342111,scored,policies/reach_target_dual/deepseek1017-s1/policy.py
324
+ reach_target_dual,core,deepseek1017-s2,deepseek1017,DeepSeek V4.1 Flash (1017),DeepSeek CLI (dsh),0.2.1-rc.2,max,default,20,14,268,99709,0.24,110742,23923200,258267,scored,policies/reach_target_dual/deepseek1017-s2/policy.py
325
+ reach_target_dual,core,deepseek1017-s3,deepseek1017,DeepSeek V4.1 Flash (1017),DeepSeek CLI (dsh),0.2.1-rc.2,max,default,35,8,124,100008,0.33,178787,43235456,296723,scored,policies/reach_target_dual/deepseek1017-s3/policy.py
326
+ reach_target_multi_modal,core,deepseek1017-s1,deepseek1017,DeepSeek V4.1 Flash (1017),DeepSeek CLI (dsh),0.2.1-rc.2,max,default,0,63,721,0,0.3,118122,40599808,274976,scored,policies/reach_target_multi_modal/deepseek1017-s1/policy.py
327
+ reach_target_multi_modal,core,deepseek1017-s2,deepseek1017,DeepSeek V4.1 Flash (1017),DeepSeek CLI (dsh),0.2.1-rc.2,max,default,10,26,862,0,0.19,82518,17546880,215648,scored,policies/reach_target_multi_modal/deepseek1017-s2/policy.py
328
+ reach_target_multi_modal,core,deepseek1017-s3,deepseek1017,DeepSeek V4.1 Flash (1017),DeepSeek CLI (dsh),0.2.1-rc.2,max,default,1,35,814,0,0.19,118697,19942784,194487,scored,policies/reach_target_multi_modal/deepseek1017-s3/policy.py
329
+ dishwasher_load_cutlery,extended,deepseek1017-s1,deepseek1017,DeepSeek V4.1 Flash (1017),DeepSeek CLI (dsh),0.2.1-rc.2,max,default,0,50,573,0,0.25,147283,31369472,217120,scored,policies/dishwasher_load_cutlery/deepseek1017-s1/policy.py
330
+ dishwasher_load_cutlery,extended,deepseek1017-s2,deepseek1017,DeepSeek V4.1 Flash (1017),DeepSeek CLI (dsh),0.2.1-rc.2,max,default,0,27,822,0,0.23,104908,23742208,240090,scored,policies/dishwasher_load_cutlery/deepseek1017-s2/policy.py
331
+ dishwasher_load_cutlery,extended,deepseek1017-s3,deepseek1017,DeepSeek V4.1 Flash (1017),DeepSeek CLI (dsh),0.2.1-rc.2,max,default,0,32,355,0,0.28,131116,42646912,224315,scored,policies/dishwasher_load_cutlery/deepseek1017-s3/policy.py
332
+ dishwasher_load_plates,extended,deepseek1017-s1,deepseek1017,DeepSeek V4.1 Flash (1017),DeepSeek CLI (dsh),0.2.1-rc.2,max,default,0,20,405,0,0.16,111802,17052288,145445,scored,policies/dishwasher_load_plates/deepseek1017-s1/policy.py
333
+ dishwasher_load_plates,extended,deepseek1017-s2,deepseek1017,DeepSeek V4.1 Flash (1017),DeepSeek CLI (dsh),0.2.1-rc.2,max,default,0,28,664,0,0.17,106315,14820992,180846,scored,policies/dishwasher_load_plates/deepseek1017-s2/policy.py
334
+ dishwasher_load_plates,extended,deepseek1017-s3,deepseek1017,DeepSeek V4.1 Flash (1017),DeepSeek CLI (dsh),0.2.1-rc.2,max,default,0,15,308,0,0.2,101588,24100608,182959,scored,policies/dishwasher_load_plates/deepseek1017-s3/policy.py
335
+ flip_cup,extended,deepseek1017-s1,deepseek1017,DeepSeek V4.1 Flash (1017),DeepSeek CLI (dsh),0.2.1-rc.2,max,default,0,1,220,89712,0.36,198883,57252992,269053,scored,policies/flip_cup/deepseek1017-s1/policy.py
336
+ flip_cup,extended,deepseek1017-s2,deepseek1017,DeepSeek V4.1 Flash (1017),DeepSeek CLI (dsh),0.2.1-rc.2,max,default,0,5,289,101000,0.37,153283,46425344,338559,scored,policies/flip_cup/deepseek1017-s2/policy.py
337
+ flip_cup,extended,deepseek1017-s3,deepseek1017,DeepSeek V4.1 Flash (1017),DeepSeek CLI (dsh),0.2.1-rc.2,max,default,0,4,364,98663,0.43,208183,79748608,261940,scored,policies/flip_cup/deepseek1017-s3/policy.py
338
+ flip_cutlery,extended,deepseek1017-s1,deepseek1017,DeepSeek V4.1 Flash (1017),DeepSeek CLI (dsh),0.2.1-rc.2,max,default,0,4,123,100834,0.37,176180,67763840,237990,scored,policies/flip_cutlery/deepseek1017-s1/policy.py
339
+ flip_cutlery,extended,deepseek1017-s2,deepseek1017,DeepSeek V4.1 Flash (1017),DeepSeek CLI (dsh),0.2.1-rc.2,max,default,0,12,376,84990,0.33,179809,50946560,258173,scored,policies/flip_cutlery/deepseek1017-s2/policy.py
340
+ flip_cutlery,extended,deepseek1017-s3,deepseek1017,DeepSeek V4.1 Flash (1017),DeepSeek CLI (dsh),0.2.1-rc.2,max,default,0,9,275,69176,0.34,153510,48504960,280593,scored,policies/flip_cutlery/deepseek1017-s3/policy.py
341
+ put_cups,extended,deepseek1017-s1,deepseek1017,DeepSeek V4.1 Flash (1017),DeepSeek CLI (dsh),0.2.1-rc.2,max,default,0,4,211,97878,0.41,192879,69361920,293616,scored,policies/put_cups/deepseek1017-s1/policy.py
342
+ put_cups,extended,deepseek1017-s2,deepseek1017,DeepSeek V4.1 Flash (1017),DeepSeek CLI (dsh),0.2.1-rc.2,max,default,0,13,175,97890,0.53,185285,92579328,374570,scored,policies/put_cups/deepseek1017-s2/policy.py
343
+ put_cups,extended,deepseek1017-s3,deepseek1017,DeepSeek V4.1 Flash (1017),DeepSeek CLI (dsh),0.2.1-rc.2,max,default,0,4,160,99516,0.33,159376,52464512,254944,scored,policies/put_cups/deepseek1017-s3/policy.py
344
+ reach_target_single,extended,deepseek1017-s1,deepseek1017,DeepSeek V4.1 Flash (1017),DeepSeek CLI (dsh),0.2.1-rc.2,max,default,61,6,279,101000,0.22,157419,25130624,195171,scored,policies/reach_target_single/deepseek1017-s1/policy.py
345
+ reach_target_single,extended,deepseek1017-s2,deepseek1017,DeepSeek V4.1 Flash (1017),DeepSeek CLI (dsh),0.2.1-rc.2,max,default,24,17,203,99324,0.42,220768,58817792,346202,scored,policies/reach_target_single/deepseek1017-s2/policy.py
346
+ reach_target_single,extended,deepseek1017-s3,deepseek1017,DeepSeek V4.1 Flash (1017),DeepSeek CLI (dsh),0.2.1-rc.2,max,default,96,7,193,100791,0.17,125264,14373248,184587,scored,policies/reach_target_single/deepseek1017-s3/policy.py
347
+ sandwich_remove,extended,deepseek1017-s1,deepseek1017,DeepSeek V4.1 Flash (1017),DeepSeek CLI (dsh),0.2.1-rc.2,max,default,0,3,191,100534,0.33,150285,46318848,280017,scored,policies/sandwich_remove/deepseek1017-s1/policy.py
348
+ sandwich_remove,extended,deepseek1017-s2,deepseek1017,DeepSeek V4.1 Flash (1017),DeepSeek CLI (dsh),0.2.1-rc.2,max,default,0,2,162,95147,0.55,232599,100829824,362609,scored,policies/sandwich_remove/deepseek1017-s2/policy.py
349
+ sandwich_remove,extended,deepseek1017-s3,deepseek1017,DeepSeek V4.1 Flash (1017),DeepSeek CLI (dsh),0.2.1-rc.2,max,default,0,10,287,91722,0.36,213255,56174976,258989,scored,policies/sandwich_remove/deepseek1017-s3/policy.py
350
+ saucepan_to_hob,extended,deepseek1017-s1,deepseek1017,DeepSeek V4.1 Flash (1017),DeepSeek CLI (dsh),0.2.1-rc.2,max,default,0,5,357,100792,0.4,176679,70610176,274608,scored,policies/saucepan_to_hob/deepseek1017-s1/policy.py
351
+ saucepan_to_hob,extended,deepseek1017-s2,deepseek1017,DeepSeek V4.1 Flash (1017),DeepSeek CLI (dsh),0.2.1-rc.2,max,default,0,4,292,99505,0.41,193278,68477440,289438,scored,policies/saucepan_to_hob/deepseek1017-s2/policy.py
352
+ saucepan_to_hob,extended,deepseek1017-s3,deepseek1017,DeepSeek V4.1 Flash (1017),DeepSeek CLI (dsh),0.2.1-rc.2,max,default,0,7,299,99986,0.4,225951,62242304,293726,scored,policies/saucepan_to_hob/deepseek1017-s3/policy.py
353
+ stack_blocks,extended,deepseek1017-s1,deepseek1017,DeepSeek V4.1 Flash (1017),DeepSeek CLI (dsh),0.2.1-rc.2,max,default,0,7,311,101000,0.25,130863,30753152,235879,scored,policies/stack_blocks/deepseek1017-s1/policy.py
354
+ stack_blocks,extended,deepseek1017-s2,deepseek1017,DeepSeek V4.1 Flash (1017),DeepSeek CLI (dsh),0.2.1-rc.2,max,default,0,5,303,100764,0.28,155075,36112512,252010,scored,policies/stack_blocks/deepseek1017-s2/policy.py
355
+ stack_blocks,extended,deepseek1017-s3,deepseek1017,DeepSeek V4.1 Flash (1017),DeepSeek CLI (dsh),0.2.1-rc.2,max,default,0,11,236,97363,0.33,143559,48217728,268558,scored,policies/stack_blocks/deepseek1017-s3/policy.py
356
+ wall_cupboard_close,extended,deepseek1017-s1,deepseek1017,DeepSeek V4.1 Flash (1017),DeepSeek CLI (dsh),0.2.1-rc.2,max,default,0,3,149,100068,0.36,172993,47115776,322495,scored,policies/wall_cupboard_close/deepseek1017-s1/policy.py
357
+ wall_cupboard_close,extended,deepseek1017-s2,deepseek1017,DeepSeek V4.1 Flash (1017),DeepSeek CLI (dsh),0.2.1-rc.2,max,default,100,1,122,93791,0.34,152725,51454464,263385,scored,policies/wall_cupboard_close/deepseek1017-s2/policy.py
358
+ wall_cupboard_close,extended,deepseek1017-s3,deepseek1017,DeepSeek V4.1 Flash (1017),DeepSeek CLI (dsh),0.2.1-rc.2,max,default,0,3,182,95457,0.43,189866,60228352,370109,scored,policies/wall_cupboard_close/deepseek1017-s3/policy.py
359
+ wall_cupboard_open,extended,deepseek1017-s1,deepseek1017,DeepSeek V4.1 Flash (1017),DeepSeek CLI (dsh),0.2.1-rc.2,max,default,0,5,225,100539,0.47,206259,76819968,342657,scored,policies/wall_cupboard_open/deepseek1017-s1/policy.py
360
+ wall_cupboard_open,extended,deepseek1017-s2,deepseek1017,DeepSeek V4.1 Flash (1017),DeepSeek CLI (dsh),0.2.1-rc.2,max,default,0,4,119,86678,0.57,287459,105897728,354574,scored,policies/wall_cupboard_open/deepseek1017-s2/policy.py
361
+ wall_cupboard_open,extended,deepseek1017-s3,deepseek1017,DeepSeek V4.1 Flash (1017),DeepSeek CLI (dsh),0.2.1-rc.2,max,default,0,6,119,101000,0.46,191728,72174976,358948,scored,policies/wall_cupboard_open/deepseek1017-s3/policy.py
362
+ dishwasher_close,core,gpt61terra-s1,gpt61terra,GPT-6.1 Terra,Codex CLI,codex-cli 0.164.0,high,default,0,3,54,98701,0.68,223622,6669056,25348,scored,policies/dishwasher_close/gpt61terra-s1/policy.py
363
+ dishwasher_close,core,gpt61terra-s2,gpt61terra,GPT-6.1 Terra,Codex CLI,codex-cli 0.164.0,high,default,0,2,74,96350,1.07,185708,14334720,32671,scored,policies/dishwasher_close/gpt61terra-s2/policy.py
364
+ dishwasher_close,core,gpt61terra-s3,gpt61terra,GPT-6.1 Terra,Codex CLI,codex-cli 0.164.0,high,default,0,4,47,100780,0.96,104394,13574144,34402,scored,policies/dishwasher_close/gpt61terra-s3/policy.py
365
+ dishwasher_load_cups,core,gpt61terra-s1,gpt61terra,GPT-6.1 Terra,Codex CLI,codex-cli 0.164.0,high,default,0,1,68,30927,0.49,106260,6052992,16980,scored,policies/dishwasher_load_cups/gpt61terra-s1/policy.py
366
+ dishwasher_load_cups,core,gpt61terra-s2,gpt61terra,GPT-6.1 Terra,Codex CLI,codex-cli 0.164.0,high,default,0,3,44,34530,0.47,115270,5379712,17328,scored,policies/dishwasher_load_cups/gpt61terra-s2/policy.py
367
+ dishwasher_load_cups,core,gpt61terra-s3,gpt61terra,GPT-6.1 Terra,Codex CLI,codex-cli 0.164.0,high,default,36,7,43,87426,1.12,211917,15364864,28831,scored,policies/dishwasher_load_cups/gpt61terra-s3/policy.py
368
+ drawer_top_close,core,gpt61terra-s1,gpt61terra,GPT-6.1 Terra,Codex CLI,codex-cli 0.164.0,high,default,70,4,17,101000,0.24,66134,2510464,10387,scored,policies/drawer_top_close/gpt61terra-s1/policy.py
369
+ drawer_top_close,core,gpt61terra-s2,gpt61terra,GPT-6.1 Terra,Codex CLI,codex-cli 0.164.0,high,default,88,6,16,97369,0.27,67925,3137920,8580,scored,policies/drawer_top_close/gpt61terra-s2/policy.py
370
+ drawer_top_close,core,gpt61terra-s3,gpt61terra,GPT-6.1 Terra,Codex CLI,codex-cli 0.164.0,high,default,81,5,15,97928,0.25,49107,3182464,9257,scored,policies/drawer_top_close/gpt61terra-s3/policy.py
371
+ drawer_top_open,core,gpt61terra-s1,gpt61terra,GPT-6.1 Terra,Codex CLI,codex-cli 0.164.0,high,default,100,4,37,100418,0.47,128277,4772864,19997,scored,policies/drawer_top_open/gpt61terra-s1/policy.py
372
+ drawer_top_open,core,gpt61terra-s2,gpt61terra,GPT-6.1 Terra,Codex CLI,codex-cli 0.164.0,high,default,0,2,37,100934,0.5,87065,6531072,17661,scored,policies/drawer_top_open/gpt61terra-s2/policy.py
373
+ drawer_top_open,core,gpt61terra-s3,gpt61terra,GPT-6.1 Terra,Codex CLI,codex-cli 0.164.0,high,default,27,5,46,101000,0.83,177732,10476928,25999,scored,policies/drawer_top_open/gpt61terra-s3/policy.py
374
+ move_plate,core,gpt61terra-s1,gpt61terra,GPT-6.1 Terra,Codex CLI,codex-cli 0.164.0,high,default,3,2,38,100751,0.46,98398,5232768,19043,scored,policies/move_plate/gpt61terra-s1/policy.py
375
+ move_plate,core,gpt61terra-s2,gpt61terra,GPT-6.1 Terra,Codex CLI,codex-cli 0.164.0,high,default,0,2,56,98241,0.8,116997,10929280,27762,scored,policies/move_plate/gpt61terra-s2/policy.py
376
+ move_plate,core,gpt61terra-s3,gpt61terra,GPT-6.1 Terra,Codex CLI,codex-cli 0.164.0,high,default,1,6,31,99847,0.66,91464,8794880,25468,scored,policies/move_plate/gpt61terra-s3/policy.py
377
+ move_two_plates,core,gpt61terra-s1,gpt61terra,GPT-6.1 Terra,Codex CLI,codex-cli 0.164.0,high,default,0,1,59,100920,0.58,112054,7130624,22364,scored,policies/move_two_plates/gpt61terra-s1/policy.py
378
+ move_two_plates,core,gpt61terra-s2,gpt61terra,GPT-6.1 Terra,Codex CLI,codex-cli 0.164.0,high,default,0,3,70,98195,0.98,168479,13447040,27076,scored,policies/move_two_plates/gpt61terra-s2/policy.py
379
+ move_two_plates,core,gpt61terra-s3,gpt61terra,GPT-6.1 Terra,Codex CLI,codex-cli 0.164.0,high,default,5,11,52,99784,1.03,145823,14936320,27246,scored,policies/move_two_plates/gpt61terra-s3/policy.py
380
+ pick_box,core,gpt61terra-s1,gpt61terra,GPT-6.1 Terra,Codex CLI,codex-cli 0.164.0,high,default,3,4,37,101000,0.79,153827,10743040,20264,scored,policies/pick_box/gpt61terra-s1/policy.py
381
+ pick_box,core,gpt61terra-s2,gpt61terra,GPT-6.1 Terra,Codex CLI,codex-cli 0.164.0,high,default,8,6,35,100837,0.67,119766,8539776,24597,scored,policies/pick_box/gpt61terra-s2/policy.py
382
+ pick_box,core,gpt61terra-s3,gpt61terra,GPT-6.1 Terra,Codex CLI,codex-cli 0.164.0,high,default,0,6,110,94000,1.19,176197,17336320,30040,scored,policies/pick_box/gpt61terra-s3/policy.py
383
+ reach_target_dual,core,gpt61terra-s1,gpt61terra,GPT-6.1 Terra,Codex CLI,codex-cli 0.164.0,high,default,67,7,54,96185,0.44,137351,4476672,15883,scored,policies/reach_target_dual/gpt61terra-s1/policy.py
384
+ reach_target_dual,core,gpt61terra-s2,gpt61terra,GPT-6.1 Terra,Codex CLI,codex-cli 0.164.0,high,default,34,6,57,98847,0.72,131414,8145920,35830,scored,policies/reach_target_dual/gpt61terra-s2/policy.py
385
+ reach_target_dual,core,gpt61terra-s3,gpt61terra,GPT-6.1 Terra,Codex CLI,codex-cli 0.164.0,high,default,34,8,63,100905,0.66,171551,7149184,26445,scored,policies/reach_target_dual/gpt61terra-s3/policy.py
386
+ reach_target_multi_modal,core,gpt61terra-s1,gpt61terra,GPT-6.1 Terra,Codex CLI,codex-cli 0.164.0,high,default,86,7,66,100097,0.42,101419,4562560,17918,scored,policies/reach_target_multi_modal/gpt61terra-s1/policy.py
387
+ reach_target_multi_modal,core,gpt61terra-s2,gpt61terra,GPT-6.1 Terra,Codex CLI,codex-cli 0.164.0,high,default,84,6,28,100916,0.48,69440,6277248,19104,scored,policies/reach_target_multi_modal/gpt61terra-s2/policy.py
388
+ reach_target_multi_modal,core,gpt61terra-s3,gpt61terra,GPT-6.1 Terra,Codex CLI,codex-cli 0.164.0,high,default,46,10,45,100242,0.56,116136,6442624,23939,scored,policies/reach_target_multi_modal/gpt61terra-s3/policy.py
389
+ dishwasher_load_cutlery,extended,gpt61terra-s1,gpt61terra,GPT-6.1 Terra,Codex CLI,codex-cli 0.164.0,high,default,1,3,71,82391,0.98,156026,13393280,31086,scored,policies/dishwasher_load_cutlery/gpt61terra-s1/policy.py
390
+ dishwasher_load_cutlery,extended,gpt61terra-s2,gpt61terra,GPT-6.1 Terra,Codex CLI,codex-cli 0.164.0,high,default,0,2,48,21947,0.29,70957,2932864,13523,scored,policies/dishwasher_load_cutlery/gpt61terra-s2/policy.py
391
+ dishwasher_load_cutlery,extended,gpt61terra-s3,gpt61terra,GPT-6.1 Terra,Codex CLI,codex-cli 0.164.0,high,default,0,2,67,99850,1.36,379275,15532288,40728,scored,policies/dishwasher_load_cutlery/gpt61terra-s3/policy.py
392
+ dishwasher_load_plates,extended,gpt61terra-s1,gpt61terra,GPT-6.1 Terra,Codex CLI,codex-cli 0.164.0,high,default,0,14,44,90029,0.75,90559,10237824,28764,scored,policies/dishwasher_load_plates/gpt61terra-s1/policy.py
393
+ dishwasher_load_plates,extended,gpt61terra-s2,gpt61terra,GPT-6.1 Terra,Codex CLI,codex-cli 0.164.0,high,default,0,7,71,83599,0.84,125740,11471616,28697,scored,policies/dishwasher_load_plates/gpt61terra-s2/policy.py
394
+ dishwasher_load_plates,extended,gpt61terra-s3,gpt61terra,GPT-6.1 Terra,Codex CLI,codex-cli 0.164.0,high,default,0,7,56,99279,0.93,166678,12973696,23863,scored,policies/dishwasher_load_plates/gpt61terra-s3/policy.py
395
+ flip_cup,extended,gpt61terra-s1,gpt61terra,GPT-6.1 Terra,Codex CLI,codex-cli 0.164.0,high,default,0,4,61,100613,0.71,102528,8874112,32701,scored,policies/flip_cup/gpt61terra-s1/policy.py
396
+ flip_cup,extended,gpt61terra-s2,gpt61terra,GPT-6.1 Terra,Codex CLI,codex-cli 0.164.0,high,default,0,2,65,100522,0.67,95250,9125504,23874,scored,policies/flip_cup/gpt61terra-s2/policy.py
397
+ flip_cup,extended,gpt61terra-s3,gpt61terra,GPT-6.1 Terra,Codex CLI,codex-cli 0.164.0,high,default,11,5,62,99768,0.74,208184,8265472,22878,scored,policies/flip_cup/gpt61terra-s3/policy.py
398
+ flip_cutlery,extended,gpt61terra-s1,gpt61terra,GPT-6.1 Terra,Codex CLI,codex-cli 0.164.0,high,default,3,3,80,95340,0.78,113036,10792448,24865,scored,policies/flip_cutlery/gpt61terra-s1/policy.py
399
+ flip_cutlery,extended,gpt61terra-s2,gpt61terra,GPT-6.1 Terra,Codex CLI,codex-cli 0.164.0,high,default,0,2,90,99755,0.64,96904,8498432,23176,scored,policies/flip_cutlery/gpt61terra-s2/policy.py
400
+ flip_cutlery,extended,gpt61terra-s3,gpt61terra,GPT-6.1 Terra,Codex CLI,codex-cli 0.164.0,high,default,0,1,37,99228,0.63,158757,6823680,25373,scored,policies/flip_cutlery/gpt61terra-s3/policy.py
401
+ put_cups,extended,gpt61terra-s1,gpt61terra,GPT-6.1 Terra,Codex CLI,codex-cli 0.164.0,high,default,0,4,49,96760,0.54,86884,6914176,21985,scored,policies/put_cups/gpt61terra-s1/policy.py
402
+ put_cups,extended,gpt61terra-s2,gpt61terra,GPT-6.1 Terra,Codex CLI,codex-cli 0.164.0,high,default,0,15,62,98660,0.64,96275,7722752,30687,scored,policies/put_cups/gpt61terra-s2/policy.py
403
+ put_cups,extended,gpt61terra-s3,gpt61terra,GPT-6.1 Terra,Codex CLI,codex-cli 0.164.0,high,default,0,2,40,12940,0.25,61814,2774528,10661,scored,policies/put_cups/gpt61terra-s3/policy.py
404
+ reach_target_single,extended,gpt61terra-s1,gpt61terra,GPT-6.1 Terra,Codex CLI,codex-cli 0.164.0,high,default,30,6,29,100406,0.33,61329,3848960,14967,scored,policies/reach_target_single/gpt61terra-s1/policy.py
405
+ reach_target_single,extended,gpt61terra-s2,gpt61terra,GPT-6.1 Terra,Codex CLI,codex-cli 0.164.0,high,default,66,6,34,101000,0.3,93833,2734592,14649,scored,policies/reach_target_single/gpt61terra-s2/policy.py
406
+ reach_target_single,extended,gpt61terra-s3,gpt61terra,GPT-6.1 Terra,Codex CLI,codex-cli 0.164.0,high,default,78,4,91,100112,0.4,94014,4663552,15357,scored,policies/reach_target_single/gpt61terra-s3/policy.py
407
+ sandwich_remove,extended,gpt61terra-s1,gpt61terra,GPT-6.1 Terra,Codex CLI,codex-cli 0.164.0,high,default,0,2,43,94222,0.76,117504,10146432,27209,scored,policies/sandwich_remove/gpt61terra-s1/policy.py
408
+ sandwich_remove,extended,gpt61terra-s2,gpt61terra,GPT-6.1 Terra,Codex CLI,codex-cli 0.164.0,high,default,0,2,33,57777,0.54,123946,6094080,22380,scored,policies/sandwich_remove/gpt61terra-s2/policy.py
409
+ sandwich_remove,extended,gpt61terra-s3,gpt61terra,GPT-6.1 Terra,Codex CLI,codex-cli 0.164.0,high,default,0,2,44,56010,0.48,68793,6278784,19039,scored,policies/sandwich_remove/gpt61terra-s3/policy.py
410
+ saucepan_to_hob,extended,gpt61terra-s1,gpt61terra,GPT-6.1 Terra,Codex CLI,codex-cli 0.164.0,high,default,0,1,41,100545,0.81,124926,11319296,24054,scored,policies/saucepan_to_hob/gpt61terra-s1/policy.py
411
+ saucepan_to_hob,extended,gpt61terra-s2,gpt61terra,GPT-6.1 Terra,Codex CLI,codex-cli 0.164.0,high,default,0,2,52,100934,0.77,107157,10763648,25228,scored,policies/saucepan_to_hob/gpt61terra-s2/policy.py
412
+ saucepan_to_hob,extended,gpt61terra-s3,gpt61terra,GPT-6.1 Terra,Codex CLI,codex-cli 0.164.0,high,default,0,1,40,38951,0.32,62405,3927552,11898,scored,policies/saucepan_to_hob/gpt61terra-s3/policy.py
413
+ stack_blocks,extended,gpt61terra-s1,gpt61terra,GPT-6.1 Terra,Codex CLI,codex-cli 0.164.0,high,default,0,3,76,99440,0.86,115164,11490944,33586,scored,policies/stack_blocks/gpt61terra-s1/policy.py
414
+ stack_blocks,extended,gpt61terra-s2,gpt61terra,GPT-6.1 Terra,Codex CLI,codex-cli 0.164.0,high,default,0,5,108,88720,1.16,144596,17021056,32016,scored,policies/stack_blocks/gpt61terra-s2/policy.py
415
+ stack_blocks,extended,gpt61terra-s3,gpt61terra,GPT-6.1 Terra,Codex CLI,codex-cli 0.164.0,high,default,0,6,136,98620,1.01,170707,13534592,31994,scored,policies/stack_blocks/gpt61terra-s3/policy.py
416
+ wall_cupboard_close,extended,gpt61terra-s1,gpt61terra,GPT-6.1 Terra,Codex CLI,codex-cli 0.164.0,high,default,0,2,48,101000,0.41,79880,4750464,17830,scored,policies/wall_cupboard_close/gpt61terra-s1/policy.py
417
+ wall_cupboard_close,extended,gpt61terra-s2,gpt61terra,GPT-6.1 Terra,Codex CLI,codex-cli 0.164.0,high,default,100,1,17,53820,0.22,78406,1948416,8433,scored,policies/wall_cupboard_close/gpt61terra-s2/policy.py
418
+ wall_cupboard_close,extended,gpt61terra-s3,gpt61terra,GPT-6.1 Terra,Codex CLI,codex-cli 0.164.0,high,default,0,1,41,99593,0.36,69664,4271232,16132,scored,policies/wall_cupboard_close/gpt61terra-s3/policy.py
419
+ wall_cupboard_open,extended,gpt61terra-s1,gpt61terra,GPT-6.1 Terra,Codex CLI,codex-cli 0.164.0,high,default,0,2,50,99699,0.56,171769,5635200,21473,scored,policies/wall_cupboard_open/gpt61terra-s1/policy.py
420
+ wall_cupboard_open,extended,gpt61terra-s2,gpt61terra,GPT-6.1 Terra,Codex CLI,codex-cli 0.164.0,high,default,0,4,59,99078,0.58,85954,7069568,28030,scored,policies/wall_cupboard_open/gpt61terra-s2/policy.py
421
+ wall_cupboard_open,extended,gpt61terra-s3,gpt61terra,GPT-6.1 Terra,Codex CLI,codex-cli 0.164.0,high,default,0,6,28,98905,0.86,103286,12311168,28846,scored,policies/wall_cupboard_open/gpt61terra-s3/policy.py
policies/stack_blocks/deepseek1017-s2/episodes.csv ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ seed,success,length,termination,fell
2
+ 620000,0,8750,timeout,0
3
+ 620001,0,8750,timeout,0
4
+ 620002,0,8750,timeout,0
5
+ 620003,0,8750,timeout,0
6
+ 620004,0,8750,timeout,0
7
+ 620005,0,8750,timeout,0
8
+ 620006,0,8750,timeout,0
9
+ 620007,0,8750,timeout,0
10
+ 620008,0,8750,timeout,0
11
+ 620009,0,8750,timeout,0
12
+ 620010,0,8750,timeout,0
13
+ 620011,0,8750,timeout,0
14
+ 620012,0,8750,timeout,0
15
+ 620013,0,8750,timeout,0
16
+ 620014,0,8750,timeout,0
17
+ 620015,0,8750,timeout,0
18
+ 620016,0,8750,timeout,0
19
+ 620017,0,8750,timeout,0
20
+ 620018,0,8750,timeout,0
21
+ 620019,0,8750,timeout,0
22
+ 620020,0,8750,timeout,0
23
+ 620021,0,8750,timeout,0
24
+ 620022,0,8750,timeout,0
25
+ 620023,0,8750,timeout,0
26
+ 620024,0,8750,timeout,0
27
+ 620025,0,8750,timeout,0
28
+ 620026,0,8750,timeout,0
29
+ 620027,0,8750,timeout,0
30
+ 620028,0,8750,timeout,0
31
+ 620029,0,8750,timeout,0
32
+ 620030,0,8750,timeout,0
33
+ 620031,0,8750,timeout,0
34
+ 620032,0,8750,timeout,0
35
+ 620033,0,8750,timeout,0
36
+ 620034,0,8750,timeout,0
37
+ 620035,0,8750,timeout,0
38
+ 620036,0,8750,timeout,0
39
+ 620037,0,8750,timeout,0
40
+ 620038,0,8750,timeout,0
41
+ 620039,0,8750,timeout,0
42
+ 620040,0,8750,timeout,0
43
+ 620041,0,8750,timeout,0
44
+ 620042,0,8750,timeout,0
45
+ 620043,0,8750,timeout,0
46
+ 620044,0,8750,timeout,0
47
+ 620045,0,8750,timeout,0
48
+ 620046,0,8750,timeout,0
49
+ 620047,0,8750,timeout,0
50
+ 620048,0,8750,timeout,0
51
+ 620049,0,8750,timeout,0
52
+ 620050,0,8750,timeout,0
53
+ 620051,0,8750,timeout,0
54
+ 620052,0,8750,timeout,0
55
+ 620053,0,8750,timeout,0
56
+ 620054,0,8750,timeout,0
57
+ 620055,0,8750,timeout,0
58
+ 620056,0,8750,timeout,0
59
+ 620057,0,8750,timeout,0
60
+ 620058,0,8750,timeout,0
61
+ 620059,0,8750,timeout,0
62
+ 620060,0,8750,timeout,0
63
+ 620061,0,8750,timeout,0
64
+ 620062,0,8750,timeout,0
65
+ 620063,0,8750,timeout,0
66
+ 620064,0,8750,timeout,0
67
+ 620065,0,8750,timeout,0
68
+ 620066,0,8750,timeout,0
69
+ 620067,0,8750,timeout,0
70
+ 620068,0,8750,timeout,0
71
+ 620069,0,8750,timeout,0
72
+ 620070,0,8750,timeout,0
73
+ 620071,0,8750,timeout,0
74
+ 620072,0,8750,timeout,0
75
+ 620073,0,8750,timeout,0
76
+ 620074,0,8750,timeout,0
77
+ 620075,0,8750,timeout,0
78
+ 620076,0,8750,timeout,0
79
+ 620077,0,8750,timeout,0
80
+ 620078,0,8750,timeout,0
81
+ 620079,0,8750,timeout,0
82
+ 620080,0,8750,timeout,0
83
+ 620081,0,8750,timeout,0
84
+ 620082,0,8750,timeout,0
85
+ 620083,0,8750,timeout,0
86
+ 620084,0,8750,timeout,0
87
+ 620085,0,8750,timeout,0
88
+ 620086,0,8750,timeout,0
89
+ 620087,0,8750,timeout,0
90
+ 620088,0,8750,timeout,0
91
+ 620089,0,8750,timeout,0
92
+ 620090,0,8750,timeout,0
93
+ 620091,0,8750,timeout,0
94
+ 620092,0,8750,timeout,0
95
+ 620093,0,8750,timeout,0
96
+ 620094,0,8750,timeout,0
97
+ 620095,0,8750,timeout,0
98
+ 620096,0,8750,timeout,0
99
+ 620097,0,8750,timeout,0
100
+ 620098,0,8750,timeout,0
101
+ 620099,0,8750,timeout,0
policies/stack_blocks/deepseek1017-s2/policy.py ADDED
@@ -0,0 +1,303 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Control policy for the G1 ``stack_blocks`` task.
2
+
3
+ The robot starts at the source table with red blocks right next to its open
4
+ grippers. The destination is another table carrying a green pad which may
5
+ appear anywhere in the room, so the policy grabs the blocks first, scans for
6
+ the green pad with the head camera and then carries the blocks to it.
7
+
8
+ Only the robot's own cameras and proprioception are used. All logic is
9
+ deterministic (no wall clock, no unseeded randomness).
10
+ """
11
+
12
+ import cv2
13
+ import numpy as np
14
+
15
+
16
+ def _wrap(a):
17
+ return (a + np.pi) % (2 * np.pi) - np.pi
18
+
19
+
20
+ class Policy:
21
+ # ---------------------------------------------------------------- helpers
22
+ @staticmethod
23
+ def _green_blob(im):
24
+ """Largest green blob in an 84x84 RGB image -> (area, cx, cy)."""
25
+ r = im[:, :, 0].astype(np.int16)
26
+ g = im[:, :, 1].astype(np.int16)
27
+ b = im[:, :, 2].astype(np.int16)
28
+ m = ((g > r + 18) & (g > b + 18) & (g > 52)).astype(np.uint8) * 255
29
+ if m.sum() == 0:
30
+ return 0, 42.0, 42.0
31
+ try:
32
+ n, lab, stats, cents = cv2.connectedComponentsWithStats(m, 8)
33
+ except Exception:
34
+ return 0, 42.0, 42.0
35
+ best, bx, by = 0, 42.0, 42.0
36
+ for i in range(1, n):
37
+ a = int(stats[i, 4])
38
+ if a > best:
39
+ best = a
40
+ bx, by = float(cents[i, 0]), float(cents[i, 1])
41
+ return best, bx, by
42
+
43
+ def _carry(self, raw, lift=0.32, elbow=0.14):
44
+ raw[5] = lift
45
+ raw[6] = 0.0
46
+ raw[7] = elbow
47
+ raw[8] = 0.0
48
+ raw[9] = 0.0
49
+ raw[10] = 0.0
50
+ raw[11] = 0.0
51
+ raw[12] = lift
52
+ raw[13] = 0.0
53
+ raw[14] = elbow
54
+ raw[15] = 0.0
55
+ raw[16] = 0.0
56
+ raw[17] = 0.0
57
+ raw[18] = 0.0
58
+ raw[19] = 1.0
59
+ raw[20] = 1.0
60
+ return raw
61
+
62
+ def _normal(self, raw):
63
+ raw[2] = 0.74
64
+ raw[4] = 0.0
65
+ return raw
66
+
67
+ # ------------------------------------------------------------------ reset
68
+ def reset(self, obs, tools):
69
+ ld = np.asarray(obs["low_dim_obs"])
70
+ self.sx = float(ld[21])
71
+ self.sy = float(ld[22])
72
+ self.syaw = float(ld[24])
73
+ self.t = 0
74
+ self.state = "grab"
75
+ self.scan_k = 0
76
+ self.scan_t = 0
77
+ self.scan_phase = 0
78
+ self.leg = 0
79
+ self.legs = [
80
+ (self.sx - 1.0, self.sy - 2.6),
81
+ (self.sx + 6.2, self.sy - 2.6),
82
+ (self.sx + 6.2, self.sy - 5.0),
83
+ (self.sx + 1.0, self.sy - 5.0),
84
+ (self.sx + 1.0, self.sy - 6.8),
85
+ (self.sx + 6.5, self.sy - 6.8),
86
+ (self.sx + 6.5, self.sy + 2.6),
87
+ (self.sx + 1.0, self.sy + 2.6),
88
+ (self.sx + 1.0, self.sy + 5.0),
89
+ (self.sx - 2.0, self.sy + 5.0),
90
+ (self.sx - 2.0, self.sy + 2.0),
91
+ (self.sx - 4.0, self.sy + 2.0),
92
+ (self.sx - 4.0, self.sy - 2.0),
93
+ (self.sx - 6.0, self.sy - 2.0),
94
+ ]
95
+ self.green_seen = 0
96
+ self.last_blob = (0, 42.0, 42.0)
97
+ self.place_t = 0
98
+ self.approach_t = 0
99
+ self.last_pos = (self.sx, self.sy)
100
+ self.approach_stall = 0
101
+ self.wrist_seen = 0
102
+
103
+ # -------------------------------------------------------------------- act
104
+ def act(self, obs, tools):
105
+ ld = np.asarray(obs["low_dim_obs"])
106
+ x = float(ld[21])
107
+ y = float(ld[22])
108
+ z = float(ld[23])
109
+ yaw = float(ld[24])
110
+ raw = np.asarray(tools.hold_action(), dtype=np.float32)
111
+ t = self.t
112
+ self.t += 1
113
+
114
+ if z < 0.45: # fallen: freeze
115
+ return raw
116
+
117
+ # ------------------------------------------------ 1. grasp the blocks
118
+ if self.state == "grab":
119
+ raw = self._carry(raw, lift=0.30, elbow=0.12)
120
+ if t >= 50:
121
+ self.state = "retreat"
122
+ return raw
123
+
124
+ # ------------------------------------------------ 2. back away
125
+ if self.state == "retreat":
126
+ raw = self._carry(raw, lift=0.30, elbow=0.12)
127
+ raw[0] = -0.45
128
+ if t >= 165:
129
+ self.state = "scan0"
130
+ self.scan_k = 0
131
+ self.scan_phase = 0
132
+ self.scan_t = 0
133
+ return raw
134
+
135
+ # ------------------------------------------------ 3. initial tall scan
136
+ if self.state == "scan0":
137
+ target = self.syaw + self.scan_k * np.pi / 4.0
138
+ err = _wrap(target - yaw)
139
+ if self.scan_phase == 0:
140
+ # rotate at normal height
141
+ raw = self._carry(raw)
142
+ self._normal(raw)
143
+ if abs(err) > 0.06 and self.scan_t < 70:
144
+ raw[3] = float(np.clip(2.4 * err, -0.65, 0.65))
145
+ self.scan_t += 1
146
+ return raw
147
+ self.scan_phase = 1
148
+ self.scan_t = 0
149
+ if self.scan_phase == 1:
150
+ # settle tall, lean back and look around
151
+ raw = self._carry(raw)
152
+ raw[2] = 0.92
153
+ raw[4] = -0.2
154
+ if self.scan_t < 30:
155
+ self.scan_t += 1
156
+ return raw
157
+ try:
158
+ im = tools.image("head")
159
+ area, cx, cy = self._green_blob(im)
160
+ except Exception:
161
+ area, cx, cy = 0, 42.0, 42.0
162
+ if area >= 5:
163
+ self.state = "approach"
164
+ self.last_blob = (area, cx, cy)
165
+ self.approach_t = 0
166
+ return raw
167
+ self.scan_phase = 2
168
+ self.scan_t = 0
169
+ if self.scan_phase == 2:
170
+ # back to normal before next rotation
171
+ raw = self._carry(raw)
172
+ self._normal(raw)
173
+ self.scan_t += 1
174
+ if self.scan_t >= 12:
175
+ self.scan_k += 1
176
+ self.scan_phase = 0
177
+ self.scan_t = 0
178
+ if self.scan_k >= 8:
179
+ self.state = "search"
180
+ self.leg = 0
181
+ return raw
182
+
183
+ # ------------------------------------------------ 4. search the room
184
+ if self.state == "search":
185
+ try:
186
+ im = tools.image("head")
187
+ area, cx, cy = self._green_blob(im)
188
+ except Exception:
189
+ area, cx, cy = 0, 42.0, 42.0
190
+ if area < 9 and self.t % 4 == 0:
191
+ # the wrist cameras can spot a near pad the head camera misses
192
+ try:
193
+ wl = tools.image("left_wrist")
194
+ ar1, _, _ = self._green_blob(wl)
195
+ wr = tools.image("right_wrist")
196
+ ar2, _, _ = self._green_blob(wr)
197
+ except Exception:
198
+ ar1 = ar2 = 0
199
+ if max(ar1, ar2) >= 9:
200
+ self.wrist_seen += 1
201
+ else:
202
+ self.wrist_seen = 0
203
+ if self.wrist_seen >= 2:
204
+ self.state = "approach"
205
+ self.last_blob = (max(ar1, ar2), 42.0, 60.0)
206
+ self.approach_t = 0
207
+ return raw
208
+ if area >= 8:
209
+ self.green_seen += 1
210
+ else:
211
+ self.green_seen = 0
212
+ if self.green_seen >= 2:
213
+ self.state = "approach"
214
+ self.last_blob = (area, cx, cy)
215
+ self.approach_t = 0
216
+ return raw
217
+
218
+ if self.leg >= len(self.legs):
219
+ self.state = "idle"
220
+ return raw
221
+ tx, ty = self.legs[self.leg]
222
+ dx, dy = tx - x, ty - y
223
+ dist = float(np.hypot(dx, dy))
224
+ if dist < 0.45:
225
+ self.leg += 1
226
+ return raw
227
+ target = float(np.arctan2(dy, dx))
228
+ err = _wrap(target - yaw)
229
+ raw = self._carry(raw)
230
+ raw[0] = 0.55 if abs(err) < 0.7 else 0.05
231
+ raw[3] = float(np.clip(2.2 * err, -0.55, 0.55))
232
+ return raw
233
+
234
+ # ------------------------------------------------ 5. approach the pad
235
+ if self.state == "approach":
236
+ self.approach_t += 1
237
+ try:
238
+ im = tools.image("head")
239
+ area, cx, cy = self._green_blob(im)
240
+ except Exception:
241
+ area, cx, cy = 0, 42.0, 42.0
242
+ if area >= 5:
243
+ self.last_blob = (area, cx, cy)
244
+ else:
245
+ area, cx, cy = self.last_blob
246
+ bearing = -(cx - 42.0) / 42.0 * 0.55
247
+ raw = self._carry(raw)
248
+ raw[3] = float(np.clip(1.8 * bearing, -0.45, 0.45))
249
+ if area < 40:
250
+ raw[0] = 0.32
251
+ elif area < 120:
252
+ raw[0] = 0.18
253
+ else:
254
+ raw[0] = 0.0
255
+ # stalled against the table -> place now
256
+ moved = ((x - self.last_pos[0]) ** 2 + (y - self.last_pos[1]) ** 2) ** 0.5
257
+ if self.approach_t % 20 == 0:
258
+ if moved < 0.05:
259
+ self.approach_stall += 1
260
+ else:
261
+ self.approach_stall = 0
262
+ self.last_pos = (x, y)
263
+ if self.approach_t > 25 and (area >= 110 or (area >= 60 and cy > 46)):
264
+ self.state = "place"
265
+ self.place_t = 0
266
+ if self.approach_t > 300 or self.approach_stall >= 2:
267
+ self.state = "place"
268
+ self.place_t = 0
269
+ return raw
270
+
271
+ # ------------------------------------------------ 6. place the blocks
272
+ if self.state == "place":
273
+ self.place_t += 1
274
+ raw[0] = 0.0
275
+ raw[2] = 0.66
276
+ raw[4] = 0.55
277
+ raw[5] = 0.95
278
+ raw[6] = 0.0
279
+ raw[7] = -0.10
280
+ raw[8] = 0.0
281
+ raw[9] = 0.0
282
+ raw[10] = 0.0
283
+ raw[11] = 0.0
284
+ raw[12] = 0.95
285
+ raw[13] = 0.0
286
+ raw[14] = -0.10
287
+ raw[15] = 0.0
288
+ raw[16] = 0.0
289
+ raw[17] = 0.0
290
+ raw[18] = 0.0
291
+ if self.place_t < 40:
292
+ raw[19] = 1.0
293
+ raw[20] = 1.0
294
+ else:
295
+ raw[19] = 0.0
296
+ raw[20] = 0.0
297
+ if self.place_t > 80:
298
+ self.state = "idle"
299
+ return raw
300
+
301
+ # ------------------------------------------------------------- idle
302
+ raw = self._carry(raw, lift=0.0, elbow=0.0)
303
+ return raw
policies/stack_blocks/deepseek1017-s3/episodes.csv ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ seed,success,length,termination,fell
2
+ 620000,0,8750,timeout,0
3
+ 620001,0,8750,timeout,0
4
+ 620002,0,8750,timeout,0
5
+ 620003,0,8750,timeout,0
6
+ 620004,0,8750,timeout,0
7
+ 620005,0,8750,timeout,0
8
+ 620006,0,8750,timeout,0
9
+ 620007,0,8750,timeout,0
10
+ 620008,0,8750,timeout,0
11
+ 620009,0,8750,timeout,0
12
+ 620010,0,8750,timeout,0
13
+ 620011,0,8750,timeout,0
14
+ 620012,0,8750,timeout,0
15
+ 620013,0,8750,timeout,0
16
+ 620014,0,8750,timeout,0
17
+ 620015,0,8750,timeout,0
18
+ 620016,0,8750,timeout,0
19
+ 620017,0,8750,timeout,0
20
+ 620018,0,8750,timeout,0
21
+ 620019,0,579,terminated,0
22
+ 620020,0,8750,timeout,0
23
+ 620021,0,8750,timeout,0
24
+ 620022,0,8750,timeout,0
25
+ 620023,0,8750,timeout,0
26
+ 620024,0,8750,timeout,0
27
+ 620025,0,8750,timeout,0
28
+ 620026,0,8750,timeout,0
29
+ 620027,0,8750,timeout,0
30
+ 620028,0,8750,timeout,0
31
+ 620029,0,8750,timeout,0
32
+ 620030,0,8750,timeout,0
33
+ 620031,0,634,terminated,0
34
+ 620032,0,8750,timeout,0
35
+ 620033,0,8750,timeout,0
36
+ 620034,0,8750,timeout,0
37
+ 620035,0,8750,timeout,0
38
+ 620036,0,8750,timeout,0
39
+ 620037,0,8750,timeout,0
40
+ 620038,0,8750,timeout,0
41
+ 620039,0,8750,timeout,0
42
+ 620040,0,8750,timeout,0
43
+ 620041,0,8750,timeout,0
44
+ 620042,0,8750,timeout,0
45
+ 620043,0,8750,timeout,0
46
+ 620044,0,8750,timeout,0
47
+ 620045,0,8750,timeout,0
48
+ 620046,0,8750,timeout,0
49
+ 620047,0,8750,timeout,0
50
+ 620048,0,8750,timeout,0
51
+ 620049,0,8750,timeout,0
52
+ 620050,0,8750,timeout,0
53
+ 620051,0,8750,timeout,0
54
+ 620052,0,8750,timeout,0
55
+ 620053,0,8750,timeout,0
56
+ 620054,0,8750,timeout,0
57
+ 620055,0,8750,timeout,0
58
+ 620056,0,8750,timeout,0
59
+ 620057,0,8750,timeout,0
60
+ 620058,0,8750,timeout,0
61
+ 620059,0,8750,timeout,0
62
+ 620060,0,8750,timeout,0
63
+ 620061,0,8750,timeout,0
64
+ 620062,0,8750,timeout,0
65
+ 620063,0,8750,timeout,0
66
+ 620064,0,8750,timeout,0
67
+ 620065,0,8750,timeout,0
68
+ 620066,0,8750,timeout,0
69
+ 620067,0,8750,timeout,0
70
+ 620068,0,8750,timeout,0
71
+ 620069,0,8750,timeout,0
72
+ 620070,0,8750,timeout,0
73
+ 620071,0,8750,timeout,0
74
+ 620072,0,8750,timeout,0
75
+ 620073,0,8750,timeout,0
76
+ 620074,0,8750,timeout,0
77
+ 620075,0,8750,timeout,0
78
+ 620076,0,8750,timeout,0
79
+ 620077,0,8750,timeout,0
80
+ 620078,0,8750,timeout,0
81
+ 620079,0,8750,timeout,0
82
+ 620080,0,8750,timeout,0
83
+ 620081,0,8750,timeout,0
84
+ 620082,0,8750,timeout,0
85
+ 620083,0,8750,timeout,0
86
+ 620084,0,8750,timeout,0
87
+ 620085,0,8750,timeout,0
88
+ 620086,0,8750,timeout,0
89
+ 620087,0,8750,timeout,0
90
+ 620088,0,8750,timeout,0
91
+ 620089,0,8750,timeout,0
92
+ 620090,0,8750,timeout,0
93
+ 620091,0,8750,timeout,0
94
+ 620092,0,8750,timeout,0
95
+ 620093,0,8750,timeout,0
96
+ 620094,0,8750,timeout,0
97
+ 620095,0,8750,timeout,0
98
+ 620096,0,8750,timeout,0
99
+ 620097,0,8750,timeout,0
100
+ 620098,0,8750,timeout,0
101
+ 620099,0,8750,timeout,0
policies/stack_blocks/deepseek1017-s3/policy.py ADDED
@@ -0,0 +1,236 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Hand-written control policy for the G1 "stack blocks" task.
2
+
3
+ Pipeline (all control is deterministic, fixed thresholds tuned on the dev seeds):
4
+
5
+ 1. grasp -- the ready pose puts both grippers just behind two of the three
6
+ blocks. Lean the torso slightly, strafe right, creep forward while the
7
+ block in the right wrist camera is tracked, then squat, close both
8
+ grippers and lift the arms.
9
+ 2. carry -- walk around the block table (north side) to the east side of the
10
+ green pad table using pelvis odometry.
11
+ 3. place -- face the pad, push up to the table edge, lean forward so the
12
+ hands reach over the pad, and release the blocks.
13
+
14
+ Only the robot's own cameras and proprioception are used.
15
+ """
16
+
17
+ import cv2
18
+ import numpy as np
19
+
20
+
21
+ # ----------------------------------------------------------------------------
22
+ # small image helpers
23
+ # ----------------------------------------------------------------------------
24
+ def _red_blob(img):
25
+ """Largest red blob of an RGB image -> (cx, cy, area) or None."""
26
+ r = img[..., 0].astype(np.int16)
27
+ g = img[..., 1].astype(np.int16)
28
+ b = img[..., 2].astype(np.int16)
29
+ m = ((r > 80) & (r > g + 40) & (r > b + 40)).astype(np.uint8)
30
+ n, _lab, stats, cent = cv2.connectedComponentsWithStats(m, 8)
31
+ best = None
32
+ for i in range(1, n):
33
+ a = int(stats[i, cv2.CC_STAT_AREA])
34
+ if a >= 10 and (best is None or a > best[2]):
35
+ best = (float(cent[i][0]), float(cent[i][1]), a)
36
+ return best
37
+
38
+
39
+ def _green_blob(img):
40
+ """Largest green (target pad) blob of an RGB image -> (cx, cy, area)."""
41
+ r = img[..., 0].astype(np.int16)
42
+ g = img[..., 1].astype(np.int16)
43
+ b = img[..., 2].astype(np.int16)
44
+ m = ((g > r + 25) & (g > b + 25) & (g > 100)).astype(np.uint8)
45
+ if int(m.sum()) == 0:
46
+ return None
47
+ ys, xs = np.where(m)
48
+ return (float(xs.mean()), float(ys.mean()), int(m.sum()))
49
+
50
+
51
+ def _wrap(a):
52
+ return (a + np.pi) % (2.0 * np.pi) - np.pi
53
+
54
+
55
+ # waypoints: around the north side of the block table, then south along its
56
+ # east side to the green pad table.
57
+ WAYPOINTS = ((0.30, 1.15), (1.90, 1.05), (2.15, 0.0))
58
+
59
+ # phase lengths (control steps)
60
+ P_PITCH = 30
61
+ P_STRAFE = 20
62
+ P_FWD = 175
63
+ P_SQUAT = 35
64
+ P_CLOSE = 30
65
+ P_LIFT = 30
66
+
67
+
68
+ class Policy:
69
+ """Deterministic scripted pick / carry / place policy."""
70
+
71
+ def reset(self, obs, tools):
72
+ self.t = 0
73
+ self.hold = np.asarray(tools.hold_action(), dtype=np.float64)
74
+ self.phase = 0
75
+ self.phase_t = 0
76
+ self.done = False
77
+ self.wp = 0
78
+ self.nav_t = 0
79
+ self.nav_last = None
80
+ self.nav_stuck = 0
81
+ self.pitch = 0.0
82
+
83
+ # ------------------------------------------------------------------
84
+ def _pose(self, obs):
85
+ ld = obs["low_dim_obs"]
86
+ return (float(ld[21]), float(ld[22]), float(ld[23]), float(ld[24]))
87
+
88
+ def act(self, obs, tools):
89
+ self.t += 1
90
+ self.phase_t += 1
91
+ raw = self.hold.copy()
92
+
93
+ # ---------------------------------------------------------- grasp
94
+ if self.phase <= 3:
95
+ raw[19] = 0.6
96
+ raw[20] = 0.6
97
+ elif self.phase <= 9:
98
+ raw[19] = 1.0
99
+ raw[20] = 1.0
100
+
101
+ if self.phase == 0:
102
+ raw[4] = 0.10
103
+ if self.phase_t >= P_PITCH:
104
+ self._next()
105
+ elif self.phase == 1:
106
+ raw[4] = 0.10
107
+ raw[1] = -0.15
108
+ if self.phase_t >= P_STRAFE:
109
+ self._next()
110
+ elif self.phase == 2:
111
+ raw[4] = 0.10
112
+ cur = _red_blob(tools.image("right_wrist"))
113
+ if cur is None:
114
+ raw[0] = 0.0
115
+ else:
116
+ cx, cy, _area = cur
117
+ raw[0] = 0.0 if cy > 50.0 else 0.10
118
+ vy = float(np.clip(-0.006 * (cx - 43.0), -0.15, 0.15))
119
+ raw[1] = 0.0 if abs(vy) < 0.06 else vy
120
+ if cy > 50.0 and abs(cx - 43.0) < 8.0:
121
+ self._next()
122
+ if self.phase == 2 and self.phase_t >= P_FWD:
123
+ self._next()
124
+ elif self.phase == 3:
125
+ raw[2] = 0.66
126
+ raw[4] = 0.10
127
+ if self.phase_t >= P_SQUAT:
128
+ self._next()
129
+ elif self.phase == 4:
130
+ raw[2] = 0.66
131
+ raw[4] = 0.10
132
+ if self.phase_t >= P_CLOSE:
133
+ self._next()
134
+ elif self.phase == 5:
135
+ raw[2] = 0.66
136
+ raw[4] = 0.10
137
+ raw[5] = -0.30
138
+ raw[12] = -0.30
139
+ if self.phase_t >= P_LIFT:
140
+ self._next()
141
+ # ---------------------------------------------------------- carry
142
+ elif self.phase == 6:
143
+ raw[5] = -0.30
144
+ raw[12] = -0.30
145
+ raw[4] = 0.10
146
+ # stand up very gently from the grasp squat so the held blocks do
147
+ # not slip out of the grippers
148
+ raw[2] = 0.66 + 0.08 * min(1.0, self.phase_t / 250.0)
149
+ if self.phase_t < 250:
150
+ # stand up in place first; do not disturb the grip while the
151
+ # body rises
152
+ return raw
153
+ if self.wp >= len(WAYPOINTS):
154
+ self._next()
155
+ else:
156
+ p = self._pose(obs)
157
+ tx, ty = WAYPOINTS[self.wp]
158
+ dx, dy = tx - p[0], ty - p[1]
159
+ d = float(np.hypot(dx, dy))
160
+ if self.nav_last is not None and abs(p[3]) < 50.0:
161
+ step_moved = float(np.hypot(p[0] - self.nav_last[0],
162
+ p[1] - self.nav_last[1]))
163
+ if step_moved < 0.004 and self.nav_t > 90:
164
+ self.nav_stuck += 1
165
+ else:
166
+ self.nav_stuck = 0
167
+ self.nav_last = p
168
+ self.nav_t += 1
169
+ if d < 0.16 or self.nav_stuck > 45 or self.nav_t > 420:
170
+ self.wp += 1
171
+ self.nav_t = 0
172
+ self.nav_last = None
173
+ self.nav_stuck = 0
174
+ else:
175
+ des = float(np.arctan2(dy, dx))
176
+ err = _wrap(des - p[3])
177
+ raw[3] = float(np.clip(2.2 * err, -0.8, 0.8))
178
+ raw[0] = float(
179
+ 0.38 * max(0.0, min(1.0, (0.9 - abs(err)) / 0.6))
180
+ * max(0.3, min(1.0, d / 0.4))
181
+ )
182
+ # ---------------------------------------------------------- place
183
+ elif self.phase == 7:
184
+ raw[5] = -0.30
185
+ raw[12] = -0.30
186
+ raw[4] = 0.05
187
+ p = self._pose(obs)
188
+ err = _wrap(np.pi - p[3])
189
+ if abs(err) < 0.04 or self.phase_t > 260:
190
+ self._next()
191
+ else:
192
+ raw[3] = float(np.clip(2.5 * err, -0.9, 0.9))
193
+ elif self.phase == 8:
194
+ raw[5] = -0.30
195
+ raw[12] = -0.30
196
+ raw[4] = 0.10
197
+ raw[0] = 0.15
198
+ raw[3] = float(np.clip(2.5 * _wrap(np.pi - self._pose(obs)[3]), -0.5, 0.5))
199
+
200
+ if self.phase_t >= 70:
201
+ self._next()
202
+ elif self.phase == 9:
203
+ # reach down-forward over the table towards the pad
204
+ raw[2] = 0.72
205
+ raw[4] = 0.35
206
+ raw[5] = 0.35
207
+ raw[12] = 0.35
208
+ if self.phase_t >= 30:
209
+ self._next()
210
+ elif self.phase == 10:
211
+ raw[2] = 0.72
212
+ raw[4] = 0.40
213
+ raw[5] = 0.45
214
+ raw[12] = 0.45
215
+ raw[19] = 0.0
216
+ raw[20] = 0.0
217
+ if self.phase_t >= 40:
218
+ self._next()
219
+ elif self.phase == 11:
220
+ # settle and lift the empty grippers clear of the pad
221
+ raw[2] = 0.74
222
+ raw[4] = 0.20
223
+ raw[5] = 0.10
224
+ raw[12] = 0.10
225
+ raw[19] = 0.0
226
+ raw[20] = 0.0
227
+ if self.phase_t >= 30:
228
+ self._next()
229
+ else:
230
+ raw = self.hold.copy()
231
+ raw[4] = 0.1
232
+ return raw
233
+
234
+ def _next(self):
235
+ self.phase += 1
236
+ self.phase_t = 0
policies/stack_blocks/gpt61sol-s1/episodes.csv ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ seed,success,length,termination,fell
2
+ 620000,0,8750,timeout,0
3
+ 620001,0,8750,timeout,0
4
+ 620002,0,4495,terminated,0
5
+ 620003,0,8750,timeout,0
6
+ 620004,0,8750,timeout,0
7
+ 620005,0,1653,terminated,0
8
+ 620006,0,8750,timeout,0
9
+ 620007,0,4578,terminated,0
10
+ 620008,0,8750,timeout,0
11
+ 620009,0,2568,terminated,0
12
+ 620010,0,8750,timeout,0
13
+ 620011,0,1947,terminated,0
14
+ 620012,0,8750,timeout,0
15
+ 620013,0,3392,terminated,0
16
+ 620014,0,8750,timeout,0
17
+ 620015,0,8750,timeout,0
18
+ 620016,0,3748,terminated,0
19
+ 620017,0,8750,timeout,0
20
+ 620018,0,4188,terminated,0
21
+ 620019,0,8750,timeout,0
22
+ 620020,0,3487,terminated,0
23
+ 620021,0,4965,terminated,0
24
+ 620022,0,8750,timeout,0
25
+ 620023,0,8750,timeout,0
26
+ 620024,0,8750,timeout,0
27
+ 620025,0,4753,terminated,0
28
+ 620026,0,8750,timeout,0
29
+ 620027,0,4069,terminated,0
30
+ 620028,0,8750,timeout,0
31
+ 620029,0,3205,terminated,0
32
+ 620030,0,1688,terminated,0
33
+ 620031,0,8750,timeout,0
34
+ 620032,0,4723,terminated,0
35
+ 620033,0,2517,terminated,0
36
+ 620034,0,8750,timeout,0
37
+ 620035,0,8750,timeout,0
38
+ 620036,0,8750,timeout,0
39
+ 620037,0,3240,terminated,0
40
+ 620038,0,8750,timeout,0
41
+ 620039,0,8750,timeout,0
42
+ 620040,0,8750,timeout,0
43
+ 620041,0,3896,terminated,0
44
+ 620042,0,8750,timeout,0
45
+ 620043,0,8750,timeout,0
46
+ 620044,0,4267,terminated,0
47
+ 620045,0,8750,timeout,0
48
+ 620046,0,3741,terminated,0
49
+ 620047,0,8750,timeout,0
50
+ 620048,0,3577,terminated,0
51
+ 620049,0,8750,timeout,0
52
+ 620050,0,2446,terminated,0
53
+ 620051,0,3211,terminated,0
54
+ 620052,0,7386,terminated,0
55
+ 620053,0,8750,timeout,0
56
+ 620054,0,8750,timeout,0
57
+ 620055,0,2186,terminated,0
58
+ 620056,0,4775,terminated,0
59
+ 620057,0,8750,timeout,0
60
+ 620058,0,8750,timeout,0
61
+ 620059,0,8750,timeout,0
62
+ 620060,0,8522,terminated,0
63
+ 620061,0,8750,timeout,0
64
+ 620062,0,2152,terminated,0
65
+ 620063,0,8750,timeout,0
66
+ 620064,0,1923,terminated,0
67
+ 620065,0,8750,timeout,0
68
+ 620066,0,8750,timeout,0
69
+ 620067,0,4238,terminated,0
70
+ 620068,0,8750,timeout,0
71
+ 620069,0,4927,terminated,0
72
+ 620070,0,8750,timeout,0
73
+ 620071,0,7167,terminated,0
74
+ 620072,0,8750,timeout,0
75
+ 620073,0,8750,timeout,0
76
+ 620074,0,8750,timeout,0
77
+ 620075,0,8750,timeout,0
78
+ 620076,0,8750,timeout,0
79
+ 620077,0,2057,terminated,0
80
+ 620078,0,8750,timeout,0
81
+ 620079,0,3928,terminated,0
82
+ 620080,0,8750,timeout,0
83
+ 620081,0,8750,timeout,0
84
+ 620082,0,4196,terminated,0
85
+ 620083,0,3371,terminated,0
86
+ 620084,0,7686,terminated,0
87
+ 620085,0,8750,timeout,0
88
+ 620086,0,4814,terminated,0
89
+ 620087,0,8750,timeout,0
90
+ 620088,0,8750,timeout,0
91
+ 620089,0,8750,timeout,0
92
+ 620090,0,8750,timeout,0
93
+ 620091,0,3337,terminated,0
94
+ 620092,0,8750,timeout,0
95
+ 620093,0,4041,terminated,0
96
+ 620094,0,8750,timeout,0
97
+ 620095,0,8750,timeout,0
98
+ 620096,0,8750,timeout,0
99
+ 620097,0,8750,timeout,0
100
+ 620098,0,3847,terminated,0
101
+ 620099,0,8750,timeout,0
policies/stack_blocks/gpt61sol-s1/policy.py ADDED
@@ -0,0 +1,207 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Deterministic visual control for transferring and stacking three blocks.
2
+
3
+ Colour segmentation supplies image errors; body pose closes the navigation
4
+ loop. All constants and state transitions are hand-written. No demonstration,
5
+ seed identity, fitted model, or stored placement data is read at runtime.
6
+ """
7
+
8
+ import numpy as np
9
+ import cv2
10
+
11
+
12
+ def blobs(im, color='red'):
13
+ r,g,b=im[:,:,0].astype(float),im[:,:,1].astype(float),im[:,:,2].astype(float)
14
+ if color=='red': m=(r>100)&(r>1.6*g)&(r>1.6*b)
15
+ else: m=(g>95)&(g>1.35*r)&(g>1.2*b)
16
+ n,l,s,c=cv2.connectedComponentsWithStats(m.astype(np.uint8))
17
+ return [(cc,np.sqrt(ss[4]),ss) for ss,cc in zip(s[1:],c[1:]) if ss[4]>12]
18
+
19
+ class Policy:
20
+ def reset(self,obs,tools):
21
+ self.a=np.asarray(tools.hold_action(),dtype=float)
22
+ self.a[19:]=0
23
+ self.phase='open';self.start=0;self.servo=0
24
+ self.route=[(0,-1,0),(2.4,-1,0),(2.4,0,0),(2.4,0,np.pi)]
25
+ self.ri=0;self.stable=0;self.pickx=0;self.pickpitch=0;self.rightpitch=0;self.placebase=None;self.level=1;self.returning=False;self.stackoffset=None;self.held_uv=None;self.last=self.a.copy();self.limits=(np.array(tools.info['raw_low']),np.array(tools.info['raw_high']))
26
+ def transition(self,name,t):
27
+ self.phase=name;self.start=t;self.stable=0
28
+ def drive(self,p,x,y,yaw):
29
+ err=np.array([x,y])-p[:2];co=np.cos(p[3]);si=np.sin(p[3]);v=np.array([co*err[0]+si*err[1],-si*err[0]+co*err[1]])*1.2
30
+ norm=np.linalg.norm(v)
31
+ if norm>.4:v*=.4/norm
32
+ if np.linalg.norm(err)<.025:v[:]=0
33
+ elif norm<.07:v*=.07/max(norm,1e-8)
34
+ ye=(yaw-p[3]+np.pi)%(2*np.pi)-np.pi
35
+ self.a[:2]=v;self.a[3]=np.clip(ye*1.8,-.5,.5) if abs(ye)>.02 else 0
36
+ return np.linalg.norm(err)<.035 and abs(ye)<.04
37
+ def act(self,obs,tools):
38
+ t=obs['t'];p=obs['low_dim_obs'][21:25];dt=t-self.start
39
+ if self.phase in ['approach','align_left','place_left','release_left','clear_left','align_right','place_right','release_right','clear_right','arrived']:
40
+ ye=(np.pi-p[3]+np.pi)%(2*np.pi)-np.pi
41
+ self.a[3]=np.clip(ye*1.5,-.25,.25)
42
+ if self.phase=='open':
43
+ if dt>=60:self.transition('grasp',t)
44
+ elif self.phase=='grasp':
45
+ if dt%10==0:
46
+ vals=[]
47
+ for j,cam in enumerate(['left_wrist','right_wrist']):
48
+ bs=blobs(tools.image(cam));rr=min(bs,key=lambda z:abs(z[0][0]-42)) if bs else None
49
+ vals.append(rr)
50
+ if rr:
51
+ c,sz,_=rr
52
+ self.a[7+7*j]+=np.clip((42-c[0])*.0015,-.02,.02)
53
+ self.a[5+7*j]+=np.clip((c[1]-20)*.001,-.02,.02)
54
+ self.a[0]=.08 if any(rr and rr[1]<39 for rr in vals) else 0
55
+ good=all(rr and abs(rr[0][0]-42)<2 and abs(rr[0][1]-20)<2 and rr[1]>39 for rr in vals)
56
+ self.stable=self.stable+10 if good else 0
57
+ if self.stable>=80 or dt>800:
58
+ self.a[:2]=0;self.a[19]=1;self.pickx=p[0];self.pickpitch=self.a[5];self.transition('left_close',t)
59
+ elif self.phase=='left_close':
60
+ if dt>70:
61
+ self.a[5]=-.12;self.transition('right_grasp',t)
62
+ elif self.phase=='right_grasp':
63
+ if dt%10==0:
64
+ bs=blobs(tools.image('right_wrist'));rr=min(bs,key=lambda z:abs(z[0][0]-42)) if bs else None
65
+ if rr:
66
+ c,sz,_=rr
67
+ self.a[14]+=np.clip((42-c[0])*.0015,-.015,.015)
68
+ self.a[12]+=np.clip((c[1]-20)*.001,-.015,.015)
69
+ self.a[0]=.06 if sz<53 and p[0]<self.pickx+.055 else 0
70
+ good=abs(c[0]-42)<2 and abs(c[1]-20)<2 and sz>50
71
+ self.stable=self.stable+10 if good else 0
72
+ if self.stable>=70 or dt>400:
73
+ self.a[:2]=0;self.a[20]=1;self.rightpitch=self.a[12];self.transition('close',t)
74
+ elif self.phase=='close':
75
+ if dt>70:
76
+ self.a[5]=self.a[12]=-.12
77
+ self.transition('lift',t)
78
+ elif self.phase=='lift':
79
+ if dt>100:self.transition('route',t)
80
+ elif self.phase=='route':
81
+ x,y,yaw=self.route[self.ri]
82
+ if self.drive(p,x,y,yaw):
83
+ self.stable+=1
84
+ if self.stable>10:
85
+ self.ri+=1;self.stable=0
86
+ if self.ri==len(self.route):
87
+ self.a[:2]=0;self.a[3]=0
88
+ if self.returning:
89
+ self.a[12]=.20;self.a[13]=0;self.a[14]=0;self.a[20]=0;self.transition('third_approach',t)
90
+ else:self.transition('approach',t)
91
+ elif self.phase=='approach':
92
+ if dt%10==0:
93
+ bs=blobs(tools.image('head'),'green')
94
+ if bs:
95
+ c,sz,_=max(bs,key=lambda b:b[1])
96
+ self.a[0]=.1 if c[1]<42 else 0
97
+ self.a[1]=np.clip((42-c[0])*.005,-.12,.12) if abs(c[0]-42)>3 else 0
98
+ if c[1]>=42:
99
+ self.a[:2]=0;self.transition('align_left' if self.level==1 else 'align_right',t)
100
+ elif self.phase=='align_left':
101
+ if dt%10==0:
102
+ im=tools.image('head');gs=blobs(im,'green');rs=blobs(im)
103
+ if gs and rs:
104
+ gc,_,_=max(gs,key=lambda b:b[1]);rc,_,_=max([b for b in rs if b[0][0]<60 and b[1]>5] or rs,key=lambda b:b[1])
105
+ self.a[7]+=np.clip((rc[0]-gc[0])*.003,-.02,.02)
106
+ self.stable=self.stable+10 if abs(rc[0]-gc[0])<1.5 else 0
107
+ if self.stable>60 or dt>500:self.transition('place_left',t)
108
+ elif self.phase=='place_left':
109
+ self.a[5]=min(self.pickpitch,self.a[5]+.0015)
110
+ if dt%10==0 and dt>260:
111
+ im=tools.image('head');gs=blobs(im,'green');rs=blobs(im)
112
+ if gs and rs:
113
+ gc,_,st=max(gs,key=lambda b:b[1]);gc=np.array([st[0]+(st[2]-1)/2,st[1]+(st[3]-1)/2])
114
+ rc,_,_=max([b for b in rs if b[0][0]<60 and b[1]>5] or rs,key=lambda b:b[1])
115
+ self.a[7]+=np.clip((rc[0]-gc[0])*.003,-.02,.02)
116
+ dy=rc[1]-(gc[1]-4)
117
+ self.a[0]=(.065 if dy>1.5 else -.065 if dy< -1.5 else 0)
118
+ good=abs(rc[0]-gc[0])<1.5 and abs(dy)<1.5
119
+ self.stable=self.stable+10 if good else 0
120
+ if self.stable>60 or dt>350:
121
+ self.a[0]=0;self.a[19]=0;self.transition('release_left',t)
122
+ elif self.phase=='release_left':
123
+ if dt>100:
124
+ self.placebase=p[:2].copy();self.a[0]=-.08;self.transition('clear_left',t)
125
+ elif self.phase=='clear_left':
126
+ if dt>70:
127
+ self.a[0]=0;self.a[5]=-.12;self.a[7]=.5;self.a[8]=0;self.held_uv=None;self.transition('align_right',t)
128
+ elif self.phase=='align_right':
129
+ # Translate the body until the carried cube is above the base cube.
130
+ # Keeping the carrying arm in its pickup orientation avoids twisting
131
+ # the cube while bringing the two hands into the same workspace.
132
+ self.a[0]=0
133
+ if dt%10==0:
134
+ rs=[b for b in blobs(tools.image('head')) if b[1]>5]
135
+ if len(rs)>=2:
136
+ held=min(rs,key=lambda b:b[0][1])
137
+ ground=max(rs,key=lambda b:b[0][1])
138
+ dx=held[0][0]-ground[0][0]
139
+ self.a[1]=.07 if dx>1.5 else -.07 if dx< -1.5 else 0
140
+ self.stable=self.stable+10 if abs(dx)<1.5 else 0
141
+ else:self.a[1]=0
142
+ if self.stable>50 or dt>400:
143
+ self.a[:2]=0;self.upperbase=p[:2].copy()
144
+ self.transition('place_right',t)
145
+ elif self.phase=='place_right':
146
+ targetpitch=self.rightpitch-.13*self.level
147
+ self.a[12]=min(targetpitch,self.a[12]+.0015)
148
+ if dt<200:self.drive(p,self.upperbase[0]-.03,self.upperbase[1],np.pi)
149
+ elif dt%10==0:
150
+ rs=[b for b in blobs(tools.image('head')) if b[1]>5]
151
+ if len(rs)>=2:
152
+ held=min(rs,key=lambda b:b[0][1]);ground=max(rs,key=lambda b:b[0][1])
153
+ dx=held[0][0]-ground[0][0]
154
+ dy=held[0][1]-ground[0][1]+7+3.5*(self.level-1)
155
+ self.a[1]=.065 if dx>1.5 else -.065 if dx< -1.5 else 0
156
+ self.a[0]=.065 if dy>1.5 else -.065 if dy< -1.5 else 0
157
+ self.stable=self.stable+10 if abs(dx)<1.5 and abs(dy)<1.5 else 0
158
+ else:
159
+ self.a[:2]=0;self.stable+=10
160
+ if self.stable>50 or dt>450:
161
+ self.a[:2]=0;self.a[20]=0;self.transition('release_right',t)
162
+ elif self.phase=='release_right':
163
+ if dt>100:
164
+ self.a[0]=-.08;self.transition('clear_right',t)
165
+ elif self.phase=='clear_right':
166
+ if dt>70:
167
+ self.a[0]=0;self.a[12]=-.35
168
+ if self.level==2:self.transition('finished',t)
169
+ else:
170
+ self.route=[(2.4,0,np.pi),(2.4,-1,np.pi),(0,-1,0),(.08,0,0)]
171
+ self.ri=0;self.returning=True;self.transition('route',t)
172
+
173
+ elif self.phase=='third_approach':
174
+ ye=(-p[3]+np.pi)%(2*np.pi)-np.pi;self.a[3]=np.clip(ye*1.5,-.25,.25)
175
+ if dt%10==0 and dt>80:
176
+ rs=blobs(tools.image('head'))
177
+ if rs:
178
+ c,sz,_=max(rs,key=lambda b:b[1])
179
+ self.a[0]=.08 if c[1]<41 else 0
180
+ self.a[1]=.07 if c[0]<63 else -.07 if c[0]>67 else 0
181
+ if c[1]>=41 and abs(c[0]-65)<3:
182
+ self.a[:2]=0;self.transition('third_grasp',t)
183
+ elif self.phase=='third_grasp':
184
+ ye=(-p[3]+np.pi)%(2*np.pi)-np.pi
185
+ self.a[3]=np.clip(ye*1.5,-.25,.25)
186
+ if dt%10==0 and dt>70:
187
+ bs=blobs(tools.image('right_wrist'));rr=max(bs,key=lambda z:z[1]) if bs else None
188
+ if rr:
189
+ c,sz,_=rr
190
+ self.a[14]+=np.clip((42-c[0])*.0015,-.02,.02)
191
+ self.a[12]+=np.clip((c[1]-20)*.001,-.02,.02)
192
+ self.a[0]=.06 if sz<52 and abs(c[0]-42)<5 else 0
193
+ self.stable=self.stable+10 if sz>50 and abs(c[0]-42)<2 and abs(c[1]-20)<2 else 0
194
+ if self.stable>60 or dt>350:
195
+ self.a[0]=0;self.a[20]=1;self.rightpitch=self.a[12];self.transition('third_close',t)
196
+ elif self.phase=='third_close':
197
+ if dt>80:
198
+ self.a[12]=-.12;self.level=2;self.returning=False
199
+ self.route=[(0,-1,0),(2.4,-1,0),(2.4,0,0),(2.4,0,np.pi)]
200
+ self.ri=0;self.transition('route',t)
201
+ if self.phase=='finished':
202
+ self.a[:2]=0;self.a[3]=0
203
+ out=self.a.copy()
204
+ if self.phase in ['align_right','place_right','release_right','clear_right']:out[5:12]=self.last[5:12]+np.clip(out[5:12]-self.last[5:12],-.008,.008)
205
+ out=np.clip(out,self.limits[0],self.limits[1])
206
+ self.last=out.copy()
207
+ return out
policies/stack_blocks/gpt61sol-s2/episodes.csv ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ seed,success,length,termination,fell
2
+ 620000,0,8750,timeout,0
3
+ 620001,0,8750,timeout,0
4
+ 620002,0,8750,timeout,0
5
+ 620003,0,1484,terminated,0
6
+ 620004,0,7970,terminated,0
7
+ 620005,0,8750,timeout,0
8
+ 620006,0,8750,timeout,0
9
+ 620007,0,1573,terminated,0
10
+ 620008,0,8750,timeout,0
11
+ 620009,0,8750,timeout,0
12
+ 620010,0,8750,timeout,0
13
+ 620011,0,4783,terminated,0
14
+ 620012,0,8750,timeout,0
15
+ 620013,0,4584,terminated,0
16
+ 620014,0,8750,timeout,0
17
+ 620015,0,2028,terminated,0
18
+ 620016,0,8750,timeout,0
19
+ 620017,0,8750,timeout,0
20
+ 620018,0,8750,timeout,0
21
+ 620019,0,7461,terminated,0
22
+ 620020,0,7859,terminated,0
23
+ 620021,0,8750,timeout,0
24
+ 620022,1,7957,success,0
25
+ 620023,0,1596,terminated,0
26
+ 620024,0,8750,timeout,0
27
+ 620025,0,5058,terminated,0
28
+ 620026,0,8750,timeout,0
29
+ 620027,0,8750,timeout,0
30
+ 620028,0,8750,timeout,0
31
+ 620029,0,8750,timeout,0
32
+ 620030,0,8750,timeout,0
33
+ 620031,0,1539,terminated,0
34
+ 620032,0,8622,terminated,0
35
+ 620033,0,8750,timeout,0
36
+ 620034,0,1074,terminated,0
37
+ 620035,0,8508,terminated,0
38
+ 620036,0,8750,timeout,0
39
+ 620037,0,8750,timeout,0
40
+ 620038,0,8750,timeout,0
41
+ 620039,0,8750,timeout,0
42
+ 620040,0,8750,timeout,0
43
+ 620041,0,8750,timeout,0
44
+ 620042,0,8750,timeout,0
45
+ 620043,0,8750,timeout,0
46
+ 620044,0,4806,terminated,0
47
+ 620045,0,8750,timeout,0
48
+ 620046,0,8750,timeout,0
49
+ 620047,0,8750,timeout,0
50
+ 620048,0,8750,timeout,0
51
+ 620049,0,8750,timeout,0
52
+ 620050,0,8532,terminated,0
53
+ 620051,0,8735,terminated,0
54
+ 620052,0,4382,terminated,0
55
+ 620053,0,1629,terminated,0
56
+ 620054,0,8750,timeout,0
57
+ 620055,0,8750,timeout,0
58
+ 620056,0,8750,timeout,0
59
+ 620057,0,8750,timeout,0
60
+ 620058,0,8750,timeout,0
61
+ 620059,0,8750,timeout,0
62
+ 620060,0,8750,timeout,0
63
+ 620061,0,8750,timeout,0
64
+ 620062,0,955,terminated,0
65
+ 620063,0,4639,terminated,0
66
+ 620064,0,8750,timeout,0
67
+ 620065,0,8581,terminated,0
68
+ 620066,0,8750,timeout,0
69
+ 620067,0,8750,timeout,0
70
+ 620068,0,5145,terminated,0
71
+ 620069,0,1606,terminated,0
72
+ 620070,0,8750,timeout,0
73
+ 620071,0,8750,timeout,0
74
+ 620072,0,8750,timeout,0
75
+ 620073,0,8750,timeout,0
76
+ 620074,0,8750,timeout,0
77
+ 620075,0,8647,terminated,0
78
+ 620076,0,8750,timeout,0
79
+ 620077,0,8750,timeout,0
80
+ 620078,0,8248,terminated,0
81
+ 620079,0,8750,timeout,0
82
+ 620080,0,8750,timeout,0
83
+ 620081,0,8750,timeout,0
84
+ 620082,0,8750,timeout,0
85
+ 620083,0,8750,timeout,0
86
+ 620084,0,8750,timeout,0
87
+ 620085,0,8750,timeout,0
88
+ 620086,0,8750,timeout,0
89
+ 620087,0,8750,timeout,0
90
+ 620088,0,8750,timeout,0
91
+ 620089,0,8750,timeout,0
92
+ 620090,0,8750,timeout,0
93
+ 620091,0,8750,timeout,0
94
+ 620092,0,1476,terminated,0
95
+ 620093,0,8750,timeout,0
96
+ 620094,0,5356,terminated,0
97
+ 620095,0,8750,timeout,0
98
+ 620096,0,1196,terminated,0
99
+ 620097,0,1570,terminated,0
100
+ 620098,0,1546,terminated,0
101
+ 620099,0,8750,timeout,0
policies/stack_blocks/gpt61sol-s2/policy.py ADDED
@@ -0,0 +1,123 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Deterministic visual grasping, closed-loop walking, and block stacking."""
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(),dtype=float)
8
+ self.target=self.a.copy();self.target[19:21]=0
9
+ self.target[5:12]=[-.6,.405,0,.4,0,0,0]
10
+ self.target[12:19]=[-.6,-.42,0,.4,0,0,0]
11
+ self.state='prepare';self.age=0;self.block=0;self.retry=0
12
+ self.route=[];self.good=0
13
+
14
+ def phase(self,s):
15
+ self.state=s;self.age=0
16
+
17
+ @staticmethod
18
+ def blob(im,green=False):
19
+ r,g,b=im[:,:,0].astype(float),im[:,:,1].astype(float),im[:,:,2].astype(float)
20
+ mask=((g>100)&(g>r*1.25)&(g>b*1.15)) if green else ((r>110)&(r>g*1.8)&(r>b*1.8))
21
+ n,lab,stats,cent=cv2.connectedComponentsWithStats(mask.astype('uint8'),8)
22
+ candidates=[i for i in range(1,n) if stats[i,4]>20]
23
+ if not candidates:return None
24
+ i=max(candidates,key=lambda i:stats[i,4])
25
+ return cent[i][0],cent[i][1],stats[i,4],stats[i,2],stats[i,3]
26
+
27
+ def nav(self,obs):
28
+ q=obs['low_dim_obs'];x,y,z,yaw=q[21:25]
29
+ gx,gy,ga=self.route[0];d=np.array([gx-x,gy-y]);er=(ga-yaw+np.pi)%(2*np.pi)-np.pi
30
+ cs,sn=np.cos(yaw),np.sin(yaw)
31
+ v=np.array([cs*d[0]+sn*d[1],-sn*d[0]+cs*d[1]])
32
+ dist=np.linalg.norm(v)
33
+ if dist<.025:v[:]=0
34
+ else:v*=min(.55,max(.08,dist*1.8))/dist
35
+ if abs(er)>.25:v*=.25
36
+ self.target[:2]=v;self.target[3]=np.clip(2*er,-.8,.8)
37
+ if (dist<.035 and abs(er)<.045) or self.age>550:
38
+ self.route.pop(0);self.age=0
39
+ if not self.route:
40
+ self.target[:2]=0;self.target[3]=0;self.phase(self.after_nav)
41
+
42
+ def act(self,obs,tools):
43
+ self.age+=1
44
+ t=self.target
45
+ if self.state=='nav':self.nav(obs)
46
+ elif self.state=='prepare':
47
+ if self.age>110:self.good=0;self.phase('source_align')
48
+ elif self.state=='source_align':
49
+ if self.age%5==0:
50
+ im=tools.image('head');r,g,b=im[:,:,0].astype(float),im[:,:,1].astype(float),im[:,:,2].astype(float)
51
+ mask=((r>110)&(r>g*1.8)&(r>b*1.8)).astype('uint8')
52
+ n,lab,st,cen=cv2.connectedComponentsWithStats(mask,8)
53
+ candidates=[i for i in range(1,n) if st[i,4]>8 and 12<cen[i,1]<45]
54
+ if candidates:
55
+ i=max(candidates,key=lambda i:cen[i,0]);cx,cy=cen[i]
56
+ ex,ey=70-cx,24-cy
57
+ vx=0.;vy=np.clip(ex*.008,-.16,.16)
58
+ if abs(ex)<1.5:vy=0
59
+ if abs(ey)<1.5:vx=0
60
+ norm=np.hypot(vx,vy)
61
+ if 0<norm<.07:vx*=.07/norm;vy*=.07/norm
62
+ t[0]=vx;t[1]=vy
63
+ self.good=self.good+5 if abs(ex)<2 else 0
64
+ else:t[:2]=0
65
+ yaw=obs['low_dim_obs'][24];t[3]=np.clip(((0-yaw+np.pi)%(2*np.pi)-np.pi)*2,-.3,.3)
66
+ if self.good>=25 or self.age>150:
67
+ t[:2]=0;t[3]=0;self.phase('source_settle')
68
+ elif self.state=='source_settle':
69
+ if self.age>45:self.phase('lower')
70
+ elif self.state=='lower':
71
+ t[2]=.6
72
+ if self.age>130:self.phase('align')
73
+ elif self.state=='align':
74
+ if self.age%20==0:
75
+ p=self.blob(tools.image('right_wrist'))
76
+ if p:
77
+ cx,cy,area,w,h=p
78
+ t[13]+=np.clip((36-cx)*.0025,-.035,.035)
79
+ t[2]=np.clip(t[2]+np.clip((area-2300)*.000004,-.007,.007),.56,.68)
80
+ t[12]+=np.clip((cy-41)*.0025,-.035,.035)
81
+ t[13]=np.clip(t[13],-.75,.65);t[12]=np.clip(t[12],-.95,-.3)
82
+ if self.age>220:self.phase('close')
83
+ elif self.state=='close':
84
+ t[20]=1
85
+ if self.age>65:self.phase('lift')
86
+ elif self.state=='lift':
87
+ t[2]=.74
88
+ t[5]=t[12]=-.8;t[8]=t[15]=.8;t[13]=-.42
89
+ # Use the same carrying pose for each block.
90
+ if self.age>130:
91
+ p=self.blob(tools.image('right_wrist'))
92
+ if (not p or p[2]<450) and self.retry<1:
93
+ self.retry+=1;t[20]=0;t[12]=-.6;t[13]=-.42;t[15]=.4;self.phase('lower')
94
+ else:
95
+ self.route=[(-.18,float(obs['low_dim_obs'][22]),0),(-.18,.9,0),(2.2,.9,0),(2.2,-.24,0),(2.2,-.24,np.pi),(2.07,-.24,np.pi)]
96
+ self.after_nav='settle';self.phase('nav')
97
+ elif self.state=='settle':
98
+ if self.age>60:self.phase('place')
99
+ elif self.state=='place':
100
+ t[2]=.62+.065*self.block
101
+ if self.age>140:self.phase('release')
102
+ elif self.state=='release':
103
+ t[20]=0
104
+ if self.age>80:self.phase('withdraw')
105
+ elif self.state=='withdraw':
106
+ t[2]=.74
107
+ if self.age>120:
108
+ self.block+=1
109
+ if self.block>=3:self.phase('finish')
110
+ else:
111
+ sy=[0.,.33,.43][self.block]
112
+ self.route=[(2.22,-.24,np.pi),(2.22,.9,np.pi),(-.18,.9,np.pi),(-.18,.9,0),(-.18,sy,0),(.11,sy,0)]
113
+ self.after_nav='new_grasp';self.phase('nav')
114
+ elif self.state=='new_grasp':
115
+ t[5:12]=[-.6,.405,0,.4,0,0,0]
116
+ t[12:19]=[-.6,-.42,0,.4,0,0,0];self.retry=0
117
+ if self.age>100:self.good=0;self.phase('source_align')
118
+ elif self.state=='finish':
119
+ t[:2]=0;t[3]=0
120
+ # Arm and body targets are moved gradually to avoid ejecting a block.
121
+ rate=np.array([1,1,.0015,1,.003]+[.006]*14+[.06,.06])
122
+ self.a+=np.clip(t-self.a,-rate,rate)
123
+ return self.a.copy()
policies/stack_blocks/gpt61sol-s3/episodes.csv ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ seed,success,length,termination,fell
2
+ 620000,0,8750,timeout,0
3
+ 620001,0,8750,timeout,0
4
+ 620002,0,8750,timeout,0
5
+ 620003,0,4514,terminated,0
6
+ 620004,0,2033,terminated,0
7
+ 620005,0,8750,timeout,0
8
+ 620006,0,8750,timeout,0
9
+ 620007,0,8750,timeout,0
10
+ 620008,0,4668,terminated,0
11
+ 620009,0,4166,terminated,0
12
+ 620010,0,8750,timeout,0
13
+ 620011,0,8750,timeout,0
14
+ 620012,0,8750,timeout,0
15
+ 620013,0,8750,timeout,0
16
+ 620014,0,8750,timeout,0
17
+ 620015,0,4748,terminated,0
18
+ 620016,0,8750,timeout,0
19
+ 620017,0,8750,timeout,0
20
+ 620018,0,7468,terminated,0
21
+ 620019,0,8750,timeout,0
22
+ 620020,0,8750,timeout,0
23
+ 620021,0,4945,terminated,0
24
+ 620022,0,8750,timeout,0
25
+ 620023,0,8750,timeout,0
26
+ 620024,0,8750,timeout,0
27
+ 620025,0,1262,terminated,0
28
+ 620026,0,4771,terminated,0
29
+ 620027,0,8750,timeout,0
30
+ 620028,0,4870,terminated,0
31
+ 620029,0,8750,timeout,0
32
+ 620030,0,8750,timeout,0
33
+ 620031,0,837,terminated,0
34
+ 620032,0,1443,terminated,0
35
+ 620033,0,8750,timeout,0
36
+ 620034,0,8750,timeout,0
37
+ 620035,0,8750,timeout,0
38
+ 620036,0,8750,timeout,0
39
+ 620037,0,4103,terminated,0
40
+ 620038,0,8750,timeout,0
41
+ 620039,0,8750,timeout,0
42
+ 620040,0,8750,timeout,0
43
+ 620041,0,8750,timeout,0
44
+ 620042,0,8750,timeout,0
45
+ 620043,0,8750,timeout,0
46
+ 620044,0,8750,timeout,0
47
+ 620045,0,8750,timeout,0
48
+ 620046,0,8750,timeout,0
49
+ 620047,0,4373,terminated,0
50
+ 620048,0,8750,timeout,0
51
+ 620049,0,4122,terminated,0
52
+ 620050,0,8750,timeout,0
53
+ 620051,0,4822,terminated,0
54
+ 620052,0,4251,terminated,0
55
+ 620053,0,8104,terminated,0
56
+ 620054,0,8750,timeout,0
57
+ 620055,0,8750,timeout,0
58
+ 620056,0,8750,timeout,0
59
+ 620057,0,8750,timeout,0
60
+ 620058,0,4827,terminated,0
61
+ 620059,0,7853,terminated,0
62
+ 620060,0,8750,timeout,0
63
+ 620061,0,8750,timeout,0
64
+ 620062,0,8750,timeout,0
65
+ 620063,0,8092,terminated,0
66
+ 620064,0,8750,timeout,0
67
+ 620065,0,8750,timeout,0
68
+ 620066,0,4766,terminated,0
69
+ 620067,0,4525,terminated,0
70
+ 620068,0,8750,timeout,0
71
+ 620069,0,8750,timeout,0
72
+ 620070,0,4744,terminated,0
73
+ 620071,0,8750,timeout,0
74
+ 620072,0,8750,timeout,0
75
+ 620073,0,8750,timeout,0
76
+ 620074,0,7492,terminated,0
77
+ 620075,0,8750,timeout,0
78
+ 620076,0,8750,timeout,0
79
+ 620077,0,4097,terminated,0
80
+ 620078,0,8750,timeout,0
81
+ 620079,0,8750,timeout,0
82
+ 620080,0,8750,timeout,0
83
+ 620081,0,8750,timeout,0
84
+ 620082,0,8750,timeout,0
85
+ 620083,0,8750,timeout,0
86
+ 620084,0,8750,timeout,0
87
+ 620085,0,8750,timeout,0
88
+ 620086,0,8750,timeout,0
89
+ 620087,0,8750,timeout,0
90
+ 620088,0,7725,terminated,0
91
+ 620089,0,8015,terminated,0
92
+ 620090,0,4988,terminated,0
93
+ 620091,0,8750,timeout,0
94
+ 620092,0,8750,timeout,0
95
+ 620093,0,8750,timeout,0
96
+ 620094,0,8750,timeout,0
97
+ 620095,0,8750,timeout,0
98
+ 620096,0,8750,timeout,0
99
+ 620097,0,8750,timeout,0
100
+ 620098,0,8750,timeout,0
101
+ 620099,0,8750,timeout,0
policies/stack_blocks/gpt61sol-s3/policy.py ADDED
@@ -0,0 +1,162 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Deterministic camera feedback controller for transferring and stacking blocks."""
2
+ import numpy as np
3
+ import cv2
4
+
5
+
6
+ def blobs(im, color='red'):
7
+ r,g,b = [im[:,:,k].astype(np.int16) for k in range(3)]
8
+ if color == 'red':
9
+ mask = (r>95)&(r>1.6*g)&(r>1.6*b)
10
+ else:
11
+ mask = (g>100)&(g>1.25*r)&(g>1.25*b)
12
+ n,labels,stats,centers = cv2.connectedComponentsWithStats(mask.astype(np.uint8))
13
+ return sorted([(int(stats[k,4]),centers[k],stats[k,:4])
14
+ for k in range(1,n) if stats[k,4]>8],key=lambda x:-x[0])
15
+
16
+
17
+ class Policy:
18
+ def reset(self, obs, tools):
19
+ self.a=np.asarray(tools.hold_action(),dtype=float)
20
+ self.a[19:21]=0
21
+ self.state='grasp'
22
+ self.st=0
23
+ self.trip=0
24
+ self.route=0
25
+ self.last_seen=None
26
+ self.dest_y=-.12
27
+ self.track=None
28
+ self.aligned=0
29
+
30
+ def change(self, state):
31
+ self.state=state
32
+ self.st=0
33
+
34
+ def navigate(self, obs, target):
35
+ x,y,z,yaw=obs['low_dim_obs'][21:25]
36
+ tx,ty,tw=target
37
+ dx,dy=tx-x,ty-y
38
+ vel=np.clip(np.array([dx,dy])*1.6,-.45,.45)
39
+ dist=np.hypot(dx,dy)
40
+ if dist<.035:
41
+ vel[:]=0
42
+ elif np.linalg.norm(vel)<.075:
43
+ vel*=.075/np.linalg.norm(vel)
44
+ self.a[0]=np.cos(yaw)*vel[0]+np.sin(yaw)*vel[1]
45
+ self.a[1]=-np.sin(yaw)*vel[0]+np.cos(yaw)*vel[1]
46
+ err=(tw-yaw+np.pi)%(2*np.pi)-np.pi
47
+ self.a[3]=np.clip(err*1.6,-.65,.65)
48
+ return dist<.045 and abs(err)<.05
49
+
50
+ def approach(self, values, rate=.004):
51
+ for k,v in values.items():
52
+ self.a[k]+=np.clip(v-self.a[k],-rate,rate)
53
+
54
+ def act(self, obs, tools):
55
+ a=self.a
56
+ t=self.st
57
+ if self.state=='grasp':
58
+ a[0:2]=0;a[3]=0;a[4]=0;a[20]=0
59
+ if t%3==0:
60
+ cams=[(1,'right_wrist')]
61
+ if self.trip==0:
62
+ cams.insert(0,(0,'left_wrist'))
63
+ for j,cam in cams:
64
+ objects=blobs(tools.image(cam))
65
+ if objects:
66
+ if j==1:
67
+ ref=np.array([42.,28.]) if self.track is None else self.track
68
+ candidates=[v for v in objects if v[0]>35]
69
+ if not candidates:continue
70
+ selected=min(candidates,key=lambda v:np.sum((v[1]-ref)**2))
71
+ if self.track is not None and np.linalg.norm(selected[1]-ref)>20:continue
72
+ area,(x,y),box=selected
73
+ self.track=np.array([x,y])
74
+ else:
75
+ area,(x,y),box=objects[0]
76
+ k=5+7*j
77
+ a[k]=np.clip(a[k]+.0018*(y-34),-1.1,.3)
78
+ a[k+1]=np.clip(a[k+1]+.0018*(42-x),-1.1,1.1)
79
+ a[k+4]=-a[k+1]
80
+ a[k+5]=-a[k]
81
+ if j==1:self.last_seen=area
82
+ if self.trip>0:
83
+ a[5]=a[12];a[6]=-a[13];a[9]=-a[6];a[10]=-a[5]
84
+ if t>80:a[2]=max(.51,a[2]-.002)
85
+ if t>=550:
86
+ a[20]=1
87
+ self.change('close')
88
+ elif self.state=='close':
89
+ if t>=65:self.change('lift')
90
+ elif self.state=='lift':
91
+ a[2]=min(.78,a[2]+.002)
92
+ if t>=180:
93
+ self.route=0
94
+ self.change('outbound')
95
+ elif self.state=='outbound':
96
+ routes=[(-.10,1.05,0),(2.50,1.05,0),
97
+ (2.50,self.dest_y,-np.pi),(2.10,self.dest_y,-np.pi)]
98
+ if self.navigate(obs,routes[self.route]) or (self.route==3 and t>1300):
99
+ self.route+=1
100
+ if self.route==len(routes):
101
+ a[0:2]=0;a[3]=0
102
+ self.change('reach')
103
+ elif self.state=='reach':
104
+ a[0:2]=0;a[3]=0
105
+ self.approach({2:.78,4:.2,12:-1.3,13:0,14:0,15:.8,
106
+ 16:0,17:.3,18:0},.006)
107
+ if t>240:self.change('lower')
108
+ elif self.state=='lower':
109
+ # Maintain the horizontal reach while setting the block down.
110
+ a[2]=max(.74+.02*self.trip,a[2]-.0007)
111
+ if t>100:
112
+ a[20]=0
113
+ self.change('release')
114
+ elif self.state=='release':
115
+ if t>70:self.change('withdraw')
116
+ elif self.state=='withdraw':
117
+ self.approach({2:.78,4:0,12:-.8,13:-.4,15:0,16:.4,17:.8},.004)
118
+ if t>200:
119
+ self.trip+=1
120
+ if self.trip>=3:self.change('settle')
121
+ else:
122
+ self.route=0
123
+ self.change('return')
124
+ elif self.state=='return':
125
+ sy=.27
126
+ routes=[(2.50,1.05,-np.pi),(.10,1.05,0),(.10,sy,0)]
127
+ if self.navigate(obs,routes[self.route]):
128
+ self.route+=1
129
+ if self.route==len(routes):
130
+ a[0:2]=0;a[3]=0
131
+ self.change('prepare')
132
+ elif self.state=='prepare':
133
+ a[20]=0
134
+ self.approach({2:.74,4:0,5:0,6:0,7:0,8:0,9:0,10:0,11:0,12:0,13:0,14:0,15:0,16:0,17:0,18:0},.004)
135
+ if t>250:
136
+ self.last_seen=None
137
+ self.track=None
138
+ self.aligned=0
139
+ self.change('align_source')
140
+ elif self.state=='align_source':
141
+ yaw=obs['low_dim_obs'][24]
142
+ a[3]=np.clip(1.6*((-yaw+np.pi)%(2*np.pi)-np.pi),-.3,.3)
143
+ if t%5==0:
144
+ objects=[v for v in blobs(tools.image('head')) if v[0]>14 and v[1][1]<60]
145
+ if objects:
146
+ obj=max(objects,key=lambda v:v[1][0])
147
+ x,y=obj[1]
148
+ ex,ey=67-x,25-y
149
+ vx=0 if abs(ey)<4 else np.sign(ey)*max(.07,min(.14,.007*abs(ey)))
150
+ vy=0 if abs(ex)<4 else np.sign(ex)*max(.07,min(.18,.007*abs(ex)))
151
+ a[0]=vx;a[1]=vy
152
+ self.aligned=self.aligned+5 if abs(ex)<4 and abs(ey)<4 else 0
153
+ else:
154
+ a[0]=0;a[1]=-.1
155
+ if self.aligned>=15 or t>140:
156
+ a[0:2]=0;a[3]=0
157
+ self.track=None
158
+ self.change('grasp')
159
+ elif self.state=='settle':
160
+ a[0:2]=0;a[3]=0
161
+ self.st+=1
162
+ return a.copy()
policies/stack_blocks/gpt61terra-s1/episodes.csv ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ seed,success,length,termination,fell
2
+ 620000,0,8750,timeout,0
3
+ 620001,0,661,terminated,0
4
+ 620002,0,8750,timeout,0
5
+ 620003,0,8750,timeout,0
6
+ 620004,0,8750,timeout,0
7
+ 620005,0,8750,timeout,0
8
+ 620006,0,8750,timeout,0
9
+ 620007,0,8750,timeout,0
10
+ 620008,0,8750,timeout,0
11
+ 620009,0,8750,timeout,0
12
+ 620010,0,8750,timeout,0
13
+ 620011,0,8750,timeout,0
14
+ 620012,0,8750,timeout,0
15
+ 620013,0,8750,timeout,0
16
+ 620014,0,8750,timeout,0
17
+ 620015,0,736,terminated,0
18
+ 620016,0,8750,timeout,0
19
+ 620017,0,1036,terminated,0
20
+ 620018,0,8750,timeout,0
21
+ 620019,0,8750,timeout,0
22
+ 620020,0,8750,timeout,0
23
+ 620021,0,8750,timeout,0
24
+ 620022,0,474,terminated,0
25
+ 620023,0,8750,timeout,0
26
+ 620024,0,8750,timeout,0
27
+ 620025,0,8750,timeout,0
28
+ 620026,0,8750,timeout,0
29
+ 620027,0,8750,timeout,0
30
+ 620028,0,8750,timeout,0
31
+ 620029,0,8750,timeout,0
32
+ 620030,0,8750,timeout,0
33
+ 620031,0,8750,timeout,0
34
+ 620032,0,8750,timeout,0
35
+ 620033,0,1107,terminated,0
36
+ 620034,0,8750,timeout,0
37
+ 620035,0,8750,timeout,0
38
+ 620036,0,8750,timeout,0
39
+ 620037,0,8750,timeout,0
40
+ 620038,0,8750,timeout,0
41
+ 620039,0,8750,timeout,0
42
+ 620040,0,8750,timeout,0
43
+ 620041,0,8750,timeout,0
44
+ 620042,0,8750,timeout,0
45
+ 620043,0,8750,timeout,0
46
+ 620044,0,8750,timeout,0
47
+ 620045,0,8750,timeout,0
48
+ 620046,0,8750,timeout,0
49
+ 620047,0,8750,timeout,0
50
+ 620048,0,8750,timeout,0
51
+ 620049,0,8750,timeout,0
52
+ 620050,0,8750,timeout,0
53
+ 620051,0,8750,timeout,0
54
+ 620052,0,8750,timeout,0
55
+ 620053,0,8750,timeout,0
56
+ 620054,0,8750,timeout,0
57
+ 620055,0,8750,timeout,0
58
+ 620056,0,8750,timeout,0
59
+ 620057,0,8750,timeout,0
60
+ 620058,0,8750,timeout,0
61
+ 620059,0,8750,timeout,0
62
+ 620060,0,8750,timeout,0
63
+ 620061,0,8750,timeout,0
64
+ 620062,0,8750,timeout,0
65
+ 620063,0,8750,timeout,0
66
+ 620064,0,8750,timeout,0
67
+ 620065,0,8750,timeout,0
68
+ 620066,0,8750,timeout,0
69
+ 620067,0,8750,timeout,0
70
+ 620068,0,8750,timeout,0
71
+ 620069,0,8750,timeout,0
72
+ 620070,0,8750,timeout,0
73
+ 620071,0,8750,timeout,0
74
+ 620072,0,8750,timeout,0
75
+ 620073,0,8750,timeout,0
76
+ 620074,0,8750,timeout,0
77
+ 620075,0,8750,timeout,0
78
+ 620076,0,8750,timeout,0
79
+ 620077,0,8750,timeout,0
80
+ 620078,0,8750,timeout,0
81
+ 620079,0,8750,timeout,0
82
+ 620080,0,8750,timeout,0
83
+ 620081,0,8750,timeout,0
84
+ 620082,0,8750,timeout,0
85
+ 620083,0,8750,timeout,0
86
+ 620084,0,8750,timeout,0
87
+ 620085,0,8750,timeout,0
88
+ 620086,0,8750,timeout,0
89
+ 620087,0,8750,timeout,0
90
+ 620088,0,8750,timeout,0
91
+ 620089,0,8750,timeout,0
92
+ 620090,0,8750,timeout,0
93
+ 620091,0,8750,timeout,0
94
+ 620092,0,8750,timeout,0
95
+ 620093,0,8750,timeout,0
96
+ 620094,0,8750,timeout,0
97
+ 620095,0,8750,timeout,0
98
+ 620096,0,8750,timeout,0
99
+ 620097,0,8750,timeout,0
100
+ 620098,0,8750,timeout,0
101
+ 620099,0,8750,timeout,0
policies/stack_blocks/gpt61terra-s1/policy.py ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Deterministic visual manipulation and waypoint control for stack_blocks."""
2
+ import math
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:21]=0
9
+ self.phase='pickup1'; self.start=0; self.route=0
10
+
11
+ def change(self, phase, t):
12
+ self.phase=phase; self.start=t
13
+
14
+ def walk(self, obs, goal):
15
+ q=obs['low_dim_obs']; x,y,yaw=q[21],q[22],q[24]
16
+ dx=goal[0]-x;dy=goal[1]-y
17
+ ang=(goal[2]-yaw+math.pi)%(2*math.pi)-math.pi
18
+ vx=np.clip(.8*dx,-.16,.16); vy=np.clip(.8*dy,-.16,.16)
19
+ if math.hypot(dx,dy)<.06: vx=vy=0
20
+ self.a[0]=vx*math.cos(yaw)+vy*math.sin(yaw)
21
+ self.a[1]=-vx*math.sin(yaw)+vy*math.cos(yaw)
22
+ self.a[3]=np.clip(.8*ang,-.3,.3) if abs(ang)>.06 else 0
23
+ return math.hypot(dx,dy)<.08 and abs(ang)<.09
24
+
25
+ def act(self, obs, tools):
26
+ t=obs['t']; age=t-self.start; q=obs['low_dim_obs']
27
+ a=self.a
28
+ if self.phase=='pickup1':
29
+ a[6]=.35;a[13]=-.35
30
+ if age<90: a[0]=.12 if q[21]<.24 else 0
31
+ elif age<180: a[0]=0;a[2]=.65
32
+ elif age<270: a[19:21]=1
33
+ elif age<370:a[2]=.74
34
+ else:self.route=0;self.change('out1',t)
35
+ elif self.phase in ('out1','out2'):
36
+ goals=[(-.07,0,0),(-.07,-.78,0),(1.35,-.78,0),(1.35,-.78,1.6)]
37
+ if self.walk(obs,goals[self.route]):
38
+ self.route+=1
39
+ if self.route==len(goals):a[0:2]=0;a[3]=0;self.change('place1' if self.phase=='out1' else 'place3',t)
40
+ elif self.phase=='place1':
41
+ a[0:2]=0;a[3]=0
42
+ z=min(1.,age/300.)
43
+ a[6]=.35*(1-z);a[13]=-.35*(1-z)
44
+ a[5]=a[12]=-.6*z;a[8]=a[15]=z
45
+ if age>375:
46
+ w=min(1.,(age-375)/150.);a[5]=a[12]=-.6-.65*w;a[8]=a[15]=1.-.9*w
47
+ if age>550:a[2]=.65
48
+ if age>650:a[19]=0
49
+ if age>825:
50
+ w=min(1.,(age-825)/150.);a[5]=-.8-.4*w;a[8]=.7+.5*w
51
+ if age>1050:
52
+ w=min(1.,(age-1050)/180.);a[13]=.27*w
53
+ if age>1250:a[20]=0
54
+ if age>1400:
55
+ a[2]=.74;a[5:19]=0;a[19:21]=0
56
+ if age>1500:self.route=0;self.change('back',t)
57
+ elif self.phase=='back':
58
+ goals=[(1.35,-.85,0),(-.07,-.8,0),(-.07,0,0),(.24,0,0)]
59
+ if self.walk(obs,goals[self.route]):
60
+ self.route+=1
61
+ if self.route==len(goals):a[0:2]=0;a[3]=0;self.change('pickup3',t)
62
+ elif self.phase=='pickup3':
63
+ a[6]=.5;a[13]=0
64
+ if age<70:a[0]=.12 if q[21]<.24 else 0
65
+ elif age<160:a[0]=0;a[2]=.65
66
+ elif age<250:a[20]=1
67
+ elif age<350:a[2]=.74
68
+ else:self.route=0;self.change('out2',t)
69
+ elif self.phase=='place3':
70
+ a[0:2]=0;a[3]=0
71
+ z=min(1.,age/300.)
72
+ a[13]=.27*z;a[12]=-1.25*z;a[15]=.1*z
73
+ if age>350:a[2]=.68
74
+ if age>450:a[20]=0
75
+ if age>600:a[12]=-1.2;a[15]=1.2
76
+ return a.copy()
policies/stack_blocks/gpt61terra-s2/episodes.csv ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ seed,success,length,termination,fell
2
+ 620000,0,8750,timeout,0
3
+ 620001,0,1555,terminated,0
4
+ 620002,0,8750,timeout,0
5
+ 620003,0,8750,timeout,0
6
+ 620004,0,8750,timeout,0
7
+ 620005,0,8750,timeout,0
8
+ 620006,0,8750,timeout,0
9
+ 620007,0,8750,timeout,0
10
+ 620008,0,8750,timeout,0
11
+ 620009,0,8750,timeout,0
12
+ 620010,0,8750,timeout,0
13
+ 620011,0,8750,timeout,0
14
+ 620012,0,8750,timeout,0
15
+ 620013,0,8750,timeout,0
16
+ 620014,0,8750,timeout,0
17
+ 620015,0,8750,timeout,0
18
+ 620016,0,8750,timeout,0
19
+ 620017,0,8750,timeout,0
20
+ 620018,0,8750,timeout,0
21
+ 620019,0,8750,timeout,0
22
+ 620020,0,8750,timeout,0
23
+ 620021,0,8750,timeout,0
24
+ 620022,0,8750,timeout,0
25
+ 620023,0,8750,timeout,0
26
+ 620024,0,2178,terminated,0
27
+ 620025,0,8750,timeout,0
28
+ 620026,0,5117,terminated,0
29
+ 620027,0,8750,timeout,0
30
+ 620028,0,8750,timeout,0
31
+ 620029,0,8750,timeout,0
32
+ 620030,0,8750,timeout,0
33
+ 620031,0,8750,timeout,0
34
+ 620032,0,8750,timeout,0
35
+ 620033,0,8750,timeout,0
36
+ 620034,0,8750,timeout,0
37
+ 620035,0,1692,terminated,0
38
+ 620036,0,8750,timeout,0
39
+ 620037,0,8750,timeout,0
40
+ 620038,0,8750,timeout,0
41
+ 620039,0,8750,timeout,0
42
+ 620040,0,8750,timeout,0
43
+ 620041,0,8750,timeout,0
44
+ 620042,0,8750,timeout,0
45
+ 620043,0,8750,timeout,0
46
+ 620044,0,8750,timeout,0
47
+ 620045,0,8750,timeout,0
48
+ 620046,0,8750,timeout,0
49
+ 620047,0,8750,timeout,0
50
+ 620048,0,8750,timeout,0
51
+ 620049,0,8750,timeout,0
52
+ 620050,0,8750,timeout,0
53
+ 620051,0,8750,timeout,0
54
+ 620052,0,8750,timeout,0
55
+ 620053,0,8750,timeout,0
56
+ 620054,0,8750,timeout,0
57
+ 620055,0,8750,timeout,0
58
+ 620056,0,8750,timeout,0
59
+ 620057,0,8750,timeout,0
60
+ 620058,0,5704,terminated,0
61
+ 620059,0,8750,timeout,0
62
+ 620060,0,8750,timeout,0
63
+ 620061,0,8750,timeout,0
64
+ 620062,0,8750,timeout,0
65
+ 620063,0,8750,timeout,0
66
+ 620064,0,8750,timeout,0
67
+ 620065,0,8750,timeout,0
68
+ 620066,0,8750,timeout,0
69
+ 620067,0,8750,timeout,0
70
+ 620068,0,8750,timeout,0
71
+ 620069,0,8750,timeout,0
72
+ 620070,0,8750,timeout,0
73
+ 620071,0,8750,timeout,0
74
+ 620072,0,2199,terminated,0
75
+ 620073,0,8750,timeout,0
76
+ 620074,0,8750,timeout,0
77
+ 620075,0,8750,timeout,0
78
+ 620076,0,8750,timeout,0
79
+ 620077,0,8750,timeout,0
80
+ 620078,0,8750,timeout,0
81
+ 620079,0,3032,terminated,0
82
+ 620080,0,8750,timeout,0
83
+ 620081,0,8750,timeout,0
84
+ 620082,0,2335,terminated,0
85
+ 620083,0,8750,timeout,0
86
+ 620084,0,8750,timeout,0
87
+ 620085,0,8750,timeout,0
88
+ 620086,0,8750,timeout,0
89
+ 620087,0,8750,timeout,0
90
+ 620088,0,8750,timeout,0
91
+ 620089,0,8750,timeout,0
92
+ 620090,0,8750,timeout,0
93
+ 620091,0,8750,timeout,0
94
+ 620092,0,8750,timeout,0
95
+ 620093,0,8750,timeout,0
96
+ 620094,0,8750,timeout,0
97
+ 620095,0,8750,timeout,0
98
+ 620096,0,8750,timeout,0
99
+ 620097,0,8750,timeout,0
100
+ 620098,0,8750,timeout,0
101
+ 620099,0,8750,timeout,0
policies/stack_blocks/gpt61terra-s2/policy.py ADDED
@@ -0,0 +1,108 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Deterministic vision-assisted block transfer controller."""
2
+ import math
3
+ import numpy as np
4
+ import cv2
5
+
6
+ class Policy:
7
+ def reset(self, obs, tools):
8
+ self.a=np.asarray(tools.hold_action(),dtype=np.float32)
9
+ self.phase='pickup'; self.enter=0
10
+ self.left_roll=.25; self.right_roll=-.15
11
+ im=tools.image('head')
12
+ mask=((im[:,:,0]>130)&(im[:,:,0]>im[:,:,1]*1.7)&(im[:,:,0]>im[:,:,2]*1.7)).astype(np.uint8)
13
+ n, lab, stats, cent=cv2.connectedComponentsWithStats(mask)
14
+ blobs=sorted([cent[i,0] for i in range(1,n) if stats[i,4]>=7])
15
+ if len(blobs)>=3:
16
+ self.left_roll=float(np.clip(.25-(blobs[0]-15)*.012,.05,.45))
17
+ self.right_roll=float(np.clip(-.15-(blobs[-1]-66)*.012,-.4,.05))
18
+ self.a[19:21]=0
19
+ self.a[6]=self.left_roll;self.a[13]=self.right_roll
20
+ def switch(self,p,t):
21
+ self.phase=p; self.enter=t
22
+ def act(self,obs,tools):
23
+ t=obs['t']; x,y,z,yaw=map(float,obs['low_dim_obs'][21:25]); dt=t-self.enter
24
+ a=self.a.copy();a[0]=a[1]=a[3]=0
25
+ phase=self.phase
26
+ if phase=='pickup':
27
+ a[0]=.1 if 30<=dt<85 else 0
28
+ if dt>=100:a[2]=.65
29
+ if dt==140:a[5]=a[12]=-.1
30
+ if 170<=dt<320 and dt%10==0:
31
+ for camera, pi, ri, wanted in [('left_wrist',5,6,35),('right_wrist',12,13,45)]:
32
+ im=tools.image(camera)
33
+ red=(im[:,:,0]>120)&(im[:,:,0]>1.6*im[:,:,1])&(im[:,:,0]>1.6*im[:,:,2])
34
+ yy,xx=np.nonzero(red)
35
+ if len(xx)>20:
36
+ dx=wanted-float(np.mean(xx)); dy=float(np.mean(yy))-35
37
+ if abs(dx)>8:a[ri]=np.clip(a[ri]+np.clip(dx*.0015,-.025,.025),-.5,.55)
38
+ if abs(dy)>10:a[pi]=np.clip(a[pi]+np.clip(dy*.0015,-.025,.025),-.3,.25)
39
+ if dt>=340:a[19:21]=1
40
+ if dt>=470:a[2]=.74
41
+ if dt>=620:self.switch('out_side',t)
42
+ elif phase=='out_side':
43
+ a[1]=-.25; a[3]=np.clip(-yaw,-.3,.3)
44
+ if y<-.95 or dt>450:self.switch('out_forward',t)
45
+ elif phase=='out_forward':
46
+ a[0]=.25; a[3]=np.clip(-yaw,-.3,.3)
47
+ if x>1.25 or dt>450:self.switch('turn_pad',t)
48
+ elif phase=='turn_pad':
49
+ a[3]=np.clip(1.57-yaw,-.3,.3)
50
+ if yaw>1.50 or dt>450:self.switch('approach_pad',t)
51
+ elif phase=='approach_pad':
52
+ a[0]=.12;a[3]=np.clip(1.57-yaw,-.3,.3)
53
+ if y>-.68 or dt>300:self.switch('first_place',t)
54
+ elif phase=='first_place':
55
+ a[4]=.8;a[12]=-.30;a[13]=-.15
56
+ if dt>200:a[2]=.70
57
+ if dt>400:a[20]=0
58
+ if dt>550:self.switch('shift',t)
59
+ elif phase=='shift':
60
+ a[4]=0;a[2]=.74;a[12]=-.6
61
+ if dt>100:
62
+ a[1]=-.12;a[3]=np.clip(1.57-yaw,-.3,.3)
63
+ if (dt>100 and x>1.57) or dt>300:self.switch('second_place',t)
64
+ elif phase=='second_place':
65
+ a[4]=.45;a[5]=-.3;a[6]=-.35
66
+ if dt>180:a[2]=.73
67
+ if dt>350:a[19]=0
68
+ if dt>500:self.switch('back_from_pad',t)
69
+ elif phase=='back_from_pad':
70
+ a[2]=.74;a[4]=0;a[5]=a[12]=-.1;a[6]=.25;a[13]=-.15
71
+ if dt>100:a[0]=-.20
72
+ a[3]=np.clip(1.57-yaw,-.3,.3)
73
+ if y<-.98 or dt>400:self.switch('turn_home',t)
74
+ elif phase=='turn_home':
75
+ a[3]=np.clip(-yaw,-.3,.3)
76
+ if yaw<.07 or dt>400:self.switch('home_forward',t)
77
+ elif phase=='home_forward':
78
+ a[0]=-.25;a[3]=np.clip(-yaw,-.3,.3)
79
+ if x<.22 or dt>500:self.switch('home_side',t)
80
+ elif phase=='home_side':
81
+ a[1]=.22;a[3]=np.clip(-yaw,-.3,.3)
82
+ if y>.12 or dt>500:self.switch('third_pick',t)
83
+ elif phase=='third_pick':
84
+ a[2]=.74;a[4]=0;a[12]=0;a[13]=-.15;a[20]=0
85
+ if dt>100:a[0]=.1
86
+ if dt>150:a[0]=0
87
+ if dt>200:a[2]=.65
88
+ if dt>240:a[12]=-.1
89
+ if dt>350:a[20]=1
90
+ if dt>450:a[2]=.74
91
+ if dt>600:self.switch('return_side',t)
92
+ elif phase=='return_side':
93
+ a[1]=-.25;a[3]=np.clip(-yaw,-.3,.3)
94
+ if y<-.95 or dt>500:self.switch('return_forward',t)
95
+ elif phase=='return_forward':
96
+ a[0]=.25;a[3]=np.clip(-yaw,-.3,.3)
97
+ if x>1.25 or dt>500:self.switch('return_turn',t)
98
+ elif phase=='return_turn':
99
+ a[3]=np.clip(1.57-yaw,-.3,.3)
100
+ if yaw>1.5 or dt>450:self.switch('return_approach',t)
101
+ elif phase=='return_approach':
102
+ a[0]=.12;a[3]=np.clip(1.57-yaw,-.3,.3)
103
+ if y>-.68 or dt>300:self.switch('third_place',t)
104
+ elif phase=='third_place':
105
+ a[4]=.5;a[12]=-.3;a[13]=-.15
106
+ if dt>300:a[20]=0
107
+ self.a=a.copy()
108
+ return a
policies/stack_blocks/gpt61terra-s3/episodes.csv ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ seed,success,length,termination,fell
2
+ 620000,0,8750,timeout,0
3
+ 620001,0,1267,terminated,0
4
+ 620002,0,8750,timeout,0
5
+ 620003,0,8750,timeout,0
6
+ 620004,0,1061,terminated,0
7
+ 620005,0,8750,timeout,0
8
+ 620006,0,8750,timeout,0
9
+ 620007,0,8750,timeout,0
10
+ 620008,0,8750,timeout,0
11
+ 620009,0,878,terminated,0
12
+ 620010,0,1432,terminated,0
13
+ 620011,0,8750,timeout,0
14
+ 620012,0,8750,timeout,0
15
+ 620013,0,1385,terminated,0
16
+ 620014,0,8750,timeout,0
17
+ 620015,0,8750,timeout,0
18
+ 620016,0,7611,terminated,0
19
+ 620017,0,8750,timeout,0
20
+ 620018,0,1225,terminated,0
21
+ 620019,0,7669,terminated,0
22
+ 620020,0,8750,timeout,0
23
+ 620021,0,8750,timeout,0
24
+ 620022,0,8750,timeout,0
25
+ 620023,0,8750,timeout,0
26
+ 620024,0,8750,timeout,0
27
+ 620025,0,8750,timeout,0
28
+ 620026,0,6345,terminated,0
29
+ 620027,0,8750,timeout,0
30
+ 620028,0,8750,timeout,0
31
+ 620029,0,8750,timeout,0
32
+ 620030,0,6411,terminated,0
33
+ 620031,0,8750,timeout,0
34
+ 620032,0,7812,terminated,0
35
+ 620033,0,8750,timeout,0
36
+ 620034,0,6981,terminated,0
37
+ 620035,0,8750,timeout,0
38
+ 620036,0,7432,terminated,0
39
+ 620037,0,8750,timeout,0
40
+ 620038,0,8750,timeout,0
41
+ 620039,0,8750,timeout,0
42
+ 620040,0,8750,timeout,0
43
+ 620041,0,8750,timeout,0
44
+ 620042,0,8750,timeout,0
45
+ 620043,0,8750,timeout,0
46
+ 620044,0,7478,terminated,0
47
+ 620045,0,8750,timeout,0
48
+ 620046,0,8750,timeout,0
49
+ 620047,0,8750,timeout,0
50
+ 620048,0,8750,timeout,0
51
+ 620049,0,7358,terminated,0
52
+ 620050,0,7209,terminated,0
53
+ 620051,0,1990,terminated,0
54
+ 620052,0,8750,timeout,0
55
+ 620053,0,6931,terminated,0
56
+ 620054,0,8750,timeout,0
57
+ 620055,0,8750,timeout,0
58
+ 620056,0,8750,timeout,0
59
+ 620057,0,8750,timeout,0
60
+ 620058,0,8750,timeout,0
61
+ 620059,0,7153,terminated,0
62
+ 620060,0,8750,timeout,0
63
+ 620061,0,8750,timeout,0
64
+ 620062,0,1799,terminated,0
65
+ 620063,0,8750,timeout,0
66
+ 620064,0,8750,timeout,0
67
+ 620065,0,2171,terminated,0
68
+ 620066,0,8750,timeout,0
69
+ 620067,0,840,terminated,0
70
+ 620068,0,8750,timeout,0
71
+ 620069,0,8750,timeout,0
72
+ 620070,0,7390,terminated,0
73
+ 620071,0,8750,timeout,0
74
+ 620072,0,8750,timeout,0
75
+ 620073,0,552,terminated,0
76
+ 620074,0,1843,terminated,0
77
+ 620075,0,8750,timeout,0
78
+ 620076,0,2201,terminated,0
79
+ 620077,0,8750,timeout,0
80
+ 620078,0,581,terminated,0
81
+ 620079,0,1255,terminated,0
82
+ 620080,0,511,terminated,0
83
+ 620081,0,778,terminated,0
84
+ 620082,0,8750,timeout,0
85
+ 620083,0,8750,timeout,0
86
+ 620084,0,8750,timeout,0
87
+ 620085,0,8750,timeout,0
88
+ 620086,0,1187,terminated,0
89
+ 620087,0,8750,timeout,0
90
+ 620088,0,8750,timeout,0
91
+ 620089,0,568,terminated,0
92
+ 620090,0,8750,timeout,0
93
+ 620091,0,761,terminated,0
94
+ 620092,0,8750,timeout,0
95
+ 620093,0,6715,terminated,0
96
+ 620094,0,6277,terminated,0
97
+ 620095,0,1248,terminated,0
98
+ 620096,0,8750,timeout,0
99
+ 620097,0,8750,timeout,0
100
+ 620098,0,8750,timeout,0
101
+ 620099,0,8750,timeout,0
policies/stack_blocks/gpt61terra-s3/policy.py ADDED
@@ -0,0 +1,136 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import math
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(), dtype=np.float32)
8
+ self.a[19:21] = 0
9
+ self.a[6] = .22
10
+ self.a[13] = -.22
11
+ self.third_x = .2
12
+ self.third_y = .17
13
+ self.approach_steps = 35
14
+ im = tools.image('head')
15
+ red = ((im[:,:,0] > 130) & (im[:,:,0] > im[:,:,1]*1.7) & (im[:,:,0] > im[:,:,2]*1.7)).astype(np.uint8)
16
+ n, labels, stats, centers = cv2.connectedComponentsWithStats(red)
17
+ blobs = sorted([(centers[i][0], centers[i][1], stats[i,4]) for i in range(1,n) if stats[i,4] >= 25], key=lambda p:p[0])
18
+ if len(blobs) >= 3:
19
+ left, mid, right = blobs[0], blobs[len(blobs)//2], blobs[-1]
20
+ self.a[6] = np.clip(.22 + (13.3-left[0])*.020, -.15, .50)
21
+ self.a[13] = np.clip(-.22 + (66.5-right[0])*.020, -.50, .15)
22
+ self.approach_steps = int(round(np.clip(35 - ((left[1]+right[1])*.5-25.0)*2.5, 17, 50)))
23
+ self.third_x = float(np.clip(.2 - (mid[1]-26.7)*.010, .12, .26))
24
+ self.third_y = float(np.clip(.17 - (mid[0]-36.2)*.010, -.05, .38))
25
+ self.stage = 0
26
+ self.n = 0
27
+ self.waypoints = []
28
+ self.point = 0
29
+ self.wait = 0
30
+ self.point_steps = 0
31
+
32
+ def next(self):
33
+ self.stage += 1
34
+ self.n = 0
35
+
36
+ def path(self, points):
37
+ self.waypoints = points
38
+ self.point = 0
39
+ self.wait = 0
40
+ self.point_steps = 0
41
+
42
+ def navigate(self, obs):
43
+ if self.point >= len(self.waypoints):
44
+ self.a[0:2]=0; self.a[3]=0
45
+ return True
46
+ x,y,yaw = self.waypoints[self.point]
47
+ X,Y,_,th = obs['low_dim_obs'][21:25]
48
+ dx,dy=x-X,y-Y
49
+ ang=(yaw-th+math.pi)%(2*math.pi)-math.pi
50
+ dist=math.hypot(dx,dy)
51
+ self.point_steps += 1
52
+ if (dist < .055 and abs(ang)<.075) or (self.point_steps > 350 and dist < .09 and abs(ang) < .13):
53
+ self.a[0:2]=0;self.a[3]=0
54
+ self.wait+=1
55
+ if self.wait>=30:
56
+ self.point+=1; self.wait=0; self.point_steps=0
57
+ return False
58
+ self.wait=0
59
+ v=np.clip(np.array([dx,dy])*1.0,-.27,.27)
60
+ self.a[0]=math.cos(th)*v[0]+math.sin(th)*v[1]
61
+ self.a[1]=-math.sin(th)*v[0]+math.cos(th)*v[1]
62
+ if dist<.05:self.a[0:2]=0
63
+ self.a[3]=np.clip(ang*1.3,-.5,.5)
64
+ return False
65
+
66
+ def act(self, obs, tools):
67
+ s=self.stage; self.n+=1
68
+ if s==0:
69
+ self.a[0]=.2
70
+ if self.n>=self.approach_steps:self.a[0]=0;self.next()
71
+ elif s==1:
72
+ self.a[2]=.63
73
+ if self.n>=150:self.next()
74
+ elif s==2:
75
+ self.a[19:21]=1
76
+ if self.n>=100:self.next()
77
+ elif s==3:
78
+ self.a[2]=.74
79
+ if self.n>=150:
80
+ self.path([(.2,0,1.57),(.2,.9,1.57),(.2,.9,0),(2.7,.9,0),(2.7,.9,-1.57),(2.7,0,-1.57),(2.7,0,3.14),(1.9,.18,3.14)]);self.next()
81
+ elif s==4:
82
+ if self.navigate(obs):self.next()
83
+ elif s==5:
84
+ self.a[2]=.63
85
+ if self.n>=150:self.next()
86
+ elif s==6:
87
+ self.a[19]=0
88
+ if self.n>=120:self.next()
89
+ elif s==7:
90
+ self.a[2]=.74;self.a[5]=-.5
91
+ if self.n>=150:self.path([(1.9,-.32,3.14)]);self.next()
92
+ elif s==8:
93
+ if self.navigate(obs):self.next()
94
+ elif s==9:
95
+ self.a[2]=.69
96
+ if self.n>=150:self.next()
97
+ elif s==10:
98
+ self.a[20]=0
99
+ if self.n>=120:self.next()
100
+ elif s==11:
101
+ self.a[2]=.74;self.a[12]=-.5
102
+ if self.n>=150:
103
+ self.path([(2.7,-.32,3.14),(2.7,.9,1.57),(.2,.9,3.14),(.2,.9,0),(self.third_x,self.third_y,0)]);self.next()
104
+ elif s==12:
105
+ if self.navigate(obs):self.next()
106
+ elif s==13:
107
+ self.a[12]=0
108
+ if self.n < 40:
109
+ self.a[13]=-.22
110
+ elif self.n % 10 == 0:
111
+ im = tools.image('right_wrist')
112
+ mask = ((im[:,:,0] > 130) & (im[:,:,0] > im[:,:,1]*1.7) & (im[:,:,0] > im[:,:,2]*1.7)).astype(np.uint8)
113
+ count, labels, stats, centers = cv2.connectedComponentsWithStats(mask)
114
+ candidates = [i for i in range(1,count) if stats[i,4] >= 20]
115
+ if candidates:
116
+ i = max(candidates, key=lambda j:stats[j,4])
117
+ self.a[13] = np.clip(self.a[13] + np.clip((35-centers[i,0])*.002, -.035, .035), -.5, .15)
118
+ if self.n>=120:self.next()
119
+ elif s==14:
120
+ self.a[2]=.63
121
+ if self.n>=150:self.next()
122
+ elif s==15:
123
+ self.a[20]=1
124
+ if self.n>=120:self.next()
125
+ elif s==16:
126
+ self.a[2]=.74
127
+ if self.n>=150:
128
+ self.path([(.2,.9,1.57),(.2,.9,0),(2.7,.9,0),(2.7,0,-1.57),(2.7,0,3.14),(1.9,-.32,3.14)]);self.next()
129
+ elif s==17:
130
+ if self.navigate(obs):self.next()
131
+ elif s==18:
132
+ self.a[20]=0
133
+ if self.n>=120:self.next()
134
+ elif s==19:
135
+ self.a[12]=-.5
136
+ return self.a.copy()
policies/stack_blocks/gpt6sol-s1/episodes.csv ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ seed,success,length,termination,fell
2
+ 620000,0,8750,timeout,0
3
+ 620001,0,8750,timeout,0
4
+ 620002,0,8750,timeout,0
5
+ 620003,0,8750,timeout,0
6
+ 620004,0,8750,timeout,0
7
+ 620005,0,8750,timeout,0
8
+ 620006,0,8750,timeout,0
9
+ 620007,0,8750,timeout,0
10
+ 620008,0,8750,timeout,0
11
+ 620009,0,8750,timeout,0
12
+ 620010,0,8750,timeout,0
13
+ 620011,0,8750,timeout,0
14
+ 620012,0,573,terminated,0
15
+ 620013,0,8750,timeout,0
16
+ 620014,0,8750,timeout,0
17
+ 620015,0,8750,timeout,0
18
+ 620016,0,8750,timeout,0
19
+ 620017,0,8750,timeout,0
20
+ 620018,0,8750,timeout,0
21
+ 620019,0,8750,timeout,0
22
+ 620020,0,8750,timeout,0
23
+ 620021,0,8750,timeout,0
24
+ 620022,0,8750,timeout,0
25
+ 620023,0,5192,terminated,0
26
+ 620024,0,8750,timeout,0
27
+ 620025,0,8750,timeout,0
28
+ 620026,0,8750,timeout,0
29
+ 620027,0,8750,timeout,0
30
+ 620028,0,8750,timeout,0
31
+ 620029,0,654,terminated,0
32
+ 620030,0,8750,timeout,0
33
+ 620031,0,8750,timeout,0
34
+ 620032,0,648,terminated,0
35
+ 620033,0,8750,timeout,0
36
+ 620034,0,8750,timeout,0
37
+ 620035,0,8750,timeout,0
38
+ 620036,0,8750,timeout,0
39
+ 620037,0,8750,timeout,0
40
+ 620038,0,8750,timeout,0
41
+ 620039,0,8750,timeout,0
42
+ 620040,0,8750,timeout,0
43
+ 620041,0,8750,timeout,0
44
+ 620042,0,8750,timeout,0
45
+ 620043,0,8750,timeout,0
46
+ 620044,0,2900,terminated,0
47
+ 620045,0,8750,timeout,0
48
+ 620046,0,8750,timeout,0
49
+ 620047,0,8750,timeout,0
50
+ 620048,0,8750,timeout,0
51
+ 620049,0,8750,timeout,0
52
+ 620050,0,8750,timeout,0
53
+ 620051,0,8750,timeout,0
54
+ 620052,0,8750,timeout,0
55
+ 620053,0,8750,timeout,0
56
+ 620054,0,8750,timeout,0
57
+ 620055,0,8750,timeout,0
58
+ 620056,0,8750,timeout,0
59
+ 620057,0,8750,timeout,0
60
+ 620058,0,8750,timeout,0
61
+ 620059,0,8750,timeout,0
62
+ 620060,0,8750,timeout,0
63
+ 620061,0,8750,timeout,0
64
+ 620062,0,8750,timeout,0
65
+ 620063,0,8750,timeout,0
66
+ 620064,0,8750,timeout,0
67
+ 620065,0,8750,timeout,0
68
+ 620066,0,8750,timeout,0
69
+ 620067,0,8750,timeout,0
70
+ 620068,0,8750,timeout,0
71
+ 620069,0,8750,timeout,0
72
+ 620070,0,8750,timeout,0
73
+ 620071,0,8750,timeout,0
74
+ 620072,0,8750,timeout,0
75
+ 620073,0,703,terminated,0
76
+ 620074,0,8750,timeout,0
77
+ 620075,0,8750,timeout,0
78
+ 620076,0,8750,timeout,0
79
+ 620077,0,8750,timeout,0
80
+ 620078,0,8750,timeout,0
81
+ 620079,0,8750,timeout,0
82
+ 620080,0,8750,timeout,0
83
+ 620081,0,1401,terminated,0
84
+ 620082,0,8750,timeout,0
85
+ 620083,0,8750,timeout,0
86
+ 620084,0,8750,timeout,0
87
+ 620085,0,8750,timeout,0
88
+ 620086,0,8750,timeout,0
89
+ 620087,0,8750,timeout,0
90
+ 620088,0,8750,timeout,0
91
+ 620089,0,8750,timeout,0
92
+ 620090,0,8750,timeout,0
93
+ 620091,0,8750,timeout,0
94
+ 620092,0,8750,timeout,0
95
+ 620093,0,8750,timeout,0
96
+ 620094,0,8750,timeout,0
97
+ 620095,0,8750,timeout,0
98
+ 620096,0,8750,timeout,0
99
+ 620097,0,8750,timeout,0
100
+ 620098,0,2883,terminated,0
101
+ 620099,0,8750,timeout,0
policies/stack_blocks/gpt6sol-s1/policy.py ADDED
@@ -0,0 +1,198 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Deterministic whole-body script for the block stacking task."""
2
+
3
+ import math
4
+ import numpy as np
5
+ import cv2
6
+
7
+
8
+ def angle_error(target, actual):
9
+ return math.atan2(math.sin(target - actual), math.cos(target - actual))
10
+
11
+
12
+ class Policy:
13
+ def reset(self, obs, tools):
14
+ self.a = np.asarray(tools.hold_action(), dtype=np.float32).copy()
15
+ self.a[19:21] = 0.0
16
+ self.phase = 0
17
+ self.clock = 0
18
+ self.entered = False
19
+ self.stages = []
20
+
21
+ def hold(n, edits=None):
22
+ self.stages.append(('hold', n, edits or {}))
23
+
24
+ def turn(yaw):
25
+ self.stages.append(('turn', yaw, {}))
26
+ hold(20, {3: 0})
27
+
28
+ def walk(axis, target, yaw, speed=.28):
29
+ self.stages.append(('walk', (axis, target, yaw, speed), {}))
30
+ hold(25, {0: 0, 1: 0, 3: 0})
31
+
32
+ def strafe(target, yaw):
33
+ self.stages.append(('strafe', (target, yaw), {}))
34
+ hold(20, {0: 0, 1: 0, 3: 0})
35
+
36
+ def back(target):
37
+ self.stages.append(('back', target, {}))
38
+ hold(20, {0: 0, 1: 0, 3: 0})
39
+
40
+ def adjust(x, y):
41
+ for _ in range(3):
42
+ self.stages.append(('adjust', (x, y), {}))
43
+ hold(20, {0: 0, 1: 0, 3: 0})
44
+
45
+ def align(camera, joint, target, pixels_per_radian):
46
+ self.stages.append(('align', (camera, joint, target, pixels_per_radian), {}))
47
+
48
+ # Grasp the two outside blocks, one hand at a time.
49
+ self.stages.append(('approach', .225, {}))
50
+ hold(30)
51
+ hold(60, {5: -.3, 6: .3, 10: .9})
52
+ align('left_wrist', 6, 50, 245)
53
+ hold(60, {19: 1})
54
+ hold(60, {5: -.5, 10: 1.2})
55
+ hold(60, {12: -.3, 13: -.3, 17: .9})
56
+ align('right_wrist', 13, 40, 90)
57
+ hold(60, {20: 1})
58
+ hold(60, {12: -.5, 17: 1.2})
59
+
60
+ # Pass north of both tables, then approach the east side of the pad.
61
+ strafe(1.2, 0)
62
+ walk('x', 2.3, 0)
63
+ strafe(0, 0)
64
+ turn(math.pi)
65
+ walk('x', 1.85, math.pi)
66
+ adjust(1.94, .24)
67
+
68
+ # Place the first block.
69
+ hold(60, {6: -.35})
70
+ hold(80, {19: 0})
71
+ hold(60, {5: -.3, 6: .3, 10: .9})
72
+ hold(80)
73
+
74
+ # Move the base so the right hand is over the placed block.
75
+ adjust(1.95, -.20)
76
+ hold(90, {20: 0})
77
+ hold(60, {12: -.8})
78
+ hold(90)
79
+
80
+ # Return for the remaining center block.
81
+ back(2.3)
82
+ strafe(1.2, math.pi)
83
+ walk('x', .05, math.pi)
84
+ strafe(-.14, math.pi)
85
+ adjust(.08, -.14)
86
+ turn(0)
87
+ adjust(.08, -.14)
88
+ self.stages.append(('approach', .225, {}))
89
+ hold(30)
90
+ hold(60, {5: -.3, 6: .3, 10: .9})
91
+ align('left_wrist', 6, 23, 245)
92
+ hold(60, {19: 1})
93
+ hold(60, {5: -.5, 10: 1.2})
94
+
95
+ # Carry the center block to the stack.
96
+ strafe(1.2, 0)
97
+ walk('x', 2.3, 0)
98
+ strafe(0, 0)
99
+ turn(math.pi)
100
+ walk('x', 1.85, math.pi)
101
+ adjust(1.94, .24)
102
+ hold(60, {5: -.7, 6: -.35})
103
+ hold(80, {19: 0})
104
+ hold(60, {5: -.3, 6: .3, 10: .9})
105
+ hold(150)
106
+
107
+ def act(self, obs, tools):
108
+ pose = obs['low_dim_obs']
109
+ while self.phase < len(self.stages):
110
+ kind, param, edits = self.stages[self.phase]
111
+ if not self.entered:
112
+ for i, value in edits.items():
113
+ self.a[i] = value
114
+ if kind == 'align':
115
+ camera, joint, target, scale = param
116
+ image = tools.image(camera)
117
+ red = ((image[:, :, 0] > 100) &
118
+ (image[:, :, 0] > 1.7 * image[:, :, 1]) &
119
+ (image[:, :, 0] > 1.7 * image[:, :, 2])).astype(np.uint8)
120
+ n, _, stats, centers = cv2.connectedComponentsWithStats(red, 8)
121
+ if n > 1:
122
+ i = 1 + int(np.argmax(stats[1:, 4]))
123
+ if stats[i, 4] > 350:
124
+ delta = np.clip((target - centers[i, 0]) / scale, -.15, .15)
125
+ self.a[joint] += delta
126
+ self.entered = True
127
+ self.clock = 0
128
+
129
+ finished = False
130
+ if kind == 'hold':
131
+ if 0 not in edits:
132
+ self.a[0] = 0
133
+ if 1 not in edits:
134
+ self.a[1] = 0
135
+ if 3 not in edits:
136
+ self.a[3] = 0
137
+ finished = self.clock >= param
138
+ elif kind == 'align':
139
+ self.a[0:2] = 0
140
+ self.a[3] = 0
141
+ finished = self.clock >= 35
142
+ elif kind == 'approach':
143
+ self.a[0] = .20
144
+ self.a[1] = 0
145
+ self.a[3] = 0
146
+ finished = float(pose[21]) > param or self.clock > 250
147
+ elif kind == 'turn':
148
+ err = angle_error(param, float(pose[24]))
149
+ self.a[0:2] = 0
150
+ turn_limit = .35 if self.a[19] > .5 or self.a[20] > .5 else .8
151
+ self.a[3] = np.clip(err, -turn_limit, turn_limit)
152
+ finished = abs(err) < .025 or self.clock > 600
153
+ elif kind == 'strafe':
154
+ target, yaw = param
155
+ coord = float(pose[22])
156
+ if self.clock == 0:
157
+ self.direction = 1 if target > coord else -1
158
+ self.a[0] = 0
159
+ self.a[1] = self.direction * .5 * math.cos(float(pose[24]))
160
+ self.a[3] = np.clip(.8 * angle_error(yaw, float(pose[24])), -.25, .25)
161
+ finished = self.direction * (target - coord) < .02 or self.clock > 500
162
+ elif kind == 'back':
163
+ self.a[0] = -.35
164
+ self.a[1] = 0
165
+ self.a[3] = np.clip(.8 * angle_error(math.pi, float(pose[24])), -.25, .25)
166
+ finished = float(pose[21]) > param - .02 or self.clock > 200
167
+ elif kind == 'walk':
168
+ axis, target, yaw, speed = param
169
+ coord = float(pose[21 if axis == 'x' else 22])
170
+ if self.clock == 0:
171
+ self.direction = 1 if target > coord else -1
172
+ self.a[0] = speed
173
+ self.a[1] = 0
174
+ self.a[3] = np.clip(.8 * angle_error(yaw, float(pose[24])), -.2, .2)
175
+ finished = self.direction * (target - coord) < .015 or self.clock > 1000
176
+ else:
177
+ x, y = param
178
+ ex, ey = x - float(pose[21]), y - float(pose[22])
179
+ yaw = float(pose[24])
180
+ vx = math.cos(yaw) * ex + math.sin(yaw) * ey
181
+ vy = -math.sin(yaw) * ex + math.cos(yaw) * ey
182
+ self.a[0] = np.clip(1.2 * vx, -.2, .2)
183
+ self.a[1] = np.clip(1.2 * vy, -.2, .2)
184
+ for i, error in ((0, vx), (1, vy)):
185
+ if .025 < abs(error) and abs(self.a[i]) < .07:
186
+ self.a[i] = math.copysign(.07, self.a[i])
187
+ self.a[3] = 0
188
+ finished = (abs(ex) < .025 and abs(ey) < .025) or self.clock > 250
189
+
190
+ if finished:
191
+ self.phase += 1
192
+ self.entered = False
193
+ continue
194
+ self.clock += 1
195
+ return self.a.copy()
196
+ self.a[0:2] = 0
197
+ self.a[3] = 0
198
+ return self.a.copy()
policies/stack_blocks/gpt6sol-s2/episodes.csv ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ seed,success,length,termination,fell
2
+ 620000,0,8750,timeout,0
3
+ 620001,0,8750,timeout,0
4
+ 620002,0,8750,timeout,0
5
+ 620003,0,8750,timeout,0
6
+ 620004,0,8750,timeout,0
7
+ 620005,0,8750,timeout,0
8
+ 620006,0,8750,timeout,0
9
+ 620007,0,8750,timeout,0
10
+ 620008,0,5155,terminated,0
11
+ 620009,0,8750,timeout,0
12
+ 620010,0,2207,terminated,0
13
+ 620011,0,8750,timeout,0
14
+ 620012,0,8750,timeout,0
15
+ 620013,0,8750,timeout,0
16
+ 620014,0,377,terminated,0
17
+ 620015,0,8750,timeout,0
18
+ 620016,0,8750,timeout,0
19
+ 620017,0,8750,timeout,0
20
+ 620018,0,8750,timeout,0
21
+ 620019,0,8750,timeout,0
22
+ 620020,0,8750,timeout,0
23
+ 620021,0,5119,terminated,0
24
+ 620022,0,8750,timeout,0
25
+ 620023,0,4777,terminated,0
26
+ 620024,0,826,terminated,0
27
+ 620025,0,4523,terminated,0
28
+ 620026,0,8750,timeout,0
29
+ 620027,0,8750,timeout,0
30
+ 620028,0,8750,timeout,0
31
+ 620029,0,8750,timeout,0
32
+ 620030,0,8750,timeout,0
33
+ 620031,0,8750,timeout,0
34
+ 620032,0,8750,timeout,0
35
+ 620033,0,8750,timeout,0
36
+ 620034,0,8750,timeout,0
37
+ 620035,0,1935,terminated,0
38
+ 620036,0,8750,timeout,0
39
+ 620037,0,8750,timeout,0
40
+ 620038,0,8750,timeout,0
41
+ 620039,0,8750,timeout,0
42
+ 620040,0,8750,timeout,0
43
+ 620041,0,8750,timeout,0
44
+ 620042,0,8750,timeout,0
45
+ 620043,0,8750,timeout,0
46
+ 620044,0,8750,timeout,0
47
+ 620045,0,8750,timeout,0
48
+ 620046,0,377,terminated,0
49
+ 620047,0,8750,timeout,0
50
+ 620048,0,4123,terminated,0
51
+ 620049,0,8750,timeout,0
52
+ 620050,0,8750,timeout,0
53
+ 620051,0,8750,timeout,0
54
+ 620052,0,8750,timeout,0
55
+ 620053,0,8750,timeout,0
56
+ 620054,0,4789,terminated,0
57
+ 620055,0,8750,timeout,0
58
+ 620056,0,392,terminated,0
59
+ 620057,0,8750,timeout,0
60
+ 620058,0,4276,terminated,0
61
+ 620059,0,8750,timeout,0
62
+ 620060,0,1912,terminated,0
63
+ 620061,0,8750,timeout,0
64
+ 620062,0,819,terminated,0
65
+ 620063,0,8750,timeout,0
66
+ 620064,0,8750,timeout,0
67
+ 620065,0,8750,timeout,0
68
+ 620066,0,8750,timeout,0
69
+ 620067,0,8750,timeout,0
70
+ 620068,0,8750,timeout,0
71
+ 620069,0,395,terminated,0
72
+ 620070,0,8750,timeout,0
73
+ 620071,0,8750,timeout,0
74
+ 620072,0,1905,terminated,0
75
+ 620073,0,396,terminated,0
76
+ 620074,0,371,terminated,0
77
+ 620075,0,372,terminated,0
78
+ 620076,0,8750,timeout,0
79
+ 620077,0,8750,timeout,0
80
+ 620078,0,8750,timeout,0
81
+ 620079,0,400,terminated,0
82
+ 620080,0,8750,timeout,0
83
+ 620081,0,8750,timeout,0
84
+ 620082,0,8750,timeout,0
85
+ 620083,0,8750,timeout,0
86
+ 620084,0,8750,timeout,0
87
+ 620085,0,8750,timeout,0
88
+ 620086,0,8750,timeout,0
89
+ 620087,0,8750,timeout,0
90
+ 620088,0,8750,timeout,0
91
+ 620089,0,383,terminated,0
92
+ 620090,0,8750,timeout,0
93
+ 620091,0,4522,terminated,0
94
+ 620092,0,8750,timeout,0
95
+ 620093,0,8750,timeout,0
96
+ 620094,0,8750,timeout,0
97
+ 620095,0,8750,timeout,0
98
+ 620096,0,8750,timeout,0
99
+ 620097,0,8750,timeout,0
100
+ 620098,0,8750,timeout,0
101
+ 620099,0,2138,terminated,0
policies/stack_blocks/gpt6sol-s2/policy.py ADDED
@@ -0,0 +1,156 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Deterministic camera and proprioceptive controller for the block task."""
2
+
3
+ import math
4
+ import numpy as np
5
+
6
+
7
+ def _wrap(v):
8
+ return (v + math.pi) % (2 * math.pi) - math.pi
9
+
10
+
11
+ class Policy:
12
+ def reset(self, obs, tools):
13
+ self.a = np.asarray(tools.hold_action(), dtype=np.float32)
14
+ self.a[2] = 0.74
15
+ self.a[4] = 0
16
+ self.a[5:19] = 0
17
+ self.a[5] = self.a[12] = 0.2
18
+ self.a[6] = 0.3
19
+ self.a[13] = -0.3
20
+ self.a[19:21] = 0
21
+ self.phase = 0
22
+ self.age = 0
23
+ self.near = 0
24
+ self.third_y = None
25
+ self.grab_tries = 0
26
+
27
+ def _nav(self, obs, x, y, heading, speed=0.28):
28
+ q = obs["low_dim_obs"]
29
+ dx = x - float(q[21])
30
+ dy = y - float(q[22])
31
+ yaw = float(q[24])
32
+ err = _wrap(heading - yaw)
33
+ near = math.hypot(dx, dy) < 0.07 and abs(err) < 0.05
34
+ if near:
35
+ self.a[0] = self.a[1] = self.a[3] = 0
36
+ self.near += 1
37
+ else:
38
+ self.near = 0
39
+ v = np.clip(np.array([dx, dy]) * 1.5, -speed, speed)
40
+ c = math.cos(yaw)
41
+ s = math.sin(yaw)
42
+ self.a[0] = c * v[0] + s * v[1]
43
+ self.a[1] = -s * v[0] + c * v[1]
44
+ self.a[3] = np.clip(1.5 * err, -0.4, 0.4)
45
+ if math.hypot(dx, dy) < 0.07:
46
+ self.a[0:2] = 0
47
+ return self.near >= 30 or self.age > 850
48
+
49
+ def act(self, obs, tools):
50
+ self.a[0] = self.a[1] = self.a[3] = 0
51
+ p = self.phase
52
+ done = False
53
+ if p == 0:
54
+ done = self.age >= 70
55
+ elif p == 1:
56
+ self.a[0] = 0.12
57
+ done = self.age >= 100
58
+ elif p == 2:
59
+ self.a[19:21] = 1
60
+ done = self.age >= 70
61
+ elif p == 3:
62
+ self.a[0] = -0.2
63
+ done = self.age >= 140
64
+ elif p == 4:
65
+ done = self._nav(obs, 0, -1.5, 0)
66
+ elif p == 5:
67
+ self.a[5] = self.a[12] = -0.2
68
+ done = self._nav(obs, 2.25, -1.5, 0)
69
+ elif p == 6:
70
+ done = self._nav(obs, 2.04, -0.07, math.pi)
71
+ elif p == 7:
72
+ self.a[12] = 0
73
+ self.a[13] = 0.3
74
+ done = self.age >= 100
75
+ elif p == 8:
76
+ self.a[20] = 0
77
+ done = self.age >= 120
78
+ elif p == 9:
79
+ self.a[12] = -0.2
80
+ self.a[13] = -0.3
81
+ done = self._nav(obs, 2.04, 0.25, math.pi, 0.2)
82
+ elif p == 10:
83
+ self.a[5] = -0.1
84
+ self.a[6] = -0.1
85
+ done = self.age >= 100
86
+ elif p == 11:
87
+ self.a[19] = 0
88
+ done = self.age >= 120
89
+ elif p == 12:
90
+ self.a[5:19] = 0
91
+ done = self._nav(obs, 2.25, -1.5, math.pi)
92
+ elif p == 13:
93
+ done = self._nav(obs, 0, -1.5, math.pi)
94
+ elif p == 14:
95
+ q = obs["low_dim_obs"]
96
+ if self.third_y is None and math.hypot(float(q[21]) - 0.1, float(q[22]) + 0.08) < 0.1 and abs(_wrap(float(q[24]))) < 0.1:
97
+ im = tools.image("head")
98
+ rr = im[:, :, 0].astype(np.int16)
99
+ gg = im[:, :, 1].astype(np.int16)
100
+ bb = im[:, :, 2].astype(np.int16)
101
+ mask = (rr > 140) & (rr > gg * 1.7) & (rr > bb * 1.5)
102
+ mask[45:, :] = False
103
+ xs = np.where(mask)[1]
104
+ if len(xs) >= 5:
105
+ self.third_y = float(np.clip(float(q[22]) + (12.0 - float(np.median(xs))) / 140.0, -0.3, 0.15))
106
+ else:
107
+ self.third_y = -0.08
108
+ self.near = 0
109
+ done = self._nav(obs, 0.1, self.third_y if self.third_y is not None else -0.08, 0)
110
+ elif p == 15:
111
+ self.a[5] = 0.2
112
+ self.a[6] = 0.1 - 0.1 * self.grab_tries
113
+ self.a[19] = 0
114
+ done = self.age >= 70
115
+ elif p == 16:
116
+ self.a[0] = 0.12
117
+ done = self.age >= 60 - 10 * self.grab_tries
118
+ elif p == 17:
119
+ self.a[19] = 1
120
+ done = self.age >= 70
121
+ elif p == 18:
122
+ self.a[0] = -0.2
123
+ done = self.age >= 140
124
+ elif p == 19:
125
+ if self.age == 0 and self.grab_tries < 2:
126
+ im = tools.image("left_wrist")
127
+ rr = im[:, :, 0].astype(np.int16)
128
+ gg = im[:, :, 1].astype(np.int16)
129
+ bb = im[:, :, 2].astype(np.int16)
130
+ held_pixels = int(((rr > 140) & (rr > gg * 1.7) & (rr > bb * 1.5)).sum())
131
+ if held_pixels < 450:
132
+ self.grab_tries += 1
133
+ self.third_y = None
134
+ self.phase = 14
135
+ self.a[19] = 0
136
+ return self.a.copy()
137
+ done = self._nav(obs, 0, -1.5, 0)
138
+ elif p == 20:
139
+ self.a[5] = -0.2
140
+ done = self._nav(obs, 2.25, -1.5, 0)
141
+ elif p == 21:
142
+ done = self._nav(obs, 2.04, 0.25, math.pi)
143
+ elif p == 22:
144
+ self.a[5] = -0.1
145
+ self.a[6] = -0.1
146
+ done = self.age >= 100
147
+ elif p == 23:
148
+ self.a[19] = 0
149
+ done = self.age >= 120
150
+ if done:
151
+ self.phase += 1
152
+ self.age = 0
153
+ self.near = 0
154
+ else:
155
+ self.age += 1
156
+ return self.a.copy()
policies/stack_blocks/gpt6sol-s3/episodes.csv ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ seed,success,length,termination,fell
2
+ 620000,0,4410,terminated,0
3
+ 620001,0,966,terminated,0
4
+ 620002,0,8750,timeout,0
5
+ 620003,0,8750,timeout,0
6
+ 620004,0,8750,timeout,0
7
+ 620005,0,8750,timeout,0
8
+ 620006,0,8750,timeout,0
9
+ 620007,0,8750,timeout,0
10
+ 620008,0,8750,timeout,0
11
+ 620009,0,8750,timeout,0
12
+ 620010,0,8750,timeout,0
13
+ 620011,0,8750,timeout,0
14
+ 620012,0,8750,timeout,0
15
+ 620013,0,8750,timeout,0
16
+ 620014,0,8750,timeout,0
17
+ 620015,0,8750,timeout,0
18
+ 620016,0,8750,timeout,0
19
+ 620017,0,8750,timeout,0
20
+ 620018,0,8750,timeout,0
21
+ 620019,0,4401,terminated,0
22
+ 620020,0,8750,timeout,0
23
+ 620021,0,8750,timeout,0
24
+ 620022,0,8750,timeout,0
25
+ 620023,0,8750,timeout,0
26
+ 620024,0,8750,timeout,0
27
+ 620025,0,8564,terminated,0
28
+ 620026,0,8750,timeout,0
29
+ 620027,0,8750,timeout,0
30
+ 620028,0,8750,timeout,0
31
+ 620029,0,8750,timeout,0
32
+ 620030,0,8750,timeout,0
33
+ 620031,0,8750,timeout,0
34
+ 620032,0,8750,timeout,0
35
+ 620033,0,8750,timeout,0
36
+ 620034,0,8750,timeout,0
37
+ 620035,0,8750,timeout,0
38
+ 620036,0,8750,timeout,0
39
+ 620037,0,8750,timeout,0
40
+ 620038,0,8750,timeout,0
41
+ 620039,0,8750,timeout,0
42
+ 620040,0,8750,timeout,0
43
+ 620041,0,8750,timeout,0
44
+ 620042,0,8750,timeout,0
45
+ 620043,0,8750,timeout,0
46
+ 620044,0,8750,timeout,0
47
+ 620045,0,8750,timeout,0
48
+ 620046,0,8750,timeout,0
49
+ 620047,0,8750,timeout,0
50
+ 620048,0,8750,timeout,0
51
+ 620049,0,8750,timeout,0
52
+ 620050,0,8750,timeout,0
53
+ 620051,0,8750,timeout,0
54
+ 620052,0,8750,timeout,0
55
+ 620053,0,8750,timeout,0
56
+ 620054,0,8750,timeout,0
57
+ 620055,0,8750,timeout,0
58
+ 620056,0,8750,timeout,0
59
+ 620057,0,8750,timeout,0
60
+ 620058,0,8750,timeout,0
61
+ 620059,0,8750,timeout,0
62
+ 620060,0,8750,timeout,0
63
+ 620061,0,8750,timeout,0
64
+ 620062,0,7410,terminated,0
65
+ 620063,0,8750,timeout,0
66
+ 620064,0,8750,timeout,0
67
+ 620065,0,8750,timeout,0
68
+ 620066,0,8750,timeout,0
69
+ 620067,0,8750,timeout,0
70
+ 620068,0,8750,timeout,0
71
+ 620069,0,8750,timeout,0
72
+ 620070,0,8750,timeout,0
73
+ 620071,0,8750,timeout,0
74
+ 620072,0,8750,timeout,0
75
+ 620073,0,8750,timeout,0
76
+ 620074,0,8750,timeout,0
77
+ 620075,0,8750,timeout,0
78
+ 620076,0,8750,timeout,0
79
+ 620077,0,3862,terminated,0
80
+ 620078,0,8750,timeout,0
81
+ 620079,0,8750,timeout,0
82
+ 620080,0,8750,timeout,0
83
+ 620081,0,8750,timeout,0
84
+ 620082,0,8750,timeout,0
85
+ 620083,0,8750,timeout,0
86
+ 620084,0,8750,timeout,0
87
+ 620085,0,8750,timeout,0
88
+ 620086,0,8750,timeout,0
89
+ 620087,0,8750,timeout,0
90
+ 620088,0,8750,timeout,0
91
+ 620089,0,8750,timeout,0
92
+ 620090,0,8750,timeout,0
93
+ 620091,0,8750,timeout,0
94
+ 620092,0,8750,timeout,0
95
+ 620093,0,8750,timeout,0
96
+ 620094,0,4049,terminated,0
97
+ 620095,0,8750,timeout,0
98
+ 620096,0,8750,timeout,0
99
+ 620097,0,8750,timeout,0
100
+ 620098,0,8750,timeout,0
101
+ 620099,0,8750,timeout,0
policies/stack_blocks/gpt6sol-s3/policy.py ADDED
@@ -0,0 +1,138 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Hand-written, deterministic block transport controller."""
2
+ import math
3
+ import numpy as np
4
+
5
+
6
+ class Policy:
7
+ def reset(self, obs, tools):
8
+ self.base = np.asarray(tools.hold_action(), dtype=np.float32)
9
+ self.phase = "approach"
10
+ self.age = 0
11
+ self.trip = 0
12
+
13
+ def change(self, name):
14
+ self.phase = name
15
+ self.age = 0
16
+
17
+ @staticmethod
18
+ def wrap(x):
19
+ return (x + math.pi) % (2 * math.pi) - math.pi
20
+
21
+ def go(self, a, q, x, y, yaw=0., speed=.27):
22
+ dx, dy = x - float(q[21]), y - float(q[22])
23
+ c, s = math.cos(float(q[24])), math.sin(float(q[24]))
24
+ a[0] = np.clip(1.5 * (c * dx + s * dy), -speed, speed)
25
+ a[1] = np.clip(1.5 * (-s * dx + c * dy), -speed, speed)
26
+ if abs(a[0]) < .06: a[0] = 0
27
+ if abs(a[1]) < .06: a[1] = 0
28
+ err = self.wrap(yaw - float(q[24]))
29
+ a[3] = np.clip(1.2 * err, -.5, .5)
30
+ return math.hypot(dx, dy) < .055 and abs(err) < .07
31
+
32
+ @staticmethod
33
+ def arms(a, p=-.5, torso=0., grip=1.):
34
+ a[4] = torso
35
+ a[5:12] = (p, .1, -.1, 0, 0, .3, -.6)
36
+ a[12:19] = (p, -.1, .1, 0, 0, .3, .6)
37
+ a[19:21] = grip
38
+
39
+ def act(self, obs, tools):
40
+ q = obs['low_dim_obs']
41
+ a = self.base.copy()
42
+ self.age += 1
43
+ p = self.phase
44
+ if p == 'approach':
45
+ self.arms(a, grip=0)
46
+ offset = (0., .10, -.10)[min(self.trip, 2)]
47
+ a[0] = .12 if q[21] < .22 else 0
48
+ a[1] = np.clip(1.5 * (offset - q[22]), -.12, .12)
49
+ if abs(a[1]) < .06: a[1] = 0
50
+ a[3] = np.clip(-1.2 * q[24], -.3, .3)
51
+ if q[21] >= .22 or self.age > 240:
52
+ self.change('reach')
53
+ elif p == 'reach':
54
+ self.arms(a, .1, .15, 0)
55
+ if self.age >= 80: self.change('close')
56
+ elif p == 'close':
57
+ self.arms(a, .1, .15, 1)
58
+ if self.age >= 60: self.change('lift1')
59
+ elif p == 'lift1':
60
+ z = min(1., self.age / 100.)
61
+ self.arms(a, .1 - .2*z, .15*(1-z), 1)
62
+ if self.age >= 100: self.change('lift2')
63
+ elif p == 'lift2':
64
+ z = min(1., self.age / 150.)
65
+ self.arms(a, -.1 - .4*z, 0, 1)
66
+ if self.age >= 150: self.change('back')
67
+ elif p == 'back':
68
+ self.arms(a)
69
+ if self.go(a, q, .02, 0, speed=.16) or self.age > 180:
70
+ self.change('north')
71
+ elif p == 'north':
72
+ self.arms(a)
73
+ if self.go(a, q, .02, 1.16) or self.age > 450:
74
+ self.change('east')
75
+ elif p == 'east':
76
+ self.arms(a)
77
+ if self.go(a, q, 1.45, 1.16) or self.age > 550:
78
+ self.change('turn_pad')
79
+ elif p == 'turn_pad':
80
+ self.arms(a)
81
+ if self.go(a, q, 1.45, 1.16, -math.pi/2, .18) or self.age > 260:
82
+ self.change('pad')
83
+ elif p == 'pad':
84
+ self.arms(a)
85
+ if self.go(a, q, 1.30, .77, -math.pi/2, .16) or self.age > 300:
86
+ self.change('lower_left')
87
+ elif p == 'lower_left':
88
+ z = min(1., self.age / 100.)
89
+ self.arms(a, -.5 + .6*z, .15*z)
90
+ a[12] = -.5
91
+ if self.age >= 100: self.change('release_left')
92
+ elif p == 'release_left':
93
+ self.arms(a, .1, .15)
94
+ a[12] = -.5
95
+ a[19] = 0
96
+ if self.age >= 75: self.change('raise_left')
97
+ elif p == 'raise_left':
98
+ self.arms(a, .1 - .6*min(1., self.age/100.))
99
+ a[19] = 0
100
+ if self.age >= 100: self.change('pad_right')
101
+ elif p == 'pad_right':
102
+ self.arms(a)
103
+ a[19] = 0
104
+ if self.go(a, q, 1.53, .77, -math.pi/2, .13) or self.age > 200:
105
+ self.change('lower_right')
106
+ elif p == 'lower_right':
107
+ z = min(1., self.age/100.)
108
+ self.arms(a)
109
+ a[19] = 0
110
+ a[4] = .15*z
111
+ a[12] = -.5 + .6*z
112
+ if self.age >= 100: self.change('release_right')
113
+ elif p == 'release_right':
114
+ self.arms(a)
115
+ a[19:21] = 0
116
+ a[4] = .15
117
+ a[12] = .1
118
+ if self.age >= 75: self.change('leave_pad')
119
+ elif p == 'leave_pad':
120
+ self.arms(a, grip=0)
121
+ if self.go(a, q, 1.45, 1.16, -math.pi/2, .2) or self.age > 350:
122
+ self.change('turn_home')
123
+ elif p == 'turn_home':
124
+ self.arms(a, grip=0)
125
+ if self.go(a, q, 1.45, 1.16, 0, .2) or self.age > 300:
126
+ self.change('west')
127
+ elif p == 'west':
128
+ self.arms(a, grip=0)
129
+ if self.go(a, q, .02, 1.16) or self.age > 600:
130
+ self.change('south')
131
+ elif p == 'south':
132
+ self.arms(a, grip=0)
133
+ if self.go(a, q, .02, 0) or self.age > 500:
134
+ self.trip += 1
135
+ self.change('approach' if self.trip < 3 else 'hold')
136
+ else:
137
+ self.arms(a, grip=0)
138
+ return a
policies/stack_blocks/kimi31pro-s1/episodes.csv ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ seed,success,length,termination,fell
2
+ 620000,0,8750,timeout,0
3
+ 620001,0,8750,timeout,0
4
+ 620002,0,8750,timeout,0
5
+ 620003,0,8750,timeout,0
6
+ 620004,0,8750,timeout,0
7
+ 620005,0,8750,timeout,0
8
+ 620006,0,5820,terminated,0
9
+ 620007,0,8750,timeout,0
10
+ 620008,0,8750,timeout,0
11
+ 620009,0,8750,timeout,0
12
+ 620010,0,8750,timeout,0
13
+ 620011,0,8750,timeout,0
14
+ 620012,0,8750,timeout,0
15
+ 620013,0,8750,timeout,0
16
+ 620014,0,8750,timeout,0
17
+ 620015,0,8750,timeout,0
18
+ 620016,0,8750,timeout,0
19
+ 620017,0,8750,timeout,0
20
+ 620018,0,8750,timeout,0
21
+ 620019,0,8750,timeout,0
22
+ 620020,0,8750,timeout,0
23
+ 620021,0,8750,timeout,0
24
+ 620022,0,8750,timeout,0
25
+ 620023,0,8750,timeout,0
26
+ 620024,0,8750,timeout,0
27
+ 620025,0,8750,timeout,0
28
+ 620026,0,8750,timeout,0
29
+ 620027,0,8750,timeout,0
30
+ 620028,0,8750,timeout,0
31
+ 620029,0,8750,timeout,0
32
+ 620030,0,8750,timeout,0
33
+ 620031,0,8750,timeout,0
34
+ 620032,0,4576,terminated,0
35
+ 620033,0,609,terminated,0
36
+ 620034,0,8750,timeout,0
37
+ 620035,0,528,terminated,0
38
+ 620036,0,8750,timeout,0
39
+ 620037,0,8750,timeout,0
40
+ 620038,0,8750,timeout,0
41
+ 620039,0,8750,timeout,0
42
+ 620040,0,8750,timeout,0
43
+ 620041,0,6775,terminated,0
44
+ 620042,0,682,terminated,0
45
+ 620043,0,8750,timeout,0
46
+ 620044,0,8750,timeout,0
47
+ 620045,0,8750,timeout,0
48
+ 620046,0,8750,timeout,0
49
+ 620047,0,8750,timeout,0
50
+ 620048,0,8750,timeout,0
51
+ 620049,0,8750,timeout,0
52
+ 620050,0,8750,timeout,0
53
+ 620051,0,8750,timeout,0
54
+ 620052,0,8750,timeout,0
55
+ 620053,0,8750,timeout,0
56
+ 620054,0,8750,timeout,0
57
+ 620055,0,8750,timeout,0
58
+ 620056,0,8750,timeout,0
59
+ 620057,0,8750,timeout,0
60
+ 620058,0,8750,timeout,0
61
+ 620059,0,8750,timeout,0
62
+ 620060,0,8750,timeout,0
63
+ 620061,0,8750,timeout,0
64
+ 620062,0,8750,timeout,0
65
+ 620063,0,8750,timeout,0
66
+ 620064,0,8750,timeout,0
67
+ 620065,0,8750,timeout,0
68
+ 620066,0,8750,timeout,0
69
+ 620067,0,8750,timeout,0
70
+ 620068,0,8750,timeout,0
71
+ 620069,0,8750,timeout,0
72
+ 620070,0,8750,timeout,0
73
+ 620071,0,8750,timeout,0
74
+ 620072,0,8750,timeout,0
75
+ 620073,0,8750,timeout,0
76
+ 620074,0,5270,terminated,0
77
+ 620075,0,8750,timeout,0
78
+ 620076,0,8750,timeout,0
79
+ 620077,0,8750,timeout,0
80
+ 620078,0,8750,timeout,0
81
+ 620079,0,8750,timeout,0
82
+ 620080,0,8750,timeout,0
83
+ 620081,0,8750,timeout,0
84
+ 620082,0,8750,timeout,0
85
+ 620083,0,8750,timeout,0
86
+ 620084,0,8750,timeout,0
87
+ 620085,0,8750,timeout,0
88
+ 620086,0,8750,timeout,0
89
+ 620087,0,710,terminated,0
90
+ 620088,0,8750,timeout,0
91
+ 620089,0,8750,timeout,0
92
+ 620090,0,8750,timeout,0
93
+ 620091,0,2526,terminated,0
94
+ 620092,0,8750,timeout,0
95
+ 620093,0,6381,terminated,0
96
+ 620094,0,8750,timeout,0
97
+ 620095,0,8750,timeout,0
98
+ 620096,0,8750,timeout,0
99
+ 620097,0,8750,timeout,0
100
+ 620098,0,685,terminated,0
101
+ 620099,0,8750,timeout,0
policies/stack_blocks/kimi31pro-s1/policy.py ADDED
@@ -0,0 +1,379 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Deterministic hand-written controller for the three-block stacking task."""
2
+
3
+ import cv2
4
+ import numpy as np
5
+
6
+
7
+ class Policy:
8
+ def reset(self, obs, tools):
9
+ self.hold = np.asarray(tools.hold_action(), dtype=np.float32)
10
+ self.hold[19:21] = 0.0
11
+ self.action = self.hold.copy()
12
+ self.start_action = self.action.copy()
13
+ self.trip = 0
14
+ self.phase = "pre_grasp"
15
+ self.phase_start = int(obs["t"])
16
+ self.torso_pitch = 0.0
17
+ self.hold_ref = None
18
+ self.prev = None
19
+ self.stable = 0
20
+ self.lost = 0
21
+ self.acquire_attempts = 0
22
+ self.yaw_adjust = 0.0
23
+ self.need_visual = False
24
+ self.retries = [0, 0, 0]
25
+ blocks = self._components(tools.image("head"), "red", 15)
26
+ blocks = sorted(blocks, key=lambda c: c[0][0])
27
+ if len(blocks) >= 3:
28
+ self.initial_outer = blocks[1][0][0] > 40
29
+ selected = blocks[0] if self.initial_outer else blocks[1]
30
+ else:
31
+ self.initial_outer = False
32
+ selected = blocks[len(blocks) // 2] if blocks else (np.array([36.0, 25.0]), 40)
33
+ self.initial_target = selected[0].copy()
34
+ cx = blocks[1][0][0] if len(blocks) >= 3 else 36.0
35
+ self.initial_yaw = 0.3 if self.initial_outer else float(np.clip(-0.3 - (cx - 36) * 0.0167, -0.55, 0.1))
36
+ self.initial_pitch = -0.1 if self.initial_outer else -0.2
37
+
38
+ @staticmethod
39
+ def _components(im, color, min_area=1):
40
+ im = np.asarray(im)
41
+ if color == "green":
42
+ mask = ((im[:, :, 1] > 120) & (im[:, :, 1] > 1.25 * im[:, :, 0])
43
+ & (im[:, :, 1] > 1.15 * im[:, :, 2]))
44
+ else:
45
+ mask = ((im[:, :, 0] > 150) & (im[:, :, 0] > 1.5 * im[:, :, 1])
46
+ & (im[:, :, 0] > 1.5 * im[:, :, 2]))
47
+ n, _, stats, cents = cv2.connectedComponentsWithStats(mask.astype(np.uint8))
48
+ return [(np.asarray(cents[i]), int(stats[i, 4])) for i in range(1, n)
49
+ if stats[i, 4] >= min_area]
50
+
51
+ def _go(self, name, obs):
52
+ self.phase = name
53
+ self.phase_start = int(obs["t"])
54
+ self.start_action = self.action.copy()
55
+ self.stable = 0
56
+ self.lost = 0
57
+ self.prev = None
58
+ if name == "pre_grasp":
59
+ self.yaw_adjust = 0.0
60
+ if name in ("sidestep", "turn_home"):
61
+ self.hold_ref = None
62
+ self.torso_pitch = 0.0
63
+ if name == "acquire":
64
+ self.torso_pitch = -0.2
65
+ self.acquire_attempts += 1
66
+ if name == "approach_settle" and self.trip == 2:
67
+ pel = obs["low_dim_obs"][21:25]
68
+ self.hold_ref = np.array([pel[0], pel[1], pel[3]])
69
+ if name == "place_base":
70
+ pel = obs["low_dim_obs"][21:25]
71
+ self.hold_ref = np.array([pel[0], pel[1], pel[3]])
72
+ if name == "turn_home":
73
+ self.torso_pitch = 0.0
74
+ print("phase", self.trip, name, "t", int(obs["t"]),
75
+ "pel", np.round(obs["low_dim_obs"][21:25], 3), flush=True)
76
+
77
+ def _pose(self, p=-0.2, yaw=0.0, elbow=0.3, grip=0.0, height=0.74):
78
+ raw = self.hold.copy()
79
+ raw[2] = height
80
+ raw[4] = self.torso_pitch
81
+ raw[5:12] = [p, 0.0, yaw, elbow, 0.0, 0.0, 0.0]
82
+ raw[12:19] = 0.0
83
+ raw[19] = grip
84
+ raw[20] = 0.0
85
+ return raw
86
+
87
+ def _carry(self, grip=1.0):
88
+ return self._pose(-0.55, -0.3, 0.2, grip, 0.8)
89
+
90
+ def _grasp_pose(self, grip=0.0):
91
+ if self.trip == 1:
92
+ yaw = 0.15 + 0.1 * min(self.retries[1], 2) + self.yaw_adjust
93
+ return self._pose(-0.2, yaw, 0.3, grip, 0.74)
94
+ if self.trip == 2:
95
+ elbow = max(0.3, 0.4 - 0.05 * self.retries[2])
96
+ return self._pose(-0.2, -0.3 + self.yaw_adjust, elbow, grip, 0.74)
97
+ return self._pose(self.initial_pitch, self.initial_yaw, 0.3, grip, 0.74)
98
+
99
+ def _place_pose(self, grip=1.0):
100
+ # Later blocks are released progressively higher above the same pad.
101
+ p = (-0.2, -0.32, -0.44)[self.trip]
102
+ h = (0.74, 0.76, 0.78)[self.trip]
103
+ return self._pose(p, -0.3, 0.3, grip, h)
104
+
105
+ def _apply_base_hold(self, obs, raw):
106
+ if self.hold_ref is None:
107
+ return raw
108
+ pel = obs["low_dim_obs"][21:25]
109
+ yaw = pel[3]
110
+ dx, dy = self.hold_ref[0] - pel[0], self.hold_ref[1] - pel[1]
111
+ ex = np.cos(yaw) * dx + np.sin(yaw) * dy
112
+ ey = -np.sin(yaw) * dx + np.cos(yaw) * dy
113
+ raw[0] = 0 if abs(ex) < 0.015 else np.clip(2 * ex, -0.15, 0.15)
114
+ raw[1] = 0 if abs(ey) < 0.015 else np.clip(2 * ey, -0.15, 0.15)
115
+ if 0 < abs(raw[0]) < 0.06:
116
+ raw[0] = np.sign(raw[0]) * 0.06
117
+ if 0 < abs(raw[1]) < 0.06:
118
+ raw[1] = np.sign(raw[1]) * 0.06
119
+ ye = (self.hold_ref[2] - yaw + np.pi) % (2 * np.pi) - np.pi
120
+ raw[3] = 0 if abs(ye) < 0.02 else np.clip(ye, -0.3, 0.3)
121
+ return raw
122
+
123
+ def _interp(self, target, pt, duration):
124
+ alpha = min(1.0, (pt + 1) / float(duration))
125
+ raw = self.start_action * (1 - alpha) + target * alpha
126
+ raw[0] = target[0]
127
+ raw[1] = target[1]
128
+ raw[3] = target[3]
129
+ return raw
130
+
131
+ def act(self, obs, tools):
132
+ pt = int(obs["t"]) - self.phase_start
133
+ name = self.phase
134
+ raw = self.action.copy()
135
+
136
+ if name == "pre_grasp":
137
+ raw = self._interp(self._pose(-0.2, 0, 0.3, 0, 0.74), pt, 40)
138
+ if pt >= 39:
139
+ self._go("visual_align" if self.need_visual or self.trip >= 1 else "approach", obs)
140
+
141
+ elif name == "visual_align":
142
+ cs = self._components(tools.image("head"), "red", 15)
143
+ if self.prev is None:
144
+ if cs:
145
+ if self.trip == 0:
146
+ self.prev = min(cs, key=lambda c: abs(c[0][0] - self.initial_target[0]))[0]
147
+ else:
148
+ self.prev = (min if self.trip == 1 else max)(cs, key=lambda c: c[0][0])[0]
149
+ else:
150
+ self.prev = self.initial_target.copy() if self.trip == 0 else (np.array([13.0, 24.0]) if self.trip == 1 else np.array([67.0, 24.0]))
151
+ if cs:
152
+ c = min(cs, key=lambda c: np.linalg.norm(c[0] - self.prev))
153
+ if np.linalg.norm(c[0] - self.prev) < 20:
154
+ self.prev = c[0]
155
+ target_x = self.initial_target[0] if self.trip == 0 else (13 if self.trip == 1 else 36)
156
+ target_y = self.initial_target[1] if self.trip == 0 else 25
157
+ ex, ey = target_x - self.prev[0], target_y - self.prev[1]
158
+ self.stable = self.stable + 1 if abs(ex) < 2.5 and abs(ey) < 2.5 else 0
159
+ raw = self._pose(-0.2, 0, 0.3, 0, 0.74)
160
+ raw[0] = 0 if abs(ey) < 1.2 else np.sign(ey) * min(0.16, max(0.06, abs(ey) * 0.025))
161
+ raw[1] = 0 if abs(ex) < 1.2 else np.sign(ex) * min(0.3, max(0.06, abs(ex) * 0.02))
162
+ raw[3] = np.clip(-0.5 * obs["low_dim_obs"][24], -0.25, 0.25)
163
+ if self.stable >= 10 or pt >= 239:
164
+ self._go("visual_settle", obs)
165
+
166
+ elif name == "visual_settle":
167
+ raw = self._pose(-0.2, 0, 0.3, 0, 0.74)
168
+ if pt >= 19:
169
+ self._go("approach", obs)
170
+
171
+ elif name == "approach":
172
+ raw = self._pose(-0.2, 0, 0.3, 0, 0.74)
173
+ raw[0] = 0.2
174
+ if pt >= 29:
175
+ self._go("approach_settle", obs)
176
+
177
+ elif name == "approach_settle":
178
+ raw = self._pose(-0.2, 0, 0.3, 0, 0.74)
179
+ raw = self._apply_base_hold(obs, raw)
180
+ if pt >= 19:
181
+ self._go("align", obs)
182
+
183
+ elif name == "align":
184
+ raw = self._interp(self._grasp_pose(0), pt, 30)
185
+ raw = self._apply_base_hold(obs, raw)
186
+ if pt >= 29:
187
+ self._go("settle", obs)
188
+
189
+ elif name == "settle":
190
+ raw = self._grasp_pose(0)
191
+ raw = self._apply_base_hold(obs, raw)
192
+ if pt >= 19:
193
+ self._go("close", obs)
194
+
195
+ elif name == "close":
196
+ if pt == 0 and self.trip >= 1:
197
+ cs = self._components(tools.image("left_wrist"), "red", 30)
198
+ if cs:
199
+ c = max(cs, key=lambda c: c[1])[0]
200
+ self.yaw_adjust = float(np.clip(0.008 * (40 - c[0]), -0.15, 0.28))
201
+ else:
202
+ self.yaw_adjust = 0.2 if self.trip == 1 else 0.15
203
+ raw = self._interp(self._grasp_pose(1), pt, 30)
204
+ raw = self._apply_base_hold(obs, raw)
205
+ if pt >= 29:
206
+ self._go("close_settle", obs)
207
+
208
+ elif name == "close_settle":
209
+ raw = self._grasp_pose(1)
210
+ raw = self._apply_base_hold(obs, raw)
211
+ if pt >= 19:
212
+ self._go("lift", obs)
213
+
214
+ elif name == "lift":
215
+ raw = self._interp(self._carry(1), pt, 50)
216
+ raw = self._apply_base_hold(obs, raw)
217
+ if pt >= 49:
218
+ self._go("lift_settle", obs)
219
+
220
+ elif name == "lift_settle":
221
+ raw = self._carry(1)
222
+ raw = self._apply_base_hold(obs, raw)
223
+ if pt >= 29:
224
+ if np.mean(obs["low_dim_obs"][10:12]) < -0.017:
225
+ self.retries[self.trip] += 1
226
+ self.need_visual = True
227
+ print("retry empty grasp", self.trip, self.retries[self.trip], flush=True)
228
+ self._go("pre_grasp", obs)
229
+ else:
230
+ self._go("sidestep", obs)
231
+
232
+ elif name == "sidestep":
233
+ raw = self._carry(1)
234
+ pel = obs["low_dim_obs"][21:25]
235
+ raw[1] = 0.5
236
+ raw[3] = np.clip(-pel[3], -0.3, 0.3)
237
+ if pel[1] >= 0.82 or pt >= 299:
238
+ self._go("side_settle", obs)
239
+
240
+ elif name == "side_settle":
241
+ raw = self._carry(1)
242
+ if pt >= 19:
243
+ self._go("pad_forward", obs)
244
+
245
+ elif name == "pad_forward":
246
+ raw = self._carry(1)
247
+ pel = obs["low_dim_obs"][21:25]
248
+ raw[0] = 0.35
249
+ raw[1] = np.clip(2 * (0.82 - pel[1]), -0.15, 0.15)
250
+ raw[3] = np.clip(-pel[3], -0.3, 0.3)
251
+ if pel[0] > 1.3 or pt >= 399:
252
+ self._go("acquire", obs)
253
+
254
+ elif name == "acquire":
255
+ head_green = self._components(tools.image("head"), "green")
256
+ raw = self._carry(1)
257
+ if head_green:
258
+ self._go("green_servo", obs)
259
+ else:
260
+ cs = self._components(tools.image("right_wrist"), "green")
261
+ if cs:
262
+ c = max(cs, key=lambda c: c[1])[0]
263
+ raw[0] = 0.08 if c[1] < 18 else 0
264
+ raw[3] = np.clip(-0.015 * (c[0] - 42), -0.3, 0.3)
265
+ else:
266
+ raw[3] = -0.5
267
+ if pt >= 399:
268
+ self._go("green_servo", obs)
269
+
270
+ elif name == "green_servo":
271
+ cs = self._components(tools.image("head"), "green")
272
+ self.lost = 0 if cs else self.lost + 1
273
+ if cs:
274
+ self.prev = max(cs, key=lambda c: c[1])[0]
275
+ ex, ey = 36 - self.prev[0], 25 - self.prev[1]
276
+ elif self.prev is not None:
277
+ ex, ey = 36 - self.prev[0], 25 - self.prev[1]
278
+ else:
279
+ ex, ey = 0, 3
280
+ self.stable = self.stable + 1 if cs and abs(ex) < 6 and abs(ey) < 12 else 0
281
+ raw = self._carry(1)
282
+ if cs:
283
+ raw[0] = 0 if abs(ey) < 1.5 or abs(ex) > 8 else np.sign(ey) * min(0.18, max(0.06, abs(ey) * 0.025))
284
+ raw[3] = np.clip(0.02 * ex, -0.3, 0.3)
285
+ else:
286
+ raw[0] = 0.06 if self.lost < 80 and self.prev is not None and self.prev[1] < 8 else 0
287
+ raw[3] = np.clip(0.02 * ex, -0.15, 0.15) if self.prev is not None else -0.08
288
+ if self.stable >= 20 or pt >= 179 or (self.lost >= 80 and self.prev is not None):
289
+ self._go("place_base", obs)
290
+ elif pt >= 599:
291
+ self._go("acquire", obs)
292
+
293
+ elif name == "place_base":
294
+ raw = self._place_pose(1)
295
+ raw = self._apply_base_hold(obs, raw)
296
+ if pt >= 19:
297
+ self._go("lower", obs)
298
+
299
+ elif name == "lower":
300
+ raw = self._interp(self._place_pose(1), pt, 30)
301
+ raw = self._apply_base_hold(obs, raw)
302
+ if pt >= 29:
303
+ self._go("place_settle", obs)
304
+
305
+ elif name == "place_settle":
306
+ raw = self._place_pose(1)
307
+ raw = self._apply_base_hold(obs, raw)
308
+ if pt >= 19:
309
+ self._go("release", obs)
310
+
311
+ elif name == "release":
312
+ raw = self._interp(self._place_pose(0), pt, 30)
313
+ raw = self._apply_base_hold(obs, raw)
314
+ if pt >= 29:
315
+ self._go("release_settle", obs)
316
+
317
+ elif name == "release_settle":
318
+ raw = self._place_pose(0)
319
+ raw = self._apply_base_hold(obs, raw)
320
+ if pt >= 29:
321
+ self._go("retreat", obs)
322
+
323
+ elif name == "retreat":
324
+ raw = self._interp(self._carry(0), pt, 50)
325
+ raw = self._apply_base_hold(obs, raw)
326
+ if pt >= 49:
327
+ self._go("retreat_settle", obs)
328
+
329
+ elif name == "retreat_settle":
330
+ raw = self._carry(0)
331
+ raw = self._apply_base_hold(obs, raw)
332
+ if pt >= 29:
333
+ if self.trip < 2:
334
+ self._go("turn_home", obs)
335
+ else:
336
+ self._go("success_wait", obs)
337
+
338
+ elif name == "turn_home":
339
+ raw = self._carry(0)
340
+ yaw = obs["low_dim_obs"][24]
341
+ err = (-yaw + np.pi) % (2 * np.pi) - np.pi
342
+ raw[3] = np.clip(1.5 * err, -0.8, 0.8)
343
+ if abs(err) < 0.035 or pt >= 399:
344
+ self._go("home_settle", obs)
345
+
346
+ elif name == "home_settle":
347
+ raw = self._carry(0)
348
+ if pt >= 19:
349
+ self._go("back_source", obs)
350
+
351
+ elif name == "back_source":
352
+ raw = self._carry(0)
353
+ pel = obs["low_dim_obs"][21:25]
354
+ raw[0] = -0.5
355
+ raw[3] = np.clip(-pel[3], -0.3, 0.3)
356
+ if pel[0] <= 0.17 or pt >= 499:
357
+ self._go("source_lateral", obs)
358
+
359
+ elif name == "source_lateral":
360
+ raw = self._carry(0)
361
+ pel = obs["low_dim_obs"][21:25]
362
+ raw[1] = np.clip(-3 * pel[1], -0.4, 0.4)
363
+ if 0 < abs(raw[1]) < 0.06:
364
+ raw[1] = np.sign(raw[1]) * 0.06
365
+ raw[3] = np.clip(-pel[3], -0.3, 0.3)
366
+ if abs(pel[1]) < 0.05 or pt >= 299:
367
+ self._go("source_settle", obs)
368
+
369
+ elif name == "source_settle":
370
+ raw = self._carry(0)
371
+ if pt >= 19:
372
+ self.trip += 1
373
+ self._go("pre_grasp", obs)
374
+
375
+ elif name == "success_wait":
376
+ raw = self._carry(0)
377
+
378
+ self.action = np.asarray(raw, dtype=np.float32)
379
+ return self.action
policies/stack_blocks/kimi31pro-s2/episodes.csv ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ seed,success,length,termination,fell
2
+ 620000,0,8750,timeout,0
3
+ 620001,0,8750,timeout,0
4
+ 620002,0,8750,timeout,0
5
+ 620003,0,8750,timeout,0
6
+ 620004,0,8750,timeout,0
7
+ 620005,0,8750,timeout,0
8
+ 620006,0,8750,timeout,0
9
+ 620007,0,8750,timeout,0
10
+ 620008,0,8750,timeout,0
11
+ 620009,0,8750,timeout,0
12
+ 620010,0,8750,timeout,0
13
+ 620011,0,8750,timeout,0
14
+ 620012,0,8750,timeout,0
15
+ 620013,0,8721,terminated,0
16
+ 620014,0,8750,timeout,0
17
+ 620015,0,8750,timeout,0
18
+ 620016,0,8750,timeout,0
19
+ 620017,0,8750,timeout,0
20
+ 620018,0,8750,timeout,0
21
+ 620019,0,8750,timeout,0
22
+ 620020,0,8750,timeout,0
23
+ 620021,0,8750,timeout,0
24
+ 620022,0,8750,timeout,0
25
+ 620023,0,8750,timeout,0
26
+ 620024,0,8750,timeout,0
27
+ 620025,0,8750,timeout,0
28
+ 620026,0,8750,timeout,0
29
+ 620027,0,8750,timeout,0
30
+ 620028,0,8750,timeout,0
31
+ 620029,0,8750,timeout,0
32
+ 620030,0,8750,timeout,0
33
+ 620031,0,8750,timeout,0
34
+ 620032,0,8750,timeout,0
35
+ 620033,0,8750,timeout,0
36
+ 620034,0,8750,timeout,0
37
+ 620035,0,1308,terminated,0
38
+ 620036,0,8750,timeout,0
39
+ 620037,0,8750,timeout,0
40
+ 620038,0,8750,timeout,0
41
+ 620039,0,7776,terminated,0
42
+ 620040,0,8750,timeout,0
43
+ 620041,0,8750,timeout,0
44
+ 620042,0,8750,timeout,0
45
+ 620043,0,4680,terminated,0
46
+ 620044,0,8750,timeout,0
47
+ 620045,0,8750,timeout,0
48
+ 620046,0,8750,timeout,0
49
+ 620047,0,8750,timeout,0
50
+ 620048,0,8750,timeout,0
51
+ 620049,0,8750,timeout,0
52
+ 620050,0,8750,timeout,0
53
+ 620051,0,8750,timeout,0
54
+ 620052,0,8750,timeout,0
55
+ 620053,0,8750,timeout,0
56
+ 620054,0,8750,timeout,0
57
+ 620055,0,8750,timeout,0
58
+ 620056,0,8750,timeout,0
59
+ 620057,0,8750,timeout,0
60
+ 620058,0,8750,timeout,0
61
+ 620059,0,8750,timeout,0
62
+ 620060,0,8750,timeout,0
63
+ 620061,0,8750,timeout,0
64
+ 620062,0,8750,timeout,0
65
+ 620063,0,8750,timeout,0
66
+ 620064,0,8750,timeout,0
67
+ 620065,0,7980,terminated,0
68
+ 620066,0,8750,timeout,0
69
+ 620067,0,8750,timeout,0
70
+ 620068,0,8750,timeout,0
71
+ 620069,0,8750,timeout,0
72
+ 620070,0,8750,timeout,0
73
+ 620071,0,8750,timeout,0
74
+ 620072,0,8750,timeout,0
75
+ 620073,0,8750,timeout,0
76
+ 620074,0,8750,timeout,0
77
+ 620075,0,8750,timeout,0
78
+ 620076,0,8750,timeout,0
79
+ 620077,0,8750,timeout,0
80
+ 620078,0,8750,timeout,0
81
+ 620079,0,8750,timeout,0
82
+ 620080,0,8750,timeout,0
83
+ 620081,0,8750,timeout,0
84
+ 620082,0,8750,timeout,0
85
+ 620083,0,8750,timeout,0
86
+ 620084,0,8750,timeout,0
87
+ 620085,0,8750,timeout,0
88
+ 620086,0,8750,timeout,0
89
+ 620087,0,8750,timeout,0
90
+ 620088,0,8750,timeout,0
91
+ 620089,0,8750,timeout,0
92
+ 620090,0,8414,terminated,0
93
+ 620091,0,8750,timeout,0
94
+ 620092,0,2201,terminated,0
95
+ 620093,0,8750,timeout,0
96
+ 620094,0,8750,timeout,0
97
+ 620095,0,8750,timeout,0
98
+ 620096,0,8750,timeout,0
99
+ 620097,0,8750,timeout,0
100
+ 620098,0,8750,timeout,0
101
+ 620099,0,8750,timeout,0
policies/stack_blocks/kimi31pro-s2/policy.py ADDED
@@ -0,0 +1,243 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Deterministic hand-written controller for the G1 block-stacking task.
2
+
3
+ The robot carries one block at a time. It uses proprioceptive waypoint control
4
+ in the open lane beside the tables and small, fixed arm motions for grasping
5
+ and releasing. Camera measurements are used only to check/adjust a grasp.
6
+ """
7
+
8
+ import cv2
9
+ import numpy as np
10
+
11
+
12
+ class Policy:
13
+ def reset(self, obs, tools):
14
+ self.a = np.asarray(tools.hold_action(), dtype=np.float32).copy()
15
+ self.cycle = 0
16
+ self.pick_y = 0.0
17
+ self.retries = 0
18
+ self.phase = "initial_walk"
19
+ self.n = 0
20
+ self.goal = np.zeros(3)
21
+ self.next_phase = ""
22
+ self.duration = 1
23
+ self.ramp_start = self.a.copy()
24
+ self.ramp_target = self.a.copy()
25
+ self.initial_x = float(obs["low_dim_obs"][21])
26
+ self.walk_goal = self.initial_x + 0.065
27
+
28
+ def _start(self, name, tools):
29
+ self.phase = name
30
+ self.n = 0
31
+ if name == "approach":
32
+ self.a[0:2] = 0
33
+ self.a[3] = 0
34
+ self.a[19:21] = 0
35
+ target = self.a.copy()
36
+ target[2] = 0.60
37
+ target[5] = target[12] = -0.35
38
+ target[6] = 0
39
+ target[7] = 0
40
+ target[10] = 0
41
+ target[13] = -0.45
42
+ target[14] = 0
43
+ target[17] = 0
44
+ self._ramp(target, "wrist", 75)
45
+ elif name == "wrist":
46
+ target = self.a.copy()
47
+ target[10] = 0.22
48
+ target[17] = 0.12
49
+ self._ramp(target, "pick_adjust", 45)
50
+ elif name == "lift":
51
+ target = self.a.copy()
52
+ target[2] = 0.74
53
+ self._ramp(target, "verify", 90)
54
+ elif name == "retract":
55
+ target = self.a.copy()
56
+ target[12] = 0
57
+ target[13] = 0
58
+ target[14] = 0
59
+ target[17] = 0
60
+ self._ramp(target, "side", 50)
61
+ elif name == "side":
62
+ self._go(-0.05, 0.90, 0.0, "far", 700)
63
+ elif name == "far":
64
+ self._go(1.63, 1.0, 0.0, "turn_dest", 800)
65
+ elif name == "turn_dest":
66
+ self._turn(-np.pi / 2, "preextend")
67
+ elif name == "preextend":
68
+ target = self.a.copy()
69
+ target[5] = -0.40
70
+ target[6] = 0
71
+ target[7] = 0
72
+ self._ramp(target, "dest", 60)
73
+ elif name == "dest":
74
+ self._go(1.63, 0.64, -np.pi / 2, "deepplace", 180)
75
+ elif name == "deepplace":
76
+ target = self.a.copy()
77
+ target[2] = 0.82
78
+ target[5] = -0.70
79
+ target[7] = -0.10
80
+ self._ramp(target, "release", 70)
81
+ elif name == "retreat":
82
+ target = self.a.copy()
83
+ target[2] = 0.74
84
+ target[5] = 0
85
+ target[6] = 0
86
+ target[7] = 0
87
+ target[10] = 0
88
+ self._ramp(target, "after_place", 80)
89
+ elif name == "return_corridor":
90
+ self._go(1.63, 0.90, -np.pi / 2, "return_turn", 400)
91
+ elif name == "return_turn":
92
+ self._turn(0.0, "return_side")
93
+ elif name == "return_side":
94
+ self._go(-0.05, 0.90, 0.0, "return_lateral", 800)
95
+ elif name == "return_lateral":
96
+ self._go(-0.05, self.pick_y, 0.0, "source_x", 500)
97
+ elif name == "source_x":
98
+ self._go(0.175, self.pick_y, 0.0, "approach", 400)
99
+ elif name == "finish":
100
+ self.a[0:2] = 0
101
+ self.a[3] = 0
102
+ self.a[19:21] = 0
103
+
104
+ def _ramp(self, target, next_phase, duration):
105
+ self.ramp_start = self.a.copy()
106
+ self.ramp_target = np.asarray(target, dtype=np.float32).copy()
107
+ self.duration = int(duration)
108
+ self.next_phase = next_phase
109
+ self.phase = "ramp"
110
+ self.n = 0
111
+
112
+ def _go(self, x, y, yaw, next_phase, limit):
113
+ self.goal = np.array([x, y, yaw], dtype=float)
114
+ self.next_phase = next_phase
115
+ self.duration = int(limit)
116
+ self.phase = "go"
117
+ self.n = 0
118
+
119
+ def _turn(self, yaw, next_phase):
120
+ self.goal = np.array([yaw], dtype=float)
121
+ self.next_phase = next_phase
122
+ self.phase = "turn"
123
+ self.n = 0
124
+
125
+ @staticmethod
126
+ def _red_centroid(image):
127
+ r = image[:, :, 0].astype(np.float32)
128
+ g = image[:, :, 1].astype(np.float32)
129
+ b = image[:, :, 2].astype(np.float32)
130
+ mask = ((r > 110) & (r > 1.5 * g) & (r > 1.5 * b)).astype(np.uint8)
131
+ count, _, stats, cents = cv2.connectedComponentsWithStats(mask)
132
+ if count <= 1:
133
+ return None
134
+ j = 1 + int(np.argmax(stats[1:, cv2.CC_STAT_AREA]))
135
+ if stats[j, cv2.CC_STAT_AREA] < 20:
136
+ return None
137
+ return cents[j]
138
+
139
+ def act(self, obs, tools):
140
+ self.n += 1
141
+ p = obs["low_dim_obs"][21:25]
142
+
143
+ if self.phase == "initial_walk":
144
+ err = self.walk_goal - p[0]
145
+ self.a[0] = np.sign(err) * max(0.06, min(0.12, 2 * abs(err))) if abs(err) > 0.006 else 0
146
+ self.a[1] = np.clip(-p[1], -0.06, 0.06) if abs(p[1]) > 0.008 else 0
147
+ self.a[3] = np.clip(-p[3], -0.2, 0.2)
148
+ if self.n >= 170:
149
+ self.a[0:2] = 0
150
+ self.a[3] = 0
151
+ self._start("approach", tools)
152
+
153
+ elif self.phase == "ramp":
154
+ # The grasp timings deliberately match the calibrated contact motion.
155
+ den = 35 if self.duration == 45 else 70 if self.duration == 90 else self.duration * 0.8
156
+ u = min(1.0, self.n / den)
157
+ self.a = self.ramp_start * (1 - u) + self.ramp_target * u
158
+ self.a[0:2] = 0
159
+ self.a[3] = 0
160
+ if self.n >= self.duration:
161
+ self._start(self.next_phase, tools)
162
+
163
+ elif self.phase == "pick_adjust":
164
+ if self.cycle == 0 and self.retries == 0:
165
+ self._start("close", tools)
166
+ return np.asarray(self.a, dtype=np.float32)
167
+ image = tools.image("left_wrist")
168
+ center = self._red_centroid(image)
169
+ if center is not None:
170
+ dx, dy = float(center[0]) - 44.0, float(center[1]) - 64.0
171
+ if abs(dx) > 6 or abs(dy) > 9:
172
+ target = self.a.copy()
173
+ target[6] = np.clip(target[6] + np.clip(0.005 * dx, -0.08, 0.08), -0.15, 0.15)
174
+ target[10] = np.clip(target[10] + np.clip(0.01 * dy, -0.10, 0.10), 0.05, 0.42)
175
+ self._ramp(target, "close", 20)
176
+ else:
177
+ self._start("close", tools)
178
+ else:
179
+ self._start("close", tools)
180
+
181
+ elif self.phase == "close":
182
+ self.a[19:21] = min(1.0, self.n / 60.0)
183
+ if self.n >= 80:
184
+ self._start("lift", tools)
185
+
186
+ elif self.phase == "verify":
187
+ fingers = obs["low_dim_obs"][10:12]
188
+ held = float(np.mean(fingers)) > -0.017
189
+ if not held and self.retries < 1:
190
+ self.retries += 1
191
+ self.pick_y += 0.05
192
+ self.a[19:21] = 0
193
+ self._start("source_x", tools)
194
+ else:
195
+ self._start("retract", tools)
196
+
197
+ elif self.phase == "go":
198
+ dp = self.goal[:2] - p[:2]
199
+ dist = float(np.linalg.norm(dp))
200
+ ye = (self.goal[2] - p[3] + np.pi) % (2 * np.pi) - np.pi
201
+ if dist < 0.05 or self.n >= self.duration:
202
+ self.a[0:2] = 0
203
+ self.a[3] = 0
204
+ self._start(self.next_phase, tools)
205
+ else:
206
+ speed_cap = 0.30 if self.next_phase == "deepplace" else 0.34
207
+ speed = max(0.065, min(speed_cap, 0.65 * dist))
208
+ vxw, vyw = dp / dist * speed
209
+ c, s = np.cos(p[3]), np.sin(p[3])
210
+ self.a[0] = c * vxw + s * vyw
211
+ self.a[1] = -s * vxw + c * vyw
212
+ self.a[3] = np.clip(1.2 * ye, -0.15, 0.15)
213
+
214
+ elif self.phase == "turn":
215
+ ye = (self.goal[0] - p[3] + np.pi) % (2 * np.pi) - np.pi
216
+ self.a[0:2] = 0
217
+ self.a[3] = np.clip(1.2 * ye, -0.35, 0.35)
218
+ if abs(ye) < 0.03 or self.n >= 420:
219
+ self._start(self.next_phase, tools)
220
+
221
+ elif self.phase == "release":
222
+ self.a[19] = max(0.0, 1.0 - self.n / 40.0)
223
+ if self.n >= 55:
224
+ self._start("retreat", tools)
225
+
226
+ elif self.phase == "after_place":
227
+ if self.cycle >= 2:
228
+ self._start("finish", tools)
229
+ else:
230
+ self.cycle += 1
231
+ self.pick_y = (0.0, -0.15, -0.35)[self.cycle]
232
+ self.retries = 0
233
+ self._start("return_corridor", tools)
234
+
235
+ elif self.phase == "finish":
236
+ self.a[0:2] = 0
237
+ self.a[3] = 0
238
+ self.a[19:21] = 0
239
+
240
+ if obs.get("fell", False):
241
+ self.a[0:2] = 0
242
+ self.a[3] = 0
243
+ return np.asarray(self.a, dtype=np.float32)
policies/stack_blocks/kimi31pro-s3/episodes.csv ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ seed,success,length,termination,fell
2
+ 620000,0,8750,timeout,0
3
+ 620001,0,8750,timeout,0
4
+ 620002,0,8750,timeout,0
5
+ 620003,0,8750,timeout,0
6
+ 620004,0,8750,timeout,0
7
+ 620005,0,8750,timeout,0
8
+ 620006,0,8750,timeout,0
9
+ 620007,0,8750,timeout,0
10
+ 620008,0,8750,timeout,0
11
+ 620009,0,8750,timeout,0
12
+ 620010,0,8750,timeout,0
13
+ 620011,0,8750,timeout,0
14
+ 620012,0,8750,timeout,0
15
+ 620013,0,8750,timeout,0
16
+ 620014,0,8750,timeout,0
17
+ 620015,0,8750,timeout,0
18
+ 620016,0,8750,timeout,0
19
+ 620017,0,8750,timeout,0
20
+ 620018,0,8750,timeout,0
21
+ 620019,0,8750,timeout,0
22
+ 620020,0,8750,timeout,0
23
+ 620021,0,8750,timeout,0
24
+ 620022,0,8750,timeout,0
25
+ 620023,0,8750,timeout,0
26
+ 620024,0,8750,timeout,0
27
+ 620025,0,8750,timeout,0
28
+ 620026,0,8750,timeout,0
29
+ 620027,0,8750,timeout,0
30
+ 620028,0,8750,timeout,0
31
+ 620029,0,8750,timeout,0
32
+ 620030,0,8750,timeout,0
33
+ 620031,0,8750,timeout,0
34
+ 620032,0,8750,timeout,0
35
+ 620033,0,8750,timeout,0
36
+ 620034,0,8750,timeout,0
37
+ 620035,0,8750,timeout,0
38
+ 620036,0,8750,timeout,0
39
+ 620037,0,8750,timeout,0
40
+ 620038,0,8750,timeout,0
41
+ 620039,0,8750,timeout,0
42
+ 620040,0,8750,timeout,0
43
+ 620041,0,8750,timeout,0
44
+ 620042,0,8750,timeout,0
45
+ 620043,0,8750,timeout,0
46
+ 620044,0,8750,timeout,0
47
+ 620045,0,8750,timeout,0
48
+ 620046,0,8750,timeout,0
49
+ 620047,0,8750,timeout,0
50
+ 620048,0,8750,timeout,0
51
+ 620049,0,8750,timeout,0
52
+ 620050,0,8750,timeout,0
53
+ 620051,0,8750,timeout,0
54
+ 620052,0,8750,timeout,0
55
+ 620053,0,8750,timeout,0
56
+ 620054,0,8750,timeout,0
57
+ 620055,0,8750,timeout,0
58
+ 620056,0,8750,timeout,0
59
+ 620057,0,8750,timeout,0
60
+ 620058,0,8750,timeout,0
61
+ 620059,0,8750,timeout,0
62
+ 620060,0,8750,timeout,0
63
+ 620061,0,8750,timeout,0
64
+ 620062,0,8750,timeout,0
65
+ 620063,0,8750,timeout,0
66
+ 620064,0,8750,timeout,0
67
+ 620065,0,8750,timeout,0
68
+ 620066,0,8750,timeout,0
69
+ 620067,0,8750,timeout,0
70
+ 620068,0,8750,timeout,0
71
+ 620069,0,8750,timeout,0
72
+ 620070,0,8750,timeout,0
73
+ 620071,0,8750,timeout,0
74
+ 620072,0,8750,timeout,0
75
+ 620073,0,8750,timeout,0
76
+ 620074,0,8750,timeout,0
77
+ 620075,0,8750,timeout,0
78
+ 620076,0,8750,timeout,0
79
+ 620077,0,8750,timeout,0
80
+ 620078,0,8750,timeout,0
81
+ 620079,0,8750,timeout,0
82
+ 620080,0,8750,timeout,0
83
+ 620081,0,8750,timeout,0
84
+ 620082,0,8750,timeout,0
85
+ 620083,0,8750,timeout,0
86
+ 620084,0,8750,timeout,0
87
+ 620085,0,8750,timeout,0
88
+ 620086,0,8750,timeout,0
89
+ 620087,0,8750,timeout,0
90
+ 620088,0,8750,timeout,0
91
+ 620089,0,8750,timeout,0
92
+ 620090,0,8750,timeout,0
93
+ 620091,0,8750,timeout,0
94
+ 620092,0,8750,timeout,0
95
+ 620093,0,8750,timeout,0
96
+ 620094,0,8750,timeout,0
97
+ 620095,0,8750,timeout,0
98
+ 620096,0,8750,timeout,0
99
+ 620097,0,8750,timeout,0
100
+ 620098,0,8750,timeout,0
101
+ 620099,0,8750,timeout,0
policies/stack_blocks/kimi31pro-s3/policy.py ADDED
@@ -0,0 +1,247 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Deterministic hand-written controller for the G1 block-stacking task."""
2
+
3
+ import cv2
4
+ import numpy as np
5
+
6
+
7
+ class Policy:
8
+ PICK = np.array([-.40, 0., 0., .75, 0., -.30, 0.] + [0.] * 7)
9
+ CARRY = np.array([-.85, 0., 0., 1.20, 0., -.30, 0.] + [0.] * 7)
10
+
11
+ def reset(self, obs, tools):
12
+ self.hold = np.asarray(tools.hold_action(), dtype=np.float32)
13
+ self.arms = np.zeros(14, dtype=float)
14
+ self.arm_start = self.arms.copy()
15
+ self.arm_goal = self.arms.copy()
16
+ self.grip_l = 0.
17
+ self.height = .74
18
+ self.pitch = 0.
19
+ self.tx = .15
20
+ self.ty = 0.
21
+ self.tyaw = 0.
22
+ self.speed = .18
23
+ self.phase = "aim"
24
+ self.k = 0
25
+ self.stable = 0
26
+ self.placed = 0
27
+ self.retries = 0
28
+ self.roll_goal = None
29
+ self._aim(obs, tools)
30
+
31
+ def _go(self, phase):
32
+ self.phase = phase
33
+ self.k = 0
34
+ self.stable = 0
35
+
36
+ def _aim(self, obs, tools):
37
+ """Choose the leftmost visible source cube and stand off from it."""
38
+ im = tools.image("head")
39
+ r = im[:, :, 0].astype(np.float32)
40
+ g = im[:, :, 1].astype(np.float32)
41
+ b = im[:, :, 2].astype(np.float32)
42
+ mask = ((r > 150) & (r > 1.7 * g) & (r > 1.7 * b)).astype(np.uint8)
43
+ n, labels, stats, centers = cv2.connectedComponentsWithStats(mask, 8)
44
+ candidates = []
45
+ for i in range(1, n):
46
+ area = int(stats[i, cv2.CC_STAT_AREA])
47
+ cx, cy = centers[i]
48
+ if area >= 10 and cy < 65:
49
+ candidates.append((float(cx), float(cy), area))
50
+ if candidates:
51
+ cx, cy, _ = min(candidates, key=lambda v: v[0])
52
+ self.tx = float(np.clip(.15 + .008 * (22. - cy), .06, .28))
53
+ self.ty = float(np.clip(.008 * (17. - cx), -.38, .22))
54
+ else:
55
+ self.tx, self.ty = .15, 0.
56
+ self.tyaw = 0.
57
+ self.speed = .18
58
+
59
+ def _arm_move(self, goal, duration, next_phase):
60
+ if self.k == 0:
61
+ self.arm_start = self.arms.copy()
62
+ self.arm_goal = np.asarray(goal, dtype=float)
63
+ u = min(1., (self.k + 1) / float(duration))
64
+ self.arms = self.arm_start + u * (self.arm_goal - self.arm_start)
65
+ if self.k + 1 >= duration:
66
+ self.arms = self.arm_goal.copy()
67
+ self._go(next_phase)
68
+
69
+ def _goto(self, next_phase, max_steps, tolerance=.055):
70
+ q = self.low
71
+ yaw_err = (self.tyaw - float(q[24]) + np.pi) % (2 * np.pi) - np.pi
72
+ if (abs(self.tx - q[21]) < tolerance and
73
+ abs(self.ty - q[22]) < tolerance and abs(yaw_err) < .08):
74
+ self.stable += 1
75
+ else:
76
+ self.stable = 0
77
+ if self.stable > 12 or self.k + 1 >= max_steps:
78
+ self._go(next_phase)
79
+
80
+ def _base_action(self):
81
+ q = self.low
82
+ x, y, yaw = float(q[21]), float(q[22]), float(q[24])
83
+ err = (self.tyaw - yaw + np.pi) % (2 * np.pi) - np.pi
84
+ ex, ey = self.tx - x, self.ty - y
85
+ c, s = np.cos(yaw), np.sin(yaw)
86
+ bx, by = c * ex + s * ey, -s * ex + c * ey
87
+ a = self.hold.copy()
88
+ a[0] = np.clip(2.5 * bx, -self.speed, self.speed) if abs(bx) > .012 else 0.
89
+ a[1] = np.clip(2.5 * by, -self.speed, self.speed) if abs(by) > .015 else 0.
90
+ if 0 < abs(a[0]) < .06:
91
+ a[0] = np.sign(a[0]) * .06
92
+ if 0 < abs(a[1]) < .06:
93
+ a[1] = np.sign(a[1]) * .06
94
+ a[2] = self.height
95
+ a[3] = np.clip(1.4 * err, -.38, .38) if abs(err) > .04 else 0.
96
+ a[4] = self.pitch
97
+ if abs(err) > .25:
98
+ a[0] = a[1] = 0.
99
+ a[5:19] = self.arms
100
+ a[19] = self.grip_l
101
+ a[20] = 0.
102
+ return a
103
+
104
+ def act(self, obs, tools):
105
+ self.low = np.asarray(obs["low_dim_obs"])
106
+ phase = self.phase
107
+ self.grip_l = 0. if phase in ("aim", "reach", "home") else self.grip_l
108
+
109
+ if phase == "aim":
110
+ self.arms = np.zeros(14)
111
+ self.grip_l = 0.
112
+ self.speed = .18
113
+ if self.k + 1 >= 15:
114
+ self._go("reach")
115
+
116
+ elif phase == "home":
117
+ self.grip_l = 0.
118
+ self.speed = .30
119
+ self._arm_move(np.zeros(14), 50, "aim")
120
+ if self.phase == "aim":
121
+ self._aim(obs, tools)
122
+
123
+ elif phase == "reach":
124
+ self.grip_l = 0.
125
+ self._arm_move(self.PICK, 100, "rolls")
126
+
127
+ elif phase == "rolls":
128
+ k = self.k
129
+ if k < 300:
130
+ cycle = k // 100
131
+ local = k % 100
132
+ self.arms[4] = (-1.57, -1., -.5)[cycle]
133
+ self.grip_l = 0. if local < 40 or local >= 80 else 1.
134
+ else:
135
+ self.arms[4] = 0.
136
+ self.grip_l = 0. if k < 340 else 1.
137
+ if k + 1 >= 380:
138
+ self._go("check_grasp")
139
+
140
+ elif phase == "check_grasp":
141
+ self.arms[4] = 0.
142
+ self.grip_l = 1.
143
+ fingers = self.low[[10, 11]]
144
+ if np.mean(fingers) < -.017 and self.retries < 1:
145
+ self.retries += 1
146
+ self.tx = float(np.clip(self.tx + .025, .06, .29))
147
+ self.ty = float(np.clip(self.ty - .02, -.40, .24))
148
+ self._go("rolls")
149
+ else:
150
+ self.retries = 0
151
+ self._go("lift")
152
+
153
+ elif phase == "lift":
154
+ self.grip_l = 1.
155
+ self.height = .74 + .10 * min(1., (self.k + 1) / 60.)
156
+ if self.k + 1 >= 60:
157
+ self._go("back")
158
+
159
+ elif phase == "back":
160
+ self.grip_l = 1.
161
+ self.height = .84
162
+ self.tx = .05
163
+ self.speed = .22
164
+ self._goto("lane", 180)
165
+
166
+ elif phase == "lane":
167
+ self.grip_l = 1.
168
+ self.height = .78
169
+ self.speed = .30
170
+ self.tx, self.ty, self.tyaw = .05, 1.0, 0.
171
+ self._goto("destination_x", 300)
172
+
173
+ elif phase == "destination_x":
174
+ self.speed = .30
175
+ self.tx, self.ty, self.tyaw = 1.55, 1.0, 0.
176
+ self._goto("turn_destination", 450)
177
+
178
+ elif phase == "turn_destination":
179
+ self.speed = .20
180
+ self.tx, self.ty, self.tyaw = 1.55, 1.0, -1.57
181
+ self._goto("raise_carry", 250)
182
+
183
+ elif phase == "raise_carry":
184
+ self.speed = .18
185
+ self._arm_move(self.CARRY, 80, "approach")
186
+
187
+ elif phase == "approach":
188
+ self.height = .74
189
+ self.speed = .18
190
+ self.tx, self.ty, self.tyaw = 1.55, .74, -1.57
191
+ self._goto("pitch_place", 250)
192
+
193
+ elif phase == "pitch_place":
194
+ self.tx = float(self.low[21])
195
+ self.ty = float(self.low[22])
196
+ self.speed = .12
197
+ self.height = (.74, .80, .86)[min(self.placed, 2)]
198
+ self.pitch = 0.
199
+ if self.k + 1 >= 40:
200
+ self._go("release")
201
+
202
+ elif phase == "release":
203
+ self.grip_l = 0.
204
+ self.pitch = 0.
205
+ if self.k + 1 >= 60:
206
+ self.placed += 1
207
+ self._go("unpitch")
208
+
209
+ elif phase == "unpitch":
210
+ self.grip_l = 0.
211
+ self.pitch = 0.
212
+ self.height = (.74, .80, .86)[min(self.placed - 1, 2)]
213
+ if self.k + 1 >= 60:
214
+ self._go("finish" if self.placed >= 3 else "retreat")
215
+
216
+ elif phase == "retreat":
217
+ self.grip_l = 0.
218
+ self.height = .74
219
+ self.pitch = 0.
220
+ self.speed = .30
221
+ self.ty = 1.0
222
+ self._goto("return_turn", 180)
223
+
224
+ elif phase == "return_turn":
225
+ self.speed = .30
226
+ self.tx, self.ty, self.tyaw = 1.55, 1.0, 0.
227
+ self._goto("return_x", 180)
228
+
229
+ elif phase == "return_x":
230
+ self.speed = .40
231
+ self.tx, self.ty, self.tyaw = .05, 1.0, 0.
232
+ self._goto("return_y", 300)
233
+
234
+ elif phase == "return_y":
235
+ self.speed = .40
236
+ self.tx, self.ty, self.tyaw = .05, 0., 0.
237
+ self._goto("home", 220)
238
+
239
+ elif phase == "finish":
240
+ self.grip_l = 0.
241
+ self.height = .86
242
+ self.pitch = 0.
243
+ self.speed = .12
244
+
245
+ action = self._base_action()
246
+ self.k += 1
247
+ return action
policies/stack_blocks/opus-s1/episodes.csv ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ seed,success,length,termination,fell
2
+ 620000,1,5784,success,0
3
+ 620001,1,5761,success,0
4
+ 620002,1,5654,success,0
5
+ 620003,1,5789,success,0
6
+ 620004,1,5680,success,0
7
+ 620005,1,5713,success,0
8
+ 620006,1,5720,success,0
9
+ 620007,1,5674,success,0
10
+ 620008,1,5774,success,0
11
+ 620009,1,5683,success,0
12
+ 620010,1,5628,success,0
13
+ 620011,1,5734,success,0
14
+ 620012,1,5712,success,0
15
+ 620013,1,5712,success,0
16
+ 620014,1,5766,success,0
17
+ 620015,1,5798,success,0
18
+ 620016,1,5796,success,0
19
+ 620017,1,5736,success,0
20
+ 620018,1,5621,success,0
21
+ 620019,1,5664,success,0
22
+ 620020,1,5753,success,0
23
+ 620021,1,5665,success,0
24
+ 620022,1,5660,success,0
25
+ 620023,1,5638,success,0
26
+ 620024,1,5712,success,0
27
+ 620025,1,5657,success,0
28
+ 620026,1,5766,success,0
29
+ 620027,1,5631,success,0
30
+ 620028,1,5765,success,0
31
+ 620029,1,5688,success,0
32
+ 620030,1,5729,success,0
33
+ 620031,1,5644,success,0
34
+ 620032,1,5742,success,0
35
+ 620033,1,5758,success,0
36
+ 620034,1,5693,success,0
37
+ 620035,1,5783,success,0
38
+ 620036,1,5672,success,0
39
+ 620037,1,5599,success,0
40
+ 620038,1,5686,success,0
41
+ 620039,1,5810,success,0
42
+ 620040,1,5721,success,0
43
+ 620041,1,5640,success,0
44
+ 620042,1,5664,success,0
45
+ 620043,1,5752,success,0
46
+ 620044,1,5749,success,0
47
+ 620045,1,5704,success,0
48
+ 620046,1,5688,success,0
49
+ 620047,1,5725,success,0
50
+ 620048,1,5486,success,0
51
+ 620049,1,5672,success,0
52
+ 620050,1,5678,success,0
53
+ 620051,1,5726,success,0
54
+ 620052,1,5774,success,0
55
+ 620053,1,5785,success,0
56
+ 620054,1,5615,success,0
57
+ 620055,1,6185,success,0
58
+ 620056,1,5657,success,0
59
+ 620057,1,5604,success,0
60
+ 620058,1,5666,success,0
61
+ 620059,1,5684,success,0
62
+ 620060,1,5673,success,0
63
+ 620061,1,5770,success,0
64
+ 620062,1,5679,success,0
65
+ 620063,1,5710,success,0
66
+ 620064,1,5649,success,0
67
+ 620065,1,5626,success,0
68
+ 620066,1,5738,success,0
69
+ 620067,1,5661,success,0
70
+ 620068,1,5783,success,0
71
+ 620069,1,5773,success,0
72
+ 620070,1,5761,success,0
73
+ 620071,1,5794,success,0
74
+ 620072,1,5647,success,0
75
+ 620073,1,5756,success,0
76
+ 620074,1,5490,success,0
77
+ 620075,1,5699,success,0
78
+ 620076,1,5813,success,0
79
+ 620077,1,5701,success,0
80
+ 620078,1,5601,success,0
81
+ 620079,1,5709,success,0
82
+ 620080,1,5740,success,0
83
+ 620081,1,5646,success,0
84
+ 620082,1,5693,success,0
85
+ 620083,1,5660,success,0
86
+ 620084,1,5727,success,0
87
+ 620085,1,5731,success,0
88
+ 620086,1,5739,success,0
89
+ 620087,1,5755,success,0
90
+ 620088,1,5570,success,0
91
+ 620089,1,5711,success,0
92
+ 620090,1,5745,success,0
93
+ 620091,1,5698,success,0
94
+ 620092,1,5650,success,0
95
+ 620093,1,5646,success,0
96
+ 620094,1,5706,success,0
97
+ 620095,1,5665,success,0
98
+ 620096,1,5718,success,0
99
+ 620097,1,5791,success,0
100
+ 620098,1,5612,success,0
101
+ 620099,1,5809,success,0
policies/stack_blocks/opus-s1/g1kin.py ADDED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Approximate G1 arm kinematics (pelvis frame), from the published G1 model."""
2
+ import numpy as np
3
+
4
+
5
+ def rx(a):
6
+ c, s = np.cos(a), np.sin(a)
7
+ return np.array([[1, 0, 0], [0, c, -s], [0, s, c]])
8
+
9
+
10
+ def ry(a):
11
+ c, s = np.cos(a), np.sin(a)
12
+ return np.array([[c, 0, s], [0, 1, 0], [-s, 0, c]])
13
+
14
+
15
+ def rz(a):
16
+ c, s = np.cos(a), np.sin(a)
17
+ return np.array([[c, -s, 0], [s, c, 0], [0, 0, 1]])
18
+
19
+
20
+ def quat(w, x, y, z):
21
+ q = np.array([w, x, y, z]) / np.linalg.norm([w, x, y, z])
22
+ w, x, y, z = q
23
+ return np.array([
24
+ [1 - 2 * (y * y + z * z), 2 * (x * y - z * w), 2 * (x * z + y * w)],
25
+ [2 * (x * y + z * w), 1 - 2 * (x * x + z * z), 2 * (y * z - x * w)],
26
+ [2 * (x * z - y * w), 2 * (y * z + x * w), 1 - 2 * (x * x + y * y)],
27
+ ])
28
+
29
+
30
+ HAND_OFF = np.array([0.0415 + 0.10, 0.0, 0.0]) # grasp point beyond wrist yaw link (to calibrate)
31
+
32
+
33
+ def torso_frame(waist):
34
+ """Torso pose in pelvis frame from waist (yaw, roll, pitch)."""
35
+ R = rz(waist[0])
36
+ p = np.zeros(3)
37
+ p = p + R @ np.array([-0.0039635, 0, 0.035])
38
+ R = R @ rx(waist[1])
39
+ p = p + R @ np.array([0, 0, 0.019])
40
+ R = R @ ry(waist[2])
41
+ return p, R
42
+
43
+
44
+ def arm_chain(q, side, waist=(0, 0, 0), hand_off=None):
45
+ """Return list of (p, R) frames: torso, shoulder pitch..wrist yaw, hand point."""
46
+ sgn = 1.0 if side == 'left' else -1.0
47
+ p, R = torso_frame(waist)
48
+ frames = []
49
+ def step(off, Rfix, axis, ang):
50
+ nonlocal p, R
51
+ p = p + R @ np.asarray(off)
52
+ R = R @ Rfix
53
+ R = R @ {'x': rx, 'y': ry, 'z': rz}[axis](ang)
54
+ frames.append((p.copy(), R.copy()))
55
+ I = np.eye(3)
56
+ step([0.0039563, sgn * 0.10022, 0.24778], quat(0.990264, sgn * 0.139201, 0, 0), 'y', q[0])
57
+ step([0, sgn * 0.038, -0.013831], quat(0.990268, -sgn * 0.139172, 0, 0), 'x', q[1])
58
+ step([0, sgn * 0.00624, -0.1032], I, 'z', q[2])
59
+ step([0.015783, 0, -0.080518], I, 'y', q[3])
60
+ step([0.1, sgn * 0.00188791, -0.01], I, 'x', q[4])
61
+ step([0.038, 0, 0], I, 'y', q[5])
62
+ step([0.046, 0, 0], I, 'z', q[6])
63
+ ho = HAND_OFF if hand_off is None else hand_off
64
+ frames.append((p + R @ ho, R.copy()))
65
+ return frames
66
+
67
+
68
+ def hand_pose(q, side, waist=(0, 0, 0), hand_off=None):
69
+ return arm_chain(q, side, waist, hand_off)[-1]
70
+
71
+
72
+ # shoulder roll is limited by the arm hitting the torso (measured: about -0.15 / +0.15)
73
+ LIM_LO = {'left': np.array([-3.0, 0.03, -2.6, -1.0, -1.9, -1.6, -1.6]),
74
+ 'right': np.array([-3.0, -2.2, -2.6, -1.0, -1.9, -1.6, -1.6])}
75
+ LIM_HI = {'left': np.array([2.6, 2.2, 2.6, 2.0, 1.9, 1.6, 1.6]),
76
+ 'right': np.array([2.6, -0.03, 2.6, 2.0, 1.9, 1.6, 1.6])}
77
+
78
+
79
+ def ik(p_target, side, q0, waist=(0, 0, 0), xdir=None, ydir=None, wdir=0.3,
80
+ reg=0.01, qref=None, hand_off=None):
81
+ """Numeric IK for the hand point; xdir: desired gripper axis, ydir: desired jaw axis."""
82
+ from scipy.optimize import least_squares
83
+ qref = q0 if qref is None else qref
84
+ def res(q):
85
+ p, R = hand_pose(q, side, waist, hand_off)
86
+ r = [p - p_target]
87
+ if xdir is not None:
88
+ r.append(wdir * (R[:, 0] - xdir))
89
+ if ydir is not None:
90
+ r.append(wdir * (R[:, 1] - ydir))
91
+ r.append(np.asarray(reg) * (q - qref))
92
+ return np.concatenate(r)
93
+ lo, hi = LIM_LO[side], LIM_HI[side]
94
+ x0 = np.clip(q0, lo + 1e-3, hi - 1e-3)
95
+ sol = least_squares(res, x0, bounds=(lo, hi), xtol=1e-8, ftol=1e-10)
96
+ p, R = hand_pose(sol.x, side, waist, hand_off)
97
+ return sol.x, np.linalg.norm(p - p_target)
policies/stack_blocks/opus-s1/headcam.py ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Head camera model (fitted constants) and helpers."""
2
+ import numpy as np
3
+ from g1kin import rx, ry, rz, torso_frame
4
+
5
+ W = H = 84
6
+ R0 = np.column_stack([[0, -1, 0], [0, 0, 1], [-1, 0, 0]])
7
+ HEAD = np.array([0.1131, 0.0043, 0.3301, 0.9779, -0.013, -0.0035, 1.0932, -0.0263])
8
+
9
+
10
+ def pelvis_world(o, kp=HEAD[7]):
11
+ """Pelvis rotation and position in world from low_dim_obs."""
12
+ Rp = rz(o[24]) @ ry(kp * o[2])
13
+ return np.array([o[21], o[22], o[23]]), Rp
14
+
15
+
16
+ def cam_world(o, p=HEAD):
17
+ cx, cy, cz, th, ps, ph, fov, kp = p[:8]
18
+ tp, tR = torso_frame(o[0:3])
19
+ pw, Rp = pelvis_world(o, kp)
20
+ Rc_t = ry(th) @ rz(ps) @ R0 @ rz(ph)
21
+ Rw = Rp @ tR @ Rc_t
22
+ cw = pw + Rp @ (tp + tR @ np.array([cx, cy, cz]))
23
+ return cw, Rw, fov
24
+
25
+
26
+ def project(o, X, p=HEAD):
27
+ cw, Rw, fov = cam_world(o, p)
28
+ xc = Rw.T @ (np.asarray(X) - cw)
29
+ f = (H / 2) / np.tan(fov / 2)
30
+ return np.array([W / 2 + f * xc[0] / -xc[2], H / 2 - f * xc[1] / -xc[2]]), -xc[2]
31
+
32
+
33
+ def ray(o, uv, p=HEAD):
34
+ """World ray (origin, unit dir) through pixel uv."""
35
+ cw, Rw, fov = cam_world(o, p)
36
+ f = (H / 2) / np.tan(fov / 2)
37
+ d = np.array([(uv[0] - W / 2) / f, -(uv[1] - H / 2) / f, -1.0])
38
+ d = Rw @ d
39
+ return cw, d / np.linalg.norm(d)
40
+
41
+
42
+ def pixel_to_plane(o, uv, z, p=HEAD):
43
+ c, d = ray(o, uv, p)
44
+ t = (z - c[2]) / d[2]
45
+ return c + t * d
46
+
47
+
48
+ def to_world(o, p_pelvis):
49
+ pw, Rp = pelvis_world(o)
50
+ return pw + Rp @ np.asarray(p_pelvis)
51
+
52
+
53
+ def to_pelvis(o, X):
54
+ pw, Rp = pelvis_world(o)
55
+ return Rp.T @ (np.asarray(X) - pw)
policies/stack_blocks/opus-s1/percept.py ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Image processing helpers."""
2
+ import cv2
3
+ import numpy as np
4
+
5
+ W = H = 84
6
+
7
+
8
+ def red_mask(im):
9
+ r, g, b = [im[..., i].astype(int) for i in range(3)]
10
+ return ((r > 110) & (g < 80) & (b < 80) & (r > 2 * g)).astype(np.uint8)
11
+
12
+
13
+ def top_mask(im):
14
+ """The brightly lit top face of a red block."""
15
+ r, g, b = [im[..., i].astype(int) for i in range(3)]
16
+ return ((r > 225) & (g < 110) & (b < 110)).astype(np.uint8)
17
+
18
+
19
+ def green_mask(im):
20
+ r, g, b = [im[..., i].astype(int) for i in range(3)]
21
+ return ((g > 120) & (g > r + 40) & (g > b + 40)).astype(np.uint8)
22
+
23
+
24
+ def blobs(mask, min_area=4, border_ok=False):
25
+ n, lab, st, cen = cv2.connectedComponentsWithStats(mask)
26
+ out = []
27
+ for i in range(1, n):
28
+ x, y, w, h, area = st[i]
29
+ touches = x == 0 or y == 0 or x + w >= mask.shape[1] or y + h >= mask.shape[0]
30
+ if area < min_area or (touches and not border_ok):
31
+ continue
32
+ out.append({'c': cen[i], 'area': int(area), 'bbox': (x, y, w, h), 'touch': bool(touches), 'mask': lab == i})
33
+ return out
policies/stack_blocks/opus-s1/policy.py ADDED
@@ -0,0 +1,503 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Scripted policy for the G1 stack-blocks task.
2
+
3
+ Pipeline: detect blocks with the head camera, grasp one block per hand with a
4
+ tilted top-down approach, walk around the tables to the green pad, place one
5
+ block on the pad and stack the second on it, then fetch the third block.
6
+ """
7
+
8
+ import numpy as np
9
+
10
+ import g1kin
11
+ import headcam
12
+ import percept
13
+
14
+ TABLE_Z = 0.707 # table top (world z)
15
+ BLOCK = 0.05 # block edge
16
+ BLOCK_Z = TABLE_Z + BLOCK / 2
17
+ HO_G = np.array([0.195, 0.0, 0.0]) # jaw centre beyond the wrist yaw link
18
+ TILT = 0.9 # gripper tilt from vertical during grasp/place
19
+ REACH = np.array([0.36, 0.20]) # target position in pelvis frame for grasping (y sign per side)
20
+ JAW_WIN = np.array([-47.0, 47.0]) # allowed jaw rotation (deg) for the right hand; mirrored for left
21
+ REG = np.array([0.006, 0.006, 0.015, 0.006, 0.015, 0.006, 0.015])
22
+ QN_R = np.array([-0.5, -0.1, 0, 0.3, 0, 0.8, 0])
23
+ TUCK_R = np.array([-0.2, -0.2, 0, -0.9, 0, 0, 0])
24
+ N_BLOCKS = 3
25
+ GRASP_DEPTH = 0.012 # jaw centre beyond block centre along the approach axis
26
+ GRIP_OK = (0.12, 0.6) # gripper state range of a square grasp on a block
27
+ LOOK = np.array([0.03, 0.14]) # wrist-camera look pose: back along heading, up
28
+ CARRY = np.array([0.33, 0.22, 0.24]) # held block position in pelvis frame while carrying
29
+ MIRROR = np.array([1, -1, -1, 1, -1, 1, -1])
30
+ SL = {'left': slice(5, 12), 'right': slice(12, 19)}
31
+ OBS_SL = {'left': slice(3, 10), 'right': slice(12, 19)}
32
+ GRIP = {'left': 19, 'right': 20}
33
+ GRIP_OBS = {'left': 50, 'right': 51}
34
+
35
+
36
+ def wrap(x):
37
+ return (x + np.pi) % (2 * np.pi) - np.pi
38
+
39
+
40
+ def side_vec(side, v):
41
+ v = np.array(v, dtype=float)
42
+ return v if side == 'right' else v * MIRROR
43
+
44
+
45
+ class Policy:
46
+ def reset(self, obs, tools):
47
+ self.tools = tools
48
+ self.obs = obs
49
+ self.a = np.asarray(tools.hold_action(), dtype=np.float64)
50
+ self.a[0] = self.a[1] = self.a[3] = 0.0
51
+ self.a[4] = 0.0
52
+ self.gen = self.script()
53
+ self.log = []
54
+ self.bias = {'left': np.zeros(7), 'right': np.zeros(7)}
55
+ self.ik_err = 0.0
56
+
57
+ def act(self, obs, tools):
58
+ self.obs = obs
59
+ try:
60
+ a = next(self.gen)
61
+ except StopIteration:
62
+ self.finished = True
63
+ self.gen = self.idle()
64
+ a = next(self.gen)
65
+ except Exception as exc: # never crash the episode: hold still instead
66
+ self.note('error', repr(exc))
67
+ self.finished = True
68
+ self.gen = self.idle()
69
+ a = next(self.gen)
70
+ return np.asarray(a, dtype=np.float32)
71
+
72
+ # ------------------------------------------------------------------ basics
73
+ def lo(self):
74
+ return np.asarray(self.obs['low_dim_obs'], dtype=np.float64)
75
+
76
+ def idle(self):
77
+ while True:
78
+ self.a[0] = self.a[1] = self.a[3] = 0.0
79
+ yield self.a.copy()
80
+
81
+ def wait(self, n):
82
+ for _ in range(n):
83
+ yield self.a.copy()
84
+
85
+ def note(self, *args):
86
+ self.log.append((int(self.obs['t']),) + args)
87
+
88
+ def goto(self, x, y, yaw, tol=0.03, ytol=0.05, maxn=1500, vmax=0.5, settle=20):
89
+ a = self.a
90
+ for i in range(maxn):
91
+ o = self.lo()
92
+ px, py, pyaw = o[21], o[22], o[24]
93
+ dx, dy = x - px, y - py
94
+ c, s = np.cos(pyaw), np.sin(pyaw)
95
+ bx, by = c * dx + s * dy, -s * dx + c * dy
96
+ dyaw = wrap(yaw - pyaw)
97
+ d = np.hypot(bx, by)
98
+ if d < tol and abs(dyaw) < ytol:
99
+ break
100
+ v = np.array([bx, by]) * 1.5
101
+ n = np.linalg.norm(v)
102
+ if n > vmax:
103
+ v *= vmax / n
104
+ if d >= tol and n < 0.07:
105
+ v *= 0.07 / max(n, 1e-6)
106
+ if d < tol:
107
+ v[:] = 0
108
+ a[0], a[1] = v
109
+ a[3] = np.clip(2.0 * dyaw, -0.8, 0.8)
110
+ yield a.copy()
111
+ a[0] = a[1] = a[3] = 0.0
112
+ yield from self.wait(settle)
113
+
114
+ def walk_path(self, pts, vmax=0.5):
115
+ """Walk through waypoints facing the direction of travel, then final yaw."""
116
+ a = self.a
117
+ for i, (x, y, yaw) in enumerate(pts):
118
+ last = i == len(pts) - 1
119
+ for _ in range(1500):
120
+ o = self.lo()
121
+ dx, dy = x - o[21], y - o[22]
122
+ d = np.hypot(dx, dy)
123
+ if d < (0.25 if last else 0.15):
124
+ break
125
+ err = wrap(np.arctan2(dy, dx) - o[24])
126
+ a[3] = np.clip(2.0 * err, -0.8, 0.8)
127
+ a[0] = vmax * max(0.0, np.cos(err)) ** 4 if abs(err) < 0.6 else 0.0
128
+ if 0 < a[0] < 0.07:
129
+ a[0] = 0.0
130
+ a[0] = min(a[0], 0.8 * d + 0.1)
131
+ a[1] = 0.0
132
+ yield a.copy()
133
+ if last:
134
+ yield from self.goto(x, y, yaw, tol=0.04, ytol=0.05, vmax=0.25, settle=10)
135
+
136
+ def turn_to(self, yaw):
137
+ a = self.a
138
+ for i in range(400):
139
+ dyaw = wrap(yaw - self.lo()[24])
140
+ if abs(dyaw) < 0.1:
141
+ break
142
+ a[0] = a[1] = 0.0
143
+ a[3] = np.clip(2.0 * dyaw, -0.8, 0.8)
144
+ yield a.copy()
145
+ a[3] = 0.0
146
+
147
+ # ------------------------------------------------------------------ arms
148
+ def fk_world(self, side, ho=HO_G):
149
+ o = self.lo()
150
+ fr = g1kin.arm_chain(o[OBS_SL[side]], side, o[0:3], ho)
151
+ return headcam.to_world(o, fr[-1][0])
152
+
153
+ def axis_world(self, jaw):
154
+ h = np.array([np.sin(jaw), -np.cos(jaw), 0.0])
155
+ xd = np.sin(TILT) * h + np.array([0, 0, -np.cos(TILT)])
156
+ yd = np.array([np.cos(jaw), np.sin(jaw), 0.0])
157
+ return xd, yd
158
+
159
+ def ik_world(self, Xw, side, jaw):
160
+ o = self.lo()
161
+ Xp = headcam.to_pelvis(o, Xw)
162
+ _, Rp = headcam.pelvis_world(o)
163
+ xd, yd = self.axis_world(jaw)
164
+ qn = side_vec(side, QN_R)
165
+ best = None
166
+ seeds = (self.a[SL[side]] - self.bias[side], qn,
167
+ side_vec(side, [-0.8, -0.3, 0.5, 0.8, 0, 0.8, 0.5]),
168
+ side_vec(side, [-0.8, -0.3, -0.5, 0.8, 0, 0.8, -0.5]))
169
+ for q0 in seeds:
170
+ q, e = g1kin.ik(Xp, side, q0, o[0:3], xdir=Rp.T @ xd, ydir=Rp.T @ yd,
171
+ reg=REG, qref=qn, hand_off=HO_G)
172
+ if best is None or e < best[1] - 3e-3:
173
+ best = (q, e)
174
+ return best
175
+
176
+ def move_arm(self, side, q, n=40, steps=5):
177
+ sl = SL[side]
178
+ q0 = self.a[sl].copy()
179
+ k = max(1, n // steps)
180
+ for s in np.linspace(0, 1, steps + 1)[1:]:
181
+ self.a[sl] = (1 - s) * q0 + s * np.asarray(q)
182
+ yield from self.wait(k)
183
+
184
+ def reach(self, side, X, jaw, n=40, iters=2, steps=5, maxcorr=0.12):
185
+ """Move the jaw centre to X; joint-space integral term removes gravity sag."""
186
+ X = np.asarray(X, dtype=float)
187
+ q, e = self.ik_world(X, side, jaw)
188
+ bias = self.bias[side]
189
+ yield from self.move_arm(side, q + bias, n, steps)
190
+ for _ in range(iters):
191
+ yield from self.wait(8)
192
+ qm = self.lo()[OBS_SL[side]]
193
+ bias = np.clip(bias + (q - qm), -maxcorr, maxcorr)
194
+ yield from self.move_arm(side, q + bias, 16, 2)
195
+ self.bias[side] = bias
196
+ self.ik_err = e
197
+
198
+ def tuck(self, side, n=40):
199
+ yield from self.move_arm(side, side_vec(side, TUCK_R), n)
200
+
201
+ # ------------------------------------------------------------------ perception
202
+ def head_blobs_border(self, mask_fn, z):
203
+ return self.head_blobs(mask_fn, z, border_ok=True)
204
+
205
+ def head_blobs(self, mask_fn, z, border_ok=False):
206
+ import cv2
207
+ o = self.lo()
208
+ im = self.tools.image('head')
209
+ mask = mask_fn(im)
210
+ for side in ('left', 'right'):
211
+ gs = o[GRIP_OBS[side]]
212
+ if 0.05 < gs < 0.9: # holding a block: ignore it
213
+ uv, d = headcam.project(o, self.fk_world(side))
214
+ if d > 0:
215
+ cv2.circle(mask, (int(round(uv[0])), int(round(uv[1]))), 11, 0, -1)
216
+ out = []
217
+ for b in percept.blobs(mask, border_ok=border_ok):
218
+ X = headcam.pixel_to_plane(o, b['c'], z)
219
+ out.append({'X': X, 'uv': b['c'], 'area': b['area'], 'mask': b['mask'], 'im': im,
220
+ 'touch': b['touch']})
221
+ return out
222
+
223
+ def block_top(self, blob, ztop):
224
+ """Top-face centre (world) and yaw (mod pi/2) of a block blob."""
225
+ import cv2
226
+ o = self.lo()
227
+ top = percept.top_mask(blob['im']) & cv2.dilate(blob['mask'].astype(np.uint8), np.ones((3, 3), np.uint8))
228
+ ys, xs = np.nonzero(top)
229
+ if len(xs) < 5:
230
+ return None, None
231
+ pts = np.array([headcam.pixel_to_plane(o, (u, v), ztop)[:2] for u, v in zip(xs, ys)])
232
+ c = pts.mean(axis=0)
233
+ (cx, cy), (w, h), ang = cv2.minAreaRect((pts * 1000).astype(np.float32))
234
+ return np.array([c[0], c[1], ztop - BLOCK / 2]), wrap(4 * np.deg2rad(ang)) / 4
235
+
236
+ # ------------------------------------------------------------------ skills
237
+ def wrist_top(self, side):
238
+ """Top face of the most prominent block in the wrist camera: (centre, angle mod 90 rad)."""
239
+ import cv2
240
+ im = self.tools.image(side + '_wrist')
241
+ red = percept.red_mask(im)
242
+ top = percept.top_mask(im)
243
+ bl = percept.blobs(red, min_area=20, border_ok=True)
244
+ if not bl:
245
+ return None, None
246
+ b = max(bl, key=lambda b: b['area'])
247
+ m = (top & b['mask']).astype(np.uint8)
248
+ if m.sum() < 20:
249
+ return None, None
250
+ cnts, _ = cv2.findContours(m, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_NONE)
251
+ cnt = max(cnts, key=cv2.contourArea)
252
+ (cx, cy), _, ang = cv2.minAreaRect(cnt)
253
+ return np.array([cx, cy]), wrap(4 * np.deg2rad(ang)) / 4
254
+
255
+ def grasp(self, side, X, jaw=np.pi / 2):
256
+ """Tilted grasp of the block whose centre is X (world)."""
257
+ g = GRIP[side]
258
+ self.a[g] = 0.0
259
+ jaw0 = jaw
260
+ for k in range(2):
261
+ h = np.array([np.sin(jaw), -np.cos(jaw), 0.0])
262
+ look = X - LOOK[0] * h + np.array([0, 0, LOOK[1]])
263
+ yield from self.reach(side, look, jaw, n=45 if k == 0 else 30)
264
+ yield from self.wait(8)
265
+ c, ang = self.wrist_top(side)
266
+ self.note('wrist', side, k, None if c is None else c.round(1).tolist(),
267
+ None if ang is None else round(float(np.rad2deg(ang)), 1))
268
+ if ang is None or abs(ang) < np.deg2rad(6):
269
+ break
270
+ jaw = jaw - ang
271
+ lo, hi = np.deg2rad(JAW_WIN) if side == 'right' else -np.deg2rad(JAW_WIN[::-1])
272
+ if jaw - jaw0 > hi:
273
+ jaw -= np.pi / 2
274
+ elif jaw - jaw0 < lo:
275
+ jaw += np.pi / 2
276
+ xd, _ = self.axis_world(jaw)
277
+ yield from self.reach(side, X - 0.08 * xd, jaw, n=30, iters=3)
278
+ yield from self.reach(side, X + GRASP_DEPTH * xd, jaw, n=30, iters=1)
279
+ at = self.fk_world(side)
280
+ self.note('at', side, at.round(3).tolist(), (at - X).round(3).tolist(), round(float(self.ik_err), 3))
281
+ self.a[g] = 1.0
282
+ yield from self.wait(30)
283
+ up = self.fk_world(side) + np.array([0, 0, 0.10])
284
+ yield from self.reach(side, up, jaw, n=30, iters=0)
285
+ yield from self.wait(10)
286
+ gs = self.lo()[GRIP_OBS[side]]
287
+ held = GRIP_OK[0] <= gs <= GRIP_OK[1]
288
+ self.note('grasp', side, held, round(float(gs), 2))
289
+ if not held:
290
+ # bad or empty grasp: put the block back down gently and back off
291
+ if gs < 0.95:
292
+ yield from self.reach(side, self.fk_world(side) - np.array([0, 0, 0.09]), jaw, n=30, iters=0)
293
+ self.a[g] = 0.0
294
+ yield from self.wait(20)
295
+ yield from self.reach(side, self.fk_world(side) - 0.06 * xd + np.array([0, 0, 0.08]), jaw, n=30, iters=0)
296
+ return held
297
+
298
+ def place(self, side, X, jaw=np.pi / 2):
299
+ """Lower the held block so its centre reaches X, release, retract."""
300
+ g = GRIP[side]
301
+ xd, _ = self.axis_world(jaw)
302
+ X = X + GRASP_DEPTH * xd # the jaw centre sits this far beyond the block centre
303
+ above = X + np.array([0, 0, 0.05])
304
+ yield from self.reach(side, above, jaw, n=40, iters=3)
305
+ self.note('above', side, self.fk_world(side).round(3).tolist(), (self.fk_world(side) - above).round(3).tolist())
306
+ yield from self.reach(side, X + np.array([0, 0, 0.008]), jaw, n=40, iters=2, steps=8)
307
+ yield from self.wait(10)
308
+ self.note('release', side, self.fk_world(side).round(3).tolist())
309
+ self.a[g] = 0.0
310
+ yield from self.wait(25)
311
+ self.note('released', side)
312
+ back = self.fk_world(side) - 0.08 * xd + np.array([0, 0, 0.03])
313
+ yield from self.reach(side, back, jaw, n=30, iters=0)
314
+ yield from self.reach(side, back + np.array([0, 0, 0.08]), jaw, n=25, iters=0)
315
+
316
+ def stand_for(self, X, side, facing):
317
+ """Pelvis pose that puts world point X at the standard reach offset."""
318
+ c, s = np.cos(facing), np.sin(facing)
319
+ ry = REACH[1] if side == 'left' else -REACH[1]
320
+ bx, by = REACH[0], ry
321
+ px = X[0] - (c * bx - s * by)
322
+ py = X[1] - (s * bx + c * by)
323
+ # do not walk into the tables
324
+ if abs(wrap(facing)) < 0.5:
325
+ px = min(px, 0.24)
326
+ else:
327
+ px = max(px, 1.92)
328
+ return px, py
329
+
330
+ # ------------------------------------------------------------------ script
331
+ def script(self):
332
+ a = self.a
333
+ a[GRIP['left']] = a[GRIP['right']] = 1.0
334
+ a[SL['left']] = side_vec('left', TUCK_R)
335
+ a[SL['right']] = side_vec('right', TUCK_R)
336
+ yield from self.wait(40)
337
+ self.level = 0
338
+ yield from self.rescan([], expected=N_BLOCKS)
339
+ blocks = self.scan
340
+ while blocks:
341
+ if len(blocks) >= 2:
342
+ plan = [('right', blocks[0]), ('left', blocks[-1])]
343
+ else:
344
+ plan = [('right', blocks[0])]
345
+ held = []
346
+ for side, X in plan:
347
+ ok = yield from self.fetch(side, X, 0.0)
348
+ if ok:
349
+ held.append(side)
350
+ blocks = [b for b in blocks if b is not X]
351
+ else:
352
+ yield from self.tuck(side)
353
+ if not held:
354
+ yield from self.rescan(blocks, expected=N_BLOCKS - self.level)
355
+ blocks = self.scan
356
+ continue
357
+ yield from self.to_table2()
358
+ for side in ['left', 'right']:
359
+ gs = self.lo()[GRIP_OBS[side]]
360
+ if side in held and GRIP_OK[0] - 0.05 <= gs <= GRIP_OK[1] + 0.2:
361
+ yield from self.put_on_stack(side, self.level)
362
+ self.level += 1
363
+ yield from self.tuck(side)
364
+ if self.level < N_BLOCKS:
365
+ yield from self.to_table1()
366
+ yield from self.rescan(blocks, expected=N_BLOCKS - self.level)
367
+ blocks = self.scan
368
+ yield from self.wait(100)
369
+
370
+ def rescan(self, guesses, expected):
371
+ """Look at table 1 (shifting sideways if needed) and list the blocks on it."""
372
+ y0 = float(np.mean([g[1] for g in guesses])) if guesses else 0.0
373
+ found = []
374
+ for dy in (0.0, -0.25, 0.25):
375
+ yield from self.goto(0.1, y0 + dy, 0.0, tol=0.05, vmax=0.3)
376
+ for b in self.head_blobs_border(percept.red_mask, BLOCK_Z):
377
+ X = b['X']
378
+ if X[0] < 0.45 or X[0] > 0.85 or b['area'] < 12:
379
+ continue
380
+ pri = 0 if not b['touch'] else 1
381
+ for k, (Xf, pf) in enumerate(found):
382
+ if np.linalg.norm(Xf[:2] - X[:2]) < 0.06:
383
+ if pri < pf:
384
+ found[k] = (X, pri)
385
+ break
386
+ else:
387
+ found.append((X, pri))
388
+ if len(found) >= expected:
389
+ break
390
+ found = [f[0] for f in found]
391
+ self.note('rescan', [f.round(3).tolist() for f in found])
392
+ self.scan = sorted(found, key=lambda X: X[1])
393
+
394
+ def to_table1(self):
395
+ o = self.lo()
396
+ yield from self.goto(o[21] + 0.15, o[22], o[24], tol=0.08, ytol=0.2, vmax=0.3, settle=0)
397
+ pts = [(2.05, 1.2, np.pi / 2), (-0.1, 1.2, np.pi), (0.1, 0.0, 0.0)]
398
+ yield from self.walk_path(pts)
399
+
400
+ def fetch(self, side, Xguess, facing):
401
+ px, py = self.stand_for(Xguess, side, facing)
402
+ yield from self.goto(px, py, facing, tol=0.03, vmax=0.25, maxn=500)
403
+ # re-detect, pick nearest blob to the guess
404
+ bl = self.head_blobs(percept.red_mask, BLOCK_Z)
405
+ yaw = 0.0
406
+ if bl:
407
+ b = min(bl, key=lambda b: np.linalg.norm(b['X'][:2] - Xguess[:2]))
408
+ if np.linalg.norm(b['X'][:2] - Xguess[:2]) < 0.1:
409
+ Xguess = b['X']
410
+ Xt, yt = self.block_top(b, TABLE_Z + BLOCK)
411
+ if Xt is not None:
412
+ Xguess, yaw = Xt, yt
413
+ jaw = facing + np.pi / 2
414
+ self.note('fetch', side, Xguess.round(3).tolist(), round(float(yaw), 3), self.lo()[21:25].round(3).tolist())
415
+ ok = yield from self.grasp(side, Xguess, jaw)
416
+ if not ok:
417
+ # second attempt with a fresh detection
418
+ yield from self.tuck(side, 30)
419
+ bl = self.head_blobs(percept.red_mask, BLOCK_Z)
420
+ if bl:
421
+ b = min(bl, key=lambda b: np.linalg.norm(b['X'][:2] - Xguess[:2]))
422
+ if np.linalg.norm(b['X'][:2] - Xguess[:2]) < 0.1:
423
+ Xt, _ = self.block_top(b, TABLE_Z + BLOCK)
424
+ Xguess = Xt if Xt is not None else b['X']
425
+ ok = yield from self.grasp(side, Xguess, jaw)
426
+ if ok:
427
+ yield from self.carry(side)
428
+ return ok
429
+
430
+ def carry(self, side):
431
+ """Lift the held block high, out of the head camera's view."""
432
+ o = self.lo()
433
+ sy = 1.0 if side == 'left' else -1.0
434
+ Xw = headcam.to_world(o, np.array([CARRY[0], sy * CARRY[1], CARRY[2]]))
435
+ jaw = o[24] + np.pi / 2
436
+ yield from self.reach(side, Xw, jaw, n=40, iters=0)
437
+
438
+ def to_table2(self):
439
+ o = self.lo()
440
+ yield from self.goto(o[21] - 0.25, o[22], o[24], tol=0.08, ytol=0.2, vmax=0.3, settle=0)
441
+ pts = [(o[21] - 0.25, 1.2, np.pi / 2), (2.05, 1.2, 0.0), (2.05, 0.0, np.pi)]
442
+ yield from self.walk_path(pts)
443
+ if not hasattr(self, 'pad'):
444
+ yield from self.find_pad()
445
+
446
+ def find_pad(self):
447
+ """Locate the green pad from the arrival pose (fully in view)."""
448
+ self.pad = np.array([1.55, 0.0, TABLE_Z])
449
+ for k in range(3):
450
+ g = [b for b in self.head_blobs_border(percept.green_mask, TABLE_Z) if b['area'] >= 15]
451
+ if not g:
452
+ break
453
+ b = max(g, key=lambda b: b['area'])
454
+ self.pad = b['X']
455
+ if not b['touch']:
456
+ break
457
+ o = self.lo()
458
+ yield from self.goto(o[21], 0.5 * (o[22] + b['X'][1]), np.pi, tol=0.03, vmax=0.25)
459
+ self.note('pad', self.pad.round(3).tolist())
460
+
461
+ def stack_top(self, level):
462
+ """Top-face centre of the stack that currently has `level` blocks."""
463
+ ztop = TABLE_Z + BLOCK * level
464
+ T = getattr(self, 'top', self.pad)
465
+ bl = self.head_blobs(percept.red_mask, ztop - BLOCK / 2)
466
+ best = None
467
+ for b in bl:
468
+ Xt, _ = self.block_top(b, ztop)
469
+ if Xt is None:
470
+ continue
471
+ d = np.linalg.norm(Xt[:2] - self.pad[:2])
472
+ if d < 0.1 and (best is None or d < best[0]):
473
+ best = (d, Xt)
474
+ if best is not None:
475
+ T = best[1]
476
+ self.top = T
477
+ return T
478
+
479
+ def put_on_stack(self, side, level):
480
+ facing = np.pi
481
+ if level == 0:
482
+ T = self.pad
483
+ else:
484
+ T = self.stack_top(level)
485
+ px, py = self.stand_for(T, side, facing)
486
+ yield from self.goto(px, py, facing, tol=0.03, vmax=0.25, maxn=500)
487
+ # refine target after moving
488
+ if level == 0:
489
+ g = self.head_blobs(percept.green_mask, TABLE_Z)
490
+ g = [b for b in g if b['area'] >= 30 and np.linalg.norm(b['X'][:2] - self.pad[:2]) < 0.05]
491
+ if g:
492
+ T = max(g, key=lambda b: b['area'])['X']
493
+ else:
494
+ T = self.stack_top(level)
495
+ last = getattr(self, 'placed', None)
496
+ if last is not None and np.linalg.norm(T[:2] - last[:2]) < 0.04:
497
+ # the previous block sits where we put it; the head camera is less
498
+ # precise than the arm, so lean on the commanded position
499
+ T = 0.7 * last + 0.3 * T
500
+ X = np.array([T[0], T[1], BLOCK_Z + BLOCK * level])
501
+ self.placed = X.copy()
502
+ self.note('place', side, level, X.round(3).tolist())
503
+ yield from self.place(side, X, jaw=-np.pi / 2)
policies/stack_blocks/opus-s2/episodes.csv ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ seed,success,length,termination,fell
2
+ 620000,0,8750,timeout,0
3
+ 620001,0,8750,timeout,0
4
+ 620002,0,8750,timeout,0
5
+ 620003,0,8750,timeout,0
6
+ 620004,0,8750,timeout,0
7
+ 620005,0,8750,timeout,0
8
+ 620006,0,8750,timeout,0
9
+ 620007,0,8750,timeout,0
10
+ 620008,0,8750,timeout,0
11
+ 620009,0,8750,timeout,0
12
+ 620010,0,8750,timeout,0
13
+ 620011,0,8750,timeout,0
14
+ 620012,0,8750,timeout,0
15
+ 620013,0,8750,timeout,0
16
+ 620014,0,8750,timeout,0
17
+ 620015,0,8750,timeout,0
18
+ 620016,0,8750,timeout,0
19
+ 620017,0,8750,timeout,0
20
+ 620018,0,8750,timeout,0
21
+ 620019,0,8750,timeout,0
22
+ 620020,0,8750,timeout,0
23
+ 620021,0,8750,timeout,0
24
+ 620022,0,8750,timeout,0
25
+ 620023,0,8750,timeout,0
26
+ 620024,0,8750,timeout,0
27
+ 620025,0,6953,terminated,0
28
+ 620026,0,8750,timeout,0
29
+ 620027,0,8750,timeout,0
30
+ 620028,0,8750,timeout,0
31
+ 620029,0,8750,timeout,0
32
+ 620030,0,8750,timeout,0
33
+ 620031,0,8750,timeout,0
34
+ 620032,0,8750,timeout,0
35
+ 620033,0,8750,timeout,0
36
+ 620034,0,8750,timeout,0
37
+ 620035,0,8750,timeout,0
38
+ 620036,0,8750,timeout,0
39
+ 620037,0,8750,timeout,0
40
+ 620038,0,8750,timeout,0
41
+ 620039,0,8750,timeout,0
42
+ 620040,0,8750,timeout,0
43
+ 620041,0,8750,timeout,0
44
+ 620042,0,8750,timeout,0
45
+ 620043,0,8750,timeout,0
46
+ 620044,0,8750,timeout,0
47
+ 620045,0,8750,timeout,0
48
+ 620046,0,8750,timeout,0
49
+ 620047,0,8750,timeout,0
50
+ 620048,0,8750,timeout,0
51
+ 620049,0,8750,timeout,0
52
+ 620050,0,8750,timeout,0
53
+ 620051,0,5937,terminated,0
54
+ 620052,0,8750,timeout,0
55
+ 620053,0,8750,timeout,0
56
+ 620054,0,8750,timeout,0
57
+ 620055,0,8750,timeout,0
58
+ 620056,0,8750,timeout,0
59
+ 620057,0,8750,timeout,0
60
+ 620058,0,8750,timeout,0
61
+ 620059,0,8750,timeout,0
62
+ 620060,0,8750,timeout,0
63
+ 620061,0,8750,timeout,0
64
+ 620062,0,8750,timeout,0
65
+ 620063,0,8750,timeout,0
66
+ 620064,0,8750,timeout,0
67
+ 620065,0,8750,timeout,0
68
+ 620066,0,8750,timeout,0
69
+ 620067,0,8750,timeout,0
70
+ 620068,0,8750,timeout,0
71
+ 620069,0,8750,timeout,0
72
+ 620070,0,8750,timeout,0
73
+ 620071,0,8750,timeout,0
74
+ 620072,0,8750,timeout,0
75
+ 620073,0,8750,timeout,0
76
+ 620074,0,8750,timeout,0
77
+ 620075,0,8750,timeout,0
78
+ 620076,0,8750,timeout,0
79
+ 620077,0,8750,timeout,0
80
+ 620078,0,8750,timeout,0
81
+ 620079,0,8750,timeout,0
82
+ 620080,0,8750,timeout,0
83
+ 620081,0,8750,timeout,0
84
+ 620082,0,8750,timeout,0
85
+ 620083,0,8750,timeout,0
86
+ 620084,0,8750,timeout,0
87
+ 620085,0,8750,timeout,0
88
+ 620086,0,8750,timeout,0
89
+ 620087,0,8750,timeout,0
90
+ 620088,0,8750,timeout,0
91
+ 620089,0,8750,timeout,0
92
+ 620090,0,8750,timeout,0
93
+ 620091,0,8750,timeout,0
94
+ 620092,0,8750,timeout,0
95
+ 620093,0,8750,timeout,0
96
+ 620094,0,8750,timeout,0
97
+ 620095,0,8750,timeout,0
98
+ 620096,0,8750,timeout,0
99
+ 620097,0,8750,timeout,0
100
+ 620098,0,8750,timeout,0
101
+ 620099,0,8750,timeout,0
policies/stack_blocks/opus-s2/policy.py ADDED
@@ -0,0 +1,686 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Stack-blocks policy for the G1: scripted state machine (no learned parts).
2
+
3
+ Geometry: arm forward kinematics of the G1 (link offsets of the Unitree model),
4
+ a pinhole model of the head camera (hand-tuned constants), damped least-squares
5
+ IK, colour segmentation of the red blocks and the green pad, closed-loop base
6
+ navigation on the pelvis pose and wrist-camera centring before each grasp.
7
+ """
8
+
9
+ import cv2
10
+ import numpy as np
11
+
12
+ # ----------------------------------------------------------------------------
13
+ # kinematics
14
+
15
+
16
+ def rx(a):
17
+ c, s = np.cos(a), np.sin(a)
18
+ return np.array([[1, 0, 0], [0, c, -s], [0, s, c]])
19
+
20
+
21
+ def ry(a):
22
+ c, s = np.cos(a), np.sin(a)
23
+ return np.array([[c, 0, s], [0, 1, 0], [-s, 0, c]])
24
+
25
+
26
+ def rz(a):
27
+ c, s = np.cos(a), np.sin(a)
28
+ return np.array([[c, -s, 0], [s, c, 0], [0, 0, 1]])
29
+
30
+
31
+ def quat(w, x, y, z):
32
+ q = np.array([w, x, y, z]) / np.linalg.norm([w, x, y, z])
33
+ w, x, y, z = q
34
+ return np.array([[1 - 2 * (y * y + z * z), 2 * (x * y - z * w), 2 * (x * z + y * w)],
35
+ [2 * (x * y + z * w), 1 - 2 * (x * x + z * z), 2 * (y * z - x * w)],
36
+ [2 * (x * z - y * w), 2 * (y * z + x * w), 1 - 2 * (x * x + y * y)]])
37
+
38
+
39
+ def T(R=None, p=(0, 0, 0)):
40
+ M = np.eye(4)
41
+ if R is not None:
42
+ M[:3, :3] = R
43
+ M[:3, 3] = p
44
+ return M
45
+
46
+
47
+ def torso_T(waist):
48
+ return (T(rz(waist[0])) @ T(None, (-0.0039635, 0, 0.035)) @ T(rx(waist[1]))
49
+ @ T(None, (0, 0, 0.019)) @ T(ry(waist[2])))
50
+
51
+
52
+ _SH = {s: quat(0.990264, s * 0.139201, 0, 0) for s in (1, -1)}
53
+ _SR = {s: quat(0.990268, -s * 0.139172, 0, 0) for s in (1, -1)}
54
+ HAND = 0.24 # wrist_yaw_link -> centre of a grasped block, along the fingers
55
+ HAND_Z = 0.017 # ... and along the hand z axis (measured from a grasp)
56
+
57
+
58
+ def hand_pose(q, side, waist, hand=None):
59
+ if hand is None:
60
+ hand = HAND
61
+ s = side
62
+ M = torso_T(waist)
63
+ M = M @ T(_SH[s], (0.0039563, s * 0.10022, 0.23778)) @ T(ry(q[0]))
64
+ M = M @ T(_SR[s], (0, s * 0.038, -0.013831)) @ T(rx(q[1]))
65
+ M = M @ T(None, (0, s * 0.00624, -0.1032)) @ T(rz(q[2]))
66
+ M = M @ T(None, (0.015783, 0, -0.080518)) @ T(ry(q[3]))
67
+ M = M @ T(None, (0.1, s * 0.00188791, -0.01)) @ T(rx(q[4]))
68
+ M = M @ T(None, (0.038, 0, 0)) @ T(ry(q[5]))
69
+ M = M @ T(None, (0.046, 0, 0)) @ T(rz(q[6]))
70
+ return M @ T(None, (hand, 0, HAND_Z))
71
+
72
+
73
+ QLO = np.array([-3.0892, -1.5882, -2.618, -1.0472, -1.97222, -1.61443, -1.61443])
74
+ QHI = np.array([2.6704, 2.2515, 2.618, 2.0944, 1.97222, 1.61443, 1.61443])
75
+
76
+
77
+ def rot_err(R, Rt):
78
+ E = Rt @ R.T
79
+ return 0.5 * np.array([E[2, 1] - E[1, 2], E[0, 2] - E[2, 0], E[1, 0] - E[0, 1]])
80
+
81
+
82
+ def ik(p_t, R_t, side, waist, q0, iters=12, wrot=0.3):
83
+ q = np.clip(np.array(q0, float), QLO + 0.02, QHI - 0.02)
84
+ for _ in range(iters):
85
+ M = hand_pose(q, side, waist)
86
+ e = np.r_[p_t - M[:3, 3], wrot * rot_err(M[:3, :3], R_t)]
87
+ if np.linalg.norm(e) < 1e-4:
88
+ break
89
+ J = np.zeros((6, 7))
90
+ for k in range(7):
91
+ dq = np.zeros(7)
92
+ dq[k] = 1e-4
93
+ M2 = hand_pose(q + dq, side, waist)
94
+ J[:3, k] = (M2[:3, 3] - M[:3, 3]) / 1e-4
95
+ J[3:, k] = -wrot * rot_err(M2[:3, :3], M[:3, :3]) / 1e-4
96
+ Jp = J.T @ np.linalg.inv(J @ J.T + 0.02 * np.eye(6))
97
+ dq = Jp @ e
98
+ # stay near a comfortable posture in the null space
99
+ rest = Q_REST * np.array([1, side, side, 1, side, 1, side])
100
+ dq += (np.eye(7) - Jp @ J) @ (NS_GAIN * (rest - q))
101
+ q = np.clip(q + dq, QLO + 0.02, QHI - 0.02)
102
+ return q
103
+
104
+
105
+ Q_REST = np.array([-0.5, 0.25, 0.0, 0.6, 0.0, 0.6, 0.0])
106
+ NS_GAIN = 0.0
107
+
108
+
109
+ # ----------------------------------------------------------------------------
110
+ # head camera (torso frame), constants tuned against the robot's own arm
111
+
112
+ CAMP = np.array([0.101472, 0.010612, 0.364666, 1.004299, -0.003941, 0.002519, 1.063025])
113
+ CAM_R = rz(CAMP[4]) @ ry(CAMP[3]) @ rx(CAMP[5])
114
+ CAM_F = 42.0 / np.tan(CAMP[6] / 2)
115
+
116
+
117
+ def pixel_ray(u, v, waist):
118
+ d_cam = np.array([1.0, -(u - 42) / CAM_F, -(v - 42) / CAM_F])
119
+ Tt = torso_T(waist)
120
+ R = Tt[:3, :3] @ CAM_R
121
+ o = Tt[:3, :3] @ CAMP[:3] + Tt[:3, 3]
122
+ return o, R @ d_cam
123
+
124
+
125
+ def pixel_to_plane(u, v, waist, z):
126
+ o, d = pixel_ray(u, v, waist)
127
+ return o + (z - o[2]) / d[2] * d
128
+
129
+
130
+ def project(pp, waist):
131
+ Tt = torso_T(waist)
132
+ pt = Tt[:3, :3].T @ (pp - Tt[:3, 3])
133
+ d = CAM_R.T @ (pt - CAMP[:3])
134
+ return np.array([42 + CAM_F * (-d[1]) / d[0], 42 - CAM_F * d[2] / d[0]])
135
+
136
+
137
+ # ----------------------------------------------------------------------------
138
+ # vision
139
+
140
+
141
+ def red_mask(im):
142
+ r, g, b = [im[..., i].astype(int) for i in range(3)]
143
+ return ((r > 100) & (r > 2 * g + 20) & (r > 2 * b + 20)).astype(np.uint8)
144
+
145
+
146
+ def green_mask(im):
147
+ r, g, b = [im[..., i].astype(int) for i in range(3)]
148
+ return ((g > 120) & (g > r + 40) & (g > b + 40)).astype(np.uint8)
149
+
150
+
151
+ def blobs(mask, min_area=6):
152
+ n, lab, st, cen = cv2.connectedComponentsWithStats(mask)
153
+ out = []
154
+ for i in range(1, n):
155
+ x, y, w, hh, area = st[i]
156
+ if area < min_area:
157
+ continue
158
+ edge = x == 0 or y == 0 or x + w >= mask.shape[1] or y + hh >= mask.shape[0]
159
+ out.append(dict(c=cen[i], area=int(area), bbox=(x, y, w, hh), edge=bool(edge)))
160
+ return out
161
+
162
+
163
+ def wrap(a):
164
+ return (a + np.pi) % (2 * np.pi) - np.pi
165
+
166
+
167
+ # ----------------------------------------------------------------------------
168
+ # task constants (FK-world frame)
169
+
170
+ Z_TABLE = 0.655 # table top
171
+ BLOCK = 0.05 # block edge
172
+ TILT = np.radians(45) # gripper pitch below horizontal while placing
173
+ GTILT = np.radians(45) # gripper pitch below horizontal while grasping
174
+ PITCH = 0.15 # torso pitch while manipulating
175
+ REACH = 0.42 # pelvis->target forward distance used to stand
176
+ SIDE_OFF = 0.15 # lateral offset of the hand used w.r.t. the pelvis
177
+ CAMS = {1: 'left_wrist', -1: 'right_wrist'}
178
+ DEBUG = False
179
+ PRE = 0.108 # height above the block of the wrist-camera reference view
180
+ REF_UV = (43.0, 37.3) # block centre in the wrist image, hand PRE above a good grasp
181
+ PAD_OFF = np.zeros(3) # pad centre vs. the wrist-servo estimate
182
+ SERVO_GAIN = 430.0 # wrist image px per metre of hand motion at PRE
183
+ CORR_GAIN = 0.07 # per-step integral gain of the gravity-sag correction
184
+
185
+
186
+ class Policy:
187
+ """Scripted policy: generator-based state machine."""
188
+
189
+ def reset(self, obs, tools):
190
+ self.tools = tools
191
+ self.obs = obs
192
+ self.a = np.asarray(tools.hold_action(), dtype=np.float64)
193
+ lo = obs['low_dim_obs']
194
+ self.q = {1: lo[3:10].astype(float).copy(), -1: lo[12:19].astype(float).copy()}
195
+ self.corr = {1: np.zeros(3), -1: np.zeros(3)}
196
+ self.tgt = {1: None, -1: None}
197
+ self.frame = {1: 'world', -1: 'world'}
198
+ self.R = {1: ry(TILT), -1: ry(TILT)}
199
+ self.grip = {1: 0.0, -1: 0.0}
200
+ self.base_cmd = np.zeros(3)
201
+ self.held = {1: None, -1: None}
202
+ self.stack = [] # world positions of the placed blocks
203
+ self.log = []
204
+ self.dbg = []
205
+ self.gen = self.main()
206
+ self.done = False
207
+
208
+ # ------------------------------------------------------------------ io
209
+ def act(self, obs, tools):
210
+ self.obs = obs
211
+ if not self.done:
212
+ try:
213
+ return next(self.gen)
214
+ except StopIteration:
215
+ self.done = True
216
+ except Exception as exc: # never crash the episode
217
+ self.log.append(('error', repr(exc)))
218
+ self.done = True
219
+ self.base_cmd = np.zeros(3)
220
+ try:
221
+ return self.compose()
222
+ except Exception:
223
+ return self.a.astype(np.float32).copy()
224
+
225
+ @property
226
+ def lo(self):
227
+ return np.asarray(self.obs['low_dim_obs'], dtype=np.float64)
228
+
229
+ def pose(self):
230
+ return self.lo[21:25]
231
+
232
+ def w2p(self, pw):
233
+ x, y, z, yaw = self.pose()
234
+ d = np.asarray(pw) - np.array([x, y, z])
235
+ c, s = np.cos(yaw), np.sin(yaw)
236
+ return np.array([c * d[0] + s * d[1], -s * d[0] + c * d[1], d[2]])
237
+
238
+ def p2w(self, pp):
239
+ x, y, z, yaw = self.pose()
240
+ c, s = np.cos(yaw), np.sin(yaw)
241
+ return np.array([x + c * pp[0] - s * pp[1], y + s * pp[0] + c * pp[1], z + pp[2]])
242
+
243
+ def hand_w(self, side):
244
+ lo = self.lo
245
+ q = lo[3:10] if side > 0 else lo[12:19]
246
+ return self.p2w(hand_pose(q, side, lo[0:3])[:3, 3])
247
+
248
+ def hand_p(self, side):
249
+ lo = self.lo
250
+ q = lo[3:10] if side > 0 else lo[12:19]
251
+ return hand_pose(q, side, lo[0:3])[:3, 3]
252
+
253
+ # ------------------------------------------------------------- control
254
+ def compose(self):
255
+ lo = self.lo
256
+ yaw = lo[24]
257
+ for side in (1, -1):
258
+ t = self.tgt[side]
259
+ if t is None:
260
+ continue
261
+ if self.frame[side] == 'world':
262
+ cur = self.hand_w(side)
263
+ tp_frame = t
264
+ else:
265
+ cur = self.hand_p(side)
266
+ tp_frame = t
267
+ err = tp_frame - cur
268
+ if self.frame[side] == 'world':
269
+ # slow integral term against gravity sag (fast gains oscillate)
270
+ self.corr[side] = np.clip(self.corr[side] + CORR_GAIN * err, -0.05, 0.05)
271
+ pc = tp_frame + self.corr[side]
272
+ if self.frame[side] == 'world':
273
+ pp = self.w2p(pc)
274
+ Rp = rz(-yaw) @ self.R[side]
275
+ else:
276
+ pp = pc
277
+ Rp = self.R[side]
278
+ self.q[side] = ik(pp, Rp, side, lo[0:3], self.q[side])
279
+ sl = slice(5, 12) if side > 0 else slice(12, 19)
280
+ self.a[sl] = self.q[side]
281
+ self.a[19] = self.grip[1]
282
+ self.a[20] = self.grip[-1]
283
+ self.a[0], self.a[1], self.a[3] = self.base_cmd
284
+ return self.a.astype(np.float32).copy()
285
+
286
+ def hold(self, n):
287
+ for _ in range(n):
288
+ yield self.compose()
289
+
290
+ def move(self, targets, n, frame=None):
291
+ """targets {side: point}; smooth interpolation in the side's frame."""
292
+ start = {}
293
+ for s, p in targets.items():
294
+ f = frame or self.frame[s]
295
+ if self.tgt[s] is None or f != self.frame[s]:
296
+ start[s] = self.hand_w(s) if f == 'world' else self.hand_p(s)
297
+ self.corr[s] = np.zeros(3)
298
+ else:
299
+ start[s] = self.tgt[s]
300
+ self.frame[s] = f
301
+ for k in range(n):
302
+ t = 0.5 - 0.5 * np.cos(np.pi * (k + 1) / n)
303
+ for s, p in targets.items():
304
+ self.tgt[s] = start[s] + (np.asarray(p, float) - start[s]) * t
305
+ yield self.compose()
306
+
307
+ def walk(self, x, y, yaw, maxn=900, tol=0.025, ytol=0.04, vmax=0.5, face=False):
308
+ """closed-loop walk to a world pose; with face=True turn toward the goal first."""
309
+ # arms keep their pose relative to the pelvis while walking
310
+ yaw0 = self.pose()[3]
311
+ for s in (1, -1):
312
+ if self.tgt[s] is not None and self.frame[s] == 'world':
313
+ self.tgt[s] = self.w2p(self.tgt[s])
314
+ self.R[s] = rz(-yaw0) @ self.R[s]
315
+ self.frame[s] = 'pelvis'
316
+ self.corr[s] = np.zeros(3)
317
+ best, best_i = 1e9, 0
318
+ for i in range(maxn):
319
+ px, py, _, pyaw = self.pose()
320
+ dx, dy = x - px, y - py
321
+ dist = np.hypot(dx, dy)
322
+ if dist < tol and abs(wrap(yaw - pyaw)) < ytol:
323
+ break
324
+ tyaw = yaw
325
+ if face and dist > 0.3:
326
+ tyaw = np.arctan2(dy, dx)
327
+ prog = dist + 0.3 * abs(wrap(tyaw - pyaw))
328
+ if prog < best - 0.01:
329
+ best, best_i = prog, i
330
+ elif i - best_i > 200:
331
+ self.log.append(('walk stalled', self.obs['t'], round(float(dist), 3)))
332
+ break
333
+ if face and dist > 0.3:
334
+ tyaw = np.arctan2(dy, dx)
335
+ c, s = np.cos(pyaw), np.sin(pyaw)
336
+ bx, by = c * dx + s * dy, -s * dx + c * dy
337
+ vx, vy = 1.5 * bx, 1.5 * by
338
+ n = np.hypot(vx, vy)
339
+ if n > vmax:
340
+ vx, vy = vx * vmax / n, vy * vmax / n
341
+ ey = wrap(tyaw - pyaw)
342
+ if face and dist > 0.3 and abs(ey) > 0.5:
343
+ vx, vy = 0.0, 0.0
344
+ if np.hypot(vx, vy) < 0.06:
345
+ if dist > tol:
346
+ k = 0.06 / max(np.hypot(vx, vy), 1e-6)
347
+ vx, vy = vx * k, vy * k
348
+ else:
349
+ vx = vy = 0.0
350
+ wz = np.clip(2.0 * ey, -0.8, 0.8)
351
+ if abs(wz) < 0.05:
352
+ wz = 0.0
353
+ self.base_cmd = np.array([vx, vy, wz])
354
+ yield self.compose()
355
+ self.base_cmd = np.zeros(3)
356
+ yield from self.hold(10)
357
+
358
+ # ------------------------------------------------------------- vision
359
+ def head_blobs(self, mask_fn, z, min_area=6):
360
+ im = self.tools.image('head')
361
+ lo = self.lo
362
+ out = []
363
+ for b in blobs(mask_fn(im), min_area):
364
+ p = pixel_to_plane(b['c'][0], b['c'][1], lo[0:3], z - lo[23])
365
+ b['w'] = self.p2w(p)
366
+ out.append(b)
367
+ return out
368
+
369
+ def wrist_block(self, side):
370
+ bl = blobs(red_mask(self.tools.image(CAMS[side])), 20)
371
+ return max(bl, key=lambda b: b['area']) if bl else None
372
+
373
+ def wrist_block_angle(self, side):
374
+ """angle (rad, in [-pi/4, pi/4)) of the block's top face edges in the wrist image."""
375
+ im = self.tools.image(CAMS[side])
376
+ r, g, b = [im[..., i].astype(int) for i in range(3)]
377
+ m = red_mask(im)
378
+ n, lab, st, cen = cv2.connectedComponentsWithStats(m)
379
+ if n < 2:
380
+ return None
381
+ i = 1 + int(np.argmax(st[1:, 4]))
382
+ if st[i, 4] < 30:
383
+ return None
384
+ ys, xs = np.nonzero(lab == i)
385
+ pts = np.stack([xs, ys], 1).astype(np.float32)
386
+ (cx, cy), (w, hh), ang = cv2.minAreaRect(pts)
387
+ a = np.radians(ang)
388
+ return (a + np.pi / 4) % (np.pi / 2) - np.pi / 4
389
+
390
+ # ------------------------------------------------------------- skills
391
+ def tuck(self, sides, n=50):
392
+ """carry pose in the pelvis frame, reached by joint interpolation to a canonical
393
+ IK solution so that later IK always starts from the same arm branch."""
394
+ lo = self.lo
395
+ goal, start, tg = {}, {}, {}
396
+ for s in sides:
397
+ tg[s] = np.array([0.38, 0.20 * s, 0.02])
398
+ self.R[s] = ry(0.6)
399
+ seed = np.array([-0.3, 0.3 * s, 0.0, 0.9, 0.0, 0.3, 0.0])
400
+ goal[s] = ik(tg[s], self.R[s], s, lo[0:3], seed, iters=150)
401
+ start[s] = self.q[s].copy()
402
+ self.tgt[s] = None
403
+ for k in range(n):
404
+ t = 0.5 - 0.5 * np.cos(np.pi * (k + 1) / n)
405
+ for s in sides:
406
+ self.q[s] = start[s] + (goal[s] - start[s]) * t
407
+ sl = slice(5, 12) if s > 0 else slice(12, 19)
408
+ self.a[sl] = self.q[s]
409
+ yield self.compose()
410
+ for s in sides:
411
+ self.tgt[s] = tg[s]
412
+ self.frame[s] = 'pelvis'
413
+ self.corr[s] = np.zeros(3)
414
+
415
+ def settle(self, s, tol=0.008, nmax=80):
416
+ """hold until the hand is within tol of its target."""
417
+ for k in range(nmax):
418
+ cur = self.hand_w(s) if self.frame[s] == 'world' else self.hand_p(s)
419
+ if np.linalg.norm(self.tgt[s] - cur) < tol and k >= 10:
420
+ break
421
+ yield self.compose()
422
+
423
+ def wrist_target(self, side, mask_fn=red_mask):
424
+ """blob in the wrist image closest to the reference position."""
425
+ bl = blobs(mask_fn(self.tools.image(CAMS[side])), 20)
426
+ if not bl:
427
+ return None
428
+ return min(bl, key=lambda b: np.hypot(b['c'][0] - REF_UV[0], b['c'][1] - REF_UV[1]))
429
+
430
+ def servo(self, s, P, yaw, iters=8, mask_fn=red_mask, gain=SERVO_GAIN):
431
+ """move the hand (pre-grasp height) until the wrist view matches REF_UV."""
432
+ c, sn = np.cos(yaw), np.sin(yaw)
433
+ for it in range(iters):
434
+ wb = self.wrist_target(s, mask_fn)
435
+ if wb is None:
436
+ break
437
+ du = REF_UV[0] - wb['c'][0]
438
+ dv = REF_UV[1] - wb['c'][1]
439
+ if abs(du) < 1.5 and abs(dv) < 1.5:
440
+ break
441
+ # hand +y -> block +u, hand +x -> block +v (hand frame, gripper yaw)
442
+ bx = np.clip(dv / gain, -0.03, 0.03)
443
+ by = np.clip(du / gain, -0.03, 0.03)
444
+ P = P + np.array([c * bx - sn * by, sn * bx + c * by, 0])
445
+ yield from self.move({s: P}, 20)
446
+ yield from self.hold(12)
447
+ return P
448
+
449
+ def locate(self, s, est, pad=False):
450
+ """precise FK-world centre of a block (or of the pad) seen by the free hand `s`."""
451
+ yaw = self.pose()[3]
452
+ self.R[s] = rz(yaw) @ ry(GTILT)
453
+ dz = PRE + (BLOCK / 2 if pad else 0.0)
454
+ P = np.array(est, float) + [0, 0, dz]
455
+ yield from self.move({s: P}, 60, frame='world')
456
+ yield from self.hold(15)
457
+ yield from self.servo(s, P, yaw, mask_fn=green_mask if pad else red_mask)
458
+ yield from self.hold(10)
459
+ c = self.hand_w(s) - [0, 0, dz]
460
+ if pad:
461
+ c = c + PAD_OFF
462
+ self.log.append(('locate', s, pad, np.round(est, 3).tolist(), c.round(3).tolist()))
463
+ return c
464
+
465
+ def grasp(self, side, B, pre=PRE):
466
+ """B: world estimate of the block centre; returns True if holding."""
467
+ s = side
468
+ yaw = self.pose()[3]
469
+ self.R[s] = rz(yaw) @ ry(GTILT)
470
+ self.grip[s] = 0.0
471
+ P = np.array(B, float) + [0, 0, pre]
472
+ yield from self.move({s: P}, 60, frame='world')
473
+ yield from self.hold(15)
474
+ if self.wrist_target(s) is None:
475
+ # block not in view: look from higher up (wider view), centre coarsely
476
+ P = P + [0, 0, 0.06]
477
+ yield from self.move({s: P}, 30)
478
+ yield from self.hold(10)
479
+ P = yield from self.servo(s, P, yaw, iters=4, gain=0.6 * SERVO_GAIN)
480
+ P = P - [0, 0, 0.06]
481
+ yield from self.move({s: P}, 30)
482
+ yield from self.hold(10)
483
+ P = yield from self.servo(s, P, yaw)
484
+ ang = self.wrist_block_angle(s)
485
+ self.log.append(('angle', s, None if ang is None else round(float(ang), 3)))
486
+ if ang is not None and abs(ang) > 0.12:
487
+ # turn the gripper onto the block faces; each wrist turns away from its
488
+ # yaw joint limit (the block is symmetric under 90 deg turns)
489
+ psi = -ang
490
+ if psi * s > 0.15:
491
+ psi -= s * np.pi / 2
492
+ for k in range(50):
493
+ self.R[s] = rz(yaw + psi * (k + 1) / 50) @ ry(GTILT)
494
+ yield self.compose()
495
+ yield from self.hold(15)
496
+ P = yield from self.servo(s, P, yaw + psi)
497
+ if DEBUG:
498
+ wb = self.wrist_block(s)
499
+ self.dbg.append(('pre', s, None if wb is None else (wb['c'].round(1).tolist(), wb['area']),
500
+ (self.hand_w(s) - P).round(3).tolist(),
501
+ self.tools.image(CAMS[s]), self.tools.image('head')))
502
+ # descend from where the hand actually is when the view matched the reference
503
+ G = self.hand_w(s) - [0, 0, pre]
504
+ yield from self.move({s: G}, 40)
505
+ yield from self.hold(10)
506
+ self.grip[s] = 1.0
507
+ yield from self.hold(30)
508
+ lo = self.lo
509
+ f = lo[10:12] if s > 0 else lo[19:21]
510
+ self.log.append(('close', s, f.round(3).tolist()))
511
+ if DEBUG:
512
+ self.dbg.append(('close', s, f.round(3).tolist(), (self.hand_w(s) - G).round(3).tolist(),
513
+ self.tools.image(CAMS[s]), self.tools.image('head')))
514
+ yield from self.move({s: G + [0, 0, 0.06]}, 40)
515
+ yield from self.hold(10)
516
+ lo = self.lo
517
+ f = lo[10:12] if s > 0 else lo[19:21]
518
+ wb = self.wrist_block(s)
519
+ area = 0 if wb is None else wb['area']
520
+ ok = bool(np.all(f > -0.017)) and area > 1200
521
+ self.log.append(('grasp', self.obs['t'], s, f.round(3).tolist(), area, ok))
522
+ self.held[s] = ok
523
+ return ok
524
+
525
+ def find_blocks(self, zc=None):
526
+ """blocks on a table (blobs of blocks held in a hand are dropped)."""
527
+ zc = Z_TABLE + BLOCK / 2 if zc is None else zc
528
+ bl = self.head_blobs(red_mask, zc)
529
+ lo = self.lo
530
+ hp = [project(self.hand_p(s), lo[0:3]) for s in (1, -1) if self.held[s]]
531
+ out = []
532
+ for b in bl:
533
+ if any(np.hypot(*(b['c'] - p)) < 10 for p in hp):
534
+ continue
535
+ out.append(b['w'])
536
+ return out
537
+
538
+ def pick(self, side, B):
539
+ """walk in front of block estimate B and grasp it with `side`."""
540
+ for attempt in range(3):
541
+ yield from self.walk(B[0] - REACH, B[1] - side * SIDE_OFF, 0.0)
542
+ yield from self.hold(10)
543
+ cand = self.find_blocks()
544
+ if cand:
545
+ B = min(cand, key=lambda b: np.linalg.norm(b[:2] - B[:2]))
546
+ ok = yield from self.grasp(side, B)
547
+ if ok:
548
+ break
549
+ self.grip[side] = 0.0
550
+ yield from self.move({side: B + [-0.12, 0, 0.12]}, 30)
551
+ yield from self.tuck([side])
552
+ return ok
553
+
554
+ def to_table2(self):
555
+ """table 1 (facing +x) -> viewing pose in front of table 2 (facing -x)."""
556
+ yield from self.walk(self.pose()[0] - 0.25, self.pose()[1], 0.0)
557
+ yield from self.walk(-0.25, 1.3, 0.0, face=True, tol=0.08, ytol=7)
558
+ yield from self.walk(2.6, 1.3, 0.0, face=True, tol=0.08, ytol=7)
559
+ yield from self.walk(2.6, 0.0, np.pi, face=True, tol=0.05, ytol=7)
560
+ yield from self.walk(2.35, 0.0, np.pi)
561
+
562
+ def to_table1(self):
563
+ yield from self.walk(self.pose()[0] + 0.25, self.pose()[1], np.pi)
564
+ yield from self.walk(2.6, 1.3, np.pi, face=True, tol=0.08, ytol=7)
565
+ yield from self.walk(-0.25, 1.3, np.pi, face=True, tol=0.08, ytol=7)
566
+ yield from self.walk(-0.25, 0.0, 0.0, face=True, tol=0.05, ytol=7)
567
+ yield from self.walk(0.05, 0.0, 0.0)
568
+
569
+ def find_pad(self):
570
+ bl = self.head_blobs(green_mask, Z_TABLE, min_area=4)
571
+ if not bl:
572
+ return None
573
+ b = max(bl, key=lambda b: b['area'])
574
+ return b['w']
575
+
576
+ def place(self, side, C):
577
+ """lower the block held by `side` until its centre is at world point C, release."""
578
+ s = side
579
+ yaw = self.pose()[3]
580
+ self.R[s] = rz(yaw) @ ry(TILT)
581
+ C = np.array(C, float)
582
+ above = C + [0, 0, 0.07]
583
+ yield from self.move({s: above}, 60, frame='world')
584
+ yield from self.settle(s)
585
+ yield from self.move({s: C + [0, 0, 0.008]}, 40)
586
+ yield from self.settle(s, nmax=60)
587
+ top = self.hand_w(s)
588
+ self.grip[s] = 0.0
589
+ yield from self.hold(25)
590
+ self.tgt[s] = self.hand_w(s)
591
+ self.corr[s] = np.zeros(3)
592
+ yield from self.move({s: self.tgt[s] + [0, 0, 0.08]}, 40)
593
+ self.held[s] = None
594
+ self.log.append(('placed', self.obs['t'], s, C.round(3).tolist(), top.round(3).tolist()))
595
+ return top
596
+
597
+ def stand_for(self, side, target, yaw):
598
+ """walk so that world xy `target` sits at (REACH, side*SIDE_OFF) in the pelvis frame."""
599
+ c, s_ = np.cos(yaw), np.sin(yaw)
600
+ rel = np.array([REACH, side * SIDE_OFF])
601
+ bx = target[0] - (c * rel[0] - s_ * rel[1])
602
+ by = target[1] - (s_ * rel[0] + c * rel[1])
603
+ yield from self.walk(bx, by, yaw)
604
+ yield from self.hold(15)
605
+
606
+ def stand_at(self, C, yaw, lateral=0.0):
607
+ """walk so that world xy C sits at (REACH, lateral) in the pelvis frame."""
608
+ c, s_ = np.cos(yaw), np.sin(yaw)
609
+ bx = C[0] - (c * REACH - s_ * lateral)
610
+ by = C[1] - (s_ * REACH + c * lateral)
611
+ yield from self.walk(bx, by, yaw)
612
+ yield from self.hold(15)
613
+
614
+ def view_pad(self):
615
+ """from the viewing pose, find the pad and stand in front of it (facing -x)."""
616
+ pad = self.find_pad()
617
+ if pad is None:
618
+ for dy in (0.4, -0.4):
619
+ yield from self.walk(2.35, dy, np.pi)
620
+ pad = self.find_pad()
621
+ if pad is not None:
622
+ break
623
+ if pad is None:
624
+ pad = np.array([1.55, 0.0, Z_TABLE])
625
+ yield from self.stand_at(pad, np.pi)
626
+ p2 = self.find_pad()
627
+ if p2 is not None:
628
+ pad = p2
629
+ self.log.append(('pad', self.obs['t'], pad.round(3).tolist()))
630
+ return pad
631
+
632
+ def stack_trip1(self):
633
+ """both hands hold a block; robot stands with the pad at (REACH, 0)."""
634
+ pad = yield from self.view_pad()
635
+ PC = np.array([pad[0], pad[1], Z_TABLE + BLOCK / 2])
636
+ # each hand works on its own side: pad in front of the left hand
637
+ yield from self.stand_at(PC, np.pi, lateral=SIDE_OFF)
638
+ # a. right block set down in front of the right hand, right arm out of the way
639
+ spot = self.p2w(np.array([REACH, -SIDE_OFF, 0.0]))
640
+ spot[2] = Z_TABLE + BLOCK / 2
641
+ spot = yield from self.place(-1, spot)
642
+ yield from self.tuck([-1])
643
+ # b. left block onto the pad; the hand position at release is where it sits
644
+ B1 = yield from self.place(1, PC)
645
+ yield from self.tuck([1])
646
+ # c. right hand picks the set-down block up again
647
+ ok = yield from self.grasp(-1, spot)
648
+ if ok:
649
+ yield from self.tuck([-1])
650
+ # d. step sideways so the stack is in front of the right hand
651
+ yield from self.stand_at(B1, np.pi, lateral=-SIDE_OFF)
652
+ yield from self.place(-1, B1 + [0, 0, BLOCK])
653
+ yield from self.tuck([-1])
654
+ return B1
655
+
656
+ def main(self):
657
+ self.a[4] = PITCH
658
+ yield from self.hold(40)
659
+ blocks = self.find_blocks()
660
+ self.log.append(('blocks', [b.round(3).tolist() for b in blocks]))
661
+ blocks = sorted(blocks, key=lambda b: -b[1])
662
+ if len(blocks) < 2:
663
+ return
664
+ yield from self.pick(-1, blocks[-1])
665
+ yield from self.pick(1, blocks[0])
666
+ self.rest = blocks[1:-1]
667
+ yield from self.to_table2()
668
+ B1 = yield from self.stack_trip1()
669
+ self.B1 = B1
670
+ yield from self.trip2(B1)
671
+
672
+ def trip2(self, B1):
673
+ s = -1
674
+ yield from self.to_table1()
675
+ cand = self.find_blocks()
676
+ if not cand:
677
+ return
678
+ B = min(cand, key=lambda b: abs(b[1]))
679
+ ok = yield from self.pick(s, B)
680
+ if not ok:
681
+ return
682
+ yield from self.to_table2()
683
+ yield from self.stand_at(B1, np.pi, lateral=s * SIDE_OFF)
684
+ yield from self.place(s, B1 + [0, 0, 2 * BLOCK])
685
+ yield from self.tuck([s])
686
+ yield from self.hold(100)
policies/stack_blocks/opus-s3/cam.py ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Head camera model (fitted from robot-motion observations of static blocks)."""
2
+ import numpy as np
3
+ import fk
4
+
5
+ CAM = np.array([0.0879, 0.0304, 0.3378, 0.8672, 0.0061, 0.0083, 66.0443])
6
+ # head camera at the initial state (t=0), fitted to wrist-measured block positions
7
+ CAM0 = np.array([0.0862, 0.0096, 0.3415, 0.9988, -0.0457, -0.045, 74.1238])
8
+ PEL0 = np.array([0.109, -0.003, 0.747, 0.001])
9
+ WAIST0 = np.array([0.001, -0.009, 0.053])
10
+ # wrist cameras in the hand (wrist-yaw) frame: x, y, z, roll, pitch, yaw, f
11
+ WCAM = {
12
+ 'left': np.array([0.1158, -0.0003, 0.0244, 0.0089, 0.6207, 0.0309, 70.3616]),
13
+ 'right': np.array([0.1158, 0.0003, 0.0244, -0.0089, 0.6207, -0.0309, 70.3616]), # mirror of left
14
+ }
15
+
16
+
17
+ def wrist_offset(side):
18
+ c = WCAM[side]
19
+ return fk.T(fk.rpy(c[3], c[4], c[5]), c[0:3])
20
+
21
+
22
+ def wrist_point(side, depth):
23
+ """hand-frame point at `depth` along the wrist camera axis."""
24
+ M = wrist_offset(side)
25
+ return M[:3, 3] + depth * M[:3, 0]
26
+
27
+
28
+ def wrist_ray(side, Thand, uv):
29
+ """origin and direction (frame of Thand) of the ray through pixel uv."""
30
+ c = WCAM[side]
31
+ Tc = Thand @ wrist_offset(side)
32
+ d = np.array([c[6], 42 - uv[0], 42 - uv[1]])
33
+ return Tc[:3, 3], Tc[:3, :3] @ d / np.linalg.norm(d)
34
+
35
+
36
+ def head_T(pel, waist, ppitch=0.0, c=CAM):
37
+ Wp = fk.T(fk.rot('z', pel[3]) @ fk.rot('y', ppitch), (pel[0], pel[1], pel[2]))
38
+ return Wp @ fk.torso_T(waist) @ fk.T(fk.rpy(c[5], c[3], c[4]), c[0:3])
39
+
40
+
41
+ def project(Tc, P, f=CAM[6]):
42
+ d = Tc[:3, :3].T @ (np.asarray(P) - Tc[:3, 3])
43
+ return np.array([42 - f * d[1] / d[0], 42 - f * d[2] / d[0]])
44
+
45
+
46
+ def ray_plane(Tc, uv, z, f=CAM[6]):
47
+ """World point where the pixel ray hits the horizontal plane at height z."""
48
+ d = np.array([f, 42 - uv[0], 42 - uv[1]])
49
+ dw = Tc[:3, :3] @ d
50
+ t = (z - Tc[2, 3]) / dw[2]
51
+ return Tc[:3, 3] + t * dw
policies/stack_blocks/opus-s3/episodes.csv ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ seed,success,length,termination,fell
2
+ 620000,0,8750,timeout,0
3
+ 620001,0,8750,timeout,0
4
+ 620002,0,8750,timeout,0
5
+ 620003,0,8750,timeout,0
6
+ 620004,0,8750,timeout,0
7
+ 620005,0,8750,timeout,0
8
+ 620006,0,8750,timeout,0
9
+ 620007,0,8750,timeout,0
10
+ 620008,0,2987,terminated,0
11
+ 620009,0,8750,timeout,0
12
+ 620010,0,8750,timeout,0
13
+ 620011,0,3065,terminated,0
14
+ 620012,0,8750,timeout,0
15
+ 620013,0,8750,timeout,0
16
+ 620014,0,8750,timeout,0
17
+ 620015,0,8750,timeout,0
18
+ 620016,0,8750,timeout,0
19
+ 620017,0,8750,timeout,0
20
+ 620018,0,8750,timeout,0
21
+ 620019,0,8750,timeout,0
22
+ 620020,0,8750,timeout,0
23
+ 620021,0,8750,timeout,0
24
+ 620022,0,8750,timeout,0
25
+ 620023,0,8750,timeout,0
26
+ 620024,0,8750,timeout,0
27
+ 620025,0,8750,timeout,0
28
+ 620026,0,8750,timeout,0
29
+ 620027,0,8750,timeout,0
30
+ 620028,0,8750,timeout,0
31
+ 620029,0,8750,timeout,0
32
+ 620030,0,8750,timeout,0
33
+ 620031,0,8750,timeout,0
34
+ 620032,0,8750,timeout,0
35
+ 620033,0,8750,timeout,0
36
+ 620034,0,8750,timeout,0
37
+ 620035,0,8750,timeout,0
38
+ 620036,0,8750,timeout,0
39
+ 620037,0,8750,timeout,0
40
+ 620038,0,8750,timeout,0
41
+ 620039,0,8750,timeout,0
42
+ 620040,0,8750,timeout,0
43
+ 620041,0,8750,timeout,0
44
+ 620042,0,8750,timeout,0
45
+ 620043,0,8750,timeout,0
46
+ 620044,1,6263,success,0
47
+ 620045,0,8750,timeout,0
48
+ 620046,0,8750,timeout,0
49
+ 620047,0,8750,timeout,0
50
+ 620048,0,8750,timeout,0
51
+ 620049,0,8750,timeout,0
52
+ 620050,0,8750,timeout,0
53
+ 620051,0,8750,timeout,0
54
+ 620052,0,3155,terminated,0
55
+ 620053,0,8750,timeout,0
56
+ 620054,0,8750,timeout,0
57
+ 620055,0,8750,timeout,0
58
+ 620056,0,8750,timeout,0
59
+ 620057,0,8750,timeout,0
60
+ 620058,0,8750,timeout,0
61
+ 620059,0,8750,timeout,0
62
+ 620060,0,8750,timeout,0
63
+ 620061,0,8750,timeout,0
64
+ 620062,0,8750,timeout,0
65
+ 620063,0,8750,timeout,0
66
+ 620064,0,8750,timeout,0
67
+ 620065,0,8750,timeout,0
68
+ 620066,0,8750,timeout,0
69
+ 620067,0,8750,timeout,0
70
+ 620068,0,8750,timeout,0
71
+ 620069,0,6399,terminated,0
72
+ 620070,0,8750,timeout,0
73
+ 620071,0,8750,timeout,0
74
+ 620072,0,8750,timeout,0
75
+ 620073,0,3037,terminated,0
76
+ 620074,0,8750,timeout,0
77
+ 620075,0,8750,timeout,0
78
+ 620076,0,8750,timeout,0
79
+ 620077,0,8750,timeout,0
80
+ 620078,0,8750,timeout,0
81
+ 620079,0,8750,timeout,0
82
+ 620080,0,8750,timeout,0
83
+ 620081,0,8750,timeout,0
84
+ 620082,0,8750,timeout,0
85
+ 620083,0,8750,timeout,0
86
+ 620084,0,8750,timeout,0
87
+ 620085,0,8750,timeout,0
88
+ 620086,0,8750,timeout,0
89
+ 620087,0,8750,timeout,0
90
+ 620088,0,8750,timeout,0
91
+ 620089,0,6365,terminated,0
92
+ 620090,0,8750,timeout,0
93
+ 620091,0,8750,timeout,0
94
+ 620092,0,8750,timeout,0
95
+ 620093,0,8750,timeout,0
96
+ 620094,0,8750,timeout,0
97
+ 620095,0,8750,timeout,0
98
+ 620096,0,8750,timeout,0
99
+ 620097,0,8750,timeout,0
100
+ 620098,0,8750,timeout,0
101
+ 620099,0,8750,timeout,0
policies/stack_blocks/opus-s3/fk.py ADDED
@@ -0,0 +1,132 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Forward kinematics of the G1 upper body (URDF geometry), pelvis frame."""
2
+ import numpy as np
3
+
4
+
5
+ def rot(axis, a):
6
+ c, s = np.cos(a), np.sin(a)
7
+ if axis == 'x':
8
+ return np.array([[1, 0, 0], [0, c, -s], [0, s, c]])
9
+ if axis == 'y':
10
+ return np.array([[c, 0, s], [0, 1, 0], [-s, 0, c]])
11
+ return np.array([[c, -s, 0], [s, c, 0], [0, 0, 1]])
12
+
13
+
14
+ def rpy(r, p, y):
15
+ return rot('z', y) @ rot('y', p) @ rot('x', r)
16
+
17
+
18
+ def T(R=None, p=(0, 0, 0)):
19
+ M = np.eye(4)
20
+ if R is not None:
21
+ M[:3, :3] = R
22
+ M[:3, 3] = p
23
+ return M
24
+
25
+
26
+ def torso_T(waist):
27
+ """pelvis -> torso_link given waist (yaw, roll, pitch)."""
28
+ M = T(rot('z', waist[0]))
29
+ M = M @ T(rot('x', waist[1]), (-0.0039635, 0, 0.035))
30
+ M = M @ T(rot('y', waist[2]), (0, 0, 0.019))
31
+ return M
32
+
33
+
34
+ # (origin xyz, origin rpy, axis) for the left arm; right arm mirrors y.
35
+ LEFT_CHAIN = [
36
+ ((0.0039563, 0.10022, 0.23778), (0.27931, 5.4949e-05, -0.00019159), 'y'),
37
+ ((0, 0.038, -0.013831), (-0.27925, 0, 0), 'x'),
38
+ ((0, 0.00624, -0.1032), (0, 0, 0), 'z'),
39
+ ((0.015783, 0, -0.080518), (0, 0, 0), 'y'),
40
+ ((0.100, 0.00188791, -0.010), (0, 0, 0), 'x'),
41
+ ((0.038, 0, 0), (0, 0, 0), 'y'),
42
+ ((0.046, 0, 0), (0, 0, 0), 'z'),
43
+ ]
44
+
45
+
46
+ def arm_chain(side):
47
+ if side == 'left':
48
+ return LEFT_CHAIN
49
+ out = []
50
+ for (x, y, z), (r, p, yw), ax in LEFT_CHAIN:
51
+ out.append(((x, -y, z), (-r, p, -yw), ax))
52
+ return out
53
+
54
+
55
+ def arm_T(side, q, waist=(0, 0, 0), tool=(0.0, 0, 0)):
56
+ """pelvis -> hand frame (after wrist yaw, translated by tool offset)."""
57
+ M = torso_T(waist)
58
+ for (p, r, ax), qi in zip(arm_chain(side), q):
59
+ M = M @ T(rpy(*r), p) @ T(rot(ax, qi))
60
+ return M @ T(None, tool)
61
+
62
+
63
+ # joint box used by the IK: the action limits narrowed to postures that keep the
64
+ # arm on its own side of the body (left arm; the right arm mirrors roll/yaw)
65
+ SANE_LO = np.array([-2.6, 0.0, -1.3, -1.0, -1.6, -1.55, -1.55])
66
+ SANE_HI = np.array([1.0, 1.6, 1.3, 2.0, 1.6, 1.55, 1.55])
67
+ Q_NOM = [np.array([-0.4, 0.15, 0.0, 0.9, 0.0, 0.4, 0.0]),
68
+ np.array([-0.9, 0.2, 0.0, 0.4, 0.0, 0.9, 0.0]),
69
+ np.array([0.0, 0.15, 0.0, 1.2, 0.0, 0.0, 0.0])]
70
+
71
+
72
+ def limits(side):
73
+ lo, hi = SANE_LO.copy(), SANE_HI.copy()
74
+ if side == 'right':
75
+ for i in (1, 2, 4, 6):
76
+ lo[i], hi[i] = -SANE_HI[i], -SANE_LO[i]
77
+ return lo, hi
78
+
79
+
80
+ def mirror(q, side):
81
+ q = np.array(q, float)
82
+ if side == 'right':
83
+ q[[1, 2, 4, 6]] *= -1
84
+ return q
85
+
86
+
87
+ def _ik1(side, p, xdir, ydir, q0, waist, tool, w_ori, w_reg, lo, hi):
88
+ from scipy.optimize import least_squares
89
+ q0 = np.clip(np.asarray(q0, float), lo + 1e-3, hi - 1e-3)
90
+ qref = q0.copy()
91
+
92
+ def res(q):
93
+ M = arm_T(side, q, waist, tool)
94
+ r = [M[:3, 3] - p]
95
+ if xdir is not None:
96
+ r.append(w_ori * (M[:3, 0] - xdir))
97
+ if ydir is not None:
98
+ r.append(w_ori * (M[:3, 1] - ydir))
99
+ r.append(w_reg * (q - qref))
100
+ return np.concatenate(r)
101
+
102
+ sol = least_squares(res, q0, bounds=(lo, hi))
103
+ M = arm_T(side, sol.x, waist, tool)
104
+ e = np.linalg.norm(M[:3, 3] - p)
105
+ eo = 0.0
106
+ if xdir is not None:
107
+ eo += np.linalg.norm(M[:3, 0] - xdir)
108
+ if ydir is not None:
109
+ eo += np.linalg.norm(M[:3, 1] - ydir)
110
+ return sol.x, e, eo
111
+
112
+
113
+ def ik(side, p, xdir=None, ydir=None, q0=None, waist=(0, 0, 0), tool=(0.12, 0, 0),
114
+ w_ori=1.0, w_reg=0.01, multi=True):
115
+ """Least-squares IK: tool point to p, hand x axis to xdir, hand y axis to ydir.
116
+ Tries the given start and nominal postures; returns (q, position error)."""
117
+ lo, hi = limits(side)
118
+ p = np.asarray(p, float)
119
+ starts = [] if q0 is None else [np.asarray(q0, float)]
120
+ best = None
121
+ if starts:
122
+ q, e, eo = _ik1(side, p, xdir, ydir, starts[0], waist, tool, w_ori, w_reg, lo, hi)
123
+ best = (e + 0.1 * eo, q, e)
124
+ if e < 0.003 and eo < 0.03:
125
+ return q, e
126
+ if multi or not starts:
127
+ for qn in Q_NOM:
128
+ q, e, eo = _ik1(side, p, xdir, ydir, mirror(qn, side), waist, tool, w_ori, w_reg, lo, hi)
129
+ c = e + 0.1 * eo + 0.002
130
+ if best is None or c < best[0]:
131
+ best = (c, q, e)
132
+ return best[1], best[2]
policies/stack_blocks/opus-s3/policy.py ADDED
@@ -0,0 +1,718 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Stack-blocks policy for the G1: hand-written state machine.
2
+
3
+ Plan: grasp two blocks on table 1 (one per hand, wrist-camera visual servo),
4
+ walk around to table 2, put the first on the green pad and the second on top,
5
+ walk back for the third block and stack it.
6
+
7
+ Geometry: fk.py holds the G1 arm kinematics (URDF dimensions) and a bounded IK;
8
+ cam.py holds the head / wrist camera models, calibrated from the robot's own
9
+ camera views of static and held blocks. Blocks are located with the head camera
10
+ at t=0 and refined with a wrist camera; placements close the loop on the
11
+ forward-kinematic position of the held block in world coordinates.
12
+ """
13
+
14
+ import os
15
+ import sys
16
+
17
+ import numpy as np
18
+ import scipy.ndimage as ndi
19
+
20
+ sys.path.append(os.path.dirname(os.path.abspath(__file__)))
21
+ import fk # noqa: E402
22
+ import cam # noqa: E402
23
+
24
+ PELVIS_H = 0.74
25
+ BLOCK_Z = 0.718 # block centre height on a table (world)
26
+ TABLE_Z = 0.70 # table top (world)
27
+ BLOCK = 0.05 # block edge
28
+ CAM_PITCH = 0.68 # gripper / wrist camera axis, below the hand x axis (rad)
29
+ GRASP_OFF = (0.183, 0.0, -0.005) # grasp centre in the hand frame (m)
30
+ WRIST_F = 68.0 # wrist camera focal length (px)
31
+ ALPHA = 0.9 # gripper axis below horizontal while grasping (rad)
32
+ # wrist camera appearance of a block at the moment of closing (demo, left wrist)
33
+ WRIST_UV = np.array([43.0, 36.0])
34
+ WRIST_AREA = 5000.0
35
+
36
+ # route between the tables (world)
37
+ HELD_OFF = np.array([0.200, 0.0, 0.008]) # held block centre in the hand frame (measured)
38
+ PAD_SIZE = 0.11 # green pad edge (wrist-camera measurement)
39
+ PAD_CHECKS = 0 # wrist-camera pad re-check of block 1 (disabled: not validated)
40
+ PAD_TOL = 0.012 # re-place block 1 if its head-image offset from the pad exceeds this
41
+ PLACE_DZ = 0.006 # release height of the block bottom above its support
42
+ VIEW_ALPHA = 0.95
43
+ VIEW_DIST = 0.20
44
+ STAND_X_MAX = 0.20 # closest pelvis x in front of table 1 (edge at x=0.385)
45
+ PAD_DEFAULT = np.array([1.60, 0.0, TABLE_Z])
46
+ T2_DX = 0.40 # pelvis stands this far (+x) from the pad, facing -x
47
+ T2_STAND = np.array([1.95, 0.0, np.pi])
48
+ VIA = [np.array([-0.05, 1.05]), np.array([2.45, 1.05]), np.array([2.45, 0.0])]
49
+
50
+ ARM_REST = {
51
+ 'left': np.array([0.0, 0.15, 0.0, 1.5, 0.0, 0.0, 0.0]),
52
+ 'right': np.array([0.0, -0.15, 0.0, 1.5, 0.0, 0.0, 0.0]),
53
+ }
54
+
55
+
56
+ def wrap(a):
57
+ return (a + np.pi) % (2 * np.pi) - np.pi
58
+
59
+
60
+ def red_mask(im):
61
+ r, g, b = [im[..., i].astype(int) for i in range(3)]
62
+ return (r > 100) & (g < 70) & (b < 70) & (r > 2 * g)
63
+
64
+
65
+ def green_mask(im):
66
+ r, g, b = [im[..., i].astype(int) for i in range(3)]
67
+ return (g > 150) & (g > r + 40) & (g > b + 40)
68
+
69
+
70
+ def components(mask, min_px=8):
71
+ lab, k = ndi.label(mask)
72
+ out = []
73
+ for i in range(1, k + 1):
74
+ ys, xs = np.nonzero(lab == i)
75
+ if len(xs) >= min_px:
76
+ out.append(dict(u=xs.mean(), v=ys.mean(), n=len(xs),
77
+ box=(xs.min(), xs.max(), ys.min(), ys.max())))
78
+ return out
79
+
80
+
81
+ class Policy:
82
+ """The control policy that is scored on the hidden seeds."""
83
+
84
+ def reset(self, obs, tools):
85
+ self.tools = tools
86
+ self.obs = obs
87
+ self.A = np.zeros(21)
88
+ self.A[2] = PELVIS_H
89
+ o = obs['low_dim_obs']
90
+ self.A[5:12] = o[3:10]
91
+ self.A[12:19] = o[12:19]
92
+ self.A[19] = self.A[20] = 0.0
93
+ self.q = {'left': o[3:10].astype(float).copy(), 'right': o[12:19].astype(float).copy()}
94
+ self.held = {'left': False, 'right': False}
95
+ self.grip_pose = {'left': (0.0, 1.0), 'right': (0.0, 1.0)}
96
+ self.stack = [] # world positions of placed blocks
97
+ self.log = []
98
+ self.phase = 'start'
99
+ self.gen = self.script()
100
+
101
+ # ------------------------------------------------------------------ utils
102
+ @property
103
+ def o(self):
104
+ return self.obs['low_dim_obs']
105
+
106
+ def note(self, *a):
107
+ self.log.append((int(self.obs['t']), self.phase) + a)
108
+
109
+ def w2p(self, P):
110
+ """world point -> pelvis yaw frame (z relative to pelvis)."""
111
+ o = self.o
112
+ d = np.asarray(P, float) - o[21:24]
113
+ c, s = np.cos(o[24]), np.sin(o[24])
114
+ return np.array([c * d[0] + s * d[1], -s * d[0] + c * d[1], d[2]])
115
+
116
+ def p2w(self, p):
117
+ o = self.o
118
+ c, s = np.cos(o[24]), np.sin(o[24])
119
+ return np.array([o[21] + c * p[0] - s * p[1], o[22] + s * p[0] + c * p[1], o[23] + p[2]])
120
+
121
+ def act(self, obs, tools):
122
+ self.obs = obs
123
+ try:
124
+ a = next(self.gen)
125
+ except StopIteration:
126
+ a = None
127
+ except Exception:
128
+ # never crash an episode: freeze in place
129
+ self.gen = iter(())
130
+ a = None
131
+ if a is None:
132
+ self.A[0] = self.A[1] = self.A[3] = 0.0
133
+ a = self.A
134
+ return np.asarray(a, dtype=np.float32).copy()
135
+
136
+ def wait(self, n):
137
+ for _ in range(n):
138
+ yield self.A
139
+
140
+ # ------------------------------------------------------------- base motion
141
+ def walk_to(self, x, y, yaw=None, tol=0.03, ytol=0.05, n=1500, speed=0.4, final=True):
142
+ A = self.A
143
+ for i in range(n):
144
+ o = self.o
145
+ px, py, pyaw = o[21], o[22], o[24]
146
+ dx, dy = x - px, y - py
147
+ dist = np.hypot(dx, dy)
148
+ c, s = np.cos(pyaw), np.sin(pyaw)
149
+ fx, fy = c * dx + s * dy, -s * dx + c * dy
150
+ if dist > 0.25 or (not final and dist > 0.12):
151
+ hd = wrap(np.arctan2(dy, dx) - pyaw)
152
+ if yaw is not None and dist < 0.6:
153
+ # close to the goal: keep the final heading, side-step
154
+ hd2 = wrap(yaw - pyaw)
155
+ wz = np.clip(1.5 * hd2, -0.6, 0.6)
156
+ vx, vy = np.clip(1.2 * fx, -speed, speed), np.clip(1.2 * fy, -0.3, 0.3)
157
+ else:
158
+ wz = np.clip(1.5 * hd, -0.8, 0.8)
159
+ vx = speed * max(0.0, np.cos(hd)) ** 4 if abs(hd) < 0.6 else 0.0
160
+ vx = min(vx, 0.6 * dist + 0.1)
161
+ vy = np.clip(1.0 * fy, -0.2, 0.2) if abs(hd) < 0.6 else 0.0
162
+ else:
163
+ if not final:
164
+ return
165
+ yf = yaw if yaw is not None else pyaw
166
+ hd = wrap(yf - pyaw)
167
+ wz = np.clip(1.5 * hd, -0.6, 0.6)
168
+ vx, vy = np.clip(1.5 * fx, -0.2, 0.2), np.clip(1.5 * fy, -0.2, 0.2)
169
+ if abs(fx) < tol and abs(fy) < tol and abs(hd) < ytol:
170
+ break
171
+ sp = np.hypot(vx, vy)
172
+ if 0 < sp < 0.065:
173
+ vx, vy = vx / sp * 0.065, vy / sp * 0.065
174
+ if abs(wz) < 0.06 and abs(wz) > 0.005 and sp < 0.065:
175
+ wz = 0.06 * np.sign(wz)
176
+ A[0], A[1], A[3] = vx, vy, wz
177
+ yield A
178
+ A[0] = A[1] = A[3] = 0.0
179
+ yield from self.wait(25)
180
+
181
+ # -------------------------------------------------------------- arm motion
182
+ def arm_to(self, side, q, n=40, grip=None):
183
+ """linear joint interpolation to q over n steps."""
184
+ sl = slice(5, 12) if side == 'left' else slice(12, 19)
185
+ q0 = self.A[sl].copy()
186
+ q = np.asarray(q, float)
187
+ for i in range(1, n + 1):
188
+ self.A[sl] = q0 + (q - q0) * i / n
189
+ if grip is not None:
190
+ self.A[19 if side == 'left' else 20] = grip
191
+ yield self.A
192
+ self.q[side] = q.copy()
193
+
194
+ def grip(self, side, g, n=30):
195
+ self.A[19 if side == 'left' else 20] = g
196
+ yield from self.wait(n)
197
+
198
+ def azimuth(self, side, p):
199
+ sh = np.array([0.0, 0.10 if side == 'left' else -0.10])
200
+ yaw = np.arctan2(p[1] - sh[1], max(p[0] - sh[0], 0.05))
201
+ return float(np.clip(yaw, -0.8, 0.8))
202
+
203
+ @staticmethod
204
+ def frame(psi, alpha):
205
+ """gripper axis a (azimuth psi, alpha below horizontal), closing axis y,
206
+ camera-up n, and the hand x/y axes that realise it."""
207
+ a = np.array([np.cos(alpha) * np.cos(psi), np.cos(alpha) * np.sin(psi), -np.sin(alpha)])
208
+ y = np.array([-np.sin(psi), np.cos(psi), 0.0])
209
+ n = np.cross(a, y)
210
+ x = np.cos(CAM_PITCH) * a + np.sin(CAM_PITCH) * n
211
+ return a, y, n, x
212
+
213
+ def solve(self, side, p, xd, yd, tool=GRASP_OFF, q0=None, multi=True):
214
+ q0 = self.q[side] if q0 is None else q0
215
+ q, err = fk.ik(side, np.asarray(p, float), xdir=xd, ydir=yd, q0=q0,
216
+ waist=self.o[0:3], tool=tool, multi=multi)
217
+ return q, err
218
+
219
+ def hand_pose(self, side, tool=GRASP_OFF):
220
+ o = self.o
221
+ q = o[3:10] if side == 'left' else o[12:19]
222
+ return fk.arm_T(side, q, o[0:3], tool)
223
+
224
+ # -------------------------------------------------------------- perception
225
+ def head_blocks(self, ppitch=0.0):
226
+ im = self.tools.image('head')
227
+ o = self.o
228
+ Tc = cam.head_T(o[21:25], o[0:3], ppitch)
229
+ out = []
230
+ for c in components(red_mask(im), 15):
231
+ P = cam.ray_plane(Tc, (c['u'], c['v']), BLOCK_Z)
232
+ out.append(dict(c, P=P))
233
+ return out
234
+
235
+ def head_pad(self, ppitch=0.0):
236
+ im = self.tools.image('head')
237
+ o = self.o
238
+ Tc = cam.head_T(o[21:25], o[0:3], ppitch)
239
+ cs = components(green_mask(im), 10)
240
+ if not cs:
241
+ return None
242
+ c = max(cs, key=lambda c: c['n'])
243
+ return dict(c, P=cam.ray_plane(Tc, (c['u'], c['v']), TABLE_Z))
244
+
245
+ def wrist_blob(self, side):
246
+ im = self.tools.image('left_wrist' if side == 'left' else 'right_wrist')
247
+ cs = components(red_mask(im), 20)
248
+ if not cs:
249
+ return None
250
+ return max(cs, key=lambda c: c['n'])
251
+
252
+ # ------------------------------------------------------------------ grasp
253
+ def set_arm(self, side, q):
254
+ sl = slice(5, 12) if side == 'left' else slice(12, 19)
255
+ self.A[sl] = q
256
+ self.q[side] = np.asarray(q, float).copy()
257
+
258
+ @staticmethod
259
+ def grasp_point(side):
260
+ return tuple(cam.wrist_point(side, 0.05 * cam.WCAM[side][6] / 62.0))
261
+
262
+ def wrist_locate(self, side, near=None, zw=BLOCK_Z, color='red'):
263
+ """blobs seen by a wrist camera -> pelvis-frame positions on plane zw."""
264
+ im = self.tools.image(side + '_wrist')
265
+ mask = red_mask(im) if color == 'red' else green_mask(im)
266
+ lab, k = ndi.label(mask)
267
+ o = self.o
268
+ Th = fk.arm_T(side, o[3:10] if side == 'left' else o[12:19], o[0:3])
269
+ zp = zw - o[23]
270
+ out = []
271
+ for i in range(1, k + 1):
272
+ ys, xs = np.nonzero(lab == i)
273
+ if len(xs) < 30:
274
+ continue
275
+ org, d = cam.wrist_ray(side, Th, (xs.mean(), ys.mean()))
276
+ if d[2] > -0.05:
277
+ continue
278
+ P = org + d * (zp - org[2]) / d[2]
279
+ # yaw of the top face: project pixels onto the top plane, min-area rectangle
280
+ yaw = None
281
+ try:
282
+ import cv2
283
+ c = cam.WCAM[side]
284
+ Tc = Th @ cam.wrist_offset(side)
285
+ D = np.stack([np.full(len(xs), c[6]), 42.0 - xs, 42.0 - ys], 1) @ Tc[:3, :3].T
286
+ zt = zp + BLOCK / 2
287
+ t = (zt - Tc[2, 3]) / D[:, 2]
288
+ pts = (Tc[:3, 3][None, :2] + D[:, :2] * t[:, None]).astype(np.float32) * 1000
289
+ (cx, cy), (w, h), ang = cv2.minAreaRect(pts)
290
+ yaw = np.radians(ang) % (np.pi / 2)
291
+ except Exception:
292
+ pass
293
+ out.append(dict(P=P, n=len(xs), u=xs.mean(), v=ys.mean(), yaw=yaw,
294
+ box=(xs.min(), xs.max(), ys.min(), ys.max())))
295
+ if near is not None and out:
296
+ out.sort(key=lambda b: np.hypot(*(b['P'][:2] - near[:2])))
297
+ return out
298
+
299
+ def grasp(self, side, Pw, alpha=1.0):
300
+ """Pick the block near world point Pw with one hand."""
301
+ self.phase = 'grasp_' + side
302
+ p = self.w2p(Pw)
303
+ psi = self.azimuth(side, p)
304
+ a, y, n, x = self.frame(psi, VIEW_ALPHA)
305
+ tv = tuple(cam.wrist_point(side, VIEW_DIST))
306
+ q, err = self.solve(side, p + [0, 0, 0.10], x, y, tool=tv)
307
+ yield from self.arm_to(side, q, 40, grip=0.0)
308
+ q, err = self.solve(side, p, x, y, tool=tv, q0=q)
309
+ yield from self.arm_to(side, q, 25, grip=0.0)
310
+ yield from self.wait(12)
311
+ seen = self.wrist_locate(side, near=p)
312
+ if seen and np.hypot(*(seen[0]['P'][:2] - p[:2])) < 0.12:
313
+ b = seen[0]
314
+ p = b['P']
315
+ self.note('view', np.round(p, 3), b['n'], None if b['yaw'] is None else round(float(b['yaw']), 3))
316
+ yaw = b['yaw']
317
+ else:
318
+ self.note('view-miss', len(seen))
319
+ yaw = None
320
+ psi0 = self.azimuth(side, p)
321
+ cands = [psi0]
322
+ if yaw is not None:
323
+ # closing axis perpendicular to a pair of faces
324
+ cands = [yaw + k * np.pi / 2 for k in range(-3, 4)]
325
+ cands = [c for c in cands if abs(wrap(c - psi0)) < 0.9]
326
+ tg = self.grasp_point(side)
327
+ best = None
328
+ for psi in cands:
329
+ for al in (1.0, 1.2, 0.8):
330
+ a, y, n, x = self.frame(psi, al)
331
+ q1, e1 = self.solve(side, p - 0.09 * a, x, y, tool=tg)
332
+ q2, e2 = self.solve(side, p, x, y, tool=tg, q0=q1)
333
+ cost = e1 + 3 * e2 + 0.01 * abs(wrap(psi - psi0))
334
+ if best is None or cost < best[0]:
335
+ best = (cost, psi, al, q1, q2, e2)
336
+ _, psi, al, q1, q2, e2 = best
337
+ self.note('grasp-pose', round(float(psi), 3), al, round(float(e2), 4))
338
+ a, y, n, x = self.frame(psi, al)
339
+ yield from self.arm_to(side, q1, 30, grip=0.0)
340
+ tgt = p - 0.09 * a
341
+ q = q1
342
+ f = cam.WCAM[side][6]
343
+ best_n, stall = 0, 0
344
+ for it in range(40):
345
+ yield from self.wait(4)
346
+ b = self.wrist_blob(side)
347
+ if b is None:
348
+ self.note('servo-lost', it)
349
+ break
350
+ eu, ev = b['u'] - WRIST_UV[0], b['v'] - WRIST_UV[1]
351
+ depth = 0.052 * np.sqrt(WRIST_AREA / max(b['n'], 50))
352
+ if b['n'] > 0.9 * WRIST_AREA and abs(eu) < 6 and abs(ev) < 7:
353
+ break
354
+ if b['n'] > best_n:
355
+ best_n, stall = b['n'], 0
356
+ else:
357
+ stall += 1
358
+ if best_n > 0.75 * WRIST_AREA and stall >= 3 and abs(eu) < 14 and abs(ev) < 14:
359
+ break
360
+ k = 0.6 * min(depth, 0.15) / f
361
+ fwd = float(np.clip(0.5 * (depth - 0.052), 0.0, 0.012)) if abs(eu) < 12 and abs(ev) < 12 else 0.0
362
+ tgt = tgt + fwd * a - k * eu * y - k * ev * n
363
+ q, err = self.solve(side, tgt, x, y, tool=tg, q0=q, multi=False)
364
+ self.set_arm(side, q)
365
+ self.note('servo', it, round(b['u'], 1), round(b['v'], 1), b['n'], round(err, 3))
366
+ yield from self.wait(4)
367
+ b = self.wrist_blob(side)
368
+ self.note('pregrip', None if b is None else (round(b['u'], 1), round(b['v'], 1), b['n']), np.round(tgt - p, 3))
369
+ yield from self.grip(side, 1.0, 30)
370
+ g = self.o[50 if side == 'left' else 51]
371
+ self.held[side] = 0.08 < g < 0.85
372
+ self.note('closed', round(float(g), 3))
373
+ self.grasp_p = p
374
+ self.grip_pose[side] = (psi, al)
375
+ q, err = self.solve(side, p + [0, 0, 0.12], x, y, tool=tg, q0=q)
376
+ yield from self.arm_to(side, q, 40)
377
+
378
+ def held_point(self, side):
379
+ """hand-frame position of the centre of a held block."""
380
+ return tuple(HELD_OFF)
381
+
382
+ def place(self, side, Pw, release=True):
383
+ """Put the held block with its centre at world point Pw (lowering until contact)."""
384
+ self.phase = 'place_' + side
385
+ psi, al = self.grip_pose[side]
386
+ p = self.w2p(Pw)
387
+ tg = self.held_point(side)
388
+ best = None
389
+ az = self.azimuth(side, p)
390
+ cands = [psi + k * np.pi / 2 for k in range(-4, 5)]
391
+ cands = [ps for ps in cands if abs(wrap(ps - az)) < 0.8]
392
+ for ps in cands:
393
+ for a_ in (1.0, 1.2, 0.8, 1.4):
394
+ a, y, n, x = self.frame(ps, a_)
395
+ q1, e1 = self.solve(side, p + [0, 0, 0.07], x, y, tool=tg)
396
+ q2, e2 = self.solve(side, p, x, y, tool=tg, q0=q1)
397
+ c = e1 + 3 * e2 + 0.004 * abs(wrap(ps - az)) + 0.004 * abs(a_ - 1.0)
398
+ if best is None or c < best[0]:
399
+ best = (c, ps, a_, q1, e2)
400
+ _, psi, al, q1, e2 = best
401
+ a, y, n, x = self.frame(psi, al)
402
+ self.note('place-pose', np.round(p, 3), round(float(psi), 3), al, round(float(e2), 4))
403
+ yield from self.arm_to(side, q1, 45)
404
+ yield from self.wait(10)
405
+ q = q1
406
+ # descend in stages, closing the loop on the measured (FK) block position
407
+ corr = np.zeros(3)
408
+ contact = False
409
+ # xy is corrected while the block is still clear of the support (no friction),
410
+ # then the block goes straight down with z-only corrections
411
+ stages = [(0.07, 15, False), (0.07, 15, False), (0.035, 15, False)] + \
412
+ [(0.035, 8, False)] * 8 + [(PLACE_DZ, 18, True), (PLACE_DZ, 12, True)]
413
+ for z, n_wait, low in stages:
414
+ p = self.w2p(Pw) # the base drifts while standing: track the world target
415
+ m = self.hand_pose(side, tg)[:3, 3]
416
+ err = (p + [0, 0, z]) - m
417
+ if not low:
418
+ if z < 0.05 and np.hypot(err[0], err[1]) < 0.005:
419
+ continue
420
+ corr[:2] = np.clip(corr[:2] + np.clip(err[:2], -0.03, 0.03), -0.07, 0.07)
421
+ else:
422
+ corr[2] = np.clip(corr[2] + np.clip(err[2], -0.02, 0.02), -0.04, 0.04)
423
+ q, e = self.solve(side, p + [0, 0, z] + corr, x, y, tool=tg, q0=q, multi=False)
424
+ if low:
425
+ q0_ = self.q[side]
426
+ for i in range(1, 7):
427
+ self.set_arm(side, q0_ + (q - q0_) * i / 6)
428
+ yield from self.wait(2)
429
+ self.set_arm(side, q)
430
+ yield from self.wait(n_wait)
431
+ p = self.w2p(Pw)
432
+ m = self.hand_pose(side, tg)[:3, 3]
433
+ self.note('pre-release', np.round(m - p, 3), np.round(corr, 3))
434
+ z = PLACE_DZ
435
+ Ph = self.p2w(m)
436
+ self.note('placed', contact, round(z, 3), np.round(Ph, 3))
437
+ if release:
438
+ yield from self.grip(side, 0.0, 25)
439
+ self.held[side] = False
440
+ q, e = self.solve(side, p + [0, 0, z] - 0.06 * a, x, y, tool=tg, q0=q)
441
+ yield from self.arm_to(side, q, 20)
442
+ q, e = self.solve(side, p + [0, 0, z + 0.06] - 0.08 * a, x, y, tool=tg, q0=q)
443
+ yield from self.arm_to(side, q, 20)
444
+ return Ph
445
+
446
+ def carry_pose(self, side):
447
+ p = np.array([0.30, 0.20 if side == 'left' else -0.20, 0.10])
448
+ a, y, n, x = self.frame(0.0, 0.5)
449
+ q, err = self.solve(side, p, x, y)
450
+ return q
451
+
452
+ # ------------------------------------------------------------------ script
453
+ def head_blocks0(self):
454
+ """blocks on table 1 from the head camera at the initial state."""
455
+ im = self.tools.image('head')
456
+ Tc = cam.head_T(cam.PEL0, cam.WAIST0, 0.0, cam.CAM0)
457
+ found = []
458
+ for c in components(red_mask(im), 12):
459
+ found.append([cam.ray_plane(Tc, (c['u'], c['v']), BLOCK_Z, cam.CAM0[6]), c['n']])
460
+ # a block split by a gripper finger in front of it shows up as two blobs: merge
461
+ out = []
462
+ for P, n in sorted(found, key=lambda f: -f[1]):
463
+ for o in out:
464
+ if np.hypot(*(o[0][:2] - P[:2])) < 0.045:
465
+ o[0] = (o[0] * o[1] + P * n) / (o[1] + n)
466
+ o[1] += n
467
+ break
468
+ else:
469
+ out.append([P, n])
470
+ return [o[0] for o in out]
471
+
472
+ def approach_block(self, side, Pw):
473
+ """stand so that block Pw is in comfortable reach of `side`."""
474
+ self.phase = 'approach_' + side
475
+ sg = 1.0 if side == 'left' else -1.0
476
+ x = float(np.clip(Pw[0] - 0.36, 0.0, STAND_X_MAX))
477
+ y = float(Pw[1] - sg * 0.17)
478
+ yield from self.walk_to(x, y, 0.0, tol=0.02, ytol=0.04, speed=0.2)
479
+
480
+ def park_pose(self, side):
481
+ sg = 1.0 if side == 'left' else -1.0
482
+ p = np.array([0.16, sg * 0.36, 0.10])
483
+ a, y, n, x = self.frame(sg * 0.6, 0.6)
484
+ q, err = self.solve(side, p, x, y)
485
+ return q
486
+
487
+ def view_locate(self, side, Pw, zw, color='red', dist=VIEW_DIST):
488
+ """look at world point Pw with a wrist camera; return world position of the
489
+ nearest blob on plane zw (or None)."""
490
+ p = self.w2p(Pw)
491
+ p[2] = zw - self.o[23]
492
+ psi = self.azimuth(side, p)
493
+ a, y, n, x = self.frame(psi, VIEW_ALPHA)
494
+ tv = tuple(cam.wrist_point(side, dist))
495
+ q, err = self.solve(side, p + [0, 0, 0.06], x, y, tool=tv)
496
+ yield from self.arm_to(side, q, 30)
497
+ q, err = self.solve(side, p, x, y, tool=tv, q0=q)
498
+ yield from self.arm_to(side, q, 20)
499
+ yield from self.wait(12)
500
+ seen = self.wrist_locate(side, near=p, zw=zw, color=color)
501
+ if seen and np.hypot(*(seen[0]['P'][:2] - p[:2])) < 0.10:
502
+ P = self.p2w(seen[0]['P'])
503
+ P[2] = zw
504
+ self.note('view_locate', side, color, np.round(P, 3))
505
+ return P
506
+ self.note('view_locate-miss', side, color, len(seen))
507
+ return None
508
+
509
+ def wrist_project(self, side, mask, zw):
510
+ """world points where the pixels of `mask` hit the plane z = zw."""
511
+ o = self.o
512
+ Th = fk.arm_T(side, o[3:10] if side == 'left' else o[12:19], o[0:3])
513
+ c = cam.WCAM[side]
514
+ Tc = Th @ cam.wrist_offset(side)
515
+ ys, xs = np.nonzero(mask)
516
+ D = np.stack([np.full(len(xs), c[6]), 42.0 - xs, 42.0 - ys], 1) @ Tc[:3, :3].T
517
+ D = D[D[:, 2] < -1e-3]
518
+ t = ((zw - o[23]) - Tc[2, 3]) / D[:, 2]
519
+ pts = Tc[:3, 3][None, :] + D * t[:, None]
520
+ cy, sy = np.cos(o[24]), np.sin(o[24])
521
+ wx = o[21] + cy * pts[:, 0] - sy * pts[:, 1]
522
+ wy = o[22] + sy * pts[:, 0] + cy * pts[:, 1]
523
+ return np.stack([wx, wy], 1)
524
+
525
+ def wrist_pad_offset(self, side, b1):
526
+ """look down at block b1 on the pad; return pad centre minus block centre (xy)."""
527
+ p = self.w2p(b1)
528
+ psi = self.azimuth(side, p)
529
+ a, y, n, x = self.frame(psi, 1.1)
530
+ q, err = self.solve(side, p, x, y, tool=tuple(cam.wrist_point(side, 0.24)))
531
+ yield from self.arm_to(side, q, 30)
532
+ yield from self.wait(15)
533
+ im = self.tools.image(side + '_wrist')
534
+ g = green_mask(im)
535
+ lab, k = ndi.label(red_mask(im))
536
+ if g.sum() < 40 or k == 0:
537
+ return None
538
+ sizes = ndi.sum(np.ones_like(lab), lab, range(1, k + 1))
539
+ rb = self.wrist_project(side, lab == (1 + int(np.argmax(sizes))), BLOCK_Z).mean(0)
540
+ gp = self.wrist_project(side, g, TABLE_Z - 0.008)
541
+ lo, hi = gp.min(0), gp.max(0)
542
+ c = (lo + hi) / 2
543
+ for i in range(2):
544
+ if hi[i] - lo[i] < PAD_SIZE - 0.01:
545
+ # one side hidden under the block: trust the far edge
546
+ c[i] = hi[i] - PAD_SIZE / 2 if abs(rb[i] - lo[i]) < abs(rb[i] - hi[i]) else lo[i] + PAD_SIZE / 2
547
+ off = c - rb
548
+ nrm = np.hypot(*off)
549
+ if nrm > 0.05:
550
+ off = off * 0.05 / nrm
551
+ self.note('pad-view', np.round(c, 3), np.round(rb, 3), np.round(hi - lo, 3))
552
+ return off
553
+
554
+ def head_block_near(self, Pw, maxd=0.08):
555
+ """head-camera estimate (CAM0 model) of the block nearest world point Pw."""
556
+ im = self.tools.image('head')
557
+ o = self.o
558
+ Tc = cam.head_T(o[21:25], o[0:3], 0.0, cam.CAM0)
559
+ best = None
560
+ for c in components(red_mask(im), 12):
561
+ P = cam.ray_plane(Tc, (c['u'], c['v']), BLOCK_Z, cam.CAM0[6])
562
+ d = np.hypot(*(P[:2] - Pw[:2]))
563
+ if d < maxd and (best is None or d < best[0]):
564
+ best = (d, P)
565
+ return None if best is None else best[1]
566
+
567
+ def head_pad(self):
568
+ im = self.tools.image('head')
569
+ o = self.o
570
+ Tc = cam.head_T(o[21:25], o[0:3], 0.0, cam.CAM0)
571
+ cs = components(green_mask(im), 10)
572
+ if not cs:
573
+ return None
574
+ c = max(cs, key=lambda c: c['n'])
575
+ return cam.ray_plane(Tc, (c['u'], c['v']), TABLE_Z, cam.CAM0[6])
576
+
577
+ def run_place(self, side, Pw):
578
+ g = self.place(side, Pw)
579
+ while True:
580
+ try:
581
+ yield next(g)
582
+ except StopIteration as e:
583
+ self.last_placed = e.value
584
+ return
585
+
586
+ def run_view(self, side, Pw, zw, color='red'):
587
+ g = self.view_locate(side, Pw, zw, color)
588
+ while True:
589
+ try:
590
+ yield next(g)
591
+ except StopIteration as e:
592
+ self.last_seen = e.value
593
+ return
594
+
595
+ def get_block(self, side, Pw, tries=3):
596
+ """approach and grasp the block near Pw, retrying on a miss."""
597
+ for k in range(tries):
598
+ yield from self.approach_block(side, Pw)
599
+ yield from self.grasp(side, Pw)
600
+ if self.held[side]:
601
+ break
602
+ # missed: open, back off and look again
603
+ yield from self.grip(side, 0.0, 10)
604
+ yield from self.arm_to(side, self.carry_pose(side), 30)
605
+ self.phase = 'regrasp'
606
+ yield from self.run_view(side, Pw, BLOCK_Z)
607
+ if self.last_seen is not None:
608
+ Pw = self.last_seen
609
+ yield from self.arm_to(side, self.carry_pose(side), 30)
610
+
611
+ def script(self):
612
+ self.phase = 'look0'
613
+ blocks = self.head_blocks0()
614
+ blocks.sort(key=lambda P: -P[1])
615
+ self.note('blocks', [np.round(P, 3) for P in blocks])
616
+ while len(blocks) < 3:
617
+ blocks.append(np.array([0.55, 0.0, BLOCK_Z]))
618
+ self.blocks0 = blocks
619
+ # raise both hands out of the way, gripper open
620
+ for side in ('left', 'right'):
621
+ yield from self.arm_to(side, self.carry_pose(side), 30, grip=0.0)
622
+ right_b, left_b = blocks[-1], blocks[0]
623
+ third = blocks[1]
624
+ yield from self.get_block('right', right_b)
625
+ yield from self.get_block('left', left_b)
626
+
627
+ self.phase = 'trip1'
628
+ yield from self.go_table2()
629
+ pad = self.head_pad()
630
+ self.note('pad0', None if pad is None else np.round(pad, 3))
631
+ if pad is None:
632
+ pad = PAD_DEFAULT.copy()
633
+ yield from self.walk_to(pad[0] + T2_DX, pad[1], np.pi, tol=0.02, ytol=0.04, speed=0.15)
634
+ p2 = self.head_pad()
635
+ if p2 is not None and np.hypot(*(p2[:2] - pad[:2])) < 0.1:
636
+ pad = p2
637
+ self.note('pad', np.round(pad, 3))
638
+ yield from self.stack_two(pad)
639
+
640
+ self.phase = 'return'
641
+ side = 'left' if third[1] > 0.0 else 'right'
642
+ sg = 1.0 if side == 'left' else -1.0
643
+ yield from self.go_table1(float(np.clip(third[0] - 0.36, 0.0, STAND_X_MAX)), float(third[1] - sg * 0.17))
644
+ yield from self.wait(20)
645
+ seen = self.head_block_near(third, maxd=0.25)
646
+ if seen is not None:
647
+ third = seen
648
+ self.note('third', np.round(third, 3))
649
+ yield from self.get_block(side, third)
650
+
651
+ self.phase = 'trip2'
652
+ yield from self.go_table2()
653
+ top = self.stack_top
654
+ yield from self.walk_to(top[0] + T2_DX, top[1], np.pi, tol=0.02, ytol=0.04, speed=0.15)
655
+ other = 'right' if side == 'left' else 'left'
656
+ yield from self.arm_to(other, self.park_pose(other), 30)
657
+ yield from self.align_for(side, top)
658
+ yield from self.run_place(side, top + [0, 0, BLOCK])
659
+ yield from self.arm_to(side, self.park_pose(side), 40)
660
+ self.phase = 'done'
661
+ yield None
662
+
663
+ def align_for(self, side, Pw):
664
+ """stand facing -x with world point Pw in comfortable reach of `side`."""
665
+ sg = 1.0 if side == 'left' else -1.0
666
+ yield from self.walk_to(Pw[0] + T2_DX, Pw[1] + sg * 0.05, np.pi, tol=0.02, ytol=0.05, speed=0.15, n=400)
667
+
668
+ def stack_two(self, pad):
669
+ """left block on the pad, right block on top of it."""
670
+ yield from self.arm_to('right', self.park_pose('right'), 30)
671
+ target = np.array([pad[0], pad[1], BLOCK_Z])
672
+ yield from self.align_for('left', target)
673
+ yield from self.run_place('left', target)
674
+ b1 = np.array([self.last_placed[0], self.last_placed[1], BLOCK_Z])
675
+ yield from self.arm_to('left', self.park_pose('left'), 30)
676
+ # check block 1 against the pad with the free wrist camera (same image, bias cancels)
677
+ for attempt in range(PAD_CHECKS):
678
+ g = self.wrist_pad_offset('left', b1)
679
+ while True:
680
+ try:
681
+ yield next(g)
682
+ except StopIteration as e:
683
+ off = e.value
684
+ break
685
+ yield from self.arm_to('left', self.park_pose('left'), 30)
686
+ if off is None:
687
+ break
688
+ self.note('pad-check', np.round(off, 3))
689
+ if np.hypot(*off) < PAD_TOL:
690
+ break
691
+ yield from self.grasp('left', b1)
692
+ if not self.held['left']:
693
+ yield from self.grip('left', 0.0, 10)
694
+ yield from self.arm_to('left', self.park_pose('left'), 30)
695
+ break
696
+ yield from self.arm_to('left', self.carry_pose('left'), 25)
697
+ new = b1 + [off[0], off[1], 0.0]
698
+ yield from self.align_for('left', new)
699
+ yield from self.run_place('left', new)
700
+ b1 = np.array([self.last_placed[0], self.last_placed[1], BLOCK_Z])
701
+ yield from self.arm_to('left', self.park_pose('left'), 30)
702
+ yield from self.align_for('right', b1)
703
+ yield from self.run_place('right', b1 + [0, 0, BLOCK])
704
+ top = self.last_placed
705
+ self.stack_top = np.array([top[0], top[1], BLOCK_Z + BLOCK])
706
+ yield from self.arm_to('right', self.park_pose('right'), 30)
707
+
708
+ def go_table2(self):
709
+ yield from self.walk_to(0.0, self.o[22], None, final=False, speed=0.25) # back off table 1
710
+ for w in VIA:
711
+ yield from self.walk_to(w[0], w[1], None, final=False)
712
+ yield from self.walk_to(T2_STAND[0], T2_STAND[1], T2_STAND[2], tol=0.03, ytol=0.05, speed=0.2)
713
+
714
+ def go_table1(self, x, y):
715
+ yield from self.walk_to(T2_STAND[0] + 0.15, self.o[22], None, final=False, speed=0.25)
716
+ for w in VIA[::-1]:
717
+ yield from self.walk_to(w[0], w[1], None, final=False)
718
+ yield from self.walk_to(x, y, 0.0, tol=0.02, ytol=0.04, speed=0.2)
policies/wall_cupboard_close/astra-s1/episodes.csv ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ seed,success,length,termination,fell
2
+ 620000,1,465,success,0
3
+ 620001,1,465,success,0
4
+ 620002,1,465,success,0
5
+ 620003,1,465,success,0
6
+ 620004,1,465,success,0
7
+ 620005,1,465,success,0
8
+ 620006,1,465,success,0
9
+ 620007,1,465,success,0
10
+ 620008,1,465,success,0
11
+ 620009,1,465,success,0
12
+ 620010,1,465,success,0
13
+ 620011,1,465,success,0
14
+ 620012,1,465,success,0
15
+ 620013,1,465,success,0
16
+ 620014,1,465,success,0
17
+ 620015,1,465,success,0
18
+ 620016,1,465,success,0
19
+ 620017,1,465,success,0
20
+ 620018,1,465,success,0
21
+ 620019,1,465,success,0
22
+ 620020,1,465,success,0
23
+ 620021,1,465,success,0
24
+ 620022,1,465,success,0
25
+ 620023,1,465,success,0
26
+ 620024,1,465,success,0
27
+ 620025,1,465,success,0
28
+ 620026,1,465,success,0
29
+ 620027,1,465,success,0
30
+ 620028,1,465,success,0
31
+ 620029,1,465,success,0
32
+ 620030,1,465,success,0
33
+ 620031,1,465,success,0
34
+ 620032,1,465,success,0
35
+ 620033,1,465,success,0
36
+ 620034,1,465,success,0
37
+ 620035,1,465,success,0
38
+ 620036,1,465,success,0
39
+ 620037,1,465,success,0
40
+ 620038,1,465,success,0
41
+ 620039,1,465,success,0
42
+ 620040,1,465,success,0
43
+ 620041,1,465,success,0
44
+ 620042,1,465,success,0
45
+ 620043,1,465,success,0
46
+ 620044,1,465,success,0
47
+ 620045,1,465,success,0
48
+ 620046,1,465,success,0
49
+ 620047,1,465,success,0
50
+ 620048,1,465,success,0
51
+ 620049,1,465,success,0
52
+ 620050,1,465,success,0
53
+ 620051,1,465,success,0
54
+ 620052,1,465,success,0
55
+ 620053,1,465,success,0
56
+ 620054,1,465,success,0
57
+ 620055,1,465,success,0
58
+ 620056,1,465,success,0
59
+ 620057,1,465,success,0
60
+ 620058,1,465,success,0
61
+ 620059,1,465,success,0
62
+ 620060,1,465,success,0
63
+ 620061,1,465,success,0
64
+ 620062,1,465,success,0
65
+ 620063,1,465,success,0
66
+ 620064,1,465,success,0
67
+ 620065,1,465,success,0
68
+ 620066,1,465,success,0
69
+ 620067,1,465,success,0
70
+ 620068,1,465,success,0
71
+ 620069,1,465,success,0
72
+ 620070,1,465,success,0
73
+ 620071,1,465,success,0
74
+ 620072,1,465,success,0
75
+ 620073,1,465,success,0
76
+ 620074,1,465,success,0
77
+ 620075,1,465,success,0
78
+ 620076,1,465,success,0
79
+ 620077,1,465,success,0
80
+ 620078,1,465,success,0
81
+ 620079,1,465,success,0
82
+ 620080,1,465,success,0
83
+ 620081,1,465,success,0
84
+ 620082,1,465,success,0
85
+ 620083,1,465,success,0
86
+ 620084,1,465,success,0
87
+ 620085,1,465,success,0
88
+ 620086,1,465,success,0
89
+ 620087,1,465,success,0
90
+ 620088,1,465,success,0
91
+ 620089,1,465,success,0
92
+ 620090,1,465,success,0
93
+ 620091,1,465,success,0
94
+ 620092,1,465,success,0
95
+ 620093,1,465,success,0
96
+ 620094,1,465,success,0
97
+ 620095,1,465,success,0
98
+ 620096,1,465,success,0
99
+ 620097,1,465,success,0
100
+ 620098,1,465,success,0
101
+ 620099,1,465,success,0
policies/wall_cupboard_close/astra-s1/policy.py ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Hand-written cabinet closing motion with closed-loop base positioning.
2
+
3
+ The arms first clear the open leaves, then sweep inward together while
4
+ forward pressure seats the doors. All motion is indexed by simulation steps.
5
+ """
6
+
7
+ import numpy as np
8
+
9
+
10
+ class Policy:
11
+ def reset(self, obs, tools):
12
+ self.hold = np.asarray(tools.hold_action(), dtype=np.float32)
13
+
14
+ def act(self, obs, tools):
15
+ t = obs["t"]
16
+ action = self.hold.copy()
17
+
18
+ # Raise the hands outside the doors, approach, and sweep inward.
19
+ roll = 0.9 if t < 280 else max(0.2, 0.9 - (t - 280) * 0.003)
20
+ action[5:12] = [-1.3, roll, 0, 0.8, 0, 0, 0]
21
+ action[12:19] = [-1.3, -roll, 0, 0.8, 0, 0, 0]
22
+ action[19:] = 0
23
+
24
+ # Pose feedback compensates for walking lag and contact-induced drift.
25
+ x, y, _, yaw = obs["low_dim_obs"][21:25]
26
+ target_x = -0.27 if t < 80 else 0.45
27
+ error = target_x - x
28
+ action[0] = (
29
+ 0 if abs(error) < 0.015
30
+ else np.sign(error) * min(0.25, max(0.065, abs(error) * 1.5))
31
+ )
32
+ action[1] = (
33
+ 0 if abs(y) < 0.015
34
+ else -np.sign(y) * min(0.15, max(0.065, abs(y) * 1.5))
35
+ )
36
+ action[3] = np.clip(-yaw * 2, -0.2, 0.2)
37
+ return action
policies/wall_cupboard_close/astra-s2/episodes.csv ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ seed,success,length,termination,fell
2
+ 620000,1,1388,success,0
3
+ 620001,1,1388,success,0
4
+ 620002,1,1388,success,0
5
+ 620003,1,1388,success,0
6
+ 620004,1,1388,success,0
7
+ 620005,1,1388,success,0
8
+ 620006,1,1388,success,0
9
+ 620007,1,1388,success,0
10
+ 620008,1,1388,success,0
11
+ 620009,1,1388,success,0
12
+ 620010,1,1388,success,0
13
+ 620011,1,1388,success,0
14
+ 620012,1,1388,success,0
15
+ 620013,1,1388,success,0
16
+ 620014,1,1388,success,0
17
+ 620015,1,1388,success,0
18
+ 620016,1,1388,success,0
19
+ 620017,1,1388,success,0
20
+ 620018,1,1388,success,0
21
+ 620019,1,1388,success,0
22
+ 620020,1,1388,success,0
23
+ 620021,1,1388,success,0
24
+ 620022,1,1388,success,0
25
+ 620023,1,1388,success,0
26
+ 620024,1,1388,success,0
27
+ 620025,1,1388,success,0
28
+ 620026,1,1388,success,0
29
+ 620027,1,1388,success,0
30
+ 620028,1,1388,success,0
31
+ 620029,1,1388,success,0
32
+ 620030,1,1388,success,0
33
+ 620031,1,1388,success,0
34
+ 620032,1,1388,success,0
35
+ 620033,1,1388,success,0
36
+ 620034,1,1388,success,0
37
+ 620035,1,1388,success,0
38
+ 620036,1,1388,success,0
39
+ 620037,1,1388,success,0
40
+ 620038,1,1388,success,0
41
+ 620039,1,1388,success,0
42
+ 620040,1,1388,success,0
43
+ 620041,1,1388,success,0
44
+ 620042,1,1388,success,0
45
+ 620043,1,1388,success,0
46
+ 620044,1,1388,success,0
47
+ 620045,1,1388,success,0
48
+ 620046,1,1388,success,0
49
+ 620047,1,1388,success,0
50
+ 620048,1,1388,success,0
51
+ 620049,1,1388,success,0
52
+ 620050,1,1388,success,0
53
+ 620051,1,1388,success,0
54
+ 620052,1,1388,success,0
55
+ 620053,1,1388,success,0
56
+ 620054,1,1388,success,0
57
+ 620055,1,1388,success,0
58
+ 620056,1,1388,success,0
59
+ 620057,1,1388,success,0
60
+ 620058,1,1388,success,0
61
+ 620059,1,1388,success,0
62
+ 620060,1,1388,success,0
63
+ 620061,1,1388,success,0
64
+ 620062,1,1388,success,0
65
+ 620063,1,1388,success,0
66
+ 620064,1,1388,success,0
67
+ 620065,1,1388,success,0
68
+ 620066,1,1388,success,0
69
+ 620067,1,1388,success,0
70
+ 620068,1,1388,success,0
71
+ 620069,1,1388,success,0
72
+ 620070,1,1388,success,0
73
+ 620071,1,1388,success,0
74
+ 620072,1,1388,success,0
75
+ 620073,1,1388,success,0
76
+ 620074,1,1388,success,0
77
+ 620075,1,1388,success,0
78
+ 620076,1,1388,success,0
79
+ 620077,1,1388,success,0
80
+ 620078,1,1388,success,0
81
+ 620079,1,1388,success,0
82
+ 620080,1,1388,success,0
83
+ 620081,1,1388,success,0
84
+ 620082,1,1388,success,0
85
+ 620083,1,1388,success,0
86
+ 620084,1,1388,success,0
87
+ 620085,1,1388,success,0
88
+ 620086,1,1388,success,0
89
+ 620087,1,1388,success,0
90
+ 620088,1,1388,success,0
91
+ 620089,1,1388,success,0
92
+ 620090,1,1388,success,0
93
+ 620091,1,1388,success,0
94
+ 620092,1,1388,success,0
95
+ 620093,1,1388,success,0
96
+ 620094,1,1388,success,0
97
+ 620095,1,1388,success,0
98
+ 620096,1,1388,success,0
99
+ 620097,1,1388,success,0
100
+ 620098,1,1388,success,0
101
+ 620099,1,1388,success,0
policies/wall_cupboard_close/astra-s2/policy.py ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Deterministic sequential cabinet-door pushing controller."""
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
+ # Approach the outside of each door, sweep towards the middle, then
11
+ # follow through towards the wall. Keep the unused hand below the doors.
12
+ sequence = [
13
+ (-.10, .50, 0), (.05, .50, 1), (.05, .15, 1),
14
+ (.25, .00, 1), (.25, .00, 0), (-.10, -.50, 0),
15
+ (.05, -.50, 2), (.05, -.15, 2), (.25, .00, 2),
16
+ (.25, .00, 0),
17
+ ]
18
+ stage = min(int(obs['t']) // 160, len(sequence)-1)
19
+ x, y, side = sequence[stage]
20
+ a = self.hold.copy()
21
+ a[5:19] = 0
22
+ a[19:] = 0
23
+ if side:
24
+ k = 5 if side == 1 else 12
25
+ s = 1 if side == 1 else -1
26
+ a[k:k+7] = [-2.2, s*.2, 0, .6, 0, .9, 0]
27
+ pos = obs['low_dim_obs'][21:25]
28
+ dx, dy = x-pos[0], y-pos[1]
29
+ a[0] = np.clip(dx*2, -.22, .22) if abs(dx) > .02 else 0
30
+ a[1] = np.clip(dy*2, -.22, .22) if abs(dy) > .02 else 0
31
+ a[3] = -pos[3]*2
32
+ return a
policies/wall_cupboard_close/astra-s3/episodes.csv ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ seed,success,length,termination,fell
2
+ 620000,1,1274,success,0
3
+ 620001,1,1274,success,0
4
+ 620002,1,1274,success,0
5
+ 620003,1,1274,success,0
6
+ 620004,1,1274,success,0
7
+ 620005,1,1274,success,0
8
+ 620006,1,1274,success,0
9
+ 620007,1,1274,success,0
10
+ 620008,1,1274,success,0
11
+ 620009,1,1274,success,0
12
+ 620010,1,1274,success,0
13
+ 620011,1,1274,success,0
14
+ 620012,1,1274,success,0
15
+ 620013,1,1274,success,0
16
+ 620014,1,1274,success,0
17
+ 620015,1,1274,success,0
18
+ 620016,1,1274,success,0
19
+ 620017,1,1274,success,0
20
+ 620018,1,1274,success,0
21
+ 620019,1,1274,success,0
22
+ 620020,1,1274,success,0
23
+ 620021,1,1274,success,0
24
+ 620022,1,1274,success,0
25
+ 620023,1,1274,success,0
26
+ 620024,1,1274,success,0
27
+ 620025,1,1274,success,0
28
+ 620026,1,1274,success,0
29
+ 620027,1,1274,success,0
30
+ 620028,1,1274,success,0
31
+ 620029,1,1274,success,0
32
+ 620030,1,1274,success,0
33
+ 620031,1,1274,success,0
34
+ 620032,1,1274,success,0
35
+ 620033,1,1274,success,0
36
+ 620034,1,1274,success,0
37
+ 620035,1,1274,success,0
38
+ 620036,1,1274,success,0
39
+ 620037,1,1274,success,0
40
+ 620038,1,1274,success,0
41
+ 620039,1,1274,success,0
42
+ 620040,1,1274,success,0
43
+ 620041,1,1274,success,0
44
+ 620042,1,1274,success,0
45
+ 620043,1,1274,success,0
46
+ 620044,1,1274,success,0
47
+ 620045,1,1274,success,0
48
+ 620046,1,1274,success,0
49
+ 620047,1,1274,success,0
50
+ 620048,1,1274,success,0
51
+ 620049,1,1274,success,0
52
+ 620050,1,1274,success,0
53
+ 620051,1,1274,success,0
54
+ 620052,1,1274,success,0
55
+ 620053,1,1274,success,0
56
+ 620054,1,1274,success,0
57
+ 620055,1,1274,success,0
58
+ 620056,1,1274,success,0
59
+ 620057,1,1274,success,0
60
+ 620058,1,1274,success,0
61
+ 620059,1,1274,success,0
62
+ 620060,1,1274,success,0
63
+ 620061,1,1274,success,0
64
+ 620062,1,1274,success,0
65
+ 620063,1,1274,success,0
66
+ 620064,1,1274,success,0
67
+ 620065,1,1274,success,0
68
+ 620066,1,1274,success,0
69
+ 620067,1,1274,success,0
70
+ 620068,1,1274,success,0
71
+ 620069,1,1274,success,0
72
+ 620070,1,1274,success,0
73
+ 620071,1,1274,success,0
74
+ 620072,1,1274,success,0
75
+ 620073,1,1274,success,0
76
+ 620074,1,1274,success,0
77
+ 620075,1,1274,success,0
78
+ 620076,1,1274,success,0
79
+ 620077,1,1274,success,0
80
+ 620078,1,1274,success,0
81
+ 620079,1,1274,success,0
82
+ 620080,1,1274,success,0
83
+ 620081,1,1274,success,0
84
+ 620082,1,1274,success,0
85
+ 620083,1,1274,success,0
86
+ 620084,1,1274,success,0
87
+ 620085,1,1274,success,0
88
+ 620086,1,1274,success,0
89
+ 620087,1,1274,success,0
90
+ 620088,1,1274,success,0
91
+ 620089,1,1274,success,0
92
+ 620090,1,1274,success,0
93
+ 620091,1,1274,success,0
94
+ 620092,1,1274,success,0
95
+ 620093,1,1274,success,0
96
+ 620094,1,1274,success,0
97
+ 620095,1,1274,success,0
98
+ 620096,1,1274,success,0
99
+ 620097,1,1274,success,0
100
+ 620098,1,1274,success,0
101
+ 620099,1,1274,success,0
policies/wall_cupboard_close/astra-s3/policy.py ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Deterministic cabinet closing with symmetric, gradual arm sweeps."""
2
+ import numpy as np
3
+
4
+ class Policy:
5
+ def reset(self, obs, tools):
6
+ self.action = np.asarray(tools.hold_action(), dtype=np.float32)
7
+ self.action[19:] = 0
8
+ self.stages = [(130,-.27,1.1),(180,.05,1.1),(180,.05,-.2),
9
+ (130,.05,1.1),(130,.22,1.1),(180,.22,-.2),
10
+ (130,.22,1.1),(130,.4,1.1),(180,.4,-.2)]
11
+ self.stage=0
12
+ self.start=0
13
+ self.initial=self.action.copy()
14
+
15
+ def act(self, obs, tools):
16
+ t=obs['t']
17
+ if self.stage<len(self.stages)-1 and t-self.start>=self.stages[self.stage][0]:
18
+ self.stage+=1
19
+ self.start=t
20
+ self.initial=self.action.copy()
21
+ _,x,roll=self.stages[self.stage]
22
+ q=obs['low_dim_obs']
23
+ a=self.action.copy()
24
+ dx=x-q[21]; dy=-q[22]
25
+ a[0]=np.clip(1.5*dx,-.18,.18) if abs(dx)>.015 else 0
26
+ a[1]=np.clip(1.5*dy,-.12,.12) if abs(dy)>.015 else 0
27
+ speed=np.linalg.norm(a[:2])
28
+ if 0<speed<.06:a[:2]*=.06/speed
29
+ a[3]=np.clip(-2*q[24],-.3,.3)
30
+ target=np.array([-2.7,roll,0,.3,0,1.4,0,-2.7,-roll,0,.3,0,1.4,0])
31
+ u=min(1,(t-self.start+1)/100)
32
+ a[5:19]=self.initial[5:19]*(1-u)+target*u
33
+ self.action=a
34
+ return a
policies/wall_cupboard_close/deepseek1017-s1/episodes.csv ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ seed,success,length,termination,fell
2
+ 620000,0,1700,timeout,0
3
+ 620001,0,1700,timeout,0
4
+ 620002,0,1700,timeout,0
5
+ 620003,0,1700,timeout,0
6
+ 620004,0,1700,timeout,0
7
+ 620005,0,1700,timeout,0
8
+ 620006,0,1700,timeout,0
9
+ 620007,0,1700,timeout,0
10
+ 620008,0,1700,timeout,0
11
+ 620009,0,1700,timeout,0
12
+ 620010,0,1700,timeout,0
13
+ 620011,0,1700,timeout,0
14
+ 620012,0,1700,timeout,0
15
+ 620013,0,1700,timeout,0
16
+ 620014,0,1700,timeout,0
17
+ 620015,0,1700,timeout,0
18
+ 620016,0,1700,timeout,0
19
+ 620017,0,1700,timeout,0
20
+ 620018,0,1700,timeout,0
21
+ 620019,0,1700,timeout,0
22
+ 620020,0,1700,timeout,0
23
+ 620021,0,1700,timeout,0
24
+ 620022,0,1700,timeout,0
25
+ 620023,0,1700,timeout,0
26
+ 620024,0,1700,timeout,0
27
+ 620025,0,1700,timeout,0
28
+ 620026,0,1700,timeout,0
29
+ 620027,0,1700,timeout,0
30
+ 620028,0,1700,timeout,0
31
+ 620029,0,1700,timeout,0
32
+ 620030,0,1700,timeout,0
33
+ 620031,0,1700,timeout,0
34
+ 620032,0,1700,timeout,0
35
+ 620033,0,1700,timeout,0
36
+ 620034,0,1700,timeout,0
37
+ 620035,0,1700,timeout,0
38
+ 620036,0,1700,timeout,0
39
+ 620037,0,1700,timeout,0
40
+ 620038,0,1700,timeout,0
41
+ 620039,0,1700,timeout,0
42
+ 620040,0,1700,timeout,0
43
+ 620041,0,1700,timeout,0
44
+ 620042,0,1700,timeout,0
45
+ 620043,0,1700,timeout,0
46
+ 620044,0,1700,timeout,0
47
+ 620045,0,1700,timeout,0
48
+ 620046,0,1700,timeout,0
49
+ 620047,0,1700,timeout,0
50
+ 620048,0,1700,timeout,0
51
+ 620049,0,1700,timeout,0
52
+ 620050,0,1700,timeout,0
53
+ 620051,0,1700,timeout,0
54
+ 620052,0,1700,timeout,0
55
+ 620053,0,1700,timeout,0
56
+ 620054,0,1700,timeout,0
57
+ 620055,0,1700,timeout,0
58
+ 620056,0,1700,timeout,0
59
+ 620057,0,1700,timeout,0
60
+ 620058,0,1700,timeout,0
61
+ 620059,0,1700,timeout,0
62
+ 620060,0,1700,timeout,0
63
+ 620061,0,1700,timeout,0
64
+ 620062,0,1700,timeout,0
65
+ 620063,0,1700,timeout,0
66
+ 620064,0,1700,timeout,0
67
+ 620065,0,1700,timeout,0
68
+ 620066,0,1700,timeout,0
69
+ 620067,0,1700,timeout,0
70
+ 620068,0,1700,timeout,0
71
+ 620069,0,1700,timeout,0
72
+ 620070,0,1700,timeout,0
73
+ 620071,0,1700,timeout,0
74
+ 620072,0,1700,timeout,0
75
+ 620073,0,1700,timeout,0
76
+ 620074,0,1700,timeout,0
77
+ 620075,0,1700,timeout,0
78
+ 620076,0,1700,timeout,0
79
+ 620077,0,1700,timeout,0
80
+ 620078,0,1700,timeout,0
81
+ 620079,0,1700,timeout,0
82
+ 620080,0,1700,timeout,0
83
+ 620081,0,1700,timeout,0
84
+ 620082,0,1700,timeout,0
85
+ 620083,0,1700,timeout,0
86
+ 620084,0,1700,timeout,0
87
+ 620085,0,1700,timeout,0
88
+ 620086,0,1700,timeout,0
89
+ 620087,0,1700,timeout,0
90
+ 620088,0,1700,timeout,0
91
+ 620089,0,1700,timeout,0
92
+ 620090,0,1700,timeout,0
93
+ 620091,0,1700,timeout,0
94
+ 620092,0,1700,timeout,0
95
+ 620093,0,1700,timeout,0
96
+ 620094,0,1700,timeout,0
97
+ 620095,0,1700,timeout,0
98
+ 620096,0,1700,timeout,0
99
+ 620097,0,1700,timeout,0
100
+ 620098,0,1700,timeout,0
101
+ 620099,0,1700,timeout,0
policies/wall_cupboard_close/deepseek1017-s1/policy.py ADDED
@@ -0,0 +1,149 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Control policy for the Unitree G1 "close the wall-cabinet doors" task.
2
+
3
+ The reset scene is deterministic: the robot starts just in front of the
4
+ kitchen counter and the wall cabinet (with its two doors) is mounted above
5
+ it. The policy walks up to the counter, raises both arms to the height of
6
+ the cabinet bottom and then executes a sequence of pushes (upward, forward,
7
+ outward, inward and a downward sweep). The hands are then withdrawn so the
8
+ doors are not held by them, and the whole approach/push sequence is repeated
9
+ once more at a slightly different arm pose.
10
+
11
+ No learning, no randomness and no wall-clock dependency: the action is a
12
+ pure function of the control step (``obs["t"]``), so every episode is
13
+ reproducible from the reset.
14
+ """
15
+
16
+ import numpy as np
17
+
18
+
19
+ class Policy:
20
+ """Hand-written controller for the wall-cabinet-closing task."""
21
+
22
+ def reset(self, obs, tools):
23
+ """Remember the pose-holding action (zero base velocity)."""
24
+ self.hold = np.asarray(tools.hold_action(), dtype=np.float32)
25
+ self.t = 0
26
+
27
+ @staticmethod
28
+ def _ramp(t, t0, t1, a, b):
29
+ """Linear interpolation between ``a`` at ``t0`` and ``b`` at ``t1``."""
30
+ if t <= t0:
31
+ return float(a)
32
+ if t >= t1:
33
+ return float(b)
34
+ f = (t - t0) / float(t1 - t0)
35
+ return float(a + (b - a) * f)
36
+
37
+ def _arm_targets(self, t):
38
+ """Return (shoulder_pitch, roll, yaw, elbow) for the current step."""
39
+ if t < 120:
40
+ sp = self._ramp(t, 0, 120, 0.0, -1.60)
41
+ sr = self._ramp(t, 0, 120, 0.0, 0.45)
42
+ el = self._ramp(t, 0, 120, 0.0, 0.70)
43
+ return sp, sr, 0.0, el
44
+ if t < 210:
45
+ sp = self._ramp(t, 120, 210, -1.60, -2.60)
46
+ el = self._ramp(t, 120, 210, 0.70, 0.40)
47
+ return sp, 0.45, 0.0, el
48
+ if t < 300:
49
+ return -2.00, 0.25, 0.0, 1.00
50
+ if t < 390:
51
+ return -2.00, self._ramp(t, 300, 390, 0.25, 1.55), 0.0, 1.00
52
+ if t < 480:
53
+ return -2.00, self._ramp(t, 390, 480, 1.55, -0.20), 0.0, 1.00
54
+ if t < 570:
55
+ sp = self._ramp(t, 480, 570, -2.00, -0.80)
56
+ el = self._ramp(t, 480, 570, 1.00, 0.30)
57
+ return sp, 0.30, 0.0, el
58
+ if t < 660:
59
+ sp = self._ramp(t, 570, 660, -1.70, -2.75)
60
+ el = self._ramp(t, 570, 660, 0.60, 0.10)
61
+ return sp, 0.20, 0.0, el
62
+ if t < 780:
63
+ return -1.90, 0.20, 0.0, 0.15
64
+ if t < 900:
65
+ sp = self._ramp(t, 780, 900, -0.60, -2.60)
66
+ el = self._ramp(t, 780, 900, 1.80, 0.20)
67
+ sr = self._ramp(t, 780, 900, 0.00, 0.30)
68
+ return sp, sr, 0.0, el
69
+ if t < 1000:
70
+ el = self._ramp(t, 900, 1000, 0.20, 0.90)
71
+ sr = self._ramp(t, 900, 1000, 0.30, 1.40)
72
+ return -2.40, sr, 0.0, el
73
+ if t < 1120:
74
+ sp = self._ramp(t, 1000, 1120, -2.40, 0.0)
75
+ el = self._ramp(t, 1000, 1120, 0.90, 0.0)
76
+ sr = self._ramp(t, 1000, 1120, 1.40, 0.0)
77
+ return sp, sr, 0.0, el
78
+ if t < 1300:
79
+ # second attempt: walk in again with the hands in front
80
+ sp = self._ramp(t, 1200, 1300, 0.0, -1.70)
81
+ sr = self._ramp(t, 1200, 1300, 0.0, 0.35)
82
+ el = self._ramp(t, 1200, 1300, 0.0, 0.90)
83
+ return sp, sr, 0.0, el
84
+ if t < 1420:
85
+ sp = self._ramp(t, 1300, 1420, -1.70, -2.70)
86
+ el = self._ramp(t, 1300, 1420, 0.90, 0.20)
87
+ return sp, 0.30, 0.0, el
88
+ if t < 1520:
89
+ return -1.90, self._ramp(t, 1420, 1520, 0.30, 1.40), 0.0, 0.80
90
+ if t < 1600:
91
+ return -1.90, self._ramp(t, 1520, 1600, 1.40, -0.10), 0.0, 0.80
92
+ if t < 1700:
93
+ sp = self._ramp(t, 1600, 1700, -1.90, -2.70)
94
+ el = self._ramp(t, 1600, 1700, 0.80, 0.10)
95
+ return sp, 0.30, 0.0, el
96
+ return 0.0, 0.0, 0.0, 0.0
97
+
98
+ def act(self, obs, tools):
99
+ """Return the 21-float physical action for this control step."""
100
+ t = int(obs.get("t", self.t))
101
+ self.t = t
102
+ a = self.hold.copy()
103
+
104
+ # ---- base ------------------------------------------------------
105
+ if t < 150:
106
+ vx = 0.30
107
+ elif t < 240:
108
+ vx = 0.15
109
+ elif t < 340:
110
+ vx = 0.35
111
+ elif t < 520:
112
+ vx = 0.12
113
+ elif t < 620:
114
+ vx = 0.30
115
+ elif t < 700:
116
+ vx = 0.15
117
+ elif t < 760:
118
+ vx = -0.25
119
+ elif t < 900:
120
+ vx = 0.30
121
+ elif t < 1000:
122
+ vx = 0.10
123
+ elif t < 1120:
124
+ vx = -0.30
125
+ elif t < 1300:
126
+ vx = 0.28
127
+ elif t < 1420:
128
+ vx = 0.15
129
+ elif t < 1520:
130
+ vx = 0.25
131
+ elif t < 1600:
132
+ vx = 0.10
133
+ elif t < 1680:
134
+ vx = 0.25
135
+ else:
136
+ vx = -0.25
137
+ a[0] = vx
138
+ a[1] = 0.0
139
+ a[2] = 0.74
140
+ a[3] = 0.0
141
+ a[4] = 0.0
142
+
143
+ # ---- arms ------------------------------------------------------
144
+ sp, sr, sy, el = self._arm_targets(t)
145
+ a[5:12] = np.array([sp, sr, sy, el, 0.0, 0.0, 0.0], np.float32)
146
+ a[12:19] = np.array([sp, -sr, -sy, el, 0.0, 0.0, 0.0], np.float32)
147
+ a[19] = 0.85
148
+ a[20] = 0.85
149
+ return a
policies/wall_cupboard_close/deepseek1017-s2/episodes.csv ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ seed,success,length,termination,fell
2
+ 620000,1,1170,success,0
3
+ 620001,1,1170,success,0
4
+ 620002,1,1170,success,0
5
+ 620003,1,1170,success,0
6
+ 620004,1,1170,success,0
7
+ 620005,1,1170,success,0
8
+ 620006,1,1170,success,0
9
+ 620007,1,1170,success,0
10
+ 620008,1,1170,success,0
11
+ 620009,1,1170,success,0
12
+ 620010,1,1170,success,0
13
+ 620011,1,1170,success,0
14
+ 620012,1,1170,success,0
15
+ 620013,1,1170,success,0
16
+ 620014,1,1170,success,0
17
+ 620015,1,1170,success,0
18
+ 620016,1,1170,success,0
19
+ 620017,1,1170,success,0
20
+ 620018,1,1170,success,0
21
+ 620019,1,1170,success,0
22
+ 620020,1,1170,success,0
23
+ 620021,1,1170,success,0
24
+ 620022,1,1170,success,0
25
+ 620023,1,1170,success,0
26
+ 620024,1,1170,success,0
27
+ 620025,1,1170,success,0
28
+ 620026,1,1170,success,0
29
+ 620027,1,1170,success,0
30
+ 620028,1,1170,success,0
31
+ 620029,1,1170,success,0
32
+ 620030,1,1170,success,0
33
+ 620031,1,1170,success,0
34
+ 620032,1,1170,success,0
35
+ 620033,1,1170,success,0
36
+ 620034,1,1170,success,0
37
+ 620035,1,1170,success,0
38
+ 620036,1,1170,success,0
39
+ 620037,1,1170,success,0
40
+ 620038,1,1170,success,0
41
+ 620039,1,1170,success,0
42
+ 620040,1,1170,success,0
43
+ 620041,1,1170,success,0
44
+ 620042,1,1170,success,0
45
+ 620043,1,1170,success,0
46
+ 620044,1,1170,success,0
47
+ 620045,1,1170,success,0
48
+ 620046,1,1170,success,0
49
+ 620047,1,1170,success,0
50
+ 620048,1,1170,success,0
51
+ 620049,1,1170,success,0
52
+ 620050,1,1170,success,0
53
+ 620051,1,1170,success,0
54
+ 620052,1,1170,success,0
55
+ 620053,1,1170,success,0
56
+ 620054,1,1170,success,0
57
+ 620055,1,1170,success,0
58
+ 620056,1,1170,success,0
59
+ 620057,1,1170,success,0
60
+ 620058,1,1170,success,0
61
+ 620059,1,1170,success,0
62
+ 620060,1,1170,success,0
63
+ 620061,1,1170,success,0
64
+ 620062,1,1170,success,0
65
+ 620063,1,1170,success,0
66
+ 620064,1,1170,success,0
67
+ 620065,1,1170,success,0
68
+ 620066,1,1170,success,0
69
+ 620067,1,1170,success,0
70
+ 620068,1,1170,success,0
71
+ 620069,1,1170,success,0
72
+ 620070,1,1170,success,0
73
+ 620071,1,1170,success,0
74
+ 620072,1,1170,success,0
75
+ 620073,1,1170,success,0
76
+ 620074,1,1170,success,0
77
+ 620075,1,1170,success,0
78
+ 620076,1,1170,success,0
79
+ 620077,1,1170,success,0
80
+ 620078,1,1170,success,0
81
+ 620079,1,1170,success,0
82
+ 620080,1,1170,success,0
83
+ 620081,1,1170,success,0
84
+ 620082,1,1170,success,0
85
+ 620083,1,1170,success,0
86
+ 620084,1,1170,success,0
87
+ 620085,1,1170,success,0
88
+ 620086,1,1170,success,0
89
+ 620087,1,1170,success,0
90
+ 620088,1,1170,success,0
91
+ 620089,1,1170,success,0
92
+ 620090,1,1170,success,0
93
+ 620091,1,1170,success,0
94
+ 620092,1,1170,success,0
95
+ 620093,1,1170,success,0
96
+ 620094,1,1170,success,0
97
+ 620095,1,1170,success,0
98
+ 620096,1,1170,success,0
99
+ 620097,1,1170,success,0
100
+ 620098,1,1170,success,0
101
+ 620099,1,1170,success,0
policies/wall_cupboard_close/deepseek1017-s2/policy.py ADDED
@@ -0,0 +1,122 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Close both open doors of the wall cabinet.
2
+
3
+ The policy is a hand-written, open-loop upper-body trajectory with a small
4
+ base-position feedback term. It was tuned by running episodes on the
5
+ development seeds; there is no learned component and no data lookup table.
6
+
7
+ Behaviour
8
+ 1. Step 0-249: bring both hands up in front of the wall cupboard and creep
9
+ towards the counter while keeping the pelvis near x = 0.10 m.
10
+ 2. Step 250 onwards: apply a slow multi-frequency sweep of the shoulder
11
+ pitch / yaw and elbow, plus small wrist-roll and gripper oscillations,
12
+ while nudging the base into the doors. The different periods make the
13
+ two hands sweep the door faces in a quasi-periodic pattern, which pushes
14
+ both doors shut. Occasional firmer shoves (t % 400 < 30) help seat the
15
+ doors in their latches.
16
+
17
+ The motion only uses proprioception (pelvis x from low_dim_obs) for feedback,
18
+ so it is deterministic and needs no image processing at run time.
19
+ """
20
+
21
+ import numpy as np
22
+
23
+
24
+ class Policy:
25
+ """Deterministic scripted controller for the wall-cabinet task."""
26
+
27
+ def reset(self, obs, tools):
28
+ """Capture the initial hold action and reset the step counter.
29
+
30
+ Args:
31
+ obs: The first observation.
32
+ tools: The tools described in docs/api.md.
33
+ """
34
+ # Keep the reset-pose targets (arms down, height/pitch/velocity zero,
35
+ # half-closed grippers) as the base of every command.
36
+ self.hold = np.asarray(tools.hold_action(), dtype=np.float32).copy()
37
+ self.step = 0
38
+ self.two_pi = 2.0 * np.pi
39
+
40
+ def act(self, obs, tools):
41
+ """Return the physical action for this control step.
42
+
43
+ Args:
44
+ obs: The current observation.
45
+ tools: The tools described in docs/api.md.
46
+
47
+ Returns:
48
+ The 21-float physical action.
49
+ """
50
+ i = self.step
51
+ self.step += 1
52
+ x = float(obs["low_dim_obs"][21])
53
+ a = self.hold.copy()
54
+
55
+ if i < 250:
56
+ # Reach: hands up at the cupboard height, walking slowly in.
57
+ self._arm(a, pitch=-1.2, roll=0.2, elbow=0.4, yaw=0.0,
58
+ wrist_roll=0.0, wrist_pitch=0.0, grip=0.5)
59
+ err = 0.10 - x
60
+ a[0] = float(np.clip(1.5 * err, -0.15, 0.15)) if abs(err) > 0.02 else 0.0
61
+ return a
62
+
63
+ t = i - 250
64
+ w = self.two_pi
65
+ # Quasi-periodic sweep of the arms over the door faces.
66
+ pitch = -1.3 + 0.45 * np.sin(w * t / 150.0) + 0.1 * np.sin(w * t / 53.0)
67
+ yaw = 0.55 * np.sin(w * t / 230.0)
68
+ roll = 0.2
69
+ elbow = 0.45 + 0.25 * np.sin(w * t / 110.0)
70
+ wrist_roll = 0.7 * np.sin(w * t / 190.0)
71
+ grip = 0.5 + 0.5 * np.sin(w * t / 300.0)
72
+
73
+ self._arm(a, pitch=pitch, roll=roll, elbow=elbow, yaw=yaw,
74
+ wrist_roll=wrist_roll, wrist_pitch=0.0, grip=grip)
75
+
76
+ # Lean into the cupboard and keep the pelvis at the counter.
77
+ err = 0.10 - x
78
+ a[0] = float(np.clip(1.2 * err, -0.08, 0.08)) if abs(err) > 0.02 else 0.05
79
+ a[4] = 0.15 * np.sin(w * t / 170.0)
80
+
81
+ # Periodic firmer shove: drive the torso forward and step in.
82
+ if t % 400 < 30:
83
+ a[0] = 0.25
84
+ a[4] = 0.6
85
+
86
+ return a
87
+
88
+ @staticmethod
89
+ def _arm(a, pitch, roll, elbow, yaw, wrist_roll, wrist_pitch, grip):
90
+ """Write symmetric arm and gripper targets into ``a`` in place.
91
+
92
+ Args:
93
+ a: 21-float action buffer.
94
+ pitch: Shoulder pitch for both arms, rad.
95
+ roll: Left shoulder roll, rad (right arm mirrors it).
96
+ elbow: Elbow flexion for both arms, rad.
97
+ yaw: Left shoulder yaw, rad (right arm mirrors it).
98
+ wrist_roll: Left wrist roll, rad (right arm mirrors it).
99
+ wrist_pitch: Wrist pitch for both arms, rad.
100
+ grip: Gripper command for both hands, 0 open .. 1 closed.
101
+
102
+ Returns:
103
+ The same action buffer ``a``.
104
+ """
105
+ a[5] = pitch
106
+ a[6] = roll
107
+ a[7] = yaw
108
+ a[8] = elbow
109
+ a[9] = wrist_roll
110
+ a[10] = wrist_pitch
111
+ a[11] = 0.0
112
+ a[19] = grip
113
+
114
+ a[12] = pitch
115
+ a[13] = -roll
116
+ a[14] = -yaw
117
+ a[15] = elbow
118
+ a[16] = -wrist_roll
119
+ a[17] = wrist_pitch
120
+ a[18] = 0.0
121
+ a[20] = grip
122
+ return a