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

Include ellipsoid as a math shape #182

Merged
merged 7 commits into from
Dec 18, 2020
Merged

Conversation

brawner
Copy link
Contributor

@brawner brawner commented Dec 11, 2020

This follows #163 pretty closely, but I'm happy to make changes where needed for this own class.

I noticed that the API for different shapes has diverged, and it may also be worth revisiting how bad parameters are dealt with across the different shapes.

Signed-off-by: Stephen Brawner [email protected]

Signed-off-by: Stephen Brawner <[email protected]>
@github-actions github-actions bot added 🏢 edifice Ignition Edifice 🏰 citadel Ignition Citadel 📜 blueprint Ignition Blueprint 🔮 dome Ignition Dome labels Dec 11, 2020
@codecov
Copy link

codecov bot commented Dec 11, 2020

Codecov Report

Merging #182 (b9e8013) into ign-math6 (0160cdf) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           ign-math6     #182   +/-   ##
==========================================
  Coverage      99.19%   99.20%           
==========================================
  Files             61       63    +2     
  Lines           5982     6024   +42     
==========================================
+ Hits            5934     5976   +42     
  Misses            48       48           
Impacted Files Coverage Δ
include/ignition/math/Ellipsoid.hh 100.00% <100.00%> (ø)
include/ignition/math/detail/Ellipsoid.hh 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0160cdf...b9e8013. Read the comment docs.

Signed-off-by: Stephen Brawner <[email protected]>
Copy link
Member

@scpeters scpeters left a comment

Choose a reason for hiding this comment

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

looks straightforward; I just have a few minor comments

include/ignition/math/Ellipsoid.hh Outdated Show resolved Hide resolved
include/ignition/math/detail/Ellipsoid.hh Outdated Show resolved Hide resolved
template<typename T>
std::optional< MassMatrix3<T> > Ellipsoid<T>::MassMatrix() const
{
if (this->radii.X() < 0 || this->radii.Y() < 0 || this->radii.Z() < 0)
Copy link
Member

Choose a reason for hiding this comment

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

I think we want to use <= for these comparisons, since the inertial properties are invalid if any radii are 0

Copy link
Contributor Author

@brawner brawner Dec 14, 2020

Choose a reason for hiding this comment

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

Completely reasonable and fixed, but then that begs another question. If 0 and negative values are invalid, should they be checked during construction/SetRadii()? And an exception thrown in that case?

Copy link
Member

Choose a reason for hiding this comment

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

If 0 and negative values are invalid, should they be checked during construction/SetRadii()? And an exception thrown in that case?

Currently the constructors and Get/Set methods act like plain old data structures, and there's only validity checking in the methods dealing with inertia computations. I'm inclined to keep it that way for ign-math6 so that the shape classes have the same exception behavior. I think we could consider that for ignition-math7, but it would be good to consider the impact it would have on downstream code in libsdformat, ign-gazebo, etc.

Signed-off-by: Stephen Brawner <[email protected]>
Signed-off-by: Stephen Brawner <[email protected]>
@brawner
Copy link
Contributor Author

brawner commented Dec 14, 2020

Forgot to update a unit test for the stricter check that was added.

Signed-off-by: Stephen Brawner <[email protected]>
@brawner brawner force-pushed the brawner/ellipsoid-simple-shape branch from 396f673 to 941ea07 Compare December 15, 2020 22:32
@brawner
Copy link
Contributor Author

brawner commented Dec 17, 2020

@scpeters Is there anything else you would like to see from this PR?

namespace math
{
// Foward declarations
class EllipsoidPrivate;
Copy link
Contributor

Choose a reason for hiding this comment

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

Did you mean to create this class? I see the same thing sneaked into the Capsule class.

Copy link
Member

Choose a reason for hiding this comment

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

I'll take the liberty of removing this so it can rerun the windows job

Copy link
Member

Choose a reason for hiding this comment

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

there is no CapsulePrivate, so that forward declaration could be removed as well

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks @scpeters. We can blame my gratuitous use of copy/paste.

Signed-off-by: Steve Peters <[email protected]>
@brawner
Copy link
Contributor Author

brawner commented Dec 17, 2020

Thanks again @scpeters for the review and quick fix. Looks like all checks now pass.

@brawner brawner merged commit 32b374f into ign-math6 Dec 18, 2020
@brawner brawner deleted the brawner/ellipsoid-simple-shape branch December 18, 2020 00:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📜 blueprint Ignition Blueprint 🏰 citadel Ignition Citadel 🔮 dome Ignition Dome 🏢 edifice Ignition Edifice
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants