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

gz sdf --print should be able to print auto-computed inertial values #1348

Closed
scpeters opened this issue Nov 28, 2023 · 4 comments
Closed

gz sdf --print should be able to print auto-computed inertial values #1348

scpeters opened this issue Nov 28, 2023 · 4 comments
Labels
enhancement New feature or request

Comments

@scpeters
Copy link
Member

Desired behavior

We should add a command-line option to gz sdf --print that will replace <inertial auto="true"/> elements with the explicit, auto-computed inertial values. This will only work for simple shapes, but this could potentially be extended by a gz sim command.

Alternatives considered

Implementation suggestion

Add a configuration to the PrintConfig class to configure whether to expand auto-inertial elements with explicitly computed inertial values and a corresponding command-line option to gz sdf --print.

For example:

  • bool PrintConfig::ExpandAutoInertials() const
  • void PrintConfig::SetExpandAutoInertials(bool)
  • gz sdf --print <file> --expand-auto-inertials

For shapes that don't have a way to compute auto-inertials (such as mesh), they should either print the default inertial values or retain the <inertial auto="true"/> element.

Additional context

@scpeters scpeters added the enhancement New feature or request label Nov 28, 2023
@azeey
Copy link
Collaborator

azeey commented Nov 30, 2023

The ConfigureResolveAutoInertials enum might be a good place to add another option where the computed inertia is written back to the ElementPtr that corresponds to the <inertial> tag. Then gz sdf --print would just set the ParserConfig (not PrintConfig) with this new option. Using the PrintConfig directly will probably be tricky because where that config is used, we don't have the computed inertia readily available.

@azeey azeey moved this from Inbox to To do in Core development Nov 30, 2023
@scpeters
Copy link
Member Author

see also the discussion in #1335 (comment)

@scpeters
Copy link
Member Author

this feature will help me with other work, so I've attempted to implement it in #1422

@scpeters
Copy link
Member Author

implemented for simple shapes (not meshes) in #1422. A similar command could be implemented in gz-sim to print mesh inertial data.

@github-project-automation github-project-automation bot moved this from To do to Done in Core development May 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Archived in project
Development

No branches or pull requests

2 participants