Fix Pink IK USD-to-URDF conversion on aarch64 (#6177)#6181
Conversation
- Remove the Pink IK runtime dependency on `nvidia.srl` and use Isaac Sim's built-in `isaacsim.asset.exporter.urdf` converter. - Normalize generated URDF joint limits so Pinocchio accepts Isaac Sim exporter output (`effort`/`velocity` defaults and `inf` cleanup). - Align affected GR1T2 and G1-Inspire Pink IK frame names with the link/frame names produced by the Isaac Sim exporter. - Remove the `nvidia-srl-usd-to-urdf` dependency from `isaaclab_mimic`. - `python -m py_compile docs/conf.py source/isaaclab/isaaclab/controllers/utils.py source/isaaclab/test/controllers/test_controller_utils.py source/isaaclab_tasks/isaaclab_tasks/contrib/pick_place/nutpour_gr1t2_pink_ik_env_cfg.py source/isaaclab_tasks/isaaclab_tasks/contrib/pick_place/exhaustpipe_gr1t2_pink_ik_env_cfg.py source/isaaclab_tasks/isaaclab_tasks/contrib/pick_place/pickplace_gr1t2_env_cfg.py source/isaaclab_tasks/isaaclab_tasks/contrib/pick_place/pickplace_unitree_g1_inspire_hand_env_cfg.py` - `git diff --check` - Direct mocked smoke test of `convert_usd_to_urdf()` using Isaac Sim exporter modules. - Generated GR1T2 and G1-Inspire URDFs with `isaacsim.asset.exporter.urdf`, sanitized them with the new utility, and verified Pinocchio can load them and contains the adjusted target frames: - `GR1T2_fourier_hand_6dof.urdf nq 54 nv 54 missing frames []` - `g1_29dof_inspire_hand.urdf nq 53 nv 53 missing frames []` - Attempted focused pytest through `./isaaclab.sh -p -m pytest source/isaaclab/test/controllers/test_controller_utils.py -k convert_usd_to_urdf_uses_isaacsim_exporter -q`, but this worktree uses system Python and is missing `lazy_loader`. - Attempted Ruff on touched files, but no local Python environment had Ruff installed.
Greptile SummaryThis PR fixes the Pink IK USD-to-URDF pipeline on aarch64 by replacing the unavailable
Confidence Score: 4/5Safe to merge; the changes are well-scoped and tested, with one cosmetic concern around XML comment preservation during URDF sanitization. The converter swap and sanitization logic are straightforward and backed by a mocked smoke test. The only notable gap is that xml.etree.ElementTree silently drops comments when rewriting the URDF, but Isaac Sim's exporter output is effectively comment-free, so this has no runtime impact today. source/isaaclab/isaaclab/controllers/utils.py — specifically the _sanitize_urdf_for_pinocchio rewrite path Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["convert_usd_to_urdf(usd_path, output_path)"] --> B["enable_extension(isaacsim.asset.exporter.urdf)"]
B --> C{URDF & meshes exist\nand not force_conversion?}
C -->|Skip| Z["return urdf_output_path, urdf_meshes_output_dir"]
C -->|Convert| D["makedirs urdf/ and meshes/"]
D --> E["UsdToUrdfConverter(stage, mesh_dir_name='../meshes', ...)"]
E --> F["usd_to_urdf.convert(urdf_output_path)"]
F --> G["_sanitize_urdf_for_pinocchio(urdf_output_path)"]
G --> H["ET.parse(urdf_path)"]
H --> I{"effort / velocity\n== inf or None?"}
I -->|Yes| J["Set attr to '0.'"]
J --> K{"changed?"}
I -->|No| K
K -->|Yes| L["tree.write(urdf_path, encoding='unicode')"]
K -->|No| Z
L --> Z
Reviews (1): Last reviewed commit: "Fix Pink IK USD-to-URDF conversion on aa..." | Re-trigger Greptile |
| def _sanitize_urdf_for_pinocchio(urdf_path: str) -> None: | ||
| """Fill Pinocchio-required non-kinematic joint-limit fields in exported URDFs.""" | ||
| tree = ET.parse(urdf_path) | ||
| changed = False | ||
| for limit in tree.iter("limit"): | ||
| for attr in ("effort", "velocity"): | ||
| if limit.get(attr) in {None, "inf", "+inf", "-inf"}: | ||
| limit.set(attr, "0.") | ||
| changed = True | ||
| if changed: | ||
| tree.write(urdf_path, encoding="unicode") |
There was a problem hiding this comment.
xml.etree.ElementTree silently drops XML comments during parsing. When changed=True, the rewritten file will lose any comments that the Isaac Sim exporter included. While current exporter output appears comment-free, this is a fragile assumption. In Python 3.8+, ET.XMLParser(target=ET.TreeBuilder(insert_comments=True)) preserves comments. Additionally, tree.write(..., encoding="unicode") omits the XML declaration from the original file.
| def _sanitize_urdf_for_pinocchio(urdf_path: str) -> None: | |
| """Fill Pinocchio-required non-kinematic joint-limit fields in exported URDFs.""" | |
| tree = ET.parse(urdf_path) | |
| changed = False | |
| for limit in tree.iter("limit"): | |
| for attr in ("effort", "velocity"): | |
| if limit.get(attr) in {None, "inf", "+inf", "-inf"}: | |
| limit.set(attr, "0.") | |
| changed = True | |
| if changed: | |
| tree.write(urdf_path, encoding="unicode") | |
| def _sanitize_urdf_for_pinocchio(urdf_path: str) -> None: | |
| """Fill Pinocchio-required non-kinematic joint-limit fields in exported URDFs.""" | |
| parser = ET.XMLParser(target=ET.TreeBuilder(insert_comments=True)) | |
| tree = ET.parse(urdf_path, parser=parser) | |
| changed = False | |
| for limit in tree.iter("limit"): | |
| for attr in ("effort", "velocity"): | |
| if limit.get(attr) in {None, "inf", "+inf", "-inf"}: | |
| limit.set(attr, "0.") | |
| changed = True | |
| if changed: | |
| tree.write(urdf_path, encoding="unicode", xml_declaration=False) |
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
b2e3a3d
into
isaac-sim:release/3.0.0-beta2
Description
Remove the Pink IK runtime dependency on
nvidia.srland use Isaac Sim's built-inisaacsim.asset.exporter.urdfconverter.Normalize generated URDF joint limits so Pinocchio accepts Isaac Sim exporter output (
effort/velocitydefaults andinfcleanup).Align affected GR1T2 and G1-Inspire Pink IK frame names with the link/frame names produced by the Isaac Sim exporter.
Remove the
nvidia-srl-usd-to-urdfdependency fromisaaclab_mimic.python -m py_compile docs/conf.py source/isaaclab/isaaclab/controllers/utils.py source/isaaclab/test/controllers/test_controller_utils.py source/isaaclab_tasks/isaaclab_tasks/contrib/pick_place/nutpour_gr1t2_pink_ik_env_cfg.py source/isaaclab_tasks/isaaclab_tasks/contrib/pick_place/exhaustpipe_gr1t2_pink_ik_env_cfg.py source/isaaclab_tasks/isaaclab_tasks/contrib/pick_place/pickplace_gr1t2_env_cfg.py source/isaaclab_tasks/isaaclab_tasks/contrib/pick_place/pickplace_unitree_g1_inspire_hand_env_cfg.pygit diff --checkDirect mocked smoke test of
convert_usd_to_urdf()using Isaac Sim exporter modules.Generated GR1T2 and G1-Inspire URDFs with
isaacsim.asset.exporter.urdf, sanitized them with the new utility, and verified Pinocchio can load them and contains the adjusted target frames:GR1T2_fourier_hand_6dof.urdf nq 54 nv 54 missing frames []g1_29dof_inspire_hand.urdf nq 53 nv 53 missing frames []Attempted focused pytest through
./isaaclab.sh -p -m pytest source/isaaclab/test/controllers/test_controller_utils.py -k convert_usd_to_urdf_uses_isaacsim_exporter -q, but this worktree uses system Python and is missinglazy_loader.Attempted Ruff on touched files, but no local Python environment had Ruff installed.
Type of change
Screenshots
Please attach before and after screenshots of the change if applicable.
Checklist
pre-commitchecks with./isaaclab.sh --formatconfig/extension.tomlfileCONTRIBUTORS.mdor my name already exists there