Skip to content
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

A more efficient calculation of quaternion inverse #178

Open
AndyZe opened this issue Nov 5, 2018 · 3 comments
Open

A more efficient calculation of quaternion inverse #178

AndyZe opened this issue Nov 5, 2018 · 3 comments

Comments

@AndyZe
Copy link
Contributor

AndyZe commented Nov 5, 2018

I'm not an expert on quaternions, but from looking at several online sources, I believe there are 2 equivalent ways to invert a quaternion:

xi+yj+zk - w = -xi-yj-zk+w

The tf source code uses the right-hand method, which is less efficient (3 numbers are negated instead of 1). If everybody agrees, I could make a PR for this.

Relevant stack exchange proofs (wish I had a better reference):

https://math.stackexchange.com/questions/2016282/negative-quaternion

https://math.stackexchange.com/questions/1937833/the-quaternion-matrix-for-a-rotation-of-theta-2-pi?rq=1

@tfoote
Copy link
Member

tfoote commented Nov 8, 2018

This is a fork of the bullet linear math library.

That particular function is here: https://github.com/bulletphysics/bullet3/blob/f7237647fb44f17d791894f5e46be8b80aac3337/src/LinearMath/btQuaternion.h#L497-L505 If that change can be accepted upstream we can backport it here. In general though we've run into trouble diverging from the upstream implementation that I'd rather not encounter again.

@davetcoleman
Copy link

Should we be targeting geometry2 repo for these kinds of improvements? @AndyZe if you're working on moveit1 still using melodic-devel, it will change whether or not its using tf1 or tf2 depending on whether you're compiling on Ubuntu 16.04 (Kinetic) or 18.04 (Melodic)

@tfoote
Copy link
Member

tfoote commented Feb 20, 2019

Yes, any changes are highly recommended to be targeted at geometry2 as geometry has been deprecated for quite a long time now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants