isaaclab.sim.views#
Views for manipulating USD prims.
Classes
Abstract interface for reading and writing world-space transforms of multiple prims. |
|
Batched interface for reading and writing transforms of multiple USD prims. |
|
FrameView that dispatches to the active physics backend. |
Base Frame View#
- class isaaclab.sim.views.BaseFrameView[source]#
Bases:
ABCAbstract interface for reading and writing world-space transforms of multiple prims.
Backend-specific implementations (USD/Fabric, Newton GPU state, etc.) subclass this to provide efficient batched pose queries. The factory
FrameViewselects the correct implementation at runtime based on the active physics backend.All pose getters return
ProxyArray. Setters acceptwp.array.Attributes:
Methods:
get_world_poses([indices])Get world-space positions and orientations for prims in the view.
set_world_poses([positions, orientations, ...])Set world-space positions and/or orientations for prims in the view.
get_local_poses([indices])Get local-space positions and orientations for prims in the view.
set_local_poses([translations, ...])Set local-space translations and/or orientations for prims in the view.
get_scales([indices])Get scales for prims in the view.
set_scales(scales[, indices])Set scales for prims in the view.
- abstractmethod get_world_poses(indices: wp.array | None = None) tuple[ProxyArray, ProxyArray][source]#
Get world-space positions and orientations for prims in the view.
- Parameters:
indices – Subset of prims to query.
Nonemeans all prims.- Returns:
A tuple
(positions, orientations)ofProxyArraywrappers. Use.warpfor the underlyingwp.arrayor.torchfor a cached zero-copytorch.Tensorview.
- abstractmethod set_world_poses(positions: wp.array | None = None, orientations: wp.array | None = None, indices: wp.array | None = None) None[source]#
Set world-space positions and/or orientations for prims in the view.
- Parameters:
positions – World-space positions
(M, 3).Noneleaves positions unchanged.orientations – World-space quaternions
(M, 4).Noneleaves orientations unchanged.indices – Subset of prims to update.
Nonemeans all prims.
- abstractmethod get_local_poses(indices: wp.array | None = None) tuple[ProxyArray, ProxyArray][source]#
Get local-space positions and orientations for prims in the view.
- Parameters:
indices – Subset of prims to query.
Nonemeans all prims.- Returns:
A tuple
(translations, orientations)ofProxyArraywrappers. Use.warpfor the underlyingwp.arrayor.torchfor a cached zero-copytorch.Tensorview.
- abstractmethod set_local_poses(translations: wp.array | None = None, orientations: wp.array | None = None, indices: wp.array | None = None) None[source]#
Set local-space translations and/or orientations for prims in the view.
- Parameters:
translations – Local-space translations
(M, 3).Noneleaves translations unchanged.orientations – Local-space quaternions
(M, 4).Noneleaves orientations unchanged.indices – Subset of prims to update.
Nonemeans all prims.
USD Frame View#
- class isaaclab.sim.views.UsdFrameView[source]#
Bases:
BaseFrameViewBatched interface for reading and writing transforms of multiple USD prims.
Provides batch operations for getting and setting poses (position and orientation) of multiple prims at once via USD’s
XformCache.The class supports both world-space and local-space pose operations:
World poses: Positions and orientations in the global world frame
Local poses: Positions and orientations relative to each prim’s parent
For GPU-accelerated Fabric operations, use the PhysX backend variant obtained via
FrameView.Pose getters return
ProxyArray. Setters acceptwp.array.Note
Transform Requirements:
All prims in the view must be Xformable and have standardized transform operations:
[translate, orient, scale]. Non-standard prims will raise a ValueError during initialization ifvalidate_xform_opsis True. Please use the functionisaaclab.sim.utils.standardize_xform_ops()to prepare prims before using this view.Warning
This class operates at the USD default time code. Any animation or time-sampled data will not be affected by write operations. For animated transforms, you need to handle time-sampled keyframes separately.
Methods:
__init__(prim_path[, device, ...])Initialize the view with matching prims.
set_world_poses([positions, orientations, ...])Set world-space poses for prims in the view.
set_local_poses([translations, ...])Set local-space poses for prims in the view.
set_scales(scales[, indices])Set scales for prims in the view.
set_visibility(visibility[, indices])Set visibility for prims in the view.
get_world_poses([indices])Get world-space poses for prims in the view.
get_local_poses([indices])Get local-space poses for prims in the view.
get_scales([indices])Get scales for prims in the view.
get_visibility([indices])Get visibility for prims in the view.
Attributes:
Number of prims in this view.
Device where arrays are allocated (cpu or cuda).
List of USD prims being managed by this view.
List of prim paths (as strings) for all prims being managed by this view.
- __init__(prim_path: str, device: str = 'cpu', validate_xform_ops: bool = True, stage: Usd.Stage | None = None, **kwargs)[source]#
Initialize the view with matching prims.
- Parameters:
prim_path – USD prim path pattern to match prims. Supports wildcards (
*) and regex patterns (e.g.,"/World/Env_.*/Robot"). Seeisaaclab.sim.utils.find_matching_prims()for pattern syntax.device – Device to place arrays on. Can be
"cpu"or CUDA devices like"cuda:0". Defaults to"cpu".validate_xform_ops – Whether to validate that the prims have standard xform operations. Defaults to True.
stage – USD stage to search for prims. Defaults to None, in which case the current active stage from the simulation context is used.
**kwargs – Additional keyword arguments (ignored). Allows forward-compatible construction when callers pass backend-specific options like
sync_usd_on_fabric_write.
- Raises:
ValueError – If any matched prim is not Xformable or doesn’t have standardized transform operations (translate, orient, scale in that order).
- property prim_paths: list[str]#
List of prim paths (as strings) for all prims being managed by this view.
The conversion is performed lazily on first access and cached.
- set_world_poses(positions: wp.array | None = None, orientations: wp.array | None = None, indices: wp.array | None = None)[source]#
Set world-space poses for prims in the view.
Converts the desired world pose to local-space relative to each prim’s parent before writing to USD xform ops.
- Parameters:
positions – World-space positions of shape
(M, 3).orientations – World-space quaternions
(w, x, y, z)of shape(M, 4).indices – Indices of prims to set poses for. Defaults to None (all prims).
- set_local_poses(translations: wp.array | None = None, orientations: wp.array | None = None, indices: wp.array | None = None)[source]#
Set local-space poses for prims in the view.
- Parameters:
translations – Local-space translations of shape
(M, 3).orientations – Local-space quaternions
(w, x, y, z)of shape(M, 4).indices – Indices of prims to set poses for. Defaults to None (all prims).
- set_scales(scales: wp.array, indices: wp.array | None = None)[source]#
Set scales for prims in the view.
- Parameters:
scales – Scales of shape
(M, 3).indices – Indices of prims to set scales for. Defaults to None (all prims).
- set_visibility(visibility: torch.Tensor, indices: wp.array | None = None)[source]#
Set visibility for prims in the view.
- Parameters:
visibility – Visibility as a boolean tensor of shape
(M,).indices – Indices of prims to set visibility for. Defaults to None (all prims).
- get_world_poses(indices: wp.array | None = None) tuple[ProxyArray, ProxyArray][source]#
Get world-space poses for prims in the view.
- Parameters:
indices – Indices of prims to get poses for. Defaults to None (all prims).
- Returns:
A tuple
(positions, orientations)ofProxyArraywrappers. Use.warpfor the underlyingwp.arrayor.torchfor a cached zero-copytorch.Tensorview.
- get_local_poses(indices: wp.array | None = None) tuple[ProxyArray, ProxyArray][source]#
Get local-space poses for prims in the view.
- Parameters:
indices – Indices of prims to get poses for. Defaults to None (all prims).
- Returns:
A tuple
(translations, orientations)ofProxyArraywrappers. Use.warpfor the underlyingwp.arrayor.torchfor a cached zero-copytorch.Tensorview.
- get_scales(indices: wp.array | None = None) wp.array[source]#
Get scales for prims in the view.
- Parameters:
indices – Indices of prims to get scales for. Defaults to None (all prims).
- Returns:
A
wp.arrayof shape(M, 3).
- get_visibility(indices: wp.array | None = None) torch.Tensor[source]#
Get visibility for prims in the view.
- Parameters:
indices – Indices of prims to get visibility for. Defaults to None (all prims).
- Returns:
A tensor of shape
(M,)containing the visibility of each prim (bool).
Frame View#
- class isaaclab.sim.views.FrameView[source]#
Bases:
FactoryBase,BaseFrameViewFrameView that dispatches to the active physics backend.
Callers use
FrameView(prim_path, device=device)and get the correct implementation automatically:PhysX / no backend:
FabricFrameView(Fabric GPU acceleration with USD fallback).Newton:
NewtonSiteFrameView(GPU-resident site-based transforms).
Methods:
__new__(cls, *args, **kwargs)Create a new FrameView for the active physics backend.
- static __new__(cls, *args, **kwargs) BaseFrameView[source]#
Create a new FrameView for the active physics backend.