Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ Guidelines for modifications:
* Tsz Ki GAO
* Tyler Lum
* Victor Khaustov
* Vidur Vij
* Virgilio Gómez Lambo
* Vladimir Fokow
* Wei Yang
Expand Down
19 changes: 19 additions & 0 deletions source/isaaclab/changelog.d/vidurv-schema-fragments.minor.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Added
^^^^^

* Added the single-namespace schema-fragment API: :class:`~isaaclab.sim.schemas.SchemaFragment`,
the :class:`~isaaclab.sim.schemas.RigidBodyFragment` marker, and
:class:`~isaaclab.sim.schemas.UsdPhysicsRigidBodyCfg`. Each fragment carries
``_usd_namespace`` / ``_usd_applied_schema`` metadata and a ``func`` applier so a prim can
carry rigid-body properties from multiple USD namespaces at once.
* Added :func:`~isaaclab.sim.schemas.apply_namespaced` (generic fragment writer) and
:func:`~isaaclab.sim.schemas.apply_rigid_body_properties` (applies a list of rigid-body
fragments with ``UsdPhysics.RigidBodyAPI`` as the implicit anchor).

Changed
^^^^^^^

* Changed the spawner ``rigid_props`` slot
(:attr:`~isaaclab.sim.spawners.RigidObjectSpawnerCfg.rigid_props`) to also accept a list of
:class:`~isaaclab.sim.schemas.RigidBodyFragment` fragments. Legacy single cfgs continue to
work through a transition bridge in the spawn writers.
230 changes: 122 additions & 108 deletions source/isaaclab/isaaclab/sim/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@ __all__ = [
"PhysxJointDrivePropertiesCfg",
"PhysxRigidBodyPropertiesCfg",
"RigidBodyBaseCfg",
"RigidBodyFragment",
"SchemaFragment",
"UsdPhysicsRigidBodyCfg",
"apply_namespaced",
"apply_rigid_body_properties",
"SDFMeshPropertiesCfg",
"SpatialTendonPropertiesCfg",
"TriangleMeshPropertiesCfg",
Expand Down Expand Up @@ -191,8 +196,6 @@ __all__ = [
"XformPrimView",
]

from .simulation_cfg import RenderCfg, SimulationCfg
from .simulation_context import SimulationContext, build_simulation_context
from .converters import (
AssetConverterBase,
AssetConverterBaseCfg,
Expand All @@ -207,22 +210,6 @@ from .schemas import (
MESH_APPROXIMATION_TOKENS,
PHYSX_MESH_COLLISION_CFGS,
USD_MESH_COLLISION_CFGS,
activate_contact_sensors,
define_articulation_root_properties,
define_collision_properties,
define_deformable_body_properties,
define_mass_properties,
define_mesh_collision_properties,
define_rigid_body_properties,
modify_articulation_root_properties,
modify_collision_properties,
modify_deformable_body_properties,
modify_fixed_tendon_properties,
modify_joint_drive_properties,
modify_mass_properties,
modify_mesh_collision_properties,
modify_rigid_body_properties,
modify_spatial_tendon_properties,
ArticulationRootPropertiesCfg,
BoundingCubePropertiesCfg,
BoundingSpherePropertiesCfg,
Expand All @@ -238,11 +225,34 @@ from .schemas import (
PhysxJointDrivePropertiesCfg,
PhysxRigidBodyPropertiesCfg,
RigidBodyBaseCfg,
RigidBodyFragment,
SchemaFragment,
SDFMeshPropertiesCfg,
SpatialTendonPropertiesCfg,
TriangleMeshPropertiesCfg,
TriangleMeshSimplificationPropertiesCfg,
UsdPhysicsRigidBodyCfg,
activate_contact_sensors,
apply_namespaced,
apply_rigid_body_properties,
define_articulation_root_properties,
define_collision_properties,
define_deformable_body_properties,
define_mass_properties,
define_mesh_collision_properties,
define_rigid_body_properties,
modify_articulation_root_properties,
modify_collision_properties,
modify_deformable_body_properties,
modify_fixed_tendon_properties,
modify_joint_drive_properties,
modify_mass_properties,
modify_mesh_collision_properties,
modify_rigid_body_properties,
modify_spatial_tendon_properties,
)
from .simulation_cfg import RenderCfg, SimulationCfg
from .simulation_context import SimulationContext, build_simulation_context

# Forwarded to isaaclab_newton.sim.schemas via __getattr__ shim
MujocoJointDrivePropertiesCfg = ...
Expand All @@ -255,129 +265,133 @@ NewtonMeshCollisionPropertiesCfg = ...
NewtonRigidBodyPropertiesCfg = ...
NewtonSDFCollisionPropertiesCfg = ...
from .spawners import (
SpawnerCfg,
RigidObjectSpawnerCfg,
DeformableObjectSpawnerCfg,
spawn_from_mjcf,
spawn_from_urdf,
spawn_from_usd,
spawn_from_usd_with_compliant_contact_material,
spawn_ground_plane,
GroundPlaneCfg,
MjcfFileCfg,
UrdfFileCfg,
UsdFileCfg,
UsdFileWithCompliantContactCfg,
spawn_light,
CapsuleCfg,
ConeCfg,
CuboidCfg,
CylinderCfg,
CylinderLightCfg,
DeformableBodyMaterialBaseCfg,
DeformableBodyMaterialCfg,
DeformableObjectSpawnerCfg,
DiskLightCfg,
DistantLightCfg,
DomeLightCfg,
LightCfg,
SphereLightCfg,
spawn_rigid_body_material,
spawn_deformable_body_material,
PhysicsMaterialCfg,
RigidBodyMaterialCfg,
DeformableBodyMaterialBaseCfg,
DeformableBodyMaterialCfg,
SurfaceDeformableBodyMaterialBaseCfg,
SurfaceDeformableBodyMaterialCfg,
spawn_from_mdl_file,
spawn_preview_surface,
FisheyeCameraCfg,
GlassMdlCfg,
GroundPlaneCfg,
LightCfg,
MdlFileCfg,
PreviewSurfaceCfg,
VisualMaterialCfg,
spawn_mesh_capsule,
spawn_mesh_cone,
spawn_mesh_cuboid,
spawn_mesh_cylinder,
spawn_mesh_rectangle,
spawn_mesh_sphere,
MeshCapsuleCfg,
MeshCfg,
MeshConeCfg,
MeshCuboidCfg,
MeshCylinderCfg,
MeshRectangleCfg,
MeshSphereCfg,
spawn_camera,
spawn_sensor_frame,
FisheyeCameraCfg,
MjcfFileCfg,
MultiAssetSpawnerCfg,
MultiUsdFileCfg,
PhysicsMaterialCfg,
PinholeCameraCfg,
PreviewSurfaceCfg,
RigidBodyMaterialCfg,
RigidObjectSpawnerCfg,
SensorFrameCfg,
ShapeCfg,
SpawnerCfg,
SphereCfg,
SphereLightCfg,
SurfaceDeformableBodyMaterialBaseCfg,
SurfaceDeformableBodyMaterialCfg,
UrdfFileCfg,
UsdFileCfg,
UsdFileWithCompliantContactCfg,
VisualMaterialCfg,
spawn_camera,
spawn_capsule,
spawn_cone,
spawn_cuboid,
spawn_cylinder,
spawn_sphere,
CapsuleCfg,
ConeCfg,
CuboidCfg,
CylinderCfg,
ShapeCfg,
SphereCfg,
spawn_deformable_body_material,
spawn_from_mdl_file,
spawn_from_mjcf,
spawn_from_urdf,
spawn_from_usd,
spawn_from_usd_with_compliant_contact_material,
spawn_ground_plane,
spawn_light,
spawn_mesh_capsule,
spawn_mesh_cone,
spawn_mesh_cuboid,
spawn_mesh_cylinder,
spawn_mesh_rectangle,
spawn_mesh_sphere,
spawn_multi_asset,
spawn_multi_usd_file,
MultiAssetSpawnerCfg,
MultiUsdFileCfg,
spawn_preview_surface,
spawn_rigid_body_material,
spawn_sensor_frame,
spawn_sphere,
)
from .utils import (
add_labels,
add_reference_to_stage,
get_stage_up_axis,
traverse_stage,
get_prim_at_path,
get_prim_path,
is_prim_path_valid,
define_prim,
get_prim_type_name,
get_next_free_path,
add_usd_reference,
apply_nested,
bind_physics_material,
bind_visual_material,
change_prim_property,
check_missing_labels,
clear_stage,
clone,
close_stage,
convert_world_pose_to_local,
count_total_labels,
create_new_stage,
create_prim,
define_prim,
delete_prim,
make_uninstanceable,
set_prim_visibility,
safe_set_attribute_on_usd_schema,
safe_set_attribute_on_usd_prim,
change_prim_property,
export_prim_to_file,
apply_nested,
clone,
bind_visual_material,
bind_physics_material,
add_usd_reference,
get_usd_references,
select_usd_variants,
get_next_free_prim_path,
get_first_matching_ancestor_prim,
get_first_matching_child_prim,
get_all_matching_child_prims,
find_first_matching_prim,
find_matching_prims,
resolve_matching_prims_from_source,
find_matching_prim_paths,
find_global_fixed_joint_prim,
add_labels,
find_matching_prim_paths,
find_matching_prims,
get_all_matching_child_prims,
get_current_stage,
get_current_stage_id,
get_first_matching_ancestor_prim,
get_first_matching_child_prim,
get_labels,
remove_labels,
check_missing_labels,
count_total_labels,
resolve_paths,
create_new_stage,
get_next_free_path,
get_next_free_prim_path,
get_prim_at_path,
get_prim_path,
get_prim_type_name,
get_stage_up_axis,
get_usd_references,
is_current_stage_in_memory,
is_prim_path_valid,
make_uninstanceable,
open_stage,
use_stage,
update_stage,
remove_labels,
resolve_matching_prims_from_source,
resolve_paths,
resolve_prim_pose,
resolve_prim_scale,
safe_set_attribute_on_usd_prim,
safe_set_attribute_on_usd_schema,
save_stage,
close_stage,
clear_stage,
get_current_stage,
get_current_stage_id,
select_usd_variants,
set_prim_visibility,
standardize_xform_ops,
traverse_stage,
update_stage,
use_stage,
validate_standard_xform_ops,
resolve_prim_pose,
resolve_prim_scale,
convert_world_pose_to_local,
)
from .views import BaseFrameView, UsdFrameView, FrameView
from .views import XformPrimView # deprecated alias
from .views import (
BaseFrameView,
FrameView,
UsdFrameView,
XformPrimView, # deprecated alias
)
8 changes: 6 additions & 2 deletions source/isaaclab/isaaclab/sim/converters/mesh_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,9 +185,13 @@ def _convert_asset(self, cfg: MeshConverterCfg):
# apply mass properties
if cfg.mass_props is not None:
schemas.define_mass_properties(prim_path=xform_prim.GetPath(), cfg=cfg.mass_props, stage=stage)
# apply rigid body properties
# apply rigid body properties (transition shim, remove later: fragment list -> apply_*; legacy cfg -> define_*)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Transition shim — remove at the end of the migration. A fragment list routes to apply_rigid_body_properties; a legacy single cfg falls through to the existing define_/modify_ writer, so current behavior is unchanged (this PR is purely additive). Collapses to one unconditional apply_* call once call sites move to fragments and the legacy cfgs are dropped.

if cfg.rigid_props is not None:
schemas.define_rigid_body_properties(prim_path=xform_prim.GetPath(), cfg=cfg.rigid_props, stage=stage)
rigid_frags = cfg.rigid_props if isinstance(cfg.rigid_props, (list, tuple)) else [cfg.rigid_props]
if rigid_frags and all(isinstance(f, schemas.SchemaFragment) for f in rigid_frags):
schemas.apply_rigid_body_properties(str(xform_prim.GetPath()), rigid_frags, stage=stage)
else:
schemas.define_rigid_body_properties(prim_path=xform_prim.GetPath(), cfg=cfg.rigid_props, stage=stage)

# Save changes to USD stage
stage.Save()
Expand Down
10 changes: 10 additions & 0 deletions source/isaaclab/isaaclab/sim/schemas/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ __all__ = [
"PHYSX_MESH_COLLISION_CFGS",
"USD_MESH_COLLISION_CFGS",
"activate_contact_sensors",
"apply_namespaced",
"apply_rigid_body_properties",
"define_actuator_properties",
"define_articulation_root_properties",
"define_collision_properties",
Expand All @@ -33,6 +35,9 @@ __all__ = [
"JointDriveBaseCfg",
"MassPropertiesCfg",
"MeshCollisionBaseCfg",
"RigidBodyFragment",
"SchemaFragment",
"UsdPhysicsRigidBodyCfg",
"MujocoJointDrivePropertiesCfg",
"MujocoRigidBodyPropertiesCfg",
"NewtonArticulationRootPropertiesCfg",
Expand All @@ -50,6 +55,8 @@ from .schemas import (
PHYSX_MESH_COLLISION_CFGS,
USD_MESH_COLLISION_CFGS,
activate_contact_sensors,
apply_namespaced,
apply_rigid_body_properties,
define_articulation_root_properties,
define_collision_properties,
define_deformable_body_properties,
Expand Down Expand Up @@ -80,6 +87,9 @@ from .schemas_cfg import (
MassPropertiesCfg,
MeshCollisionBaseCfg,
RigidBodyBaseCfg,
RigidBodyFragment,
SchemaFragment,
UsdPhysicsRigidBodyCfg,
)

# Forwarded to isaaclab_newton.sim.schemas via __getattr__ shim
Expand Down
Loading
Loading