Skip to content

Commit 946c5fc

Browse files
committed
changed naming,, task defined more clearly
1 parent 4de55d2 commit 946c5fc

File tree

3 files changed

+32
-22
lines changed

3 files changed

+32
-22
lines changed

src/rai_bench/rai_bench/main.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@
152152
)
153153

154154
# custom request to arm
155-
base_arm_pose = PoseModel(translation=Translation(x=0.3, y=0.0, z=0.4))
155+
base_arm_pose = PoseModel(translation=Translation(x=0.3, y=0.0, z=0.5))
156156

157157
# define benchamrk
158158
benchmark = Benchmark(

src/rai_bench/rai_bench/o3de_test_bench/tasks/grab_carrot_task.py

+18-10
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ def validate_scene(self, simulation_config: SimulationConfig) -> bool:
2121
return False
2222

2323
def calculate_result(self, simulation_bridge: SimulationBridge) -> float:
24-
corrected_objects = 0 # when the object which was in the incorrect place at the start, is in a correct place at the end
25-
misplaced_objects = 0 # when the object which was in the incorrect place at the start, is in a incorrect place at the end
26-
unchanged_correct = 0 # when the object which was in the correct place at the start, is in a correct place at the end
27-
displaced_objects = 0 # when the object which was in the correct place at the start, is in a incorrect place at the end
24+
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
25+
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
26+
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
27+
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
2828

2929
scene_state = simulation_bridge.get_scene_state()
3030

@@ -55,14 +55,20 @@ def calculate_result(self, simulation_bridge: SimulationBridge) -> float:
5555
initial_y <= 0.0
5656
): # Carrot started in the incorrect place (right side)
5757
if final_y >= 0.0:
58-
corrected_objects += 1 # Moved to correct side
58+
initially_misplaced_now_correct += (
59+
1 # Moved to correct side
60+
)
5961
else:
60-
misplaced_objects += 1 # Stayed on incorrect side
62+
initially_misplaced_still_incorrect += (
63+
1 # Stayed on incorrect side
64+
)
6165
else: # Carrot started in the correct place (left side)
6266
if final_y >= 0.0:
63-
unchanged_correct += 1 # Stayed on correct side
67+
initially_correct_still_correct += (
68+
1 # Stayed on correct side
69+
)
6470
else:
65-
displaced_objects += (
71+
initially_correct_now_incorrect += (
6672
1 # Moved incorrectly to the wrong side
6773
)
6874
break
@@ -72,6 +78,8 @@ def calculate_result(self, simulation_bridge: SimulationBridge) -> float:
7278
)
7379

7480
self.logger.info(
75-
f"corrected_objects: {corrected_objects}, misplaced_objects: {misplaced_objects}, unchanged_correct: {unchanged_correct}, displaced_objects: {displaced_objects}"
81+
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}"
7682
)
77-
return (corrected_objects + unchanged_correct) / num_initial_carrots
83+
return (
84+
initially_misplaced_now_correct + initially_correct_still_correct
85+
) / num_initial_carrots

src/rai_bench/rai_bench/o3de_test_bench/tasks/place_cubes_task.py

+13-11
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
class PlaceCubesTask(Task):
1010
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"
1212

1313
def validate_scene(self, simulation_config: SimulationConfig) -> bool:
1414
cube_types = ["red_cube", "blue_cube", "yellow_cube"]
@@ -22,10 +22,10 @@ def validate_scene(self, simulation_config: SimulationConfig) -> bool:
2222
return False
2323

2424
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
2929

3030
cube_types = ["red_cube", "blue_cube", "yellow_cube"]
3131
scene_state = simulation_bridge.get_scene_state()
@@ -59,13 +59,13 @@ def calculate_result(self, simulation_bridge: SimulationBridge) -> float:
5959
final_cube.pose, final_poses, 0.1
6060
)
6161
if not was_adjacent_initially and is_adjacent_finally:
62-
corrected_objects += 1
62+
initially_misplaced_now_correct += 1
6363
elif not was_adjacent_initially and not is_adjacent_finally:
64-
misplaced_objects += 1
64+
initially_misplaced_still_incorrect += 1
6565
elif was_adjacent_initially and is_adjacent_finally:
66-
unchanged_correct += 1
66+
initially_correct_still_correct += 1
6767
elif was_adjacent_initially and not is_adjacent_finally:
68-
displaced_objects += 1
68+
initially_correct_now_incorrect += 1
6969

7070
break
7171
else:
@@ -74,6 +74,8 @@ def calculate_result(self, simulation_bridge: SimulationBridge) -> float:
7474
)
7575

7676
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}"
7878
)
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

Comments
 (0)