Repository navigation
Conversation
dddd-jh
requested review from
jbarry-bdai,
petercorke and
taughz
as code owners
October 6, 2026 06:59
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.