Skip to content
Merged
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 source/isaaclab/isaaclab/markers/visualization_markers.py
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,7 @@ def _process_prototype_prim(self, prim: Usd.Prim):
value=True,
prev=None,
type_to_create_if_not_exist=Sdf.ValueTypeNames.Bool,
usd_context_name=prim.GetStage(),
)
# add children to list
all_prims += child_prim.GetChildren()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ def spawn_ground_plane(
raise ValueError(f"No collision prim found at path: '{prim_path}'.")
# bind physics material to the collision prim
collision_prim_path = str(collision_prim.GetPath())
bind_physics_material(collision_prim_path, f"{prim_path}/physicsMaterial")
bind_physics_material(collision_prim_path, f"{prim_path}/physicsMaterial", stage=stage)

# Obtain environment prim
environment_prim = stage.GetPrimAtPath(f"{prim_path}/Environment")
Expand Down Expand Up @@ -247,6 +247,7 @@ def spawn_ground_plane(
value=Gf.Vec3f(*cfg.color),
prev=None,
type_to_create_if_not_exist=Sdf.ValueTypeNames.Color3f,
usd_context_name=stage,
)
# Remove the light from the ground plane
# It isn't bright enough and messes up with the user's lighting settings
Expand Down Expand Up @@ -373,7 +374,7 @@ def _spawn_from_usd_file(
# create material
cfg.visual_material.func(material_path, cfg.visual_material)
# apply material
bind_visual_material(prim_path, material_path)
bind_visual_material(prim_path, material_path, stage=stage)

# return the prim
return stage.GetPrimAtPath(prim_path)
15 changes: 8 additions & 7 deletions source/isaaclab/isaaclab/sim/spawners/meshes/meshes.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,16 +338,17 @@ def _spawn_mesh_geom_from_mesh(
"faceVertexCounts": np.asarray([3] * len(mesh.faces)),
"subdivisionScheme": "bilinear",
},
stage=stage,
)

# note: in case of deformable objects, we need to apply the deformable properties to the mesh prim.
# this is different from rigid objects where we apply the properties to the parent prim.
if cfg.deformable_props is not None:
# apply mass properties
if cfg.mass_props is not None:
schemas.define_mass_properties(mesh_prim_path, cfg.mass_props)
schemas.define_mass_properties(mesh_prim_path, cfg.mass_props, stage=stage)
# apply deformable body properties
schemas.define_deformable_body_properties(mesh_prim_path, cfg.deformable_props)
schemas.define_deformable_body_properties(mesh_prim_path, cfg.deformable_props, stage=stage)
elif cfg.collision_props is not None:
# decide on type of collision approximation based on the mesh
if cfg.__class__.__name__ == "MeshSphereCfg":
Expand All @@ -362,7 +363,7 @@ def _spawn_mesh_geom_from_mesh(
mesh_collision_api = UsdPhysics.MeshCollisionAPI.Apply(mesh_prim)
mesh_collision_api.GetApproximationAttr().Set(collision_approximation)
# apply collision properties
schemas.define_collision_properties(mesh_prim_path, cfg.collision_props)
schemas.define_collision_properties(mesh_prim_path, cfg.collision_props, stage=stage)

# apply visual material
if cfg.visual_material is not None:
Expand All @@ -373,7 +374,7 @@ def _spawn_mesh_geom_from_mesh(
# create material
cfg.visual_material.func(material_path, cfg.visual_material)
# apply material
bind_visual_material(mesh_prim_path, material_path)
bind_visual_material(mesh_prim_path, material_path, stage=stage)

# apply physics material
if cfg.physics_material is not None:
Expand All @@ -384,12 +385,12 @@ def _spawn_mesh_geom_from_mesh(
# create material
cfg.physics_material.func(material_path, cfg.physics_material)
# apply material
bind_physics_material(mesh_prim_path, material_path)
bind_physics_material(mesh_prim_path, material_path, stage=stage)

# note: we apply the rigid properties to the parent prim in case of rigid objects.
if cfg.rigid_props is not None:
# apply mass properties
if cfg.mass_props is not None:
schemas.define_mass_properties(prim_path, cfg.mass_props)
schemas.define_mass_properties(prim_path, cfg.mass_props, stage=stage)
# apply rigid properties
schemas.define_rigid_body_properties(prim_path, cfg.rigid_props)
schemas.define_rigid_body_properties(prim_path, cfg.rigid_props, stage=stage)
1 change: 1 addition & 0 deletions source/isaaclab/isaaclab/sim/spawners/sensors/sensors.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ def spawn_camera(
value=True,
prev=None,
type_to_create_if_not_exist=Sdf.ValueTypeNames.Bool,
usd_context_name=stage,
)
# decide the custom attributes to add
if cfg.projection_type == "pinhole":
Expand Down
10 changes: 5 additions & 5 deletions source/isaaclab/isaaclab/sim/spawners/shapes/shapes.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ def _spawn_geom_from_prim_type(
create_prim(mesh_prim_path, prim_type, scale=scale, attributes=attributes, stage=stage)
# apply collision properties
if cfg.collision_props is not None:
schemas.define_collision_properties(mesh_prim_path, cfg.collision_props)
schemas.define_collision_properties(mesh_prim_path, cfg.collision_props, stage=stage)
# apply visual material
if cfg.visual_material is not None:
if not cfg.visual_material_path.startswith("/"):
Expand All @@ -304,7 +304,7 @@ def _spawn_geom_from_prim_type(
# create material
cfg.visual_material.func(material_path, cfg.visual_material)
# apply material
bind_visual_material(mesh_prim_path, material_path)
bind_visual_material(mesh_prim_path, material_path, stage=stage)
# apply physics material
if cfg.physics_material is not None:
if not cfg.physics_material_path.startswith("/"):
Expand All @@ -314,12 +314,12 @@ def _spawn_geom_from_prim_type(
# create material
cfg.physics_material.func(material_path, cfg.physics_material)
# apply material
bind_physics_material(mesh_prim_path, material_path)
bind_physics_material(mesh_prim_path, material_path, stage=stage)

# note: we apply rigid properties in the end to later make the instanceable prim
# apply mass properties
if cfg.mass_props is not None:
schemas.define_mass_properties(prim_path, cfg.mass_props)
schemas.define_mass_properties(prim_path, cfg.mass_props, stage=stage)
# apply rigid body properties
if cfg.rigid_props is not None:
schemas.define_rigid_body_properties(prim_path, cfg.rigid_props)
schemas.define_rigid_body_properties(prim_path, cfg.rigid_props, stage=stage)