Page 1 of 1

Converting Global to Local Orientation.

Posted: Mon Aug 16, 2010 8:40 am
by JEIhrig
Ok, this is tough to explain, but I'd be surprised if I'm the first with this problem. (I did look for another thread though, and couldn't find one.)

When getting data from tracking tools using the natnet, the orientation does not seem consistent with the object locally.

Here's what I'm experiencing:
If I turn a rigid body to the right, I get a change in yaw.
If I turn a rigid body on it's side, I get a change in roll.
If I point a rigid body up, I get a change in pitch.

That's all great, but...
If I turn a rigid body 90 degrees to the right (yaw) and point the rigid body upward (pitch) I get a change in yaw and roll rather than yaw and pitch.

I believe this is because I am getting roll, pitch, and yaw with respect to the axes of the capture volume, but what I need is the roll, pitch and yaw with respect to the rigid body. I should be able to figure out how to convert this myself but it will take me some time. I just wanted to ask if there was a setting that would change how orientation is output, or if someone else has already figured it out.

Thanks in advance!

Re: Converting Global to Local Orientation.

Posted: Sun Oct 10, 2010 5:28 pm
by henderso
Hi Jim,

I've often had similar problems, and I think the issue is getting the rigid bodies axes aligned with what you think the axes are in your mental model. When you create a rigid body, Tracking Tools assigns a set of axes according to how the rigid body is aligned with your world coordinate system when you select the create trackable option. This is rarely aligned how you want it.

So to fix it, I do this:

1) Right click on the trackable, then properties

2) In the trackable prop panel, scroll down to the Display Options, then set orientation to TRUE. This will display the 3-color skitter that shows the axes of the rigid body

3) You will then probably want to apply some orientation corrections (in tracking tools) to solve your problem. Click on the Orientation panel, then start applying orientation offsets using the Trackable Orientation settings. I usually have to throw in a -90 YAW, or something, until it behaves like I want

4) A very helpful feature of tracking tools during this process is to put the tracking tools camera on the trackable. Just above the 3D view, there are some small icons. One of these is a triangle (a mini trackable). If you click this, the scene camera will be slaved to the trackable. When you move the trackable, it will be as if you were looking from it. Move the trackable using these view until the pitch roll and yaw do what you want.

Not the cleanest answer, but with a little trial and error you will be able to get it set like you want, and not have to do anything with your code (alowing you to develop in your own mental model of pitch, roll, yaw). Make a note of your steps so you can recreate it next time you need to calibrate etc.

Another thing that might be complicating things is if the rigid body origin (the big dot) isn't aligned with the natural center of rotation of the physical thing you are tracking. For example, if you are tracking a users head, but your markers are located on some display strapped to the front of the head (i.e. 3D glasses) then the rigid body center of rotation is forward of the head's center. You can walk the origin back using a translation offset similar to the orientation offset I described above.

Good Luck!


Re: Converting Global to Local Orientation.

Posted: Mon Aug 27, 2012 8:33 pm
by bencrossman
I am getting this exact same problem. I create a trackable looking down the +Z world axis. If I then use the "View From Trackable" option, I dont see what I would expect by pointing my trackable at a location.
Yaw seems to work, but roll and pitch seem to be locked to world space, not local to my trackable.

When I display trackable orientation, I see a red axis in the +X direction, Green in the +Y (up) direction, and blue in the +Z (what I want to be forward).

How can I make "View From Trackable" look at what my trackable is looking at?


Re: Converting Global to Local Orientation.

Posted: Tue Aug 28, 2012 2:57 pm
by NaturalPoint - Mike
Yaw appears to work while pitch and roll appear broken is due to the fact that when the object is defined, It is at yaw/pitch/roll 0 and heading is directly towards -z.

The coordinate system, and the yaw/pitch/roll that it sends are global.

Re: Converting Global to Local Orientation.

Posted: Tue Aug 28, 2012 4:57 pm
by bencrossman
Hmm ok, so the "View From Trackable" option doesnt work since you cant make it look at a forward vector on the trackable.

Thats ok I guess, still finding it hard to get the orientation out of the Tracking Tools API though.

If I'm using DirectX (Which I believe is left handed), how would I rotate my vector (say 0,0,-1)?

Could I put the quaternion into:
XMMATRIX rotationMatrix = XMMatrixRotationQuaternion(trackerOrientation);

and then rotate using:
XMVECTOR forward = XMVectorSet(0,0,-1,0);
forward = XMVector3Transform(forward,rotationMatrix);



Re: Converting Global to Local Orientation.

Posted: Mon Oct 22, 2012 8:33 pm
by bencrossman
Still havent been able to solve this yet.

Re: Converting Global to Local Orientation.

Posted: Wed Oct 24, 2012 7:30 pm
by bencrossman
Have decided I'm going to get the points directly and make trackables in my own code. That way I will have more control over the orientation.

Re: Converting Global to Local Orientation.

Posted: Thu Oct 25, 2012 7:47 pm
by yoshi
Hi Ben,

Those lines look correct. Have you tried negating the z component of the quaternion for LHC?

Re: Converting Global to Local Orientation.

Posted: Wed Dec 05, 2012 10:30 pm
by bencrossman
Yes we tried that. You can test the problem without source code.

Pick a vector on the marker arrangement to be the forward vector (in my case the direction the glasses are facing)

Create a trackable with the forward vector pointing along the -Z axis (this might be what I'm doing wrong)

In the software select the "View From Trackable" option.
Notice the camera view isnt always what the trackable (or glasses) is looking at.