PDA

View Full Version : coalesceing euler angles


epl
05-27-2004, 02:35 PM
Hi to everyone on the board. I have a quick question that I hope someone can answer. Currently I am in the process of developing some vizard code that will simulate inconsistent eye contact between an avatar and the user equipped with a head mounted display. The HMD outputs the euler angles of the users head movements. The euler angles are then fed into the avatar.avstu.command() function after some additional processing to achieve an appropriate level of eye contact. At a certain point I am have the avatar completely break away from being dependent on the euler angles generated from the HMD. From here I have two sets of euler angles, one being generated by the computer and one generated by the HMD. I was wondering if anyone has a good idea on how I can smoothly synchronize these euler angles, so that the avatar is once again dependent on the HMD values. Thanks.

----
Eric Laschinger
epl@umail.ucsb.xxx
Research Assistant
RECVEB UCSB

farshizzo
05-27-2004, 02:56 PM
Hi,

From my understanding you want a way to smoothly interpolate between two sets of euler angles? If this is the case then I would suggest to convert the euler angles to quaternions and use the slerp function to linearly interpolate between them. Example:import vizmat
euler1 = [60,45,67]
euler2 = [-5,0,54]

quat1 = vizmat.EulerToQuat(euler1)
quat2 = vizmat.EulerToQuat(euler2)

#Interpolate 75% between quat1 and quat2
quat = vizmat.slerp(quat1,quat2,0.75).get()To smoothly interpolate all you need to do is setup a timer that will increment the interpolation percentage from 0 to 1. However, you will need to find a way to convert the quaternion back to an euler angle since the old avatars don't accept quaternions. The newer avatars accept quaternions, but if you have already put a lot of development into your project then I would suggest to convert the quaternions to eulers.

epl
05-28-2004, 05:07 PM
When running vizmat.slerp() i recieve the error depicted in the attached screen shot. It seems that you are performing an unsupported operation on two lists on line 130 of vizmat.py.

a snippit of my offending code is as follows:

euler1 = [unsynchyaw, unsynchpitch, unsynchroll]
euler2 = [realyaw, realpitch, realroll]
quat1 = vizmat.EulerToQuat(euler1)
quat2 = vizmat.EulerToQuat(euler2)
#Interpolate sucsessive iterations from 0/100 to 100/100 between quat1 and quat2
quat = vizmat.slerp(quat1, quat2, (resynchcntr/100)).get()
#quat = [0,1,2,3]

let me know if you can find any kind of work around for this.

thx eric.

epl
05-28-2004, 05:10 PM
also... just a thought in a future build of vizard could you enable cut, copy of text sent to the output tab of the interactive window (thats why i attached the jpg)? That might be something that would really improve usability of the program.

farshizzo
05-28-2004, 05:15 PM
Hi Eric,

Sorry about that, the slerp function expects quaternion objects as input, not lists. The example code should look like the following:import vizmat
euler1 = [60,45,67]
euler2 = [-5,0,54]

quat1 = vizmat.EulerToQuat(euler1)
quat2 = vizmat.EulerToQuat(euler2)

#Interpolate 75% between quat1 and quat2
quat = vizmat.slerp(viz.Quat(quat1),viz.Quat(quat2),0.75) .get()

farshizzo
05-28-2004, 05:18 PM
Hi Eric,

Regarding the output window, you should be able to highlight some text then right-click on it and select Copy

epl
05-28-2004, 05:25 PM
yeah i always use cntrl-c, cntrl-x.. thanks tho