WorldViz User Forum

WorldViz User Forum (https://forum.worldviz.com/index.php)
-   Vizard (https://forum.worldviz.com/forumdisplay.php?f=17)
-   -   Facetracking and Immersion Joystick (https://forum.worldviz.com/showthread.php?t=490)

Vygreif 01-24-2006 06:18 PM

Facetracking and Immersion Joystick
 
Hi,
I was told that you guys have access to our Facetracking code. If not this question might make less sense. (not, facetrackNetCondensed is the same as facetrackNet for the functions used in my code segments).
We're trying to use the Facetracking software and the Immersion joystick in the same program. However, conflicts between the two makes the joystick go crazy when I try to use both at the same time.
Both code segments work fine when in different programs:

#Selected facetracking codesegment, works fine
def mytimer(num):
global ...
if initFlag == False:
initFlag = True
facetracker = facetrack.WebcamTrack()
curData = facetrackNetCondensed.Data()
localDisplay = facetrackNetCondensed.ImagePoser()
else:
face = facetracker.currentValidFace()
curData.update(face, facetracker.currentImage())
localDisplay.update(curData)

# selected joystick segement, works fine
global ...
if initFlag == False:
...
# curY, curX are the current x,y corodinates
curY = hdjoy_int.getPosition()[1]
curX = hdjoy_int.getPosition()[0]
velY = (curY-prevY)
velX = (curX - prevX)

#calculate the force like a spring
forceY = (curY - targetY)*kp/GAIN_SCALE * -.4 + -3 * velY
forceX = (curX - targetX)*kp/GAIN_SCALE * -.4 + -3 * velX

prevY = curY
prevX = curX
hdjoy_int.setForce(forceX,forceY)

However, when I combine the two code segments problems occur. The source of the problem seems to be the line

localDisplay.update(curData)

It that line is in the code the joystick jerks randomly at a slight touch. If it is not in the code the joystick works fine. Here is the combined code.

# combined segments
if initFlag == True:
. . .
localDisplay = facetrackNetCondensed.ImagePoser()
else:
...
# curY, curX are the current x,y corodinates
curY = hdjoy_int.getPosition()[1]
curX = hdjoy_int.getPosition()[0]
velY = (curY-prevY)
velX = (curX - prevX)

# display the facetracking information
face = facetracker.currentValidFace()
curData.update(face, facetracker.currentImage())
localDisplay.update(curData)

#calculate the force like a spring
forceY = (curY - targetY)*kp/GAIN_SCALE * -.4 + -3 * velY
forceX = (curX - targetX)*kp/GAIN_SCALE * -.4 + -3 * velX

prevY = curY
prevX = curX
hdjoy_int.setForce(forceX,forceY)

HOWEVER, if I move the localDisplay to after the hdjoy_int.setForce line the joystick becomes less jerky, though it still does not work correctly.
Also, if I do

localDisplay = facetrackNetCondensed.HeadPoser('female.cfg', 'biohead_talk.vzf')

instead of an imageposer the joystick works fine.
I suspect the problem lays with the line:

self.strtexture.command(0, str(id(image)), 320, 240)

in the ImagePoser.update() function of facetrackNet. But I don't know what that line does.

I know this message was long, but I thought the context would be helpful. Please tell me if you guys aren't going to help.

Thanks,
Yaron Greif

farshizzo 01-25-2006 10:56 AM

Hi,

Sorry, I'm not familiar with the FaceTracking code you have. Is it a python module? Also, are you using the sid module to connect to the joystick. What exactly is going on in the localDisplay.update(curData) function?


All times are GMT -7. The time now is 11:24 PM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2021, vBulletin Solutions, Inc.
Copyright 2002-2018 WorldViz LLC