Skip to content

compute mean of a set of rotations #160

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

Merged
merged 16 commits into from
Jan 26, 2025

Conversation

petercorke
Copy link
Collaborator

@petercorke petercorke commented Jan 21, 2025

New method mean() for each of SO3 and UnitQuaternion, computes the Karcher (rotational) mean.

Relatively straightforward for SO3 but UnitQuaternion required a bunch of changes to allow more methods to handle multi-valued UnitQuaternion objects. Fixed for RPY(), Eul(), UnitQuaternion() constructor, log() and exp(). Also had to fix edge case for log() and exp() for the unit quaternions case.

Tests and doco updated.

The result is a lot of changes, but generally improved functionality for the UnitQuaternion class.

@petercorke petercorke added the enhancement New feature or request label Jan 21, 2025
Copy link
Collaborator

@myeatman-bdai myeatman-bdai left a comment

Choose a reason for hiding this comment

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

See inline comments.

eta = tol * np.finfo(float).eps
R_mean = self[0] # initial guess
while True:
r = np.dstack((self.inv() * self).log()).mean(axis=2)
Copy link
Collaborator

Choose a reason for hiding this comment

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

It's unclear to me what section of the reference paper outlines this algorithm (admittedly, I did not thoroughly read it) . Would you mind pointing it out to me?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I've clarified that.

@petercorke
Copy link
Collaborator Author

Ok, fixed some bugs, tests pass. There is a randomised test but it is reproducible, using a seeded random number generator.

I've commented out, for now, the quaternion mean. Naively applying the SO(3) algorithms for quaternions didn't work, and I need to do more reading.

@myeatman-bdai myeatman-bdai self-requested a review January 26, 2025 05:56
Copy link
Collaborator

@myeatman-bdai myeatman-bdai left a comment

Choose a reason for hiding this comment

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

👍

@myeatman-bdai myeatman-bdai merged commit 59873f1 into bdaiinstitute:master Jan 26, 2025
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants