Prim path conflict in rigidbody spawning
Describe the bug
Say if spawn a cake_on_plate.usd which has prims of
../cake_on_plate
../cake_on_plate/cake
../cake_on_plate/plate
then you also define another usd: plate.usd which has a prim of
../plate
../plate/plate
then you can write object_scene_cfg:
cake_on_plate: AssetBaseCfg = RigidObjectCfg(
prim_path="{ENV_REGEX_NS}/cake_on_plate",
init_state=RigidObjectCfg.InitialStateCfg(pos=(-0.2, -0.2, 0.01), rot=(1, 0, 0, 0)),
spawn=UsdFileCfg(
usd_path=f".../assets/cake_on_plate.usd"
),
)
plate: AssetBaseCfg = RigidObjectCfg(
prim_path="{ENV_REGEX_NS}/plate",
init_state=RigidObjectCfg.InitialStateCfg(pos=(-0, -0.2, 0.01), rot=(1, 0, 0, 0)),
spawn=UsdFileCfg(
usd_path=f".../assets/plate.usd",
),
)
however, there will lead to error is rigidbody initialization, say rigidbody for cake_on_plate has successfully spawned then when spawning plate, below line causes bug:
line 298 template_prim = sim_utils.find_first_matching_prim(self.cfg.prim_path) in .../orbit/assets/rigid_object/rigid_object.py
the self.cfg.prim_path now read '/World/envs/env_.*/plate'
we expect the template_prim to be /World/envs/env_0/plate/plate'
but the actual template_prime is Usd.Prim(</World/envs/env_0/cake/white_plate/plate>)
It seems like the error is due to not checking the prefix of entire prim path. I am able to by pass this issue by manually rename the spawning assets and make sure all names are unique, but i feel this won't be a solution if scene gets complex.
Checklist
- [x] I have checked that there is no similar issue in the repo (required)
- [x] I have checked that the issue is not in running Isaac Sim itself and is related to the repo
Acceptance Criteria
Add the criteria for which this task is considered done. If not known at issue creation time, you can add this once the issue is assigned.
- [ ] rigidbody prim with the same name but different prefix can both be successfully initialized and spawned