MassMatrix3: fix bug in PrincipalAxesOffset tolerances#424
MassMatrix3: fix bug in PrincipalAxesOffset tolerances#424scpeters merged 5 commits intogazebosim:ign-math6from
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 <scpeters@openrobotics.org>
The relative tolerance was not being used when calling PrincipalMoments, so use it properly. Signed-off-by: Steve Peters <scpeters@openrobotics.org>
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.
|
chapulina
left a comment
There was a problem hiding this comment.
Works for me, thanks for the quick fix!
chapulina
left a comment
There was a problem hiding this comment.
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 <scpeters@openrobotics.org>
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 <scpeters@openrobotics.org>
@chapulina I added an additional expectation to a test case for |
chapulina
left a comment
There was a problem hiding this comment.
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::PrincipalAxesOffsetSummary
The
MassMatrix3::PrincipalAxesOffsetAPI accepts a relative tolerance parameter_tol(default1e-6) but was erroneously using the local variabletolwhen callingPrincipalMoments. This was causing inertia visuals to render improperly, with theEquivalentBoxrotation 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 oftoljust to be safe.Checklist
codecheckpassed (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-bymessages.