Skip to content

Commit b65e280

Browse files
feat: add more scenarios to o3de manipulation benchmark (#452)
Co-authored-by: Bartłomiej Boczek <[email protected]>
1 parent 485d10c commit b65e280

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+4048
-335
lines changed

demos.repos

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ repositories:
66
src/examples/rai-manipulation-demo:
77
type: git
88
url: https://github.com/RobotecAI/rai-manipulation-demo.git
9-
version: development
9+
version: kd/wait_for_clock

src/rai_bench/README.md

Lines changed: 65 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,56 @@
11
## RAI Benchmark
22

3-
## Description
3+
### Description
44

55
The RAI Bench is a package including benchmarks and providing frame for creating new benchmarks
66

7-
## Frame Components
8-
9-
Frame components can be found in `src/rai_bench/rai_bench/benchmark_model.py`
7+
### Frame Components
108

119
- `Task`
1210
- `Scenario`
1311
- `Benchmark`
1412

15-
For more information about these classes go to -> `src/rai_bench/rai_bench/benchmark_model.py`
13+
For more information about these classes go to -> [benchmark_model](./rai_bench/benchmark_model.py)
14+
15+
### O3DE Test Benchmark
16+
17+
The O3DE Test Benchmark [o3de_test_benchmark_module](./rai_bench/o3de_test_bench/) provides tasks and scene configurations for robotic arm manipulation task. The tasks use a common `ManipulationTask` logic and can be parameterized, which allows for many task variants. The current tasks include:
18+
19+
- **MoveObjectToLeftTask**
20+
- **GroupObjectsTask**
21+
- **BuildCubeTowerTask**
22+
- **PlaceObjectAtCoordTask**
23+
- **RotateObjectTask** (currently not applicable due to limitations in the ManipulatorMoveTo tool)
24+
25+
The result of a task is a value between 0 and 1, calculated like initially_misplaced_now_correct / initially_misplaced. This score is calculated at the end of each scenario.
1626

17-
### O3DE TEST BENCHMARK
27+
Current O3DE simulation binaries:
1828

19-
O3DE Test Benchmark (`src/rai_bench/rai_bench/o3de_test_bench/`), contains 2 Tasks(`tasks/`) - GrabCarrotTask and PlaceCubesTask (these tasks implement calculating scores) and 4 scene_configs(`configs/`) for O3DE robotic arm simulation.
29+
### Running
2030

21-
Both tasks calculate score, taking into consideration 4 values:
31+
1. Download O3DE simulation binary and unzip it.
2232

23-
- initially_misplaced_now_correct
24-
- initially_misplaced_still_incorrect
25-
- initially_correct_still_correct
26-
- initially_correct_now_incorrect
33+
- [ros2-humble](https://robotec-ml-rai-public.s3.eu-north-1.amazonaws.com/RAIManipulationDemo_jammyhumble.zip)
34+
- [ros2-jazzy](https://robotec-ml-rai-public.s3.eu-north-1.amazonaws.com/RAIManipulationDemo_noblejazzy.zip)
2735

28-
The result is a value between 0 and 1, calculated like (initially_misplaced_now_correct + initially_correct_still_correct) / number_of_initial_objects.
29-
This score is calculated at the beggining and at the end of each scenario.
36+
2. Follow step 2 from [Manipulation demo Setup section](../../docs/demos/manipulation.md#setup)
37+
38+
3. Adjust the path to the binary in: [o3de_config.yaml](./rai_bench/o3de_test_bench/configs/o3de_config.yaml)
39+
4. Run benchmark with:
40+
41+
```bash
42+
cd rai
43+
source setup_shell.sh
44+
python src/rai_bench/rai_bench/examples/o3de_test_benchmark.py
45+
```
46+
47+
> [!NOTE]
48+
> For now benchmark runs all available scenarios (~160). See [Examples](#example-usege)
49+
> section for details.
3050
3151
### Example usage
3252

33-
Example of how to load scenes, define scenarios and run benchmark can be found in `src/rai_bench/rai_bench/examples/o3de_test_benchmark.py`
53+
Example of how to load scenes, define scenarios and run benchmark can be found in [o3de_test_benchmark_example](./rai_bench/examples/o3de_test_benchmark.py)
3454

3555
Scenarios can be loaded manually like:
3656

@@ -52,3 +72,33 @@ scenarios = Benchmark.create_scenarios(
5272
```
5373

5474
which will result in list of scenarios with combination of every possible task and scene(task decides if scene config is suitable for it).
75+
76+
or can be imported from exisitng packets [scenarios_packets](./rai_bench/o3de_test_bench/scenarios.py):
77+
78+
```python
79+
t_scenarios = trivial_scenarios(
80+
configs_dir=configs_dir, connector_path=connector_path, logger=bench_logger
81+
)
82+
e_scenarios = easy_scenarios(
83+
configs_dir=configs_dir, connector_path=connector_path, logger=bench_logger
84+
)
85+
m_scenarios = medium_scenarios(
86+
configs_dir=configs_dir, connector_path=connector_path, logger=bench_logger
87+
)
88+
h_scenarios = hard_scenarios(
89+
configs_dir=configs_dir, connector_path=connector_path, logger=bench_logger
90+
)
91+
vh_scenarios = very_hard_scenarios(
92+
configs_dir=configs_dir, connector_path=connector_path, logger=bench_logger
93+
)
94+
```
95+
96+
which are grouped by their subjective difficulty. For now there are 10 trivial, 42 easy, 23 medium, 38 hard and 47 very hard scenarios.
97+
Check docstrings and code in [scenarios_packets](./rai_bench/o3de_test_bench/scenarios.py) if you want to know how scenarios are assigned to difficulty level.
98+
99+
### Development
100+
101+
When creating new task or changing existing ones, make sure to add unit tests for score calculation in [rai_bench_tests](../../tests/rai_bench/).
102+
This applies also when you are adding or changing the helper methods in `Task` or `ManipulationTask`.
103+
104+
The number of scenarios can be easily extened without writing new tasks, by increasing number of variants of the same task and adding more simulation configs but it won't improve variety of scenarios as much as creating new tasks.

0 commit comments

Comments
 (0)