Skip to content

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

Merged
quarkytale merged 6 commits intogazebosim:gz-math7from
jasmeet0915:jasmeet/mass_matrix_functions
Jun 30, 2023
Merged

Added std::optional MassMatrix() functions for Box, Cylinder & Sphere#538
quarkytale merged 6 commits intogazebosim:gz-math7from
jasmeet0915:jasmeet/mass_matrix_functions

Conversation

@jasmeet0915
Copy link
Copy Markdown
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>
@github-actions github-actions bot added 🌱 garden Ignition Garden 🎵 harmonic Gazebo Harmonic labels Jun 27, 2023
Copy link
Copy Markdown
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 ?

…linder

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

jasmeet0915 commented Jun 27, 2023

@ahcorde I have added the python tests in 114d39c

@codecov
Copy link
Copy Markdown

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%) ⬇️

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

@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
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.

4 participants