Local /global coordinates (why always local ?)

Post Reply
Baune
Posts: 20
Joined: Tue May 26, 2009 2:36 am

Local /global coordinates (why always local ?)

Post 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).
c6burns
Posts: 149
Joined: Fri May 24, 2013 6:08 am

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

Post by c6burns »

Local makes sense to me. As you even mention, you can just translate world to local if you like.
Basroil
Posts: 463
Joined: Fri Nov 30, 2012 4:50 am

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

Post 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.
c6burns
Posts: 149
Joined: Fri May 24, 2013 6:08 am

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

Post by c6burns »

Basroil wrote:Ever worked with an 18dof robotic snake?
Haven't we ALL?

Hint: no
Baune
Posts: 20
Joined: Tue May 26, 2009 2:36 am

Post 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.
c6burns
Posts: 149
Joined: Fri May 24, 2013 6:08 am

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

Post 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.
Baune
Posts: 20
Joined: Tue May 26, 2009 2:36 am

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

Post 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.
c6burns
Posts: 149
Joined: Fri May 24, 2013 6:08 am

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

Post 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
Baune
Posts: 20
Joined: Tue May 26, 2009 2:36 am

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

Post 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.
Post Reply