-
Notifications
You must be signed in to change notification settings - Fork 120
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
Probabilistically correct SO(3) sampling #286
Conversation
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.
LGTM! Thanks for this nice feature!
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.
Thanks a lot for the nice contribution @brentyi! I have a question for you and @fantaosha. Do we need similar procedures for our other sampling methods? In thinking in particular of randn()
and also those in SO2
class.
No, we don't. This problem only happens to |
Appreciate the fast review!! Can confirm that I'm wondering 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.
Thanks for the contribution, @brentyi.
Good question. For now I think we mostly use it in unit tests but I imagine it could be used to sample say a random (group) trajectory as input to some optimization problem. You are right the current Gaussian sampling is in tangent space. Maybe @fantaosha can expand on any other general use case where what we have currently is insufficient. |
Hi @brentyi, as @mhmukadam said, |
Searching the web to find out where the Shoemake method of sampling uniformly from the group of unit quaternions is implemented, I stumpled upon this thread, "Probabilistically correct SO(3) sampling". On math.stackexchange there is an unanswered question related to the correctness of the Shoemake algorithm that was implemented here by @brentyi. We'd be grateful if you could explain what led you to admit that the algorithm samples uniformly a unit quaternion (and as a consequence an element in SO(3)). |
Hi! Two links that might be of interest to you are:
|
The presentation from the web archive link refers to the Shoemake paper, [883], which is incriminated on math.stackexchange. EIGEN just implements operations on quaternions, including the Shoemake method of uniform sampling from SO(3). |
Motivation and Context
The current uniform sampling procedure for SO(3) works by:
This would produce a uniform output if the exponential operation were linear, but it's unfortunately not.
As intuition for why there might be something funky afoot:
exp_map(omega)
wherel2_norm(omega) = 2 * pi
, all inputs maps to a singleton.exp_map(omega)
wherel2_norm(omega) = pi /2
, the function is injective, and produces a unique rotation for each unique tangent vector.How Has This Been Tested
Unit tests still pass!
The implementation is also battle-tested:
Types of changes
Checklist