Page 1 of 1

Local /global coordinates (why always local ?)

Posted: Mon Jun 23, 2014 1:46 am
by Baune
Any reason bullet uses local coordinates when setting up joints (pivot, axes etc). In most examples I've seen most people have some kind of function
that translates to local coordinates anyway (from global). I dont think most people think in local space and its very confusing (at least to me).

Re: Local /global coordinates (why always local ?)

Posted: Mon Jun 23, 2014 2:21 am
by c6burns
Local makes sense to me. As you even mention, you can just translate world to local if you like.

Re: Local /global coordinates (why always local ?)

Posted: Mon Jun 23, 2014 3:52 am
by Basroil
Baune wrote:Any reason bullet uses local coordinates when setting up joints (pivot, axes etc). In most examples I've seen most people have some kind of function
that translates to local coordinates anyway (from global). I dont think most people think in local space and its very confusing (at least to me).
Here's a few reasons:
1) Local joint coordinates make finding distances and angles easy (in hinge for example, you can set a zero point based on the body orientation, so that point and angle is always zero). It can be done in world just fine, but it's much easier to debug when your rotation matrix is just ones and zeros rather than the crazy form it will be in world transforms.
2) If you use DH parameters for your joints, you end up with local transforms at each joint. Most roboticists use this method, since knowing how far the joint is from the body is easy (again, if you start at an arbitrary place and direction, world transforms are messy)
3) It doesn't really affect performance in bullet, but if you hard-code the transforms you can get significant speedups as long as your transforms are not messy (i.e. 0 and 1 values only in the basis matrix)
4) Ever worked with an 18dof robotic snake? You'll love local coordinates if you ever do that type of experiment.

Re: Local /global coordinates (why always local ?)

Posted: Mon Jun 23, 2014 3:58 am
by c6burns
Basroil wrote:Ever worked with an 18dof robotic snake?
Haven't we ALL?

Hint: no

Posted: Mon Jun 23, 2014 1:01 pm
by Baune
Well I can see why that is practical, of course and thanks to your all for your response. Still think it should be optional (for example, a setGlobalPivot, setGlobalAxis etc) since took me quite some time to figure out how to make the conversions and I guess it will be the same for others. Not everyone starts their project using bullet, many are porting from existing engines.

Re: Local /global coordinates (why always local ?)

Posted: Mon Jun 23, 2014 1:58 pm
by c6burns
I'm pretty much the worst mathematician I know, and I don't have a problem translating between coordinate spaces. But if you think it should be in the library you can always submit a patch.

Re: Local /global coordinates (why always local ?)

Posted: Mon Jun 23, 2014 2:24 pm
by Baune
c6burns wrote:I'm pretty much the worst mathematician I know, and I don't have a problem translating between coordinate spaces. But if you think it should be in the library you can always submit a patch.
If you have "no problems" then you are better than the average. By a longshot. Because I think the average guy would have massive problems.
I have written routines for conversions though. Still things dont work. What is a bit annoying is that I have to adapt my application to bullet instead of the other way around.

Re: Local /global coordinates (why always local ?)

Posted: Mon Jun 23, 2014 2:46 pm
by c6burns
Hmmm I don't know, I am seriously bad at math (for a programmer). High school level algebra. Ogre is my crutch :) I have learned a lot from digging into its implementations, like Node::convertWorldToLocalPosition and Node::convertWorldToLocalOrientation

Re: Local /global coordinates (why always local ?)

Posted: Mon Jun 23, 2014 2:53 pm
by Baune
Im bad at it as well and I doubt that I will ever be any good. I mostly rely on codesnippets that I dont really understand.