isaaclab_ovphysx.sim.views#
OVPhysX simulation views.
Classes
A string-keyed, generic view over OVPhysX |
Tensor Binding View#
- class isaaclab_ovphysx.sim.views.OvPhysxView[source]#
Bases:
objectA string-keyed, generic view over OVPhysX
TensorBindinghandles for one prim set.- Parameters:
physx¶ – The OVPhysX
PhysXinstance exposingcreate_tensor_binding.pattern¶ – An fnmatch glob selecting the prims this view addresses. Mutually exclusive with
prim_paths.device¶ – Simulation device (e.g.
"cuda:0"or"cpu"). State bindings are read/written on this device; CPU-only property bindings always use"cpu".prim_paths¶ – An explicit list of fnmatch globs for the fused multi-prim binding form (
create_tensor_binding(prim_paths=[...])). Mutually exclusive withpattern.key_aliases¶ – Optional mapping
requested_type -> created_typeso a binding can be stored under a differentTensorTypekey than the one created (e.g. aRigidObjectCollectionstoresrigid_body_poseunderlink_pose). This is an internal IsaacLab adapter for the fused-collection binding path, not a general public API: the requested key and the created binding type deliberately differ, so a caller reasoning from the visible key can get different runtime semantics. A public form would instead carry descriptor metadata (requested key, source tensor type, shape, native device, access mode); that is deferred to wheel-exposed descriptor metadata. Prefer not to rely on it outside the collection adapter.tensor_types¶ – Explicit set of
TensorTypemembers to instantiate eagerly. Used only wheneageris set; defaults to every applicable type.eager¶ – If
True, create bindings up front and raise if none could be created. Defaults toFalse(lazy: bindings are created on first access).
Miscellaneous:
Base class for all errors raised by
OvPhysxView.The attribute name does not resolve to an addressable
TensorType.A write was attempted on a read-only attribute.
No binding could be created for the attribute on this view's prims.
A supplied buffer does not match the binding's element count.
A supplied buffer does not use the binding-reported DLPack scalar dtype.
A supplied buffer is on a different device than the binding requires.
Methods:
__init__(physx[, pattern, device, ...])close()Destroy cached bindings before the OVPhysX runtime is released.
get_attribute(name, *[, out])Read the full attribute tensor.
read_into(name, dst)Fill
dstin place from the attribute binding (zero-copy).set_attribute(name, values, *[, indices, mask])Write a full attribute tensor;
indices/maskselect which rows apply.binding_for(name)Return the underlying
TensorBindingfor an attribute, creating it on first use.try_binding_for(name)Like
binding_for(), but returnNoneinstead of raising when the attribute is valid yet not available for this view's prims (e.g. tendon types on a tendon-less articulation, or a not-yet-created optional binding).has_attribute(name)Return whether
nameis a valid attribute name (resolves to aTensorType).Attributes:
Every valid attribute name (the full
TensorTypevocabulary).Names with a live binding instantiated for this view's prims.
Number of prims matched by this view.
USD paths of the prims matched by this view.
Per-articulation DOF names (articulation views only).
Per-articulation body (link) names (articulation views only).
Per-articulation joint names (articulation views only).
Number of DOFs per articulation (articulation views only).
Number of bodies (links) per articulation (articulation views only).
Number of joints per articulation (articulation views only).
Whether the articulation has a fixed base (articulation views only).
Number of fixed tendons per articulation (articulation views only).
Number of spatial tendons per articulation (articulation views only).
- exception OvPhysxViewError[source]#
Bases:
RuntimeErrorBase class for all errors raised by
OvPhysxView.
- exception UnknownAttribute[source]#
Bases:
OvPhysxViewErrorThe attribute name does not resolve to an addressable
TensorType.
- exception ReadOnlyAttribute[source]#
Bases:
OvPhysxViewErrorA write was attempted on a read-only attribute.
Bases:
OvPhysxViewErrorNo binding could be created for the attribute on this view’s prims.
- exception ShapeMismatch[source]#
Bases:
OvPhysxViewErrorA supplied buffer does not match the binding’s element count.
- exception DtypeMismatch[source]#
Bases:
OvPhysxViewErrorA supplied buffer does not use the binding-reported DLPack scalar dtype.
- exception DeviceMismatch[source]#
Bases:
OvPhysxViewErrorA supplied buffer is on a different device than the binding requires.
- __init__(physx: _PhysXLike, pattern: str | None = None, device: str = 'cpu', *, prim_paths: list[str] | None = None, key_aliases: dict[Any, Any] | None = None, tensor_types: list[Any] | None = None, eager: bool = False) None[source]#
- get_attribute(name: str | Any, *, out: wp.array | None = None) wp.array[source]#
Read the full attribute tensor.
Reads are full-array (the wheel exposes no selective read); index into the returned tensor for a subset.
- Parameters:
name¶ – Lowercased
TensorTypename or the member itself.out¶ – Optional destination buffer to fill (must be on the binding’s native device and match its element count). If omitted, a freshly allocated
warp.arrayon the native device is returned.
- Returns:
A
warp.arrayholding the attribute values, on the attribute’s native device –cpufor CPU-only property types even on a GPU sim (seeis_cpu_only()). Whenoutis omitted this is a fresh, caller-owned array; its dtype is the attribute’s structured Warp dtype when it has one (e.g.wp.transformffor poses,wp.spatial_vectorffor velocities). Otherwise, a flat array matching the binding shape is allocated with the Warp scalar dtype resolved from the binding’s DLPack metadata (see_ATTR_DTYPE).
- read_into(name: str | Any, dst: warp.array) None[source]#
Fill
dstin place from the attribute binding (zero-copy).dstmay be a structured-dtype buffer (e.g.wp.transformf); it is read through a binding-scalar reinterpret view that matches the binding’s flat shape, so the structured GPU/CPU buffer is filled directly with no extra copy. This is the path the asset data containers use. The reinterpret view for a givendstis built once and reused across calls (see_read_view()) so the wheel’s object-identity read cache stays warm – callers can pass the structured buffer directly each step without maintaining their own reinterpret cache.- Parameters:
- Raises:
OvPhysxView.DeviceMismatch – If
dstis not on the binding’s native device.OvPhysxView.DtypeMismatch – If
dst’s scalar element type does not match the binding-reported DLPack scalar dtype.OvPhysxView.ShapeMismatch – If
dstis non-contiguous or its element count does not match.
- set_attribute(name: str | Any, values: wp.array, *, indices: wp.array | None = None, mask: wp.array | None = None) None[source]#
Write a full attribute tensor;
indices/maskselect which rows apply.valuesmay be a structured-dtype buffer read through a binding-reported scalar dtype reinterpret view. If bothindicesandmaskare given,maskwins and the wheel emits aUserWarning– this view forwards both verbatim toTensorBinding.writeand does not implement the precedence itself.- Parameters:
- Raises:
OvPhysxView.ReadOnlyAttribute – If the attribute is read-only.
OvPhysxView.DeviceMismatch – If
valuesis not on the binding’s native device.OvPhysxView.DtypeMismatch – If
values’ scalar element type does not match the binding-reported DLPack scalar dtype.OvPhysxView.ShapeMismatch – If
valuesis non-contiguous or its element count does not match.
- binding_for(name: str | Any) _BindingLike[source]#
Return the underlying
TensorBindingfor an attribute, creating it on first use.This is a raw escape hatch for asset-internal binding management: the returned binding’s
read/writebypass the view’s device, dtype-reinterpret, shape, and read-only guards. Preferget_attribute()/read_into()/set_attribute()unless you are deliberately managing bindings directly.
- try_binding_for(name: str | Any) _BindingLike | None[source]#
Like
binding_for(), but returnNoneinstead of raising when the attribute is valid yet not available for this view’s prims (e.g. tendon types on a tendon-less articulation, or a not-yet-created optional binding).An invalid name still raises
UnknownAttribute– that is a programming error, not an availability question. Use this for the asset’sbinding or Nonepattern over optional bindings.
- property attribute_names: list[str]#
Every valid attribute name (the full
TensorTypevocabulary).This is name validity, not availability for this view’s prims – a rigid-body view still lists
"articulation_*"names. Useavailable_attributesfor what is actually instantiated.Note
A listed name is not a promise of binding availability or supported DLPack dtype metadata. Those are validated when the view creates and accesses the binding.
- property available_attributes: list[str]#
Names with a live binding instantiated for this view’s prims.
- has_attribute(name: str | Any) bool[source]#
Return whether
nameis a valid attribute name (resolves to aTensorType).This checks name validity for any view, not availability for these prims: it can return
Truefor a name whose binding does not apply to this view’s prims (in which caseget_attribute()raisesAttributeUnavailable). It likewise does not promise binding availability or supported DLPack dtype metadata.