isaaclab.sim.usd_export#

Export an initialized scene environment as USD.

Exports one initialized environment as USD. The file keeps the scene’s USD, with assets as references to their source files, and adds the physics values of the active backend that an import of that USD would not reproduce. Use export_to_usd() or export_usd_path. The file is meant for each backend’s own import: Isaac Sim and OVPhysX open it, and Newton reads it with newton.ModelBuilder.add_usd(); see Exporting an Environment to USD.

UsdExporter

Factory for the USD exporter of the active physics backend.

BaseUsdExporter

Export one environment of an initialized scene: its USD plus the values its engine holds.

UsdEdit

One value the exported USD must author so that an import reproduces the engine.

Exporters#

class isaaclab.sim.usd_export.UsdExporter[source]#

Bases: FactoryBase, BaseUsdExporter

Factory for the USD exporter of the active physics backend.

Methods:

__new__(cls, *args, **kwargs)

Create the exporter of the active physics backend.

__init__(scene[, env_id])

Initialize the exporter.

static __new__(cls, *args, **kwargs) → BaseUsdExporter[source]#

Create the exporter of the active physics backend.

__init__(scene: InteractiveScene, env_id: int = 0)[source]#

Initialize the exporter.

Parameters:
  • scene – Scene whose assets are initialized and whose physics has not stepped yet.

  • env_id – Environment to export.

class isaaclab.sim.usd_export.BaseUsdExporter[source]#

Bases: ABC

Export one environment of an initialized scene: its USD plus the values its engine holds.

The exported layer is the scene’s root layer reduced to one environment, so assets stay references to their source files. A backend compares the engine with what an import of the layer gives (its base) and writes every value that differs, which is what Isaac Lab set.

Attributes:

exports_deformables

Whether an import of the layer reproduces the scene's deformable objects.

exports_cables

Whether an import of the layer reproduces the scene's cable objects.

Methods:

__init__(scene[, env_id])

Initialize the exporter.

export(path)

Write the environment to a USD file.

compute_diff(stage)

Return the engine values that stage does not already state.

read_engine_base()

Read what the engine loaded from the stage, before the scene's assets write their configuration.

open_stage(path)

Open an exported USD file, downloading referenced remote assets as Isaac Lab does when spawning them.

exports_deformables: ClassVar[bool] = False#

Whether an import of the layer reproduces the scene’s deformable objects.

exports_cables: ClassVar[bool] = False#

Whether an import of the layer reproduces the scene’s cable objects.

__init__(scene: InteractiveScene, env_id: int = 0)[source]#

Initialize the exporter.

Parameters:
  • scene – Scene whose assets are initialized and whose physics has not stepped yet.

  • env_id – Environment to export.

export(path: str) → str[source]#

Write the environment to a USD file.

Parameters:

path – Destination USD file.

Returns:

The destination path.

abstractmethod compute_diff(stage: pxr.Usd.Stage) → list[UsdEdit][source]#

Return the engine values that stage does not already state.

Parameters:

stage – The exported stage, reduced to the selected environment.

read_engine_base() → Any[source]#

Read what the engine loaded from the stage, before the scene’s assets write their configuration.

The scene calls this when its physics is ready, ahead of asset initialization, and keeps the result for compute_diff(). Backends that compare against something else return None.

Returns:

The backend’s base values, or None.

static open_stage(path: str) → pxr.Usd.Stage[source]#

Open an exported USD file, downloading referenced remote assets as Isaac Lab does when spawning them.

Parameters:

path – Exported USD file.

Returns:

A stage whose layer references local copies of the remote assets.

class isaaclab.sim.usd_export.UsdEdit[source]#

One value the exported USD must author so that an import reproduces the engine.

Attributes:

path

Prim path in the exported stage.

attribute

Attribute name; _WORLD_POSE for a world transform given as a Gf.Matrix4d, _PHYSICS_MATERIAL for a new physics material bound to the prim, given as its path, _DEACTIVATE to deactivate the prim, or _DEFINE_PRIM for a new prim given as a PrimDefinition.

value

Value in USD units.

type_name

Value type used when the attribute does not exist yet.

schema

Applied API schema the importer requires for the attribute, e.g. "PhysicsDriveAPI:angular".

Methods:

apply(stage)

Author the edit on stage, un-instancing the asset instance that contains the prim.

__new__(_cls, path, attribute, value[, ...])

Create new instance of UsdEdit(path, attribute, value, type_name, schema)

path: str#

Prim path in the exported stage.

attribute: str#

Attribute name; _WORLD_POSE for a world transform given as a Gf.Matrix4d, _PHYSICS_MATERIAL for a new physics material bound to the prim, given as its path, _DEACTIVATE to deactivate the prim, or _DEFINE_PRIM for a new prim given as a PrimDefinition.

value: Any#

Value in USD units.

type_name: str#

Value type used when the attribute does not exist yet.

schema: str | None#

Applied API schema the importer requires for the attribute, e.g. "PhysicsDriveAPI:angular".

apply(stage: pxr.Usd.Stage)[source]#

Author the edit on stage, un-instancing the asset instance that contains the prim.

static __new__(_cls, path: str, attribute: str, value: Any, type_name: str = 'float', schema: str | None = None)#

Create new instance of UsdEdit(path, attribute, value, type_name, schema)