SlowGuess/NeurIPS_2023_OCR huggingface dataset:
# Since obj is not in a stack, robot can just move then pick it up move_then_pick(obj=obj) # place the object at the location to cook at move_then_place(obj=obj, place_location=location) # cook the object cook_until_is_cooked(obj=obj)   
def move_then_stack(obj_to_stack, obj_at_bottom, stack_location): if get_curr_location() != stack_location: move(get_curr_location(), stack_location) stack(obj_to_stack, obj_at_bottom)   
def stack_obj1_on_obj2(obj1, obj2): # To stack obj1 on obj2, the robot needs to be holding obj1 if not is_holding(obj1): # If the robot is not holding obj1, there are 2 scenarios: # (1) if obj1 is in a stack ,unstack obj1 # (2) else, pick up obj1. if is_in_a_stack(obj1): # Because obj1 is in a stack, robot need to move then unstack the obj from the obj_at_bottom first obj_at_bottom = get_obj_that_is_underneath(obj_at_top=obj1 ) move_then_unstack(obj_to_unstack=obj1, obj_at_bottom= obj_at_bottom, unstack_location=get_obj_location(obj_at_bottom)) else: # Since obj1 is not in a stack, robot can just move then pick it up move_then_pick(obj=obj1) # determine the location of obj2 to stack on obj2_location = get_obj_location(obj2) # move to obj2's location then stack obj1 on obj2 move_then_stack(obj_to_stack=obj1, obj_at_bottom=obj2, stack_location=obj2_location)   
def cut_until_is CUT(obj): while not is CUT(obj): cut(obj)   
def cut_object_at_location(obj, location): # To cut an object, the robot first needs to be holding obj if not is_holding(obj): # If the robot is not holding obj, there are 2 scenarios: # (1) if obj is in a stack ,unstack obj # (2) else, pick up obj. if is_in_a_stack(obj): # Because obj is in a stack, robot need to move then unstack the obj from the obj_at_bottom first obj_at_bottom = get_obj-that_is_underneath(obj_at_top=obj) move_then_unstack(obj_to_unstack=obj, obj_at_bottom= obj_at_bottom, unstack_location=get_obj_location(obj_at_bottom)) else: # Since obj is not in a stack, robot can just move then pick it up move_then_pick(obj=obj) # place the object at the location to cut at move_then_place(obj=obj, place_location=location) # cut the object cut_until_is CUT(obj=obj)
19.3.4 Only Analyze Helper Functions
37   
38   
39   
40   
41   
42   
43   
44   
45   
46   
47   
48   
49   
50   
51   
52   
53   
54   
55   
56   
57   
58   
59   
60   
61   
62   
63   
64   
65   
66   
67   
68   
69   
70   
71   
72   
73   
74   
75   
76   
77   
78   
79   
80   
81   
82   
83   
84   
85   
86   
87
def movethen_unstack(obj_to_unstack, obj_at_bottom, unstack_location) : # For unstacking, we need to move to the location of the bottom object if getCurr_location() != get_obj_location(obj_at_bottom): move(getCurr_location(), get_obj_location(obj_at_bottom))   
5 unstack(obj_to_unstack, obj_at_bottom)   
6 After unstacking, we need to move to the unstack_location if getCurr_location() != unstack_location: move(getCurr_location(), unstack_location)   
8   
9   
10 def move_then_pick(obj): obj_location = get_obj_location(obj) if getCurr_location() != obj_location: move(getCurr_location(), obj_location) pick_up(obj, obj_location)   
15   
16 def move_then_place(obj, place_location): if getCurr_location() != place_location: move(getCurr_location(), place_location) place(obj, place_location)   
19   
20 def cook_until_is_cooked(obj): start_cooking(obj) while not is_cooked(obj): noop()   
25   
26 def cook_object_at_location(obj, location): # To cook an object, the robot first needs to be holding obj if not is_holding(obj): # If the robot is not holding obj, there are 2 scenarios: # (1) if obj is in a stack ,unstack obj # (2) else, pick up obj. if is_in_a_stack(obj): # Because obj is in a stack, robot need to move then unstack the obj from the obj_at_bottom first obj_at_bottom = get_obj_that_is_underneath(obj_at_top=obj) move_then_unstack(obj_to_unstack=obj, obj_at_bottom= obj_at_bottom, unstack_location=get_obj_location(obj_at_bottom)) else: # Since obj is not in a stack, robot can just move then pick it up move_then_pick(obj=obj) # place the object at the location to cook at move_then_place(obj=obj, place_location=location) # cook the object cook_until_is_cooked(obj=obj)   
34   
35   
36   
37   
38   
39   
40   
41   
42   
43   
44   
45   
46   
47   
48   
49   
50 def stack_obj1_on_obj2(obj1, obj2): # To stack obj1 on obj2, the robot needs to be holding obj1 if not is_holding(obj1): # If the robot is not holding obj1, there are 2 scenarios: # (1) if obj1 is in a stack ,unstack obj1 # (2) else, pick up obj1. if is_in_a_stack(obj1): # Because obj1 is in a stack, robot need to move then unstack the obj from the obj_at_bottom first obj_at_bottom = get_obj-that_is_underneath(obj_at_top=obj1
movethen_unstack(obj_to_unstack  $\equiv$  obj1, obj_at_bottom  $=$  obj_at_bottom, unstack_location  $\equiv$  get_obj_location(obj_at_bottom)) else:   
60 # Since obj1 is not in a stack, robot can just move then pick it up move_then_pickobj=obj1)   
62 # determine the location of obj2 to stack on obj2_location  $\equiv$  get_obj_location(obj2)   
64 # move to obj2's location then stack obj1 on obj2   
65 move_thenth_stack(obj_to_stack  $\equiv$  obj1, obj_at_bottom  $\equiv$  obj2, stack_location  $\equiv$  obj2_location)   
66   
67 def cut_until_is_cut(obj): while not is CUT(obj): cut(obj)   
70   
71 def cut_object_at_location(obj, location): # To cut an object, the robot first needs to be holding obj if not is_holding(obj): # If the robot is not holding obj, there are 2 scenarios: # (1) if obj is in a stack ,unstack obj # (2) else, pick up obj. if is_in_a_stack(obj): # Because obj is in a stack, robot need to move then unstack the obj from the obj_at_bottom first obj_at_bottom  $\equiv$  get_obj_that_is_underneath(obj_at_top  $\equiv$  obj) move_thenth_unstack(obj_to_unstack  $\equiv$  obj, obj_at_bottom  $=$  obj_at_bottom, unstack_location  $\equiv$  get_obj_location(obj_at_bottom)) else:   
82 # Since obj is not in a stack, robot can just move then pick it up move_then_pickobj  $\equiv$  obj)   
84 # place the object at the location to cut at   
85 move_thenth_place(obj  $\equiv$  obj, place_location  $\equiv$  location)   
86 # cut the object   
87 cut_until_is.cut(obj  $\equiv$  obj)