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.
Run INTEGRATION_link_dom to verify the functionality of the Link class with SAVE_CALCULATION_IN_ELEMENT
Run UNIT_gz_TEST to verify the --expand-auto-inertials parameter to gz sdf --print
If you build this in a colcon workspace with gz-tools2, then gz sdf --print test/sdf/inertial_stats_auto.sdf with and without --expand-auto-inertials should demonstrate the feature.
Checklist
[X] Signed all commits for DCO
[X] Added tests
[ ] Added example and/or tutorial
[ ] Updated documentation (as needed)
[ ] Updated migration guide (as needed)
[ ] Consider updating Python bindings (if the library has them)
[ ] 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.
🎉 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 togz 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 toConfigureResolveAutoInertials
inParserConfig.hh
, and theLink
will store auto-computed inertial values directly in itssdf::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
INTEGRATION_link_dom
to verify the functionality of theLink
class withSAVE_CALCULATION_IN_ELEMENT
UNIT_gz_TEST
to verify the--expand-auto-inertials
parameter togz sdf --print
colcon
workspace withgz-tools2
, thengz sdf --print test/sdf/inertial_stats_auto.sdf
with and without--expand-auto-inertials
should demonstrate the feature.Checklist
codecheck
passed (See contributing)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.