isaaclab_ov.cloner

isaaclab_ov.cloner#

Clone contexts route assets to the representation that owns their copies:

  • OvPhysxReplicateContext prepares native physics replication.

  • OvrtxReplicateContext prepares copies for an OVRTX engine’s internal scene.

  • OvstageReplicateContext prepares copies for simulation-owned OVStage resources, independently of their consumers. An OVRTX engine borrowing that stage does not clone it again.

Clone routing#

OvrtxReplicateContext.prepare in isaaclab_ov/cloner/replicate.py selects the representation before native resource initialization. Without environment overrides, OVRTX uses native cloning with both OVPhysX and Newton. OVPhysX also retains native physics cloning.

ISAAC_LAB_OVRTX_USE_OVSTAGE=1 selects independent OVStage rendering with either physics backend; 0 selects native OVRTX cloning. Set the flag before creating the simulation. Reset retains the selected route. This flag alone never enables physics/rendering stage sharing.

To share one OVStage with OVPhysX and OVRTX, set ISAAC_LAB_SHARE_OVSTAGE=1. Sharing requires OVPhysX and selects OVStage rendering regardless of ISAAC_LAB_OVRTX_USE_OVSTAGE.

Sharing remains experimental and opt-in. It retains native physics cloning and populates complete original worlds in one stage before OVPhysX attaches. OvstageReplicateContext also receives the physics asset routes so it can complete the rendering copies after native physics cloning and binding acquisition. The selected route is retained across resets and subsequent renderer creation.

Shared-stage filtering retains joints, physics schemas, and authored physics properties, excluding only render-only clone sources. Native replication of physics-only roots without rigid bodies or colliders is rejected before attachment. Route these prims through UsdReplicateContext so their destinations are present when physics attaches. Worlds containing USD-only physics retain their companion bodies in the initial import. Source classifications are reused within each export and refreshed on subsequent exports, avoiding repeated subtree traversal while accounting for stage edits and reinitialization.

Configure shared-stage cameras and contact sensors before the initial simulation reset. Cameras may have different product settings, but share one native renderer and must agree on native logging and transform-cache settings. Full-stage physics imports, including deformable scenes that require authored environment copies, are not supported in shared mode. Disable ISAAC_LAB_SHARE_OVSTAGE for those scenes; sharing rejects them before native population rather than dropping their USD overrides.

The stage owner coordinates write ordinals and releases its borrowers before rebuilding. Rendering on an OVStage is synchronous.

Shared-stage attachment order#

Shared mode uses early physics attachment without an additional flag:

Shared OVStage attachment order Populate original worlds and required render sources, then seal ordinal 1. Attach OVPhysX and wait. Execute native physics clones and wait before warmup. Initialize asset and contact bindings, then acquire scene-data bindings. Clone remaining render prims, place environments, and seal rendering-only ordinal 2. Publish PHYSICS_READY for startup callbacks and camera preparation, then attach OVRTX during renderer preparation and continue normal rendering. Populate original worlds and required render sources Seal ordinal 1 Attach OVPhysX at ordinal 1 Wait for completion Execute native physics clones Wait for completion Run physics warmup Initialize asset and contact bindings binding_init_event Acquire scene-data bindings Clone remaining render prims and place environments Seal ordinal 2 (rendering-only) Publish PHYSICS_READY Startup callbacks and camera preparation can proceed Attach OVRTX during renderer preparation Continue normal rendering

CPU simulations populate all physics worlds before OVPhysX attachment and skip native physics cloning. Deferred render copies still populate any missing render-only prims at ordinal 2.

Sensors select their initialization phase through the initialize_event attribute. Ordinary sensors use PHYSICS_READY; OVPhysX contact sensors use the manager’s earlier binding_init_event. The earlier phase runs only when OVPhysX borrows a shared stage. Without a shared stage, asset and contact initialization callbacks run together with PHYSICS_READY callbacks in priority order, including on resets and forced reinitialization.

MODEL_INIT is a construction hook and may run before native handles exist. In OVPhysX it runs during initial warmup and rebuilds. Binding callbacks also run on ordinary non-soft resets, allowing late-created assets and contact sensors to initialize without replaying construction callbacks. The two phases therefore remain separate even though they are adjacent during startup.

Later physics edits consume their exact update ordinals and exclude the render-copy ordinal 2. A failed render copy requires a stage rebuild before retry. A forced reset releases bindings before their native owners and rebuilds the attachment sequence.

Attaching OVPhysX before cloning the remaining render prims reduced initialization work and host memory in the measured workloads.