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

Added std::optional MassMatrix() functions for Box, Cylinder & Sphere #538

Merged

Conversation

jasmeet0915
Copy link
Contributor

🎉 New feature

Summary

The Capsule.hh and Ellipsoid.hh have MassMatrix() functions that take no parameters and return a std::optional while Box.hh, Cylinder.hh and Sphere.hh have MassMatrix() functions that have a bool return type and take gz::math::MassMatrix3d object as a parameter.
This PR corrects this non-uniformity of MassMatrix functions across different shapes by overloading the MassMatrix() function in the Box, Cylinder and Sphere headers to create std::optional MassMatrix() functions with a signature similar to the ones in Capsule or Ellpisoid headers.

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.

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.

Signed-off-by: Jasmeet Singh <jasmeet0915@gmail.com>
… bindings

Signed-off-by: Jasmeet Singh <jasmeet0915@gmail.com>
Signed-off-by: Jasmeet Singh <jasmeet0915@gmail.com>
…phere

Signed-off-by: Jasmeet Singh <jasmeet0915@gmail.com>
@osrf-triage osrf-triage added this to Inbox in Core development Jun 27, 2023
@github-actions github-actions bot added 🌱 garden Ignition Garden 🎵 harmonic Gazebo Harmonic labels Jun 27, 2023
Copy link
Contributor

@ahcorde ahcorde left a comment

Choose a reason for hiding this comment

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

can you add the same test in Python ?

Core development automation moved this from Inbox to In review Jun 27, 2023
…linder

Signed-off-by: Jasmeet Singh <jasmeet0915@gmail.com>
@jasmeet0915
Copy link
Contributor Author

jasmeet0915 commented Jun 27, 2023

@ahcorde I have added the python tests in 114d39c

@codecov
Copy link

codecov bot commented Jun 28, 2023

Codecov Report

Merging #538 (99569e1) into gz-math7 (2267187) will decrease coverage by 0.05%.
The diff coverage is 82.35%.

❗ Current head 99569e1 differs from pull request most recent head 9b4a83f. Consider uploading reports for the commit 9b4a83f to get more accurate results

@@             Coverage Diff              @@
##           gz-math7     #538      +/-   ##
============================================
- Coverage     99.74%   99.70%   -0.05%     
============================================
  Files            77       77              
  Lines          7032     7049      +17     
============================================
+ Hits           7014     7028      +14     
- Misses           18       21       +3     
Impacted Files Coverage Δ
include/gz/math/Box.hh 100.00% <ø> (ø)
include/gz/math/Cylinder.hh 100.00% <ø> (ø)
include/gz/math/Sphere.hh 100.00% <ø> (ø)
include/gz/math/detail/Box.hh 99.33% <80.00%> (-0.67%) ⬇️
include/gz/math/detail/Sphere.hh 98.33% <80.00%> (-1.67%) ⬇️
include/gz/math/detail/Cylinder.hh 98.30% <85.71%> (-1.70%) ⬇️

include/gz/math/detail/Box.hh Show resolved Hide resolved
include/gz/math/detail/Cylinder.hh Show resolved Hide resolved
include/gz/math/detail/Sphere.hh Show resolved Hide resolved
Signed-off-by: Jasmeet Singh <jasmeet0915@gmail.com>
Copy link

@quarkytale quarkytale left a comment

Choose a reason for hiding this comment

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

LGTM

@quarkytale quarkytale merged commit cf5d7f3 into gazebosim:gz-math7 Jun 30, 2023
9 checks passed
Core development automation moved this from In review to Done Jun 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🌱 garden Ignition Garden 🎵 harmonic Gazebo Harmonic
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

3 participants