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

Add policy for handling CalculateInertial failures #1543

Merged
merged 6 commits into from
Feb 14, 2025

Conversation

scpeters
Copy link
Member

🎉 New feature

Alternative to #1542

Summary

If Geometry::CalculateInertial() fails to calculate valid inertial values, the current behavior is to report a LINK_INERTIA_INVALID error and write no inertial values. The changes in #1542 would change Mesh::CalculteInertial() to return default inertial values by default if no valid values are found.

This pull request adds a policy enum to ParserConfig to retain the current error behavior by default, but also provides an option to warn and use default inertial values when invalid inertial values are calculated.

Draft PR until more testing is added

Test it

Checklist

  • Signed all commits for DCO
  • 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)
  • 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.

If CalculateInertial fails to find valid inertial values,
report an error by default, but allow users to choose
a policy that uses default inertial values with a warning
instead of a hard failure.

Signed-off-by: Steve Peters <scpeters@openrobotics.org>
Signed-off-by: Steve Peters <scpeters@openrobotics.org>
@iche033
Copy link
Contributor

iche033 commented Feb 12, 2025

thanks! the approach looks good. Is the expectation that we would set CalculateInertialFailurePolicyType in gz-sim? i.e. we preserve the behavior in sdformat but we change the behavior in gz-sim

@scpeters
Copy link
Member Author

thanks! the approach looks good. Is the expectation that we would set CalculateInertialFailurePolicyType in gz-sim? i.e. we preserve the behavior in sdformat but we change the behavior in gz-sim

yes, I would lean towwards keeping the default behavior in sdformat and updating gz-sim

@iche033
Copy link
Contributor

iche033 commented Feb 13, 2025

added another test in Collision_TEST.cc in dc0242d

Signed-off-by: Steve Peters <scpeters@openrobotics.org>
@scpeters scpeters marked this pull request as ready for review February 13, 2025 06:51
@scpeters scpeters requested a review from azeey as a code owner February 13, 2025 06:51
@scpeters
Copy link
Member Author

added another test in Collision_TEST.cc in dc0242d

thanks! I updated some test expectations in 09ebe90, but otherwise it looks good

@scpeters scpeters merged commit 39826d4 into sdf15 Feb 14, 2025
17 checks passed
@scpeters scpeters deleted the scpeters/calculate_inertial_failure_policy branch February 14, 2025 23:10
@iche033
Copy link
Contributor

iche033 commented Feb 14, 2025

@Mergifyio backport sdf14

Copy link
Contributor

mergify bot commented Feb 14, 2025

backport sdf14

✅ Backports have been created

mergify bot pushed a commit that referenced this pull request Feb 14, 2025
If CalculateInertial fails to find valid inertial values,
report an error by default, but allow users to choose
a policy that uses default inertial values with a warning
instead of a hard failure.

The policy is used in Collision::CalculateInertial and tested.

Signed-off-by: Steve Peters <scpeters@openrobotics.org>
Signed-off-by: Ian Chen <ichen@openrobotics.org>
Co-authored-by: Ian Chen <ichen@openrobotics.org>
(cherry picked from commit 39826d4)
iche033 pushed a commit that referenced this pull request Feb 18, 2025
If CalculateInertial fails to find valid inertial values,
report an error by default, but allow users to choose
a policy that uses default inertial values with a warning
instead of a hard failure.

The policy is used in Collision::CalculateInertial and tested.

Signed-off-by: Steve Peters <scpeters@openrobotics.org>
Signed-off-by: Ian Chen <ichen@openrobotics.org>
Co-authored-by: Ian Chen <ichen@openrobotics.org>
(cherry picked from commit 39826d4)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏛️ ionic Gazebo Ionic 🪵 jetty Gazebo Jetty
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants