isaaclab.scene_data#
Sub-package containing the scene data provider and backend interface.
The SceneDataProvider bridges physics simulation backends and the
consumers that read scene transforms (renderers and visualizers). Physics
backends implement SceneDataBackend to expose their current
transforms in one of the SceneDataFormat Warp struct variants;
the provider converts and remaps them on demand for each consumer.
This package is deliberately separate from isaaclab.scene so that
physics backends (isaaclab_physx, isaaclab_newton) can subclass
SceneDataBackend without pulling isaaclab.scene into the
AppLauncher pre-launch import chain.
Classes
Warp struct variants describing the transform layouts that a |
Scene Data Provider#
- class isaaclab.scene_data.SceneDataProvider[source]#
Bases:
objectMethods:
__init__(backend)Initialize the scene data provider.
set_interactive_scene(scene)Attach the active interactive scene for scene-owned sensor discovery.
Return the registered interactive scene, if available.
Return Isaac Lab camera sensors keyed by scene sensor name.
Return Isaac Lab contact sensors keyed by scene sensor name.
Return the USD stage for callers using the older method-style API.
Per-camera, per-environment world transforms discovered from USD.
get_transforms(output[, mapping, ...])Convert sim backend transforms into the requested output format.
init_output(output)Allocate any uninitialized fields in
outputwith empty Warp arrays.create_mapping(paths)Create an index mapping from sim backend transforms to desired output ordering.
create_geometry_mapping(paths, particle_offsets)Create a mapping from backend geometry entities to consumer particle offsets.
get_points(output[, mapping, allow_passthrough])Copy sim backend geometry points into
output.Attributes:
Number of transforms available from the sim backend.
Pixar
Usd.Stagefor visualizers and renderers that walk USD.Number of environments discovered from
/World/envs/env_<id>prims.Number of geometry points available from the sim backend.
- __init__(backend: SceneDataBackend)[source]#
Initialize the scene data provider.
- Parameters:
backend¶ – The simulation backend that supplies raw transform data.
- set_interactive_scene(scene: Any) None[source]#
Attach the active interactive scene for scene-owned sensor discovery.
- get_camera_sensors() dict[str, Any][source]#
Return Isaac Lab camera sensors keyed by scene sensor name.
- get_contact_sensors() dict[str, Any][source]#
Return Isaac Lab contact sensors keyed by scene sensor name.
- property usd_stage: Usd.Stage | None#
Pixar
Usd.Stagefor visualizers and renderers that walk USD.Resolves to
isaaclab.sim.SimulationContext.stage, falling back toomni.usd.get_context().get_stage()when the simulation context has no cached stage. ReturnsNoneon Newton-only headless runs without a USD stage.
- get_usd_stage() Usd.Stage | None[source]#
Return the USD stage for callers using the older method-style API.
- property num_envs: int#
Number of environments discovered from
/World/envs/env_<id>prims.Cached on first call. Returns
0when no USD stage is available or when no/World/envs/env_<id>prims exist.
- get_camera_transforms() dict[str, Any] | None[source]#
Per-camera, per-environment world transforms discovered from USD.
- Returns:
Dictionary with keys
order(list of template prim paths usingenv_%d),positionsandorientations(per-camera, per-env lists, withNonefor absent envs), andnum_envs. ReturnsNonewhen no USD stage is available.
- get_transforms(output: SceneDataFormat.Vec3_Quat | SceneDataFormat.Transform | SceneDataFormat.Matrix44 | SceneDataFormat.Vec3_Matrix33, mapping: wp.array(dtype=wp.int32) | None = None, allow_passthrough: bool = True) bool[source]#
Convert sim backend transforms into the requested output format.
When the backend’s native format matches
output, data is either passed through by reference (allow_passthrough=True) or deep-copied. Otherwise a Warp conversion kernel is launched to transform the data, applyingmappingto reorder the output if provided.- Parameters:
output¶ – A pre-allocated
SceneDataFormatstruct that determines the target format. Uninitialized (None) fields are allocated automatically when a conversion kernel is needed.mapping¶ – Optional index remapping array produced by
create_mapping(). WhenNone, input and output indices are identical.allow_passthrough¶ – If
Trueand the formats already match, the output struct’s fields are set to reference the input arrays directly (zero-copy). IfFalse, the data is always copied.
- Returns:
Trueif the conversion succeeded,Falseif no suitable conversion kernel exists for the input/output format pair.
- init_output(output: Vec3_Quat | Transform | Matrix44 | Vec3_Matrix33)[source]#
Allocate any uninitialized fields in
outputwith empty Warp arrays.Only fields that are currently
Noneare allocated; already-initialized fields are left untouched.- Parameters:
output¶ – A
SceneDataFormatstruct whoseNone-valued fields will be replaced with empty arrays of lengthtransform_count.
- create_mapping(paths: list[str | None]) wp.array(dtype=wp.int32) | None[source]#
Create an index mapping from sim backend transforms to desired output ordering.
For each transform in the sim backend, the resulting array stores the index into
pathswhere that transform should be written. Transforms whose path does not appear inpaths(or maps toNone) receive an index of-1and are skipped during conversion.- Parameters:
paths¶ – Desired output ordering expressed as prim paths. Use
Nonefor slots that should not receive any transform.- Returns:
A Warp int32 array of length
transform_countcontaining the remapped indices, orNoneif the sim backend provides no transform paths or if no mapping is needed.
- create_geometry_mapping(paths: list[str | None], particle_offsets: list[int]) wp.array(dtype=wp.int32) | None[source]#
Create a mapping from backend geometry entities to consumer particle offsets.
For each geometry entity in the sim backend, the resulting array stores the destination particle offset in the consumer buffer. Entities whose path does not appear in
pathsreceive-1and are skipped during copy.- Parameters:
- Returns:
A Warp int32 array of length
len(geometry_paths)containing destination particle offsets, orNonewhen no geometry is available or every entity maps identically in order.
- get_points(output: SceneDataFormat.Points, mapping: wp.array(dtype=wp.int32) | None = None, allow_passthrough: bool = True) bool[source]#
Copy sim backend geometry points into
output.- Parameters:
output¶ – Pre-allocated
SceneDataFormat.Pointsbuffer (typically aliased to shadowparticle_q).mapping¶ – Optional destination particle-offset array from
create_geometry_mapping().allow_passthrough¶ – When
Trueand no mapping is needed, aliasoutput.pointsdirectly to the backend buffer.
- Returns:
Truewhen points were copied or passed through,Falsewhen the backend exposes no geometry.
Scene Data Backend#
- class isaaclab.scene_data.SceneDataBackend[source]#
Bases:
objectAttributes:
Return the sim backends transforms as one of the SceneDataFormat structs.
Return the number of transforms in the sim backend.
Return the paths for each transform.
Return deformable or particle geometry as flat world-space positions.
Return the number of points in
points.Return one USD prim path per geometry entity (deformable body instance).
Return the unpadded point count for each geometry entity.
- property transforms: Vec3_Quat | Transform | Matrix44 | Vec3_Matrix33#
Return the sim backends transforms as one of the SceneDataFormat structs.
- class isaaclab.scene_data.SceneDataFormat[source]#
Bases:
objectWarp struct variants describing the transform layouts that a
SceneDataBackendmay publish to consumers.Classes:
Separate position and quaternion arrays.
Separate position and rotation-matrix arrays.
Packed warp transforms (position + quaternion).
Packed 4x4 homogeneous transform matrices.
Flat world-space nodal or particle positions.
- class Vec3_Quat[source]#
Bases:
objectSeparate position and quaternion arrays.
Attributes:
Per-transform positions [m].
Per-transform orientations as quaternions.
- positions: warp.array = None#
Per-transform positions [m].
- orientations: warp.array = None#
Per-transform orientations as quaternions.
- class Vec3_Matrix33[source]#
Bases:
objectSeparate position and rotation-matrix arrays.
Attributes:
Per-transform positions [m].
Per-transform orientations as 3x3 rotation matrices.
- positions: warp.array = None#
Per-transform positions [m].
- orientations: warp.array = None#
Per-transform orientations as 3x3 rotation matrices.
- class Transform[source]#
Bases:
objectPacked warp transforms (position + quaternion).
Attributes:
Per-transform packed position + orientation transforms [m, -].
- transforms: warp.array = None#
Per-transform packed position + orientation transforms [m, -].
- class Matrix44[source]#
Bases:
objectPacked 4x4 homogeneous transform matrices.
Attributes:
Per-transform 4x4 homogeneous transform matrices [m].
- matrices: warp.array = None#
Per-transform 4x4 homogeneous transform matrices [m].