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
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,16 @@ cd duobench
pip install -ve .
```

### Asset Cache Location

DuoBench resolves its asset directory from the `DUOBENCH_PREFIX` environment variable. If `DUOBENCH_PREFIX` is not set, it defaults to `~/.duobench`.

On import, DuoBench checks whether that path exists. If it does not, the package downloads the matching asset archive from GitHub into that location automatically. This makes the default setup work out of the box, while still letting you point assets at a custom directory when needed.

```shell
export DUOBENCH_PREFIX=/path/to/duobench-assets
```

## Quickstart

Tasks need to be imported as `from duobench.tasks import <task_id>`.
Expand Down
14 changes: 7 additions & 7 deletions src/duobench/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
from rcs import get_prefix
from rcs._core import common

RCS_DUOBENCH_GITHUB_ASSET_ARCHIVE_URL = "https://github.com/RobotControlStack/rcs_duobench/archive/refs/tags/{tag}.zip"
DUOBENCH_GITHUB_ASSET_ARCHIVE_URL = "https://github.com/RobotControlStack/duobench/archive/refs/tags/{tag}.zip"

RCS_DUOBENCH_PREFIX = get_prefix(
os.environ.get("RCS_DUOBENCH_PREFIX"),
DUOBENCH_PREFIX = get_prefix(
os.environ.get("DUOBENCH_PREFIX"),
Path(__file__).resolve().parents[2],
Path.home() / ".rcs_duobench",
Path.home() / ".duobench",
__version__,
RCS_DUOBENCH_GITHUB_ASSET_ARCHIVE_URL,
DUOBENCH_GITHUB_ASSET_ARCHIVE_URL,
)

CAMERA_PATHS: dict[str, str] = {}
Expand Down Expand Up @@ -97,10 +97,10 @@
"vention_world": "assets/scenes/vention_table/vention_world.xml",
}

# Append RCS_DUOBENCH package prefix to all asset paths
# Append DUOBENCH package prefix to all asset paths
for path_dict in (GRIPPER_PATHS, SCENE_PATHS, OBJECT_PATHS, CAMERA_PATHS):
for name, path in path_dict.items():
abs_path = os.path.join(RCS_DUOBENCH_PREFIX, path)
abs_path = os.path.join(DUOBENCH_PREFIX, path)
if not os.path.isfile(abs_path):
error_msg = f"Asset {name} not found at path: {abs_path}. Please make sure to download the assets."
raise FileNotFoundError(error_msg)
Expand Down
Loading