Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set inertial origin to zero when is none in the urdf #45

Merged
merged 3 commits into from
Jun 22, 2023

Conversation

Giulero
Copy link
Collaborator

@Giulero Giulero commented Jun 22, 2023

Sometimes in the .urdf, a link can contain the inertial field (in such a case, we call it link, opposite to frame, which doesn't have inertial) without the origin, e.g.:

    <inertial>
      <mass value="0.06"/>
      <inertia ixx="1.6854e-05" ixy="0.0" ixz="0.0" iyy="1.6854e-05" iyz="0.0" izz="1.6854e-05"/>
    </inertial>

In this case, an error arises when StdLink.spatial_inertial() or StdLink.homogeneus() since link.inertial.origin is None.

This PR should fix this issue by assigning link.inertial.origin.xyz = [0,0,0] and link.inertial.origin.rpy = [0,0,0].

@traversaro do you think that this case can be managed in this way?

@Giulero Giulero requested a review from traversaro June 22, 2023 08:03
@Giulero Giulero self-assigned this Jun 22, 2023
@traversaro
Copy link
Contributor

@traversaro do you think that this case can be managed in this way?

If you check the URDF specification (http://wiki.ros.org/urdf/XML/link), it is stated:

(optional: defaults to a zero mass and zero inertia if not specified)

The link’s mass, position of its center of mass, and its central inertia properties.

(optional: defaults to identity if not specified)

So, I think the fix is indeed correct and conformant to URDF specification (it could even make sense to report it to the urdf_parser_py repo, as it could make sense that this substitution is done by urdf_parser_py itself.

@Giulero
Copy link
Collaborator Author

Giulero commented Jun 22, 2023

Thanks a lot @traversaro!

@Giulero Giulero merged commit bffcc3c into main Jun 22, 2023
@Giulero Giulero deleted the fix-none-inertial-origin branch June 22, 2023 08:22
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.

2 participants