PDA

View Full Version : Coordinate system flips when pitch crosses 90deg?


bernie
02-04-2010, 05:09 PM
we realized an odd behavior in observer coordinates: When the observer moves on a continuous trajectory that curves upwards, as soon as the pitch crosses 90deg (i.e., as soon as the observer is upside-down) the observer coordinates seems to flip upside-down as well (resulting in a change in heading, pitch, and roll coordinates)...
Is that a know feature (is it documented anywhere)?
more importantly, is there a way to switch it off?

We're trying to compute hoping vectors and the whole things get's messed up currently when the coordinates have a discontinuous jump :confused:.

Thanks for any advice!

Bernie

Jeff
02-05-2010, 07:16 AM
What kind of tracking system are you using?

dwaik
02-06-2010, 04:56 AM
hey bernie...
i faced them same problem while i was trying to rotate an object 360 deg it flips on 90 deg..
i used relative rotation and it worked just fine

obj.setEuler((110,0,0),viz.REL_LOCAL)

bernie
02-07-2010, 09:40 AM
Thanks, I'll try the relative location as soon as I get back into the lab (I don't have vizard at home). Jeff, I'm not using any tracking, just plain 3D computer graphics, and a trajectory controlled by a script. so no direct user input.
Thanks
Bernie

farshizzo
02-08-2010, 12:33 PM
Do you have sample code that demonstrates the problem? This sounds like a gimbal lock issue with euler angles. Are you using euler angle to compute the trajectory?

bernie
02-10-2010, 04:05 PM
Sorry for the delay in responding, my colleague Shawn will take over the discussion as he'll be working on the code.
we'll try to isolate the problem into a sample code. Right now we use a viz.MainView.rotate() command to update the observer's orientation each frame (viz.MainView.rotate(1,0,0,d.turnDir * d.dPhi_angle2rotateThisFrame,viz.BODY_ORI,viz.REL_ LOCAL))

I guess it could indeed be a gimble lock problem and we'll look into that.
Thanks!
Bernie

srwing
04-15-2010, 05:31 PM
Hi
This is shawn ...
Sorry about the delay.

There is some sample code attached. It first rotates the MainView, pitch, over various angles between -175 and +175. Then it rotates a pointer object over the same range.

Using something like viz.MainView.setEuler(([0, pitchs[i], 0]),viz.REL_LOCAL) produced the same results.

The rotations over 90 degrees, under -90 degrees, pitch produce something like the following:

MainView pitch= -175 i= 0
MainView.getEuler = [-180.0, -5.0000009536743164, 180.0]
mpointer.getEuler = [2.7940182008023839e-006, 5.0000009536743164, 180.0]

MainView pitch= -150 i= 1
MainView.getEuler = [-180.0, -30.0, 180.0]
mpointer.getEuler = [3.0043981951166643e-006, 30.0, 180.0]

MainView pitch= -100 i= 2
MainView.getEuler = [-180.0, -80.0, 180.0]
mpointer.getEuler = [9.4240658654598519e-006, 80.0, -180.0]

...

mpointer.pitch= 100 i= 10
MainView.getEuler = [0.0, 0.0, 0.0]
mpointer.getEuler = [180.0, 80.0, 180.0]

mpointer.pitch= 150 i= 11
MainView.getEuler = [0.0, 0.0, 0.0]
mpointer.getEuler = [180.0, 30.0, 180.0]

mpointer.pitch= 175 i= 12
MainView.getEuler = [0.0, 0.0, 0.0]
mpointer.getEuler = [180.0, 5.0000009536743164, 180.0]