Download retarget/params.py from hk239/v2d: direct link, hf CLI and curl.
- Browser
- Download file 2.03 kB
-
https://huggingface.co/datasets/hk239/v2d/resolve/main/retarget/params.py
- Command line
-
hf download hf://datasets/hk239/v2d/retarget/params.py
-
curl -L -o params.py https://huggingface.co/datasets/hk239/v2d/resolve/main/retarget/params.py
2.03 kB
| """MANO and Unitree G1 five-finger IK maps (Inspire DFQ and Wuji). | |
| Dex3 in NVIDIA robotic_grounding only has thumb/index/middle. Both Inspire and | |
| Wuji add ring + pinky; the fingertip frames differ by USD. | |
| """ | |
| MANO_JOINTS_ORDER = [ | |
| "wrist", | |
| "thumb1", | |
| "thumb2", | |
| "thumb3", | |
| "thumb4", | |
| "index1", | |
| "index2", | |
| "index3", | |
| "index4", | |
| "middle1", | |
| "middle2", | |
| "middle3", | |
| "middle4", | |
| "ring1", | |
| "ring2", | |
| "ring3", | |
| "ring4", | |
| "pinky1", | |
| "pinky2", | |
| "pinky3", | |
| "pinky4", | |
| ] | |
| MANO_JOINTS_PARENTS = [ | |
| -1, | |
| 0, 1, 2, 3, | |
| 0, 5, 6, 7, | |
| 0, 9, 10, 11, | |
| 0, 13, 14, 15, | |
| 0, 17, 18, 19, | |
| ] | |
| # Operational frames added in hand_kinematics (not raw CAD origins). | |
| # Dex3 maps palm_link origin ≈ MANO wrist. Inspire `*_hand_base_link` origin is | |
| # a CAD point ~14cm from the finger MCPs, so we IK `*_palm_ik` (MCP centroid) | |
| # and `*_…_tip` (mesh far vertex), not the link origins. | |
| # `.*` is replaced with L or R. | |
| G1_INSPIRE_TO_MANO_MAPPING = { | |
| ".*_palm_ik": ("mcp_centroid", 1.0, 0.25), | |
| ".*_thumb_tip": ("thumb4", 1.0, 0.0), | |
| ".*_index_tip": ("index4", 1.0, 0.0), | |
| ".*_middle_tip": ("middle4", 1.0, 0.0), | |
| ".*_ring_tip": ("ring4", 1.0, 0.0), | |
| ".*_pinky_tip": ("pinky4", 1.0, 0.0), | |
| } | |
| # Wuji: finger1 is the thumb (CoordEx `RIGHT_HAND_TIP_NAMES[0]`), then index→pinky. | |
| # `{side}` is replaced with left or right. Tip links already exist in the URDF. | |
| G1_WUJI_TO_MANO_MAPPING = { | |
| "{side}_palm_ik": ("mcp_centroid", 1.0, 0.25), | |
| "{side}_finger1_tip_link": ("thumb4", 1.0, 0.0), | |
| "{side}_finger2_tip_link": ("index4", 1.0, 0.0), | |
| "{side}_finger3_tip_link": ("middle4", 1.0, 0.0), | |
| "{side}_finger4_tip_link": ("ring4", 1.0, 0.0), | |
| "{side}_finger5_tip_link": ("pinky4", 1.0, 0.0), | |
| } | |
| # MANO MCP joints used as the palm IK target (index/middle/ring/pinky). | |
| MANO_MCP_JOINTS = ("index1", "middle1", "ring1", "pinky1") | |
| DEFAULT_HAND = "wuji" | |
| def retarget_npz_name(hand: str = DEFAULT_HAND) -> str: | |
| return f"g1_{hand}_retarget.npz" | |