PDA

View Full Version : Reset Pitch?


Kaminski
01-18-2012, 11:24 AM
Is there an easy way to reset the pitch to 0? I do not completely trust that my tracker is coplanar with my hmd lenses, and would like to be able to define what the user feels is "level".

I have tried using preEuler but I have to apply it a few times and it doesn't always seem right. The link.reset() doesn't have a flag to transform specific Euler values, does it?

farshizzo
01-18-2012, 11:40 AM
You should be able to use a single preEuler operator to reset the pitch to zero. The following sample code demonstrates how to reset the pitch during runtime. It will take the current raw euler values from the tracker and apply the inverse pitch to a preEuler operator.import viz
import vizact
viz.go()

viz.add('maze.osgb')

tracker = viz.add('testtrack_ori.dls')
view_link = viz.link(tracker,viz.MainView)
pitch_reset = view_link.preEuler([0,0,0],target=viz.LINK_ORI_OP)

def ResetPitch():
yaw,pitch,roll = tracker.getEuler()
pitch_reset.setEuler([0,-pitch,0])

vizact.onkeydown('r',ResetPitch)

Kaminski
02-02-2012, 07:59 AM
Thanks for the help, that works well.

Now I am trying to do a reset of the pitch, yaw, AND roll with a custom value for the pitch and "zeroing" for the yaw and roll. I would like to have the yaw and roll reset first and then set the pitch. I really can't grasp the correct order for these transformations; this article is the best I could find: http://docs.worldviz.com/vizard/Link_operators.htm

If I try to reset the yaw and roll first with a preEuler using the opposite values from the tracker, I get weird issues where I am moving or rotating the wrong directions. Any help on the best order/functions to implement this? I'm using the IS-900 for both position and euler.

Kaminski
02-02-2012, 11:15 AM
It works if I use postEuler instead of preEuler and use separate operator objects for each rotation. I also needed to use the flag target=viz.LINK_FULL_OP for at least yaw, and set the priority numbers in ascending order for yaw, roll, pitch.

Kaminski
02-02-2012, 12:59 PM
Actually preEuler on the pitch, but postEuler for yaw and roll. Everything else the same.