Repository navigation
Conversation
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
Thank you for your interest in SMTB, and for a very clear analysis. Replacing Two suggestions, neither of which is a blocker: 1. The zero-vector guard. n = math.hypot(*self._A[1:4])
v = np.zeros(3) if n == 0 else math.atan2(n, self._A[0]) * self._A[1:4] / nA regression case with a small scale factor, such as 2. A note in the docstring. The docstring still presents the formula with You may see the Merging is up to the RAI maintainers, so it may take a little while. Thanks again for the contribution! |
UnitQuaternion.Rx(1e-9).log().vcurrently returns[0, 0, 0]instead of[5e-10, 0, 0].acos(s / norm)loses the angle when the quotient rounds to one; it also loses precision for larger small rotations. Both singleton and sequence logarithms are affected, including non-unit quaternions.Use
atan2(norm(v), s)in both paths. This is the same principal angle for a nonzero vector part, retains small-angle information, and preserves the branch for negative scalar parts. The existing zero-vector handling and scalarlog(norm(q))are unchanged.Regression tests cover signed small rotations from
1e-12to1e-4radians, an ordinary rotation, singleton/sequence agreement, non-unit scales,exp(log(q)), input preservation, and the branch near the negative real axis. The original implementation fails eight scalar subcases, both sequence subcases, and the negative-real precision check.Validation on Windows / Python 3.12.14:
MPLBACKEND=Agg, the CI timeout options).scipy.spatial.transform.Rotation, through singleton unit, singleton scaled, and sequence unit quaternion logarithms: all 300 comparisons pass after the fix; 270 fail a1e-13relative-error check before it. Maximum relative error after the fix is about3.6e-16in both dependency environments.E9,F63,F7,F82), andgit diff --checkpass.This validates the quaternion math and repository tests; no ROS nodes or robot hardware were run.