Files
Tangger b178aafe40 feat: migrate omni.isaac.* imports to isaacsim.* via compat layer
- Add core/compat.py: compatibility module with try/except imports
  supporting both IS 4.x (omni.isaac.*) and IS 5.x+ (isaacsim.*)
- Migrate 152 imports across 47 files from direct omni.isaac.* to core.compat
- Handle class renames: RigidPrim→SingleRigidPrim, GeometryPrim→SingleGeometryPrim,
  XFormPrim→SingleXFormPrim, Articulation→SingleArticulation (aliased for compatibility)
- Add migerate/migrate_imports.py: automated migration script for future use
- Leave debug_draw and env_loader try/except imports as-is

This eliminates ~100 deprecation warnings from our code on IS 5.0,
and future-proofs for IS 6.x when old APIs may be removed.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-03 15:09:50 +08:00

33 lines
1.1 KiB
Python

from core.compat import get_prim_at_path
from pxr import UsdPhysics
def get_all_joints(robot_prim, joint_dict):
for child in robot_prim.GetChildren():
if child.IsA(UsdPhysics.Joint):
joint_dict[child.GetName()] = UsdPhysics.Joint(child)
else:
get_all_joints(child, joint_dict)
return joint_dict
def get_link(robot_prim):
joint_dict = {}
joint_dict = get_all_joints(robot_prim, joint_dict)
# print(self.joint_dict)
link_dict = {}
for value in joint_dict.values():
body0_rel = value.GetBody0Rel()
body0_path = body0_rel.GetTargets()
if len(body0_path) > 0:
body0_prim = get_prim_at_path(str(body0_path[0]))
if body0_prim.IsValid():
link_dict[str(body0_prim.GetPath())] = body0_prim
body1_rel = value.GetBody1Rel()
body1_path = body1_rel.GetTargets()
if len(body1_path) > 0:
body1_prim = get_prim_at_path(str(body1_path[0]))
if body1_prim.IsValid():
link_dict[str(body1_prim.GetPath())] = body1_prim
return link_dict