Skip to content

Conversation

@jmatejcz
Copy link
Contributor

@jmatejcz jmatejcz commented Feb 26, 2025

Link to the previous PR which contains review comments: #426

Purpose

Add Test Benchmark for O3DE simulation
Add framework for easier benchmark creation

Proposed Changes

Majority of file changes are only formatting changes, main changes are in src/rai_bench package and src/rai_sim

This PR contains new package rai_bench. It introduces classes like Task, Scenario and Benchmark(src/rai_bench/rai_bench/benchmark_model.py), which are frame for creating benchmarks and it also contains O3DE Test Benchmark which is a test implementation of a benchmark for O3DE engine simulation.

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 scenes(configs/) for O3DE robotic arm simulation.

Example of how can scenarios and benchmark be defined and run can be found in rai_bench/rai_bench/main.py

Additional changes:

Issues

Testing

the binary to simulation can be downloaded from here: humble

To run this benchmark you need o3de bridge config file in src/rai_bench/rai_bench/o3de_test_bench/configs/o3de_config.yaml, this config file should include fields:

binary_path: ...
robotic_stack_command: ros2 launch examples/manipulation-demo-no-binary.launch.py
required_services:
  - /grounding_dino_classify
  - /grounded_sam_segment
  - /manipulator_move_to
  - /spawn_entity
  - /delete_entity
required_topics:
  - /color_image5
  - /depth_image5
  - /color_camera_info5
required_actions: []

to install and run:

poetry install --with openset
colcon build --symlink-install
source setup_shell.sh
python src/rai_bench/rai_bench/main.py

Logs about the progess of benchmark can be found in 'src/rai_bench/o3de_test_bench/benchmark_agent.log'

You should be able to see:

  • properly started simulation
  • 4 defined scenarios
  • logs about the actions taken by agent and scores achieved in each scenario
    After finishing all scenarios, simulation should close and all nodes and services should also shutdown after no more than 30 seconds

maciejmajek and others added 30 commits February 26, 2025 09:53
```
Exception in thread Thread-1 (spin):
Traceback (most recent call last):
  File "/usr/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.10/threading.py", line 953, in run
    self._target(*self._args, **self._kwargs)
  File "/opt/ros/humble/local/lib/python3.10/dist-packages/rclpy/executors.py", line 294, in spin
    self.spin_once()
  File "/opt/ros/humble/local/lib/python3.10/dist-packages/rclpy/executors.py", line 794, in spin_once
    self._spin_once_impl(timeout_sec)
  File "/opt/ros/humble/local/lib/python3.10/dist-packages/rclpy/executors.py", line 786, in _spin_once_impl
    self._executor.submit(handler)
  File "/usr/lib/python3.10/concurrent/futures/thread.py", line 167, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
```
Co-authored-by: Jakub Matejczyk <[email protected]>

chore: naming changes

Co-authored-by: Jakub Matejczyk <[email protected]>

chore: naming changes

Co-authored-by: Jakub Matejczyk <[email protected]>

chore: redefine benchmark model

Co-authored-by: Jakub Matejczyk <[email protected]>
Co-authored-by: Kacper Dąbrowski <[email protected]>

refactor: SceneConfig to BaseModel class

feat: add SceneSetup to store initial scene setup

build: poetry initialization of rai_benchmarks and rai_simulations

chore: add licence lines

build: create packages from rai_benchmarks and rai_simulations

chore: removed mistakenly added file

feat: scene config implementation

Add O3DEEngineConnector features

Signed-off-by: Kacper Dąbrowski <[email protected]>

Remove an unused file

Signed-off-by: Kacper Dąbrowski <[email protected]>

Add binary path caching

Signed-off-by: Kacper Dąbrowski <[email protected]>

Add two example scenes

Signed-off-by: Kacper Dąbrowski <[email protected]>

feat: replace binary path with ros2 launch command + binary path

refactor: renamed rai_sim and rai_bench

fix: fixed shutdown of binary

chore: make pose mandatory

chore: remove rai_bench because it is developed on another branch

ci: add missing license lines

laoding and spawning frm benchmark

rabsed

naming change

grab xyz benchmark

benchmarks run new sim every scenario for now
removed name in launch_robotic_manipulation to avoid misnaming nodes
add main to run bechmark
add helper functions to Task
task takes simulation config as arg now
adjusted typing
 adjusted paths to configs
 add move arm request to O3DEngineArmManipulationBridge
adjusted main to task naming change
jmatejcz and others added 22 commits February 26, 2025 09:54
This fixes bug when get_transform returns always the same, first transform
Add logs to track retrieved positions
added log when all scenarios finished
refactored scenario to inlucde config path so it can be logged easily
@maciejmajek maciejmajek changed the title Feat/bench feat: rai_bench Feb 26, 2025
@maciejmajek maciejmajek merged commit c759817 into feat/simbench Feb 26, 2025
2 checks passed
@maciejmajek maciejmajek deleted the feat/bench branch February 26, 2025 08:58
maciejmajek pushed a commit that referenced this pull request Feb 26, 2025
Co-authored-by: Maciej Majek <[email protected]>
Co-authored-by: Bartłomiej Boczek <[email protected]>
Co-authored-by: MagdalenaKotynia <[email protected]>

chore: pre-commit
maciejmajek pushed a commit that referenced this pull request Mar 7, 2025
Co-authored-by: Maciej Majek <[email protected]>
Co-authored-by: Bartłomiej Boczek <[email protected]>
Co-authored-by: MagdalenaKotynia <[email protected]>

chore: pre-commit
@jmatejcz jmatejcz mentioned this pull request Mar 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants