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
Kit launcher pre-launch import chain.
Classes
Borrow or convert published arrays; producers own native refresh, renderers own destination lifecycle. |
|
Warp struct variants describing the transform layouts that a |
Scene Data Provider#
- class isaaclab.scene_data.SceneDataProvider[source]#
Bases:
objectBorrow or convert published arrays; producers own native refresh, renderers own destination lifecycle.
Methods:
__init__(backend)Initialize the scene data provider.
get_transforms(output[, mapping, ...])Bind shared transforms or write them directly into caller-owned output arrays.
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.
Per-camera, per-environment world transforms discovered from USD.
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.
get_geometry_points(*[, output, offsets])Borrow visual point views or convert directly into the requested native destination.
Attributes:
Number of transforms available from the sim backend.
Number of environments discovered from
/World/envs/env_<id>prims.- __init__(backend: SceneDataBackend)[source]#
Initialize the scene data provider.
- Parameters:
backend¶ – The simulation backend that supplies raw transform data.
- get_transforms(output: SceneDataFormat.Vec3_Quat | SceneDataFormat.Transform | SceneDataFormat.Matrix44 | SceneDataFormat.Vec3_Matrix33 | SceneDataFormat.TransposedMatrix44d | SceneDataFormat.FabricMatrix44, mapping: wp.array | wp.fabricarray | None = None, allow_passthrough: bool = True, *, count: int | None = None, scales: wp.array | None = None) bool[source]#
Bind shared transforms or write them directly into caller-owned output arrays.
With passthrough enabled, matching native arrays are borrowed without a copy; other layouts share SDP-owned buffers converted once per producer timestamp. Treat these arrays as read-only. With passthrough disabled, conversion writes directly into
output. Fabric destinations must already be bound by their rendering owner.- Parameters:
output¶ – A
SceneDataFormatstruct instance specifying the requested format. Missing non-Fabric arrays are allocated when passthrough is disabled.mapping¶ – Native-to-output indices from
create_mapping(), or identity ordering. Fabric destinations use their native output-to-source index attribute.allow_passthrough¶ – Whether to bind shared arrays instead of writing caller-owned arrays.
count¶ – Destination count when remapping, or the native transform count.
scales¶ – Static output scales for
TransposedMatrix44d, shape [count], or source-indexed authored scales for Fabric. Mapping and scales are immutable for a binding’s lifetime; replace their arrays when the layout changes.
- Returns:
True if transforms are available in
output, False if no transforms are published or the format conversion is unsupported.
- 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 num_envs: int[source]#
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.
- 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.Named paths must be unique in both layouts. Binding validates this once per layout pair; independent consumers reuse the mapping and share SDP conversions.
- 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, orNonefor identical layouts.- Raises:
ValueError – A source or named destination path is repeated.
KeyError – A named destination has no native publication.
- get_geometry_points(*, output: wp.array | SceneDataFormat.FabricPoints | None = None, offsets: dict[str, int] | None = None) dict[str, wp.array] | wp.array | SceneDataFormat.FabricPoints[source]#
Borrow visual point views or convert directly into the requested native destination.
Producers supply exact visual prim paths, native pointers and immutable interpolation metadata. SDP performs interpolation and destination reordering together, once per update timestamp and output layout. Only cross-device destinations require staging.
- Parameters:
output¶ – Consumer-owned world-space point buffer [m] or native Fabric destination. Omit to borrow shared point views.
FabricPointswithout offsets borrows native Fabric storage when the producer publishes it.offsets¶ – Visual prim paths mapped to flat-buffer offsets or Fabric array indices. Keep this mapping immutable for the destination’s lifetime.
- Returns:
Read-only world-space views by visual prim path when no output is supplied; otherwise the supplied destination, populated directly on the same device.
Scene Data Backend#
- class isaaclab.scene_data.SceneDataBackend[source]#
Bases:
objectAttributes:
Logical update timestamp, advanced after native writes or buffer swaps, including within one step.
Geometry formats the producer can publish without conversion.
Logical timestamp, incremented after native writes or buffer swaps; never reset by readers.
Formats available without conversion, used when binding consumer destinations.
Return native transforms without copying; pointer changes must increment
transforms_timestamp.Return the number of transforms in the sim backend.
Return unique native body paths in publication order, fixed for each initialized layout.
Methods:
get_geometry_batches([output_format])Publish native arrays and exact visual-prim ranges established during construction.
get_transforms(output_format)Publish the requested native format when available, otherwise the primary format.
- geometry_timestamp: int = 0#
Logical update timestamp, advanced after native writes or buffer swaps, including within one step.
This is not elapsed simulation time. Cached outputs record the timestamp they contain; reading one output never clears another output’s pending update.
- property native_geometry_formats: tuple[Any, ...][source]#
Geometry formats the producer can publish without conversion.
- get_geometry_batches(output_format: ~typing.Any = <class 'isaaclab.scene_data.scene_data_backend.SceneDataFormat.Points'>) list[tuple[Any, dict[str, tuple[int, int]]]][source]#
Publish native arrays and exact visual-prim ranges established during construction.
Each batch pairs a native format with
path: (offset, count)ranges. Offsets index native points forPointsor output vertices for an interpolated format. Publish the requested native format when available, otherwise the primary formats for SDP to convert. NativeFabricPointsuses an empty range dictionary because Fabric owns the indexing.
- transforms_timestamp: int#
Logical timestamp, incremented after native writes or buffer swaps; never reset by readers.
- property native_transform_formats: tuple[Any, ...][source]#
Formats available without conversion, used when binding consumer destinations.
- get_transforms(output_format: Any) Any[source]#
Publish the requested native format when available, otherwise the primary format.
- 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.
Double-precision row-vector transforms, as consumed by USD renderers.
Double-precision row-vector matrices in native Fabric storage.
Flat world-space nodal or particle positions.
Visual vertices interpolated from four native simulation nodes.
Polyline vertices derived from native capsule poses.
Native Fabric point arrays, already owned and updated by physics.
- 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].
- class TransposedMatrix44d[source]#
Bases:
objectDouble-precision row-vector transforms, as consumed by USD renderers.
Attributes:
World transforms [m], shape [transform_count].
- matrices: warp.array = None#
World transforms [m], shape [transform_count].
- class FabricMatrix44[source]#
Bases:
objectDouble-precision row-vector matrices in native Fabric storage.
Attributes:
Transforms [m], shape [transform_count].
- matrices: warp.fabricarray = None#
Transforms [m], shape [transform_count].
- class Points[source]#
Bases:
objectFlat world-space nodal or particle positions.
Attributes:
World-space positions [m], shape [point_count].
- points: warp.array = None#
World-space positions [m], shape [point_count].
- class WeightedPoints[source]#
Bases:
objectVisual vertices interpolated from four native simulation nodes.
Attributes:
Native world-space simulation nodes [m].
Four native node indices per visual vertex.
Four barycentric weights per visual vertex.
- points: warp.array#
Native world-space simulation nodes [m].
- indices: warp.array2d#
Four native node indices per visual vertex.
- weights: warp.array2d#
Four barycentric weights per visual vertex.
- class CapsuleEndpoints[source]#
Bases:
objectPolyline vertices derived from native capsule poses.
Attributes:
World-space body poses [m, quaternion].
Capsule poses relative to their bodies [m, quaternion].
Capsule scales [m]; the second component is the half-length.
Two (capsule index, endpoint sign) pairs per output vertex; their positions are averaged.
- transforms: warp.array#
World-space body poses [m, quaternion].
- shape_body: warp.array#
- shape_transform: warp.array#
Capsule poses relative to their bodies [m, quaternion].
- shape_scale: warp.array#
Capsule scales [m]; the second component is the half-length.
- endpoints: warp.array#
Two (capsule index, endpoint sign) pairs per output vertex; their positions are averaged.