WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rating: Thread Rating: 2 votes, 5.00 average. Display Modes
  #1  
Old 01-24-2006, 06:18 PM
Vygreif Vygreif is offline
Member
 
Join Date: Sep 2005
Posts: 21
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
Reply With Quote
  #2  
Old 01-25-2006, 10:56 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
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?
Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 02:18 AM.


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