SimReady Central (bt.simready)¶
NVIDIA's open library of simulation-ready USD assets as botrail scenery:
one package to disk at its commit, with its license and publisher, for
bt.parts.simready to stand in a cell. See
USD import.
pkg = bt.simready.fetch("https://huggingface.co/datasets/nvidia/simready-assets/"
"blob/653d91e182011f357cf1644013cc94ddf194d349/box_cardboard_a01/"
"simready_usd/sm_box_cardboard_a01_01.usd")
bt.parts.simready(scene, "carton", (1.2, 0.4), pkg, dynamic=True)
pkg.license, pkg.source # 'CC-BY-4.0', the URL at its commit
simready
¶
SimReady Central assets as botrail scenery.
NVIDIA's SimReady Central is an open library of simulation-ready OpenUSD
assets — thousands of props and a few vendor robots and grippers, each
package hosted in its publisher's Hugging Face dataset and pinned to a
dataset commit by the library's index (the Space
nvidia/simready-central). botrail reads them with scene.load_usd
unchanged: metres, Z-up, the geometry as obstacles, the mass the package
authored, the textures and MDL look in the studio.
This module finds packages and brings one to disk;
:func:botrail.parts.simready stands it in a cell. :func:search asks the
library's search service the way a person would — words, a size, a license —
and returns hits that say what they are; :func:fetch takes a hit, a
Hugging Face URL as the library hands it out (.../blob/<commit>/<asset>/...),
a (repo, asset, commit) triple, or a package directory already on disk:
hits = bt.simready.search("blue plastic crate", max_size=(0.7, 0.5, 0.4), limit=5)
hits[0].name, hits[0].size_m, hits[0].mass_kg, hits[0].license
pkg = bt.simready.fetch(hits[0])
scene.load_usd(pkg.root, prefix="crate")
pkg.license, pkg.source # 'CC-BY-4.0', the URL at its commit
Downloads go through huggingface_hub (pip install botrail[catalog]) into
its cache, pinned to the commit, without the package's thumbnails and the
CAD and texture copies under source_assets/. The library's assets are not
botrail catalog products: they carry no part number, no specs and no
mounting, so a cell records them by source URL and license on the part
(set_part(source=..., license=...)), and the catalog stays the list of
what is ordered.
PACKAGING
module-attribute
¶
str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str
Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.
ROOTS
module-attribute
¶
str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str
Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.
SEARCH_URL
module-attribute
¶
str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str
Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.
SKIPPED
module-attribute
¶
SKIPPED = (
"simready_usd/.thumbs/**",
"simready_usd/source_assets/*.png",
"simready_usd/source_assets/*.jpg",
"simready_usd/source_assets/*.jpeg",
"simready_usd/source_assets/*.exr",
"simready_usd/source_assets/*.tga",
"simready_usd/source_assets/*.tif",
"simready_usd/source_assets/*.tiff",
"simready_usd/source_assets/*.bmp",
"simready_usd/source_assets/*.hdr",
"simready_usd/source_assets/*.dds",
"simready_usd/source_assets/*.fbx",
"simready_usd/source_assets/*.obj",
"simready_usd/source_assets/*.stl",
"simready_usd/source_assets/*.step",
"simready_usd/source_assets/*.stp",
"simready_usd/source_assets/*.iges",
"simready_usd/source_assets/*.igs",
"simready_usd/source_assets/*.glb",
"simready_usd/source_assets/*.gltf",
"simready_usd/source_assets/*.blend",
"simready_usd/source_assets/*.usd",
"simready_usd/source_assets/*.usda",
"simready_usd/source_assets/*.usdc",
"simready_usd/source_assets/*.usdz",
"simready_usd/source_assets/*.zip",
"simready_usd/source_assets/*.7z",
)
Built-in immutable sequence.
If no argument is given, the constructor returns an empty tuple. If iterable is specified the tuple is initialized from iterable's items.
If the argument is a tuple, the return value is the same object.
Hit
¶
One search result: enough to read, to judge, and to fetch and pin.
Package
¶
A SimReady package on disk — what scene.load_usd(package.root) reads.
fetch
¶
fetch(
ref: Union,
*,
cache_dir: Union[str, PathLike[str], None] = None,
) -> Package
The package ref names, on disk.
ref is a :class:Hit from :func:search, a Hugging Face URL of the
package or of a file in it, a (repo, asset, revision) triple
(revision None takes the dataset's current commit, which the
returned package then records), or a path already on disk — the
package folder, or its root USD. A download needs huggingface_hub
and raises ValueError("cannot reach ...") when the hub cannot be
reached and the cache has no copy.
parse_url
¶
(repo, revision, asset, path) of a dataset URL the library hands out —
blob, resolve or tree, the path inside the asset when the URL names a file.
search
¶
search(
text: str,
*,
limit: int = 10,
max_size: Optional[
tuple[
Optional[float],
Optional[float],
Optional[float],
]
] = None,
min_size: Optional[
tuple[
Optional[float],
Optional[float],
Optional[float],
]
] = None,
max_mass_kg: Optional[float] = None,
license: Optional[str] = None,
kind: Optional[str] = None,
profile: Optional[str] = None,
publisher: Optional[str] = None,
url: Optional[str] = None,
timeout: float = 60.0,
) -> list[Hit]
Packages the library's search service ranks for text, best first.
text is what the thing is, in words ("blue plastic crate",
"two-finger gripper"); the service matches it against captions,
labels and names. The rest narrows: max_size / min_size bound the
root prim's bounding box in metres (None leaves an axis open —
max_size=(0.7, 0.5, None) caps the footprint only), max_mass_kg
the authored mass, license a substring of the declared license
("CC-BY" takes the library's three spellings), kind the package's
type ("prop", "robot", "gripper"), profile the validation
profile ("Robotics-Prop", "Robot-Body", "Robot-Gripper") and
publisher the dataset namespace ("nvidia"). The service is the Space
behind the library (SEARCH_URL, or BOTRAIL_SIMREADY_URL / url);
when it cannot be reached this raises ValueError("cannot reach ...").