8
8
9
9
class PlaceCubesTask (Task ):
10
10
def get_prompt (self ) -> str :
11
- return "Manipulate objects, so that all cubes are next to each other "
11
+ return "Manipulate objects, so that all cubes are adjacent to at least one cube "
12
12
13
13
def validate_scene (self , simulation_config : SimulationConfig ) -> bool :
14
14
cube_types = ["red_cube" , "blue_cube" , "yellow_cube" ]
@@ -22,10 +22,10 @@ def validate_scene(self, simulation_config: SimulationConfig) -> bool:
22
22
return False
23
23
24
24
def calculate_result (self , simulation_bridge : SimulationBridge ) -> float :
25
- corrected_objects = 0 # when the object which was in the incorrect place at the start, is in a correct place at the end
26
- misplaced_objects = 0 # when the object which was in the incorrect place at the start, is in a incorrect place at the end
27
- unchanged_correct = 0 # when the object which was in the correct place at the start, is in a correct place at the end
28
- displaced_objects = 0 # when the object which was in the correct place at the start, is in a incorrect place at the end
25
+ initially_misplaced_now_correct = 0 # when the object which was in the incorrect place at the start, is in a correct place at the end
26
+ initially_misplaced_still_incorrect = 0 # when the object which was in the incorrect place at the start, is in a incorrect place at the end
27
+ initially_correct_still_correct = 0 # when the object which was in the correct place at the start, is in a correct place at the end
28
+ initially_correct_now_incorrect = 0 # when the object which was in the correct place at the start, is in a incorrect place at the end
29
29
30
30
cube_types = ["red_cube" , "blue_cube" , "yellow_cube" ]
31
31
scene_state = simulation_bridge .get_scene_state ()
@@ -59,13 +59,13 @@ def calculate_result(self, simulation_bridge: SimulationBridge) -> float:
59
59
final_cube .pose , final_poses , 0.1
60
60
)
61
61
if not was_adjacent_initially and is_adjacent_finally :
62
- corrected_objects += 1
62
+ initially_misplaced_now_correct += 1
63
63
elif not was_adjacent_initially and not is_adjacent_finally :
64
- misplaced_objects += 1
64
+ initially_misplaced_still_incorrect += 1
65
65
elif was_adjacent_initially and is_adjacent_finally :
66
- unchanged_correct += 1
66
+ initially_correct_still_correct += 1
67
67
elif was_adjacent_initially and not is_adjacent_finally :
68
- displaced_objects += 1
68
+ initially_correct_now_incorrect += 1
69
69
70
70
break
71
71
else :
@@ -74,6 +74,8 @@ def calculate_result(self, simulation_bridge: SimulationBridge) -> float:
74
74
)
75
75
76
76
self .logger .info (
77
- f"corrected_objects: { corrected_objects } , misplaced_objects: { misplaced_objects } , unchanged_correct: { unchanged_correct } , displaced_objects: { displaced_objects } "
77
+ f"corrected_objects: { initially_misplaced_now_correct } , misplaced_objects: { initially_misplaced_still_incorrect } , unchanged_correct: { initially_correct_still_correct } , displaced_objects: { initially_correct_now_incorrect } "
78
78
)
79
- return (corrected_objects + unchanged_correct ) / num_of_objects
79
+ return (
80
+ initially_misplaced_now_correct + initially_correct_still_correct
81
+ ) / num_of_objects
0 commit comments