isaaclab.cloner#
Function namespaces
Classes
Prototype topology and placement used to instantiate a scene. |
|
Numeric asset-prototype and world relationships. |
|
Configuration for environment replication. |
|
Legal clone combination defined by explicitly listing active assets. |
|
Author prototypes before dispatching one shared world topology. |
|
Apply routed clone-plan sources to one USD stage. |
Functions
|
Prepare one homogeneous topology, placement, and its USD authoring inputs. |
|
Select world compositions and retain their optional placement without creating native resources. |
|
Materialize numeric topology on an explicitly selected device. |
|
Expand named combinations into world memberships and relative weights. |
|
Return the number of concrete prototypes declared by a spawner configuration. |
|
Create centered grid transforms as host arrays. |
|
Execute one topology through its declared clone contexts. |
|
Replicate USD prims from a raw source-to-environment mapping. |
|
Create inverted collision groups for clones (PhysX only). |
Clone plan#
- class isaaclab.cloner.ClonePlan[source]#
Prototype topology and placement used to instantiate a scene.
Attributes:
Numeric asset-prototype and world membership, independent of naming and placement.
Host declarations indexed by asset-prototype ID, retained once by reference.
Destination-world path template, with one
{}slot for the world ID.Destination-world origins [m], shape [num_worlds, 3]; None preserves authored placement.
Methods:
__init__(topology, asset_cfgs[, ...])- topology: PrototypeWorldTopology#
Numeric asset-prototype and world membership, independent of naming and placement.
- asset_cfgs: tuple[Any, ...]#
Host declarations indexed by asset-prototype ID, retained once by reference.
- env_template: str = '/World/envs/env_{}'#
Destination-world path template, with one
{}slot for the world ID.
- class isaaclab.cloner.PrototypeWorldTopology[source]#
Numeric asset-prototype and world relationships.
Arrays use NumPy storage for planning or Warp storage on one device for runtime queries. Treat the topology as read-only after planning;
to_warp()explicitly materializes its numeric arrays on a device. Host declarations and naming belong toClonePlan.Attributes:
Number of asset definitions, including unused prototypes.
Flat int32 asset-prototype indices.
Offsets into
world_prototypes, starting with the shared world -1.Int32 world-prototype index per world, indexed by world ID; shared assets are not sampled.
Methods:
__init__(num_asset_prototypes, ...)- world_prototypes: np.ndarray | wp.array#
Flat int32 asset-prototype indices. Repeated indices represent distinct instances.
- world_prototype_starts: np.ndarray | wp.array#
Offsets into
world_prototypes, starting with the shared world -1.Shared assets occupy
world_prototypes[world_prototype_starts[0]:world_prototype_starts[1]]. World prototypeioccupiesworld_prototypes[world_prototype_starts[i + 1]:world_prototype_starts[i + 2]]. An empty shared world starts with[0, 0]. Offsets have dtype int64.
- world_prototype_layout: np.ndarray | wp.array#
Int32 world-prototype index per world, indexed by world ID; shared assets are not sampled.
- class isaaclab.cloner.clone_plan.TemplateMatch[source]#
The
"{}"text a template captured ("3", or a wildcard".*"), and the path below it.Attributes:
Methods:
__new__(_cls, instance, suffix)Create new instance of TemplateMatch(instance, suffix)
- isaaclab.cloner.make_clone_plan(asset_cfgs: ~collections.abc.Sequence[~typing.Any], world_prototypes: ~collections.abc.Sequence[~collections.abc.Sequence[int]], num_worlds: int, *, weights: ~collections.abc.Sequence[float] | None = None, shared_assets: ~collections.abc.Sequence[int] = (), clone_strategy: ~collections.abc.Callable[[~numpy.ndarray, int], ~numpy.ndarray] = <function sequential>, env_template: str = '/World/envs/env_{}', positions: ~numpy.ndarray | None = None) ClonePlan[source]#
Select world compositions and retain their optional placement without creating native resources.
- Parameters:
asset_cfgs¶ – Asset prototype definitions, retained by reference.
world_prototypes¶ – Asset indices in each world prototype, including repeated instances.
num_worlds¶ – Number of destination worlds.
weights¶ – Relative world-prototype weights;
Nonegives every prototype equal weight.shared_assets¶ – Asset indices instantiated once in the shared world
-1.clone_strategy¶ – Function selecting world-prototype indices from weights.
env_template¶ – Destination-world path template with one
{}slot for the world ID.positions¶ – Destination-world origins [m], shape [num_worlds, 3]; None preserves authored placement.
- Returns:
A plan holding the topology and placement. Topology starts with a shared-world slice.
- isaaclab.cloner.grid_transforms(N: int, spacing: float = 1.0, up_axis: str = 'z') tuple[ndarray, ndarray][source]#
Create centered grid transforms as host arrays.
- isaaclab.cloner.to_warp(topology: PrototypeWorldTopology, device: str) PrototypeWorldTopology[source]#
Materialize numeric topology on an explicitly selected device.
- Parameters:
- Returns:
A new topology holding its arrays alive independently of the host topology. Call once during initialization and share the result; this function does not cache, synchronize later host edits, or transfer cfgs. Queries never call it implicitly.
Path#
- class isaaclab.cloner.path[source]#
Stateless prim-path operations for clone plans.
Concrete roots are matched on segment boundaries; templates carry one
"{}"instance slot. Call these functions throughcloner.pathwithout constructing an instance.Methods:
get_asset_prototypes(plan[, path_expr])Select asset-prototype IDs by their declared cfg paths, without expanding instances.
get_world_prototypes(plan[, path_expr])Select world-prototype IDs containing assets matched by their declared cfg paths.
Return authored source paths indexed by asset-prototype ID, without reading a stage.
get_world_prototype_asset_templates(plan, *)Name every asset occurrence in each world prototype.
get_parent_indices(paths)Return the nearest strict ancestor in a path collection, independent of input order.
match(path_expr, template)Match
path_expragainst a destination template, capturing the instance slot.relative_to(path, root)Strip a concrete
rootprefix offpathon a segment boundary.rebase(path, src_root, dst_root)Rebase
pathfrom one concrete root prefix onto another on a segment boundary.- static get_asset_prototypes(plan: ClonePlan, path_expr: str | None = None) ndarray[source]#
Select asset-prototype IDs by their declared cfg paths, without expanding instances.
- Parameters:
- Returns:
Ascending asset-prototype IDs, shape [num_matches], dtype int32, each included once. Generated native paths are not matched.
- static get_world_prototypes(plan: ClonePlan, path_expr: str | None = None) ndarray[source]#
Select world-prototype IDs containing assets matched by their declared cfg paths.
- Parameters:
plan¶ – Host asset declarations and their numeric topology.
path_expr¶ – Asset-path filter interpreted by
path.get_asset_prototypes(). None selects all world definitions, including empty and unused prototypes and shared world -1.
- Returns:
Ascending world-prototype IDs, shape [num_matches], dtype int32, not destination world IDs. Filtering selects complete compositions; repeated asset memberships remain in the topology.
- static get_asset_prototype_paths(plan: ClonePlan) tuple[str | None, ...][source]#
Return authored source paths indexed by asset-prototype ID, without reading a stage.
- Parameters:
plan¶ – Host declarations, topology, and naming template.
- Returns:
One source path per asset definition, or None for an unused definition. Explicit spawner paths take precedence; otherwise the first participating prototype/world supplies the source. Shared world -1 precedes replicated worlds.
- static get_world_prototype_asset_templates(plan: ClonePlan, *, include_world_indices: bool = False) tuple[tuple[str, ...], ndarray] | tuple[tuple[str, ...], ndarray, ndarray, ndarray][source]#
Name every asset occurrence in each world prototype.
- Parameters:
- Returns:
Flat templates aligned with
topology.world_prototypes, and the existingworld_prototype_startsarray by reference. Shared templates have no instance slot; repeated memberships receive distinct sibling names. Unused prototypes retain templates.When requested, two additional arrays group destination world IDs by world prototype, including shared world -1 first. For group g (prototype g-1), template starts select its members and world-index starts select its destinations. These are different boundaries; world IDs are not duplicated for every member. Both starts arrays include the final end.
- static get_parent_indices(paths: Sequence[str]) ndarray[source]#
Return the nearest strict ancestor in a path collection, independent of input order.
- Parameters:
paths¶ – Concrete paths or templates. Equal paths are peers, not parents.
- Returns:
Parent index per input, dtype int32; -1 when no ancestor occurs in the collection. For duplicate ancestors the first occurrence is used. No stage is read.
- static match(path_expr: str, template: str) TemplateMatch | None[source]#
Match
path_expragainst a destination template, capturing the instance slot.The
"{}"slot matches one path segment’s worth of text: a concrete id (3) or a wildcard standing for one segment (.*,[^/]+). The captured text identifies the instance without slicing the path by hand.- Parameters:
- Returns:
A
TemplateMatchwith the captured instance text and the asset-relative suffix, orNonewhenpath_expris not under the template’s instance root.
Example
>>> path.match("/World/envs/env_3/Robot/base", "/World/envs/env_{}/Robot") TemplateMatch(instance='3', suffix='/base')
- static relative_to(path: str, root: str) str | None[source]#
Strip a concrete
rootprefix offpathon a segment boundary.Unlike slicing or
str.removeprefix(), this returnsNonerather than a mid-segment remainder whenpathis not underroot.
Query#
- class isaaclab.cloner.query[source]#
Batched numeric topology queries. Resolve declared paths separately with
path.All queries return
(world_indices, world_starts). Indices are flat int32 values; starts are int64 offsets with shape [num_queries, num_worlds + 2], including shared world -1. For query q and world w,world_starts[q, w + 1 : w + 3]bounds its selected instances. Each row’s first/last offset bounds the entire query. Repeated IDs retain separate results.NumPy queries allocate exact-sized results. Warp queries require resident int32 query IDs and preallocated
outarrays on the topology’s device; no upload or readback is implicit. Warm up before CUDA graph capture. For nonempty batches, the valid prefix ends atworld_starts[-1, -1]. If that required size exceeds capacity, starts are still reported but indices are left untouched: the caller must provide enough capacity for its selection domain, not consume a partial result.Methods:
get_asset_prototype_world_index(topology, ...)Return one world index per asset instance, retaining repeated memberships.
Return each world containing an asset once, independently for every requested asset.
get_world_prototype_world_index(topology, ...)Return the destination worlds using each requested world prototype.
- static get_asset_prototype_world_index(topology: PrototypeWorldTopology, asset_prototype: int | np.ndarray | wp.array, *, out: tuple[np.ndarray, np.ndarray] | tuple[wp.array, wp.array] | None = None) tuple[np.ndarray, np.ndarray] | tuple[wp.array, wp.array][source]#
Return one world index per asset instance, retaining repeated memberships.
- Parameters:
- Returns:
Flat world indices and per-query world boundaries. A scalar is a batch of length one. Missing or unused asset IDs produce empty slices; shared instances use world -1.
- static get_asset_prototype_unique_world_index(topology: PrototypeWorldTopology, asset_prototype: int | np.ndarray | wp.array, *, out: tuple[np.ndarray, np.ndarray] | tuple[wp.array, wp.array] | None = None) tuple[np.ndarray, np.ndarray] | tuple[wp.array, wp.array][source]#
Return each world containing an asset once, independently for every requested asset.
- Parameters:
- Returns:
Flat world indices and per-query world boundaries, as in
query.get_asset_prototype_world_index(). Every world slice has length zero or one. Separate queries are not deduplicated together.
- static get_world_prototype_world_index(topology: PrototypeWorldTopology, world_prototype: int | np.ndarray | wp.array, *, out: tuple[np.ndarray, np.ndarray] | tuple[wp.array, wp.array] | None = None) tuple[np.ndarray, np.ndarray] | tuple[wp.array, wp.array][source]#
Return the destination worlds using each requested world prototype.
- Parameters:
topology¶ – Numeric topology with NumPy or Warp storage.
world_prototype¶ – One integer (NumPy only), or a 1-D integer array of world-prototype IDs. Index -1 selects the shared world, even when empty.
out¶ – Optional NumPy outputs, required Warp outputs. See the namespace’s result/capacity contract.
- Returns:
Flat world indices and per-query world boundaries, as in
query.get_asset_prototype_world_index(). Unused world prototypes produce empty slices.
Additional Public Classes#
- class isaaclab.cloner.CloneCfg[source]#
Bases:
objectConfiguration for environment replication.
Holds the knobs
InteractiveSceneforwards tomake_clone_plan()when building per-env layouts.Methods:
- classmethod __new__(*args, **kwargs)#
- class isaaclab.cloner.InclusionSet[source]#
Bases:
objectLegal clone combination defined by explicitly listing active assets.
Methods:
- classmethod __new__(*args, **kwargs)#
- class isaaclab.cloner.ReplicateSession[source]#
Bases:
objectAuthor prototypes before dispatching one shared world topology.
Methods:
__init__(cfgs, num_clones, env_spacing, *[, ...])Capture prototype declarations, composition choices, and USD authoring inputs.
__new__(*args, **kwargs)- __init__(cfgs: ~collections.abc.Iterable[~typing.Any], num_clones: int, env_spacing: float, *, clone_strategy: ~collections.abc.Callable[[~numpy.ndarray, int], ~numpy.ndarray] = <function sequential>, world_prototypes: ~collections.abc.Sequence[~collections.abc.Sequence[int]] | None = None, weights: ~collections.abc.Sequence[float] | None = None, replicate_physics: bool = True, env_template: str = '/World/envs/env_{}')[source]#
Capture prototype declarations, composition choices, and USD authoring inputs.
- classmethod __new__(*args, **kwargs)#