Skip to content

Ghost Link: Adjust the zero check for inertial, Avoid errors in behavior when there is no inertia or mass#107

Merged
andrewkaufman merged 6 commits into
newton-physics:mainfrom
ft-lab:ghost_link
May 21, 2026
Merged

Ghost Link: Adjust the zero check for inertial, Avoid errors in behavior when there is no inertia or mass#107
andrewkaufman merged 6 commits into
newton-physics:mainfrom
ft-lab:ghost_link

Conversation

@ft-lab

@ft-lab ft-lab commented May 19, 2026

Copy link
Copy Markdown
Collaborator

Description

Fixes #106

  • If the link specifies inertia or mass values ​​and they are both zero, it will now be identified as a ghost link.
  • We have disabled the assignment of rigid bodies under the following conditions:
    • Ghost Link (does not have inertial, visual, or collision properties)
    • Belongs to a Fixed Joint
    • Is not referenced by a Mimic Joint

Ghost Link determination

The following are all treated as ghost links.

<link name="BaseLink" />
  <link name="ghost_link_zero_mass">
    <inertial>
      <origin xyz="0 0 0" rpy="0 0 0"/>
      <mass value="0.0"/>
      <inertia ixx="0.0" ixy="0.0" ixz="0.0" iyy="0.0" iyz="0.0" izz="0.0"/>
    </inertial>
  </link>
  <link name="ghost_link_no_inertia">
    <inertial>
      <origin xyz="0 0 0" rpy="0 0 0"/>
    </inertial>
  </link>

Change the rules for Ghost Link

Consider a joint with the following link hierarchy.

https://github.com/newton-physics/urdf-usd-converter/blob/main/tests/data/link_skip_ghost_link_chain.urdf

BaseLink
  ghost_link  (<-- Ghost Link)
    ghost_link_2  (<-- Ghost Link)
      ghost_link_3  (<-- Ghost Link)
        link_box  

BaseLink and link_box have visual, and collision properties.

In this case, the URDF has the following joints.

  • joint1 (Fixed) : BaseLink - ghost_link
  • joint2 (Fixed) : ghost_link - ghost_link_2
  • joint3 (Fixed) : ghost_link_2 - ghost_link_3
  • joint_box (Revolute) : ghost_link_3 - link_box

Implementation up to PR #103

The rigid body of a link identified as a "ghost link" is deleted if it is a "ghost link all the way to the end".
The converted USD is handled as follows.
The “link_box” at the end is not a ghost link.

BaseLink (With Rigid body)
  ghost_link   (With Rigid body)
    ghost_link_2   (With Rigid body)
      ghost_link_3    (With Rigid body)
        link_box    (With Rigid body)
  • joint1 (Fixed) : BaseLink - ghost_link
  • joint2 (Fixed) : ghost_link - ghost_link_2
  • joint3 (Fixed) : ghost_link_2 - ghost_link_3
  • joint_box (Revolute) : ghost_link_3 - link_box

In this link hierarchy, even if there were ghost links, the rigid bodies and joints of the ghost links located in the middle of the hierarchy were not removed.

This implementation

We have implemented a change to remove the rigid body of the link prim when the following conditions are met.

  • Ghost Link (does not have inertial, visual, or collision properties)
  • Belongs to a Fixed Joint
  • Is not referenced by a Mimic Joint

In this example, the link structure and joints are as follows.

BaseLink (With Rigid body)
  ghost_link
    ghost_link_2
      ghost_link_3
        link_box    (With Rigid body)

The rigid bodies assigned to the prims of ghost_link, ghost_link_2, and ghost_link_3 have been removed.

  • joint1 (Fixed) : BaseLink - ghost_link <-- will be deleted
  • joint2 (Fixed) : ghost_link - ghost_link_2 <-- will be deleted
  • joint3 (Fixed) : ghost_link_2 - ghost_link_3 <-- will be deleted
  • joint_box (Revolute) : ghost_link_3 - link_box

The conditions for deleting a joint are as follows.

  • If the rigid body of the prim referenced by the joint's body1 does not exist

This rule is the same as PR #103.
In USD, PhysicsJoint's body0 specifies the parent prim, and body1 specifies the child prim.

Why do we need to remove the rigid body from the ghost link?

As pointed out in Issue #106, leaving ghost links that lack inertia and mass will result in warnings or errors.
This does not always occur; in some cases, no warnings or errors were generated depending on the prim hierarchy or joint settings.
In particular, Newton often exhibits incorrect behavior when there are rigid bodies in a ghost link.

As a result, we had to remove the Ghost Link's rigid body.

Additionally, in the USD PhysicsJoint, an error will occur if the prim referenced by body1 (out of body0 and body1) does not have a rigid body.
This is not a problem if the prim referenced by body0 does not contain a rigid body.

  • PhysicsJoint's body0: We can specify a prim that does not have a rigid body
  • PhysicsJoint's body1: We can only specify prims that have a rigid body

Under these conditions, if there is a possibility that a ghost link (a prim without a rigid body) will be assigned to body1, that joint will not be created.

Unit tests

I have added a URDF and unit tests for checking the zero values of inertial and mass.

  • tests/testGhostLink.py
    • urdf: tests/data/link_ghost_link_inertial_zero.urdf

TODO

  • There was one part where the specifications needed to be changed, so I’ll add that information.
  • Since the checks using the test repository are still incomplete, I will review them.
  • I will check whether changes are needed to docs/concept_mapping.md.

Checklist

@ft-lab

ft-lab commented May 19, 2026

Copy link
Copy Markdown
Collaborator Author

Current State: Draft

  • There was one part where the specifications needed to be changed, so I’ll add that information.
  • Since the checks using the test repository are still incomplete, I will review them.
  • I will check whether changes are needed to docs/concept_mapping.md.

@codecov

codecov Bot commented May 19, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

@ft-lab ft-lab self-assigned this May 20, 2026
Comment thread urdf_usd_converter/_impl/link_hierarchy.py
@ft-lab ft-lab changed the title Draft: Ghost Link: Adjust the zero check for inertial Ghost Link: Adjust the zero check for inertial, Avoid errors in behavior when there is no inertia or mass May 20, 2026
@ft-lab ft-lab marked this pull request as ready for review May 20, 2026 08:43
@ft-lab

ft-lab commented May 20, 2026

Copy link
Copy Markdown
Collaborator Author

I've moved this PR to code review.
Please see below for details on the changes.
#107 (comment)

Since we needed to change the specification regarding the removal of rigid bodies to address the proposal in Issue #106, I have also updated docs/concept_mapping.md.

Comment thread tests/testGhostLink.py Outdated
Comment thread urdf_usd_converter/_impl/link.py Outdated
@andrewkaufman andrewkaufman requested a review from rgasoto May 20, 2026 17:29
@andrewkaufman andrewkaufman merged commit cd583df into newton-physics:main May 21, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Treat links with explicit <inertial> of zero mass + zero inertia as ghost links

2 participants