-
Notifications
You must be signed in to change notification settings - Fork 67
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
MassMatrix3: fix bug in PrincipalAxesOffset tolerances #424
MassMatrix3: fix bug in PrincipalAxesOffset tolerances #424
Conversation
There is an error in the way tolerances are computed in the PrincipalAxesOffset API, and I've added a more tests for the tolerance parameter to the PrincipalAxes* APIs, which include failing test cases to illustrate the bug. Signed-off-by: Steve Peters <[email protected]>
The relative tolerance was not being used when calling PrincipalMoments, so use it properly. Signed-off-by: Steve Peters <[email protected]>
Codecov Report
@@ Coverage Diff @@
## ign-math6 #424 +/- ##
==========================================
Coverage 99.83% 99.83%
==========================================
Files 41 41
Lines 4138 4138
==========================================
Hits 4131 4131
Misses 7 7
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works for me, thanks for the quick fix!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually no, wait, I'm checking something here
I was mistaken before, this doesn't fix the issue for me. I just tried your reproduction steps with this branch and it didn't work: from ignition.math import MassMatrix3d
from ignition.math import Vector3d, Quaterniond
mm3 = MassMatrix3d()
mm3.set_mass(605)
mm3.set_ixx(3219)
mm3.set_iyy(3219)
mm3.set_izz(7.28)
mm3.set_ixy(-0.43)
mm3.set_ixz(-2.56)
mm3.set_iyz(3.37)
size = Vector3d()
rot = Quaterniond()
mm3.equivalent_box(size, rot)
print(size) The output is
But I'd expect |
you need to consider the orientation |
Signed-off-by: Steve Peters <[email protected]>
Codecov Report
@@ Coverage Diff @@
## ign-math6 #424 +/- ##
==========================================
Coverage 99.83% 99.83%
==========================================
Files 41 41
Lines 4138 4138
==========================================
Hits 4131 4131
Misses 7 7
Continue to review full report at Codecov.
|
Signed-off-by: Steve Peters <[email protected]>
@chapulina I added an additional expectation to a test case for |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, this does solve the inertia visualization issue I had. I think that my workspace got messed up halfway and it looked like it didn't, but it did.
Sorry for the noise and thanks for the quick fix!
🦟 Bug fix
Fixes a bug in the tolerances used by
MassMatrix3::PrincipalAxesOffset
Summary
The
MassMatrix3::PrincipalAxesOffset
API accepts a relative tolerance parameter_tol
(default1e-6
) but was erroneously using the local variabletol
when callingPrincipalMoments
. This was causing inertia visuals to render improperly, with theEquivalentBox
rotation not matching the principal moments. This includes new tests to cover the relative tolerance behavior and demonstrate the bug (build and run tests for 3776a65 to confirm) and fixes it in 478ccf8. The fix could have been just one character (tol
->_tol
), but I moved the statement up above the definition oftol
just to be safe.Checklist
codecheck
passed (See contributing)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.