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

Fix ambiguities in spec inertial documentation #990

Merged
merged 11 commits into from
May 6, 2022

Conversation

scpeters
Copy link
Member

@scpeters scpeters commented Apr 19, 2022

🎉 New feature

Part of gazebosim/sdf_tutorials#70

Summary

As noted in gazebosim/sdf_tutorials#70, there are some ambiguities in the definition of inertial properties in the SDFormat specification, particularly the pose and inertia tensor terms. Thanks to @mitiguy, @sherm1, and @EricCousineau-TRI for providing the text of these changes.

These changes should be propagated to earlier versions of the spec, both in the other folders of the sdf12 branch and to earlier supported branches such as sdf9 and sdf6. It also needs to be tested for its rendering on sdformat.org on the following page:

I have marked this as a draft pull request for now. Once the text has been approved, I will propagate the changes to the other files as needed.

Test it

  • Read the documentation
  • TODO: test its rendering on sdformat.org

Checklist

  • Signed all commits for DCO
  • Added tests
  • Added example and/or tutorial
  • Updated documentation (as needed)
  • Updated migration guide (as needed)
  • codecheck passed (See contributing)
  • All tests passed (See test coverage)
  • While waiting for a review on your PR, please help review another open pull request to support the maintainers

Note to maintainers: Remember to use Squash-Merge and edit the commit message to match the pull request summary while retaining Signed-off-by messages.

https://reviewable.io/reviews/ignitionrobotics/sdformat/990#-


This change is Reviewable

This helps resolve ambiguities in the SDF <inertial> tag by
clarifying the link’s center of mass location, explicitly
states that the inertia is always about the link’s center of
mass, clarifies directions associated with moments/products of
inertia, and clarifies the ± sign convention for product of inertia.

Thanks to Paul Mitiguy and Michael Sherman from Toyota Research
Institute for these improvements.

Signed-off-by: Steve Peters <[email protected]>
Signed-off-by: Steve Peters <[email protected]>
@github-actions github-actions bot added the 🏯 fortress Ignition Fortress label Apr 19, 2022
@codecov-commenter
Copy link

codecov-commenter commented Apr 19, 2022

Codecov Report

Merging #990 (70fa638) into sdf12 (12e7782) will not change coverage.
The diff coverage is n/a.

❗ Current head 70fa638 differs from pull request most recent head 4f9487f. Consider uploading reports for the commit 4f9487f to get more accurate results

@@           Coverage Diff           @@
##            sdf12     #990   +/-   ##
=======================================
  Coverage   65.38%   65.38%           
=======================================
  Files           2        2           
  Lines          26       26           
=======================================
  Hits           17       17           
  Misses          9        9           
Impacted Files Coverage Δ
src/EmbeddedSdf.cc 100.00% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 12e7782...4f9487f. Read the comment docs.

</element>
<element name="ixy" type="double" default="0.0" required="1">
<description></description>
<description>
The link’s product of inertia about Co (the link’s center of mass) for
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit (here and elsewhere) link’s => link's (different character?)

Copy link
Member Author

Choose a reason for hiding this comment

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

convention for product of inertia, align Ĉx, Ĉy, Ĉᴢ with principal
inertia directions so that all the products of inertia are zero.
For more information about this sign convention, see the following
Mathworks documentation for working with CAD tools:
Copy link
Contributor

Choose a reason for hiding this comment

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

Nitpick: The company is tipically indicated with the W capitalized, see https://www.mathworks.com/ .

Suggested change
Mathworks documentation for working with CAD tools:
MathWorks documentation for working with CAD tools:

Copy link
Collaborator

@EricCousineau-TRI EricCousineau-TRI left a comment

Choose a reason for hiding this comment

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

Reviewed 1 of 1 files at r2, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @scpeters)

Signed-off-by: Steve Peters <[email protected]>

Co-authored-by: Silvio Traversaro <[email protected]>
Copy link
Member Author

@scpeters scpeters left a comment

Choose a reason for hiding this comment

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

Reviewable status: 0 of 1 files reviewed, 1 unresolved discussion (waiting on @EricCousineau-TRI and @traversaro)


sdf/1.9/inertial.sdf, line 51 at r2 (raw file):

Previously, traversaro (Silvio Traversaro) wrote…

Nitpick: The company is tipically indicated with the W capitalized, see https://www.mathworks.com/ .

      MathWorks documentation for working with CAD tools:

Ok, thanks! I applied your suggestion in 1c5df36

Copy link

@mitiguy mitiguy left a comment

Choose a reason for hiding this comment

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

This looks great. Thank you Silvio, Eric, Steve, Addisu, and all. Much appreciated.

Reviewed 1 of 1 files at r3.
Reviewable status: all files reviewed (commit messages unreviewed), 1 unresolved discussion (waiting on @traversaro)

@scpeters
Copy link
Member Author

It also needs to be tested for its rendering on sdformat.org on the following page:

I just tested it, and I think there are some significant issues with URLs based on how we are rendering the content in https://sdformat.org/spec

They can be seen in the current form by interacting with the //link/pose documentation:

That documentation contains a link to http://sdformat.org/tutorials?tut=specify_pose but it is not clickable in my tests. None of the text is even selectable. Attempting to select text will drag the whole block, which drops a link to that portion of the page if you drop it into a text document.

So the text of these new URLs is visible but not clickable or selectable. This should be remedied on the web app code.

@scpeters
Copy link
Member Author

quick side-by-side comparison with this branch on the left and the existing display on the right

sdf_inertial_rendering

@EricCousineau-TRI
Copy link
Collaborator

EricCousineau-TRI commented Apr 30, 2022

I think even w/ rendering fix bug, the docs look better.
Perhaps this could merge, then we fix the rendering as a separate task?

@scpeters
Copy link
Member Author

scpeters commented May 3, 2022

I think even w/ rendering fix bug, the docs look better.
Perhaps this could merge, then we fix the rendering as a separate task?

Sure, I'll work on replicating the changes to the other spec folders

scpeters added 3 commits May 2, 2022 22:02
Versions 1.5 - 1.7 will be addressed in a separate commit
since those versions have an //inertial/pose/@frame
or //inertial/pose/@relative_to attribute that is not
present in 1.4, 1.8, or 1.9.

Signed-off-by: Steve Peters <[email protected]>
The changes to inertial.sdf are copied with slight modifications
to account to the presence of //inertial/pose/@frame in 1.5, 1.6
and //inertial/pose/@relative_to in 1.7.

Signed-off-by: Steve Peters <[email protected]>
@scpeters scpeters marked this pull request as ready for review May 3, 2022 05:12
@scpeters scpeters requested a review from azeey as a code owner May 3, 2022 05:12
@scpeters
Copy link
Member Author

scpeters commented May 3, 2022

Sure, I'll work on replicating the changes to the other spec folders

I've copied the changes back to spec version 1.4 in 43f2f84 and fc0ba0a. I adjusted the wording slightly in spec versions 1.5, 1.6, and 1.7 to account for the presence of //inertial/pose/@frame and //inertial/pose/@relative_to attributes in those versions of the spec that were removed in spec version 1.8.

vectors. The subsequent values characterize C's orientation relative to
link-frame L as a sequence of Euler rotations
(r p y) documented in http://sdformat.org/tutorials?tut=specify_pose,
or as a quaternion (x y z w), where w is the scalar component.
Copy link
Collaborator

Choose a reason for hiding this comment

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

We only support quaternions in >= SDFormat 1.9

Copy link

Choose a reason for hiding this comment

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

Please tell me the quaternion is given as (w x y z)!

Copy link
Collaborator

Choose a reason for hiding this comment

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

To be consistent with ROS and Ignition/Gazebo, we went with xyzw gazebosim/sdf_tutorials#56 (comment)

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed in 2a62ad1

Copy link

Choose a reason for hiding this comment

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

:( but consistency is a good argument. Eigen stores it that way also but was apparently so ashamed that they hid it by having their Quaternion constructor take w,x,y,z!

Copy link
Member Author

Choose a reason for hiding this comment

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

I hear your pain, but at least the convention is specified in the @rotation_format attribute as quat_xyzw.

or as a quaternion (x y z w), where w is the scalar component.
</description>

<attribute name="rotation_format" type="string" default="euler_rpy" required="0">
Copy link
Collaborator

Choose a reason for hiding this comment

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

The attributes rotation_format and degree were added to 1.9. Was it intentional to add them in sdf/1.8/inerital.sdf?

Copy link
Member Author

Choose a reason for hiding this comment

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

nope, not intentional. removed in 2a62ad1

@scpeters scpeters merged commit 6424ffa into gazebosim:sdf12 May 6, 2022
@scpeters scpeters deleted the formalize_inertial_spec_doc branch May 6, 2022 00:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏯 fortress Ignition Fortress
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

7 participants