Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -120,3 +120,7 @@ jobs:
pixi run install_all
pixi run build_tests
pixi run test_all
# TODO: Decide on a method for automated benchmark performance testing.
- name: Run benchmarks
run: |
pixi run test_benchmarks
Comment on lines +123 to +126

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've played around with, but haven't actually connected, two options here for continuous benchmark monitoring (assuming we want this)...

  1. https://github.com/benchmark-action/github-action-benchmark, which can store benchmarking results in gh-pages. It'll be a little annoying to configure so if we go this route it's probably easier to just wait until the repo is public. On the plus side we wouldn't need a separate app and it supports more benchmarking suites out of the box. On the down side it's more to configure.

  2. https://github.com/CodSpeedHQ/action, third part app to which benchmarking results are uploaded and are viewable on their dashboard. It's pretty easy to setup and use but requires granting access to our repo.

Thoughts? Or do we just want the benchmarks in place and then can come back to this later and rely on checking manually?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sample output here.

https://github.com/open-planning/roboplan/actions/runs/18103021233/job/51510609862?pr=67#step:6:27

If this is enough for now then we can call it enough for now...

@sea-bass sea-bass Sep 29, 2025

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think waiting for the repo to be public is good for me. We can just make this a non-required check for now.

As for 1 or 2, I think whichever is easier tbh

3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@
# pixi environments
.pixi
*.egg-info

# Benchmarking results
pytest_benchmarks.json
95 changes: 95 additions & 0 deletions benchmarks/test_benchmark_rrt.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
import pytest
import sys
import xacro

from roboplan import (
JointConfiguration,
Scene,
RRTOptions,
RRT,
)

# We don't build the bindings examples, so we just include the relative
# directory manually.
from pathlib import Path

examples_dir = Path(__file__).parent.parent / "bindings" / "examples"
sys.path.insert(0, str(examples_dir))

from common import MODELS, ROBOPLAN_EXAMPLES_DIR


def solve(scene: Scene, rrt: RRT, seed: int = 1234):
"""
Runs an RRT test by sampling random, collision-free joint configurations
then attempting to plan a path between them.

Returns 1 if planning was successful, 0 otherwise.
"""
scene.setRngSeed(seed)

start = JointConfiguration()
start.positions = scene.randomCollisionFreePositions()
assert start.positions is not None

goal = JointConfiguration()
goal.positions = scene.randomCollisionFreePositions()
assert goal.positions is not None

path = rrt.plan(start, goal)
return 0 if path is None else 1


def solve_many(scene: Scene, rrt: RRT, iterations: int = 10):
"""
Runs the specified number of iterations of RRT with a random seed.

Returns the number of successful solves.
"""
successes = 0
for i in range(iterations):
successes += solve(scene, rrt, 11235 + i)
return successes


def create_scene(model_name: str) -> Scene:
model_data = MODELS[model_name]
package_paths = [ROBOPLAN_EXAMPLES_DIR]

urdf_xml = xacro.process_file(model_data.urdf_path).toxml()
srdf_xml = xacro.process_file(model_data.srdf_path).toxml()

scene = Scene(
f"{model_name}_benchmark_scene",
urdf=urdf_xml,
srdf=srdf_xml,
package_paths=package_paths,
yaml_config_path=model_data.yaml_config_path,
)
return scene


@pytest.fixture(scope="session", params=["kinova", "ur5", "franka", "dual"])
def scene(request):
return create_scene(request.param)


def test_benchmark_rrt(benchmark, scene):
options = RRTOptions()
options.max_nodes = 100000
options.max_planning_time = 10.0
rrt = RRT(scene, options)

success_rate = benchmark(solve_many, scene, rrt, 10)
assert success_rate >= 0.95


def test_benchmark_rrt_connect(benchmark, scene):
options = RRTOptions()
options.max_nodes = 100000
options.rrt_connect = True
options.max_planning_time = 10.0
rrt = RRT(scene, options)

success_rate = benchmark(solve_many, scene, rrt, 10)
assert success_rate >= 0.95
28 changes: 28 additions & 0 deletions pixi.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion pixi.toml
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ test_cpp = { depends-on = [
{ task = "test", args = ["roboplan_toppra"] },
] }
test_all = { depends-on = ["test_py", "test_cpp"] }

test_benchmarks = { cmd = "pytest benchmarks/ --benchmark-json pytest_benchmarks.json" }

[dependencies]

Expand Down Expand Up @@ -227,6 +227,7 @@ compiler-rt = ">=19.1.7,<20"
# Python test dependencies
pytest = ">=6"
matplotlib = ">=3.10.5,<4"
pytest-benchmark = ">=5.1.0,<6"

[pypi-dependencies]
pycollada = ">=0.9.2, <0.10"
Expand Down
Loading