Skip to content

Guard set_merge_fixed_ignore_inertia for Isaac Sim version compatibility#6005

Open
Isk5434 wants to merge 1 commit into
isaac-sim:mainfrom
Isk5434:fix/urdf-guard-merge-fixed-ignore-inertia
Open

Guard set_merge_fixed_ignore_inertia for Isaac Sim version compatibility#6005
Isk5434 wants to merge 1 commit into
isaac-sim:mainfrom
Isk5434:fix/urdf-guard-merge-fixed-ignore-inertia

Conversation

@Isk5434

@Isk5434 Isk5434 commented Jun 6, 2026

Copy link
Copy Markdown

Description

UrdfConverter._convert_asset unconditionally calls
import_config.set_merge_fixed_ignore_inertia(...). This method is not present on
every Isaac Sim URDF importer version
, so importing a URDF raises

AttributeError: 'ImportConfig' object has no attribute 'set_merge_fixed_ignore_inertia'

on those builds, breaking asset conversion.

Fix

Call the setter only when it exists:

import_config.set_merge_fixed_joints(self.cfg.merge_fixed_joints)
if hasattr(import_config, "set_merge_fixed_ignore_inertia"):
    import_config.set_merge_fixed_ignore_inertia(self.cfg.merge_fixed_joints)

When the setter is absent, the importer behavior matches its default, so guarding the
call is safe and restores URDF import across Isaac Sim versions.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Checklist

  • I have run the pre-commit checks with ./isaaclab.sh --format
  • I have signed off all commits (DCO)
  • I have updated the changelog / docs as needed

import_config.set_merge_fixed_ignore_inertia is not available on all Isaac Sim
URDF importer versions. Calling it unconditionally raises AttributeError during
URDF import on those builds. Guard the call with hasattr; when the setter is
absent the behavior matches the importer default, so this is safe and restores
URDF import across versions.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Isk5434 <249087850+Isk5434@users.noreply.github.com>
@github-actions github-actions Bot added bug Something isn't working isaac-lab Related to Isaac Lab team labels Jun 6, 2026
@greptile-apps

greptile-apps Bot commented Jun 6, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR guards the set_merge_fixed_ignore_inertia call in UrdfConverter._create_urdf_import_config with a hasattr check, preventing an AttributeError on Isaac Sim URDF importer versions that do not expose this method.

  • The fix is a single-line guard that leaves the existing code path entirely unchanged on builds where the method is present, and silently skips the call on older builds.
  • The argument passed (self.cfg.merge_fixed_joints) is identical to the original unconditional call, so no behavioral regression is introduced on supported versions.

Confidence Score: 4/5

Safe to merge; the change only adds a compatibility guard around a single setter call and does not alter behavior on Isaac Sim builds where the method exists.

On older Isaac Sim builds that lack set_merge_fixed_ignore_inertia, the importer's compiled-in default will be used instead of the user's configured value. The PR assumes that default matches the intended behavior, but this is not verified — users with merge_fixed_joints=True on older builds may silently get different fixed-joint inertia handling than on newer builds, with no log message to indicate why.

source/isaaclab/isaaclab/sim/converters/urdf_converter.py — consider adding a log warning in the fallback branch so users on older Isaac Sim builds are informed that fixed-joint inertia behavior may differ.

Important Files Changed

Filename Overview
source/isaaclab/isaaclab/sim/converters/urdf_converter.py Adds a hasattr guard around set_merge_fixed_ignore_inertia to prevent AttributeError on Isaac Sim builds that lack the method; one-line, targeted fix with no logic changes to the existing path.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[_create_urdf_import_config] --> B[set_merge_fixed_joints]
    B --> C{hasattr set_merge_fixed_ignore_inertia?}
    C -- Yes: newer Isaac Sim --> D[set_merge_fixed_ignore_inertia]
    C -- No: older Isaac Sim --> E[Skip — use importer default]
    D --> F[set_fix_base / other physics settings]
    E --> F
Loading

Reviews (1): Last reviewed commit: "Guard set_merge_fixed_ignore_inertia for..." | Re-trigger Greptile

Comment on lines +143 to +144
if hasattr(import_config, "set_merge_fixed_ignore_inertia"):
import_config.set_merge_fixed_ignore_inertia(self.cfg.merge_fixed_joints)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Silent version fallback could mask behavior differences

When set_merge_fixed_ignore_inertia is absent, the importer silently uses whatever its compiled-in default is for that setting. If a user sets merge_fixed_joints=True and is on an older Isaac Sim build, the behavior will differ from a newer build without any indication — potentially causing hard-to-diagnose articulation issues. A one-line carb.log_warn (or omni.log.warn) here would make the version difference visible in the output log, helping users on older builds understand why their fixed-joint inertia handling differs.

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!

@isaaclab-review-bot isaaclab-review-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Summary

This PR adds a hasattr guard around import_config.set_merge_fixed_ignore_inertia(...) to prevent AttributeError on Isaac Sim versions where this method doesn't exist. The fix is minimal, targeted, and the fallback behavior (method absent → importer uses its default) is safe.

Overall: Looks good with minor suggestions.


Findings

1. 🟡 Consider logging when the method is unavailable

When set_merge_fixed_ignore_inertia is absent, the code silently skips it. This is fine for correctness, but a debug/warning log would help developers understand why behavior differs across Isaac Sim versions.

Suggestion:

if hasattr(import_config, "set_merge_fixed_ignore_inertia"):
    import_config.set_merge_fixed_ignore_inertia(self.cfg.merge_fixed_joints)
else:
    import omni.log
    omni.log.warn(
        "ImportConfig does not have 'set_merge_fixed_ignore_inertia'. "
        "Skipping — the importer will use its default behavior."
    )

2. 🟡 The guarded value reuses merge_fixed_joints — intentional but worth a comment

The call passes self.cfg.merge_fixed_joints (not a dedicated merge_fixed_ignore_inertia config field). Based on the class docstring explaining Isaac Sim 5.1's changed merge behavior, this coupling appears intentional — when merging fixed joints, you also want to ignore inertia to preserve legacy behavior.

However, a brief inline comment explaining why the same config flag drives both settings would help future maintainers:

# When merge_fixed_joints is enabled, also ignore inertia during merge
# to preserve pre-5.1 behavior (links with inertia still get merged).
if hasattr(import_config, "set_merge_fixed_ignore_inertia"):
    import_config.set_merge_fixed_ignore_inertia(self.cfg.merge_fixed_joints)

3. 🟢 Version-pinning context validates the approach

The converter already pins to isaacsim.asset.importer.urdf-2.4.31 on Isaac Sim ≥5.1 (lines 67–70). The hasattr guard adds defense-in-depth for environments where the pinned version still lacks the method (e.g., older Isaac Sim builds < 5.1 that don't have this API at all). This is sound.

4. 🔵 Minor: no test coverage for the guarded path

There's no unit test verifying that _get_urdf_import_config() succeeds when the ImportConfig object lacks set_merge_fixed_ignore_inertia. A simple mock-based test could guard against regressions:

def test_urdf_import_config_without_merge_fixed_ignore_inertia(monkeypatch):
    """Verify graceful handling when set_merge_fixed_ignore_inertia is unavailable."""
    # mock ImportConfig without the method
    ...

This is a nice-to-have given the simplicity of the fix, not a blocker.


Verdict

The fix is correct, minimal, and safe. The hasattr pattern is idiomatic Python for optional API support. The two minor suggestions (logging + comment) would improve observability and maintainability but are not blockers for merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working isaac-lab Related to Isaac Lab team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant