gazebosim / sdformat

Simulation Description Format (SDFormat) parser and description files.
http://sdformat.org
Apache License 2.0
152 stars 90 forks source link

Print auto inertial values with gz sdf --print --expand-auto-inertials #1422

Closed scpeters closed 1 month ago

scpeters commented 1 month ago

🎉 New feature

Closes #1348

Summary

The ability to automatically compute inertial values by setting the //inertial/@auto attribute to true is very convenient, but it is difficult to see what inertial values were computed. This adds a --expand-auto-inertials argument to gz sdf --print to show the auto-computed inertial values in the printed output.

To enable this behavior, a new enum value SAVE_CALCULATION_IN_ELEMENT is added to ConfigureResolveAutoInertials in ParserConfig.hh, and the Link will store auto-computed inertial values directly in its sdf::Element when this configuration is set.

I am seeing a failing test on macOS locally but want to see if it is an issue on other platforms. EDIT: fixed in https://github.com/gazebosim/sdformat/pull/1422/commits/2ffda3d91282565c4d2ef1d6a76349c7537a7448.

Test it

Checklist

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.