Download debug_hand.py from twanghcmut/gcwmb: direct link, hf CLI and curl.
- Browser
- Download file 1.92 kB
-
https://huggingface.co/twanghcmut/gcwmb/resolve/main/debug_hand.py
- Command line
-
hf download hf://twanghcmut/gcwmb/debug_hand.py
-
curl -L -o debug_hand.py https://huggingface.co/twanghcmut/gcwmb/resolve/main/debug_hand.py
1.92 kB
| import os | |
| from isaacsim import SimulationApp | |
| # Chạy headless siêu nhẹ | |
| simulation_app = SimulationApp({"headless": True}) | |
| from pxr import Usd | |
| # Trỏ vào file tay phải bạn vừa cắt | |
| USD_PATH = os.path.abspath("/workspace/IsaacLab/GR-1/GR1T2_fourier_hand_6dof/GR1T2_fourier_hand_6dof.usd") | |
| # Tên file log xuất ra | |
| LOG_FILE = os.path.abspath("usd_structure.log") | |
| stage = Usd.Stage.Open(USD_PATH) | |
| if not stage: | |
| print(f"[LỖI] Không thể mở file: {USD_PATH}") | |
| else: | |
| print(f"⏳ Đang quét cấu trúc file USD và lưu vào {LOG_FILE}...") | |
| # Mở file log để ghi (chế độ 'w' - ghi đè) | |
| with open(LOG_FILE, "w", encoding="utf-8") as f: | |
| f.write("=========================================================\n") | |
| f.write(f"🔍 CẤU TRÚC CÂY THƯ MỤC CỦA FILE: {USD_PATH}\n") | |
| f.write("=========================================================\n\n") | |
| # TraverseAll quét toàn bộ cây | |
| for prim in stage.TraverseAll(): | |
| path = str(prim.GetPath()) | |
| # Đếm số gạch chéo để làm thụt lề | |
| depth = path.count('/') - 1 | |
| indent = " " * depth | |
| name = prim.GetName() | |
| prim_type = prim.GetTypeName() | |
| type_str = f"[{prim_type}]" if prim_type else "[No Type]" | |
| # Ghi dòng dữ liệu vào file (nhớ thêm \n để xuống dòng) | |
| f.write(f"{indent}├── {name} {type_str}\n") | |
| # Nếu bạn muốn lưu luôn cả đường dẫn tuyệt đối (path) để nhúng vào code RL cho chuẩn: | |
| f.write(f"{indent}│ └─ Path: {path}\n") | |
| f.write("\n=========================================================\n") | |
| print("✅ Đã xuất log thành công! Bạn có thể mở file để xem.") | |
| simulation_app.close() |