Reatus
02-03-2014, 02:44 AM
Hi Vizard community,
I am new to python and especially Vizard and created a bone mapping script for research in a student project at university.
However I have a problem:
My arms move up, when I move them down and vice versa.
The following snippet is what I think causes the problem, but I cannot figure out the correct Eulers:
kinectToCharacter = { 'Bip01 L UpperArm':(leftShoulder, [0, 90, 0]), \
'Bip01 L Forearm':(leftElbow, [0, 90, 0]), \
'Bip01 R UpperArm':(rightShoulder, [0, -90, 180]), \
'Bip01 R Forearm':(rightElbow, [0, -90, 180]), \
'Bip01 L Thigh':(leftHip, [90, 0, -90]), \
'Bip01 L Calf':(leftKnee, [90, 0, -90]), \
'Bip01 R Thigh':(rightHip, [90, 0, -90]), \
'Bip01 R Calf':(rightKnee, [90, 0, -90]), \
'Bip01':(waist, [0, 90, -90]) \
}
bones = {}
for boneName in kinectToCharacter:
b = avatar.getBone(boneName)
b.lock()
bones[b] = kinectToCharacter[boneName]
def animate():
for bone in bones:
kinectTracker = bones[bone][0]
euler = kinectTracker.getEuler()
m = vizmat.Transform()
m.setEuler(euler)
m.preEuler(bones[bone][1])
bone.setEuler(m.getEuler(), viz.ABS_PARENT)
Oh and I am using FAAST and thus VRPN to get data from a Microsoft Kinect for Windows.
Interesting fact that might help solving my problem:
If I exchange the arms they move correctly up and down, but are obviously on the wrong side of the avatar.
To any mods/admins:
I did not know where to put this, so if this thread is in the wrong place please contact me to clarify any issues.
I am new to python and especially Vizard and created a bone mapping script for research in a student project at university.
However I have a problem:
My arms move up, when I move them down and vice versa.
The following snippet is what I think causes the problem, but I cannot figure out the correct Eulers:
kinectToCharacter = { 'Bip01 L UpperArm':(leftShoulder, [0, 90, 0]), \
'Bip01 L Forearm':(leftElbow, [0, 90, 0]), \
'Bip01 R UpperArm':(rightShoulder, [0, -90, 180]), \
'Bip01 R Forearm':(rightElbow, [0, -90, 180]), \
'Bip01 L Thigh':(leftHip, [90, 0, -90]), \
'Bip01 L Calf':(leftKnee, [90, 0, -90]), \
'Bip01 R Thigh':(rightHip, [90, 0, -90]), \
'Bip01 R Calf':(rightKnee, [90, 0, -90]), \
'Bip01':(waist, [0, 90, -90]) \
}
bones = {}
for boneName in kinectToCharacter:
b = avatar.getBone(boneName)
b.lock()
bones[b] = kinectToCharacter[boneName]
def animate():
for bone in bones:
kinectTracker = bones[bone][0]
euler = kinectTracker.getEuler()
m = vizmat.Transform()
m.setEuler(euler)
m.preEuler(bones[bone][1])
bone.setEuler(m.getEuler(), viz.ABS_PARENT)
Oh and I am using FAAST and thus VRPN to get data from a Microsoft Kinect for Windows.
Interesting fact that might help solving my problem:
If I exchange the arms they move correctly up and down, but are obviously on the wrong side of the avatar.
To any mods/admins:
I did not know where to put this, so if this thread is in the wrong place please contact me to clarify any issues.