embodichain.lab.sim.scene.expansion#
Scene expansion describes changes to a base scene before a new task execution. The initial API provides immutable existing-entity pose proposals and a bounded source of authored candidates. Task Program and GenSim hosts can share these contracts without introducing their execution or generation dependencies into the proposal package.
The core owns no physical restoration, task semantics, simulator stepping,
episode acceptance, or dataset writes. Public imports use the normal
embodichain.lab.sim initialization and require the simulation dependencies;
constructing these values creates no simulation world.
See Using Scene Services for source-independent batch generation and Where Scene Services Are Used for Gym reset and Task Program hosts.
Limits and permissions for a scene candidate source. |
|
A proposed pose for one existing physical entity. |
|
An immutable scene proposal with reproducible proposal identity. |
|
Snapshot a bounded prefix of authored proposals for repeatable iteration. |
Frames and proposal identity#
ScenePoseChange.arena_pose is a proper homogeneous 4x4 transform from the
entity frame into its local Z-up arena. It excludes replication offsets and
does not use a robot chain-root frame. Nested numeric input is copied into
immutable tuples; nonfinite, reflected, nonorthonormal, or malformed transforms
are rejected.
SceneVariant.variant_id includes the original scene identity, seed,
ordinal, proposed geometry, and provenance. Entity and provenance ordering is
canonicalized. A proposal ID is separate from the actual initial-state identity
captured after physical settling, and neither certifies task completion.
The seed reproduces a proposal schedule; it does not promise identical physics
across engines or versions.
Bounded fixed candidates#
FixedSceneCandidateSource snapshots at most max_candidates entries from
its input iterable. It leaves later entries untouched, permits changes only to
declared movable entity UIDs, and returns the same immutable candidates on each
iteration. An empty pose-change tuple is an explicit nominal candidate; an
empty source generates no candidates.
from embodichain.lab.sim.scene.expansion import (
FixedSceneCandidateSource,
SceneExpansionCfg,
ScenePoseChange,
)
source = FixedSceneCandidateSource(
SceneExpansionCfg(seed=7, max_candidates=1, movable_entity_ids=("cube",)),
parent_scene_id="pick-place-scene:revision-1",
candidates=[
(
ScenePoseChange(
entity_uid="cube",
arena_pose=(
(1, 0, 0, 0.35),
(0, 1, 0, 0.10),
(0, 0, 1, 0.76),
(0, 0, 0, 1),
),
),
),
],
metadata=(("source", "authored-layout"),),
)
variant = source.variants[0]
This only constructs a proposal. Support, manipulation reachability, collision
checks, and task semantics remain explicit host responsibilities. To evaluate
one proposal through the shared Task Program executor, use
embodichain.lab.task_program.integrations.scene_expansion.
Public contracts#
- class embodichain.lab.sim.scene.expansion.SceneExpansionCfg[source]#
Limits and permissions for a scene candidate source.
- Parameters:
seed (
int) – Nonnegative proposal-generation seed; not a physical replay seed.max_candidates (
int) – Positive maximum candidates consumed from the source.movable_entity_ids (
tuple[str,...]) – Unique physical UIDs allowed to change pose. An empty tuple permits only nominal candidates with no pose changes.
Execution and persistence budgets remain owned by the host integration. Calling a scene expansion integration opts in; ordinary execution paths do not consult this configuration.
- class embodichain.lab.sim.scene.expansion.ScenePoseChange[source]#
A proposed pose for one existing physical entity.
- Parameters:
entity_uid (
str) – Stable physical entity UID, independent of environment slots.arena_pose (
tuple[tuple[float,...],...]) – Homogeneous 4x4 transform from the entity frame into its local Z-up arena frame. Inputs are copied into immutable tuples.
Attention
An arena pose excludes replication offsets. The host converts it to backend coordinates when applying the candidate. This contract does not establish support, collision freedom, or manipulation feasibility.
Methods:
__init__(entity_uid, arena_pose)- __init__(entity_uid, arena_pose)#
- class embodichain.lab.sim.scene.expansion.SceneVariant[source]#
An immutable scene proposal with reproducible proposal identity.
- Parameters:
parent_scene_id (
str) – Content/revision identity of the original scene.seed (
int) – Nonnegative proposal-generation seed.ordinal (
int) – Nonnegative position in the candidate source.pose_changes (
tuple[ScenePoseChange,...]) – Unique existing entities and their proposed arena poses.metadata (
tuple[tuple[str,str],...]) – Unique string key/value provenance entries. Entries and pose changes are sorted so equivalent input ordering has one identity.
Attention
variant_ididentifies a proposal, not a settled initial state or a successful execution. Hosts record those identities and evidence separately. Metadata describes provenance, not executable operations. Sinceordinalparticipates in the hash, consuming the same layout at a different source position changesvariant_id. File-backed consumers should retain the original layout identity and proposal ordinal in metadata for provenance across selection orders; this ID is not a geometry-only deduplication key.Methods:
__init__(parent_scene_id, seed, ordinal, ...)Attributes:
Return a stable identity including geometry, source, seed, and ordinal.
- __init__(parent_scene_id, seed, ordinal, pose_changes, metadata=())#
- property variant_id: str#
Return a stable identity including geometry, source, seed, and ordinal.
- Returns:
SHA-256 identity independent of Python hash randomization and temporary physical environment assignments.
- class embodichain.lab.sim.scene.expansion.FixedSceneCandidateSource[source]#
Snapshot a bounded prefix of authored proposals for repeatable iteration.
- Parameters:
cfg (
SceneExpansionCfg) – Proposal budget and allowed physical entity UIDs.parent_scene_id (
str) – Identity of the scene the proposals modify.candidates (
Iterable[Iterable[ScenePoseChange]]) – Iterable of pose-change iterables. At mostcfg.max_candidatesentries are consumed; later entries are deliberately untouched. An empty pose-change iterable describes an explicit nominal proposal.metadata (
tuple[tuple[str,str],...]) – Immutable string key/value provenance added to each proposal.
The source owns no simulator, retries, or execution state. Configuration is revalidated at this boundary and no mutable caller configuration is retained. Every fresh iteration returns the same immutable proposals.
Methods:
__init__(cfg, parent_scene_id, candidates, *)Attributes:
Return the bounded, immutable snapshot of candidate proposals.
- property variants: tuple[SceneVariant, ...]#
Return the bounded, immutable snapshot of candidate proposals.
- Returns:
Candidates in source order, with consecutive zero-based ordinals.
Implementation module exports#
Limits and permissions for a scene candidate source. |
|
A proposed pose for one existing physical entity. |
|
An immutable scene proposal with reproducible proposal identity. |
Snapshot a bounded prefix of authored proposals for repeatable iteration. |
Source-independent layout generation#
Prepare explicit scaled geometry and support trees once, sample CPU/CUDA batches, and publish poses only to selected environment rows. JSON/packed v4 packages validate their source, geometric evidence and identities before exposing lazy proposals. Hosts retain stepping, cache refresh and task-acceptance ownership.
Own scaled local mesh geometry and a rooted physical support tree. |
|
Fix declared entities to arena poses without enlarging their motion domain. |
|
Own reusable numeric geometry, policy, permissions and source identity. |
|
Owned lazy proposals and exact bounded generation accounting. |
|
Selected-row pose publication and host-owned cache invalidations. |
|
Geometric policy independent of scene files and runtime lifecycles. |
|
Bounded caller-owned generation settings and output representation. |
|
One non-root member's displacement bounds in its parent support frame. |
|
Explicit member selection and conservative support geometry settings. |
|
Explicit parent-local support frame and GeoJSON Polygon/MultiPolygon. |
|
Snapshot prepared rigid entities through public simulation interfaces. |
|
Prepare source-independent hierarchy and conservative support geometry. |
|
Generate a batch without loading meshes or constructing simulation objects. |
|
Preflight all rows, then batch rigid pose writes without physics steps. |
|
Fully validated source, prepared geometry and lazy saved proposals. |
|
Publish a v4 layout package, writing the completion manifest last. |
|
Validate every file, source, geometry and identity before exposing layouts. |
- class embodichain.lab.sim.scene.expansion.SceneLayoutInput[source]#
Own scaled local mesh geometry and a rooted physical support tree.
- Parameters:
scene_id (
str) – Caller-owned source identity.support_uid (
str) – Main horizontal support, with an arbitrary native UID.poses (
Mapping[str,object]) – Proper entity-to-local-arena transforms, excluding replica offsets.vertices (
Mapping[str,object]) – Local Z-up vertices with body scale already applied once.faces (
Mapping[str,object]) – Triangle indices for each entity’s complete mesh.parent_by_uid (
Mapping[str,str]) – Parent UID for every entity except the main support.movable_entity_ids (
tuple[str,...] |None) – Allowed changed entities; None permits all children.main_support_bounds (
Sequence[Sequence[float]] |None) – Optional validated lower and upper XYZ corners of one horizontal safe rectangle in the local arena frame.
Inputs are copied and read-only. Unselected descendants follow their parent; entities excluded from the permission set must remain fixed in arena space.
Methods:
__init__(scene_id, support_uid, poses, ...)to_dict()Return an owned, JSON-compatible source snapshot.
Attributes:
Return the content identity of the complete authored source.
- __init__(scene_id, support_uid, poses, vertices, faces, parent_by_uid, movable_entity_ids=None, main_support_bounds=None)#
- property fingerprint: str#
Return the content identity of the complete authored source.
Conditional layout generation#
generate_scene_variants(..., conditions=SceneLayoutCondition(poses)) fixes
arena-space anchors while completing the rest of the layout through the same
support and clearance checks. Group-root anchors currently restrict XY only;
selected members retain their support-frame XY/yaw domain. Anchor every moving
ancestor of an absolute member anchor. Conditions cannot change permissions,
height, authored tilt, topology or physics. Invalid domains reject before sampling;
geometric infeasibility consumes the bounded proposal budget without repair.
The prepared source and original policy stay reusable and independently owned.
Omitting conditions, or providing an empty condition, retains the legacy sequence.
- class embodichain.lab.sim.scene.expansion.SceneLayoutCondition[source]#
Fix declared entities to arena poses without enlarging their motion domain.
- Parameters:
poses (
Mapping[str,object]) – Native UID to rigid arena-space pose. Inputs are independently owned immutable tuples. Group roots retain their authored rotation and height; selected members retain their declared support-frame XY/yaw constraints. A moving ancestor of a member anchor must also be anchored, so an absolute anchor cannot drift with its parent.
Conditions do not authorize new motion, topology changes or physics steps. Geometric infeasibility yields an empty/budget-exhausted generation result; malformed or unsupported conditions reject before candidate generation.
Methods:
- __init__(poses)#
- class embodichain.lab.sim.scene.expansion.PreparedSceneRandomization[source]#
Own reusable numeric geometry, policy, permissions and source identity.
Methods:
__init__(source, _policy, geometry_sha256, ...)Attributes:
Return an owned policy snapshot, preserving prepared geometry ownership.
- __init__(source, _policy, geometry_sha256, movable_uids, _geometry, _table, _movable_roots)#
- property policy: dict#
Return an owned policy snapshot, preserving prepared geometry ownership.
- class embodichain.lab.sim.scene.expansion.SceneRandomizationBatch[source]#
Owned lazy proposals and exact bounded generation accounting.
Methods:
__init__(prepared, variants, attempts, ...)- __init__(prepared, variants, attempts, status, seed, start_ordinal, next_ordinal, requested_count=None, max_attempts=None)#
- class embodichain.lab.sim.scene.expansion.SceneVariantApplicationResult[source]#
Selected-row pose publication and host-owned cache invalidations.
Methods:
__init__(env_ids, variant_ids, changed_uids)- __init__(env_ids, variant_ids, changed_uids, refresh_required=('geometry', 'planning', 'observations'))#
- class embodichain.lab.sim.scene.expansion.SceneRandomizationPolicyCfg[source]#
Geometric policy independent of scene files and runtime lifecycles.
- Parameters:
backend (
str) – Explicit numeric backend; the shared interface uses batched sampling.device (
str) – CPU or CUDA tensor device.batch_size (
int) – Maximum logical proposals evaluated together.collision_margin_m (
float) – Minimum group AABB separation in metres.randomize_groups (
bool) – Sample permitted group-root XY translations.group_targets (
tuple[str,...] |None) – Root UIDs to move; None selects all permitted roots.group_xy_offset_bounds_m (
dict[str,list[list[float]]]) – Optional per-root arena XY displacement bounds.intra_group (
IntraGroupRandomizationCfg|None) – Selected non-root XY/yaw changes and support settings.
Methods:
__init__([backend, device, batch_size, ...])copy(**kwargs)Return a new object replacing specified fields with new values.
replace(**kwargs)Return a new object replacing specified fields with new values.
to_dict()Convert an object into dictionary recursively.
validate([prefix])Check the validity of configclass object.
- __init__(backend=<factory>, device=<factory>, batch_size=<factory>, collision_margin_m=<factory>, randomize_groups=<factory>, group_targets=<factory>, group_xy_offset_bounds_m=<factory>, intra_group=<factory>)#
- copy(**kwargs)#
Return a new object replacing specified fields with new values.
This is especially useful for frozen classes. Example usage:
@configclass(frozen=True) class C: x: int y: int c = C(1, 2) c1 = c.replace(x=3) assert c1.x == 3 and c1.y == 2
- Parameters:
obj (
object) – The object to replace.**kwargs – The fields to replace and their new values.
- Return type:
object- Returns:
The new object.
- replace(**kwargs)#
Return a new object replacing specified fields with new values.
This is especially useful for frozen classes. Example usage:
@configclass(frozen=True) class C: x: int y: int c = C(1, 2) c1 = c.replace(x=3) assert c1.x == 3 and c1.y == 2
- Parameters:
obj (
object) – The object to replace.**kwargs – The fields to replace and their new values.
- Return type:
object- Returns:
The new object.
- to_dict()#
Convert an object into dictionary recursively.
Note
Ignores string names starting with “__” (i.e. built-in methods). Non-string mapping keys retain their original type.
- Parameters:
obj (
object) – An instance of a class to convert.- Raises:
ValueError – When input argument is not an object.
- Return type:
dict[Any,Any]- Returns:
Converted dictionary mapping.
- validate(prefix='')#
Check the validity of configclass object.
This function checks if the object is a valid configclass object. A valid configclass object contains no MISSING entries.
- Parameters:
obj (
object) – The object to check.prefix (
str) – The prefix to add to the missing fields. Defaults to ‘’.
- Return type:
list[str]- Returns:
A list of missing fields.
- Raises:
TypeError – When the object is not a valid configuration object.
- class embodichain.lab.sim.scene.expansion.SceneRandomizationJobCfg[source]#
Bounded caller-owned generation settings and output representation.
- Parameters:
policy (
SceneRandomizationPolicyCfg) – Source-independent geometric sampling policy.seed (
int) – Addressed generation seed.candidate_count (
int) – Requested valid layouts.max_attempts (
int) – Whole-layout proposal budget.layout_storage (
str) – JSON or packed candidate storage.
Methods:
__init__([policy, seed, candidate_count, ...])copy(**kwargs)Return a new object replacing specified fields with new values.
replace(**kwargs)Return a new object replacing specified fields with new values.
to_dict()Convert an object into dictionary recursively.
validate([prefix])Check the validity of configclass object.
- __init__(policy=<factory>, seed=<factory>, candidate_count=<factory>, max_attempts=<factory>, layout_storage=<factory>)#
- copy(**kwargs)#
Return a new object replacing specified fields with new values.
This is especially useful for frozen classes. Example usage:
@configclass(frozen=True) class C: x: int y: int c = C(1, 2) c1 = c.replace(x=3) assert c1.x == 3 and c1.y == 2
- Parameters:
obj (
object) – The object to replace.**kwargs – The fields to replace and their new values.
- Return type:
object- Returns:
The new object.
- replace(**kwargs)#
Return a new object replacing specified fields with new values.
This is especially useful for frozen classes. Example usage:
@configclass(frozen=True) class C: x: int y: int c = C(1, 2) c1 = c.replace(x=3) assert c1.x == 3 and c1.y == 2
- Parameters:
obj (
object) – The object to replace.**kwargs – The fields to replace and their new values.
- Return type:
object- Returns:
The new object.
- to_dict()#
Convert an object into dictionary recursively.
Note
Ignores string names starting with “__” (i.e. built-in methods). Non-string mapping keys retain their original type.
- Parameters:
obj (
object) – An instance of a class to convert.- Raises:
ValueError – When input argument is not an object.
- Return type:
dict[Any,Any]- Returns:
Converted dictionary mapping.
- validate(prefix='')#
Check the validity of configclass object.
This function checks if the object is a valid configclass object. A valid configclass object contains no MISSING entries.
- Parameters:
obj (
object) – The object to check.prefix (
str) – The prefix to add to the missing fields. Defaults to ‘’.
- Return type:
list[str]- Returns:
A list of missing fields.
- Raises:
TypeError – When the object is not a valid configuration object.
- class embodichain.lab.sim.scene.expansion.MemberRandomizationCfg[source]#
One non-root member’s displacement bounds in its parent support frame.
xy_offset_bounds_mis[[min_x, min_y], [max_x, max_y]]relative to the original entity origin;Nonesamples the complete support area. Yaw is a continuous increment around the support normal, retaining tilt.Methods:
__init__([xy_offset_bounds_m, ...])copy(**kwargs)Return a new object replacing specified fields with new values.
replace(**kwargs)Return a new object replacing specified fields with new values.
to_dict()Convert an object into dictionary recursively.
validate([prefix])Check the validity of configclass object.
- __init__(xy_offset_bounds_m=<factory>, yaw_delta_range_deg=<factory>)#
- copy(**kwargs)#
Return a new object replacing specified fields with new values.
This is especially useful for frozen classes. Example usage:
@configclass(frozen=True) class C: x: int y: int c = C(1, 2) c1 = c.replace(x=3) assert c1.x == 3 and c1.y == 2
- Parameters:
obj (
object) – The object to replace.**kwargs – The fields to replace and their new values.
- Return type:
object- Returns:
The new object.
- replace(**kwargs)#
Return a new object replacing specified fields with new values.
This is especially useful for frozen classes. Example usage:
@configclass(frozen=True) class C: x: int y: int c = C(1, 2) c1 = c.replace(x=3) assert c1.x == 3 and c1.y == 2
- Parameters:
obj (
object) – The object to replace.**kwargs – The fields to replace and their new values.
- Return type:
object- Returns:
The new object.
- to_dict()#
Convert an object into dictionary recursively.
Note
Ignores string names starting with “__” (i.e. built-in methods). Non-string mapping keys retain their original type.
- Parameters:
obj (
object) – An instance of a class to convert.- Raises:
ValueError – When input argument is not an object.
- Return type:
dict[Any,Any]- Returns:
Converted dictionary mapping.
- validate(prefix='')#
Check the validity of configclass object.
This function checks if the object is a valid configclass object. A valid configclass object contains no MISSING entries.
- Parameters:
obj (
object) – The object to check.prefix (
str) – The prefix to add to the missing fields. Defaults to ‘’.
- Return type:
list[str]- Returns:
A list of missing fields.
- Raises:
TypeError – When the object is not a valid configuration object.
- class embodichain.lab.sim.scene.expansion.IntraGroupRandomizationCfg[source]#
Explicit member selection and conservative support geometry settings.
Fixed members follow their parent. Clearances and grid resolution are in metres. Overrides are keyed by parent UID, independently of target order.
Methods:
__init__([targets, boundary_margin_m, ...])copy(**kwargs)Return a new object replacing specified fields with new values.
replace(**kwargs)Return a new object replacing specified fields with new values.
to_dict()Convert an object into dictionary recursively.
validate([prefix])Check the validity of configclass object.
- __init__(targets=<factory>, boundary_margin_m=<factory>, sibling_margin_m=<factory>, support_gap_m=<factory>, grid_resolution_m=<factory>, support_overrides=<factory>)#
- copy(**kwargs)#
Return a new object replacing specified fields with new values.
This is especially useful for frozen classes. Example usage:
@configclass(frozen=True) class C: x: int y: int c = C(1, 2) c1 = c.replace(x=3) assert c1.x == 3 and c1.y == 2
- Parameters:
obj (
object) – The object to replace.**kwargs – The fields to replace and their new values.
- Return type:
object- Returns:
The new object.
- replace(**kwargs)#
Return a new object replacing specified fields with new values.
This is especially useful for frozen classes. Example usage:
@configclass(frozen=True) class C: x: int y: int c = C(1, 2) c1 = c.replace(x=3) assert c1.x == 3 and c1.y == 2
- Parameters:
obj (
object) – The object to replace.**kwargs – The fields to replace and their new values.
- Return type:
object- Returns:
The new object.
- to_dict()#
Convert an object into dictionary recursively.
Note
Ignores string names starting with “__” (i.e. built-in methods). Non-string mapping keys retain their original type.
- Parameters:
obj (
object) – An instance of a class to convert.- Raises:
ValueError – When input argument is not an object.
- Return type:
dict[Any,Any]- Returns:
Converted dictionary mapping.
- validate(prefix='')#
Check the validity of configclass object.
This function checks if the object is a valid configclass object. A valid configclass object contains no MISSING entries.
- Parameters:
obj (
object) – The object to check.prefix (
str) – The prefix to add to the missing fields. Defaults to ‘’.
- Return type:
list[str]- Returns:
A list of missing fields.
- Raises:
TypeError – When the object is not a valid configuration object.
- class embodichain.lab.sim.scene.expansion.SupportOverrideCfg[source]#
Explicit parent-local support frame and GeoJSON Polygon/MultiPolygon.
The proper rigid
parent_from_supportmatrix locates the support plane at support Z=0 in the parent local Z-up geometry after asset scaling. Its polygon must be covered by actual coplanar mesh faces.Methods:
__init__([parent_from_support, polygon])copy(**kwargs)Return a new object replacing specified fields with new values.
replace(**kwargs)Return a new object replacing specified fields with new values.
to_dict()Convert an object into dictionary recursively.
validate([prefix])Check the validity of configclass object.
- __init__(parent_from_support=<factory>, polygon=<factory>)#
- copy(**kwargs)#
Return a new object replacing specified fields with new values.
This is especially useful for frozen classes. Example usage:
@configclass(frozen=True) class C: x: int y: int c = C(1, 2) c1 = c.replace(x=3) assert c1.x == 3 and c1.y == 2
- Parameters:
obj (
object) – The object to replace.**kwargs – The fields to replace and their new values.
- Return type:
object- Returns:
The new object.
- replace(**kwargs)#
Return a new object replacing specified fields with new values.
This is especially useful for frozen classes. Example usage:
@configclass(frozen=True) class C: x: int y: int c = C(1, 2) c1 = c.replace(x=3) assert c1.x == 3 and c1.y == 2
- Parameters:
obj (
object) – The object to replace.**kwargs – The fields to replace and their new values.
- Return type:
object- Returns:
The new object.
- to_dict()#
Convert an object into dictionary recursively.
Note
Ignores string names starting with “__” (i.e. built-in methods). Non-string mapping keys retain their original type.
- Parameters:
obj (
object) – An instance of a class to convert.- Raises:
ValueError – When input argument is not an object.
- Return type:
dict[Any,Any]- Returns:
Converted dictionary mapping.
- validate(prefix='')#
Check the validity of configclass object.
This function checks if the object is a valid configclass object. A valid configclass object contains no MISSING entries.
- Parameters:
obj (
object) – The object to check.prefix (
str) – The prefix to add to the missing fields. Defaults to ‘’.
- Return type:
list[str]- Returns:
A list of missing fields.
- Raises:
TypeError – When the object is not a valid configuration object.
- embodichain.lab.sim.scene.expansion.scene_layout_input_from_sim(sim, *, support_uid, parent_by_uid, movable_entity_ids=None, scene_id='authored-scene', env_id=0)[source]#
Snapshot prepared rigid entities through public simulation interfaces.
- Parameters:
sim (
SimulationManager) – Prepared caller-owned simulation manager.support_uid (
str) – Main support entity.parent_by_uid (
Mapping[str,str]) – Explicit native UID support tree.movable_entity_ids (
Sequence[str] |None) – Optional changed-entity permissions.scene_id (
str) – Source identity, independent of physical environment slots.env_id (
int) – Prototype row used only to extract authored arena-local geometry.
- Return type:
- Returns:
Owned input with scale applied by the rigid-object geometry API.
- embodichain.lab.sim.scene.expansion.prepare_scene_randomization(source, policy, *, cache_dir=None)[source]#
Prepare source-independent hierarchy and conservative support geometry.
- Parameters:
source (
SceneLayoutInput) – Owned authored scene geometry and explicit support tree.policy (
SceneRandomizationPolicyCfg|Mapping) – CPU/CUDA sampling policy, without runtime seed or file inputs.cache_dir (
str|Path|None) – Optional content-addressed support-cache directory.
- Return type:
- Returns:
Prepared geometry reusable across generation calls and ordinary resets.
- embodichain.lab.sim.scene.expansion.generate_scene_variants(prepared, *, seed=0, candidate_count=10, max_attempts=1000, start_ordinal=0, conditions=None)[source]#
Generate a batch without loading meshes or constructing simulation objects.
- Parameters:
prepared (
PreparedSceneRandomization) – Reusable geometry and policy.seed (
int) – Addressed random stream seed.candidate_count (
int) – Requested valid layouts.max_attempts (
int) – Whole-layout proposal budget.start_ordinal (
int) – First logical proposal; allows bounded continuation.conditions (
SceneLayoutCondition|None) – Optional owned arena-pose anchors. They restrict existing root XY/member XY-yaw domains and never authorize extra motion. Moving ancestors must be anchored explicitly. Empty conditions preserve the ordinary sequence. Infeasible geometry exhausts the declared proposal budget without moving or repairing anchors.
- Return type:
- Returns:
Complete or budget-exhausted proposals with exact continuation ordinal.
- embodichain.lab.sim.scene.expansion.apply_scene_variants(sim, variants, *, env_ids, movable_entity_ids)[source]#
Preflight all rows, then batch rigid pose writes without physics steps.
- Parameters:
sim (
SimulationManager) – Prepared caller-owned simulation.variants (
Sequence[SceneVariant]) – One validated proposal per selected row, in corresponding order.env_ids (
Sequence[int] |Tensor) – Unique selected rows; replica offsets never enter the poses.movable_entity_ids (
Sequence[str]) – Explicit allowed native UID set.
- Return type:
- Returns:
Applied identities and refresh requests. Native failures propagate and do not guarantee rollback of earlier writes.
- class embodichain.lab.sim.scene.expansion.LoadedSceneVariants[source]#
Fully validated source, prepared geometry and lazy saved proposals.
Methods:
__init__(prepared, variants, manifest)- __init__(prepared, variants, manifest)#
- embodichain.lab.sim.scene.expansion.save_scene_variants(result, output_dir, *, storage='packed', source_context=None)[source]#
Publish a v4 layout package, writing the completion manifest last.
- Parameters:
result (
SceneRandomizationBatch) – Bounded generation result with its owned source and geometry.output_dir (
str|Path) – New run directory; existing paths are not overwritten.storage (
str) – Individualjsonfiles or onepackedcandidate file.source_context (
dict|None) – Optional inert host references; the shared reader never executes them.
- Return type:
Path- Returns:
Absolute path to the completed run.
- embodichain.lab.sim.scene.expansion.load_scene_variants(path, *, scene_input=None)[source]#
Validate every file, source, geometry and identity before exposing layouts.
- Parameters:
path (
str|Path) – Completed v4 run directory or its layouts subdirectory.scene_input (
SceneLayoutInput|None) – Optional independently supplied expected authored source.
- Return type:
- Returns:
Validated layout sequence; reading never resamples candidates.
Condition implementation module#
- class embodichain.lab.sim.scene.expansion.conditions.SceneLayoutCondition[source]
Fix declared entities to arena poses without enlarging their motion domain.
- Parameters:
poses (
Mapping[str,object]) – Native UID to rigid arena-space pose. Inputs are independently owned immutable tuples. Group roots retain their authored rotation and height; selected members retain their declared support-frame XY/yaw constraints. A moving ancestor of a member anchor must also be anchored, so an absolute anchor cannot drift with its parent.
Conditions do not authorize new motion, topology changes or physics steps. Geometric infeasibility yields an empty/budget-exhausted generation result; malformed or unsupported conditions reject before candidate generation.
Methods:
__init__(poses)to_dict()Return a detached JSON-compatible projection of the anchors.
- __init__(poses)
- to_dict()[source]
Return a detached JSON-compatible projection of the anchors.
- Return type:
dict[str,list[list[float]]]