two continuous sockets
I am doing a reaching task experiment with vizard using 1 socket for hand data and a separate socket for target data. I use viz.director() in a while loop to call the hand position and the same for the target position (in different functions). This seems to work well except when ever the target data is called the hand data stops then starts up again. Is there any way I can run both sockets without having one interupt the other?
def handmove():
global S, X, Y, Z
try:
data, addr = S.recvfrom(30)
component = data.split(',')
X = float(component[0])
Y = float(component[1])
Z = float(component[2])
except:
pass
def targmove():
global T, A, B, C
for n in (1,2):
if n < 2:
data, addr = T.recvfrom(30)
status = data
else:
data, addr = T.recvfrom(30)
comp = data.split(',')
A = float(comp[0])
B = float(comp[1])
C = float(comp[2])
ball2.translate(A, B, C)
###################################
MAIN LOOP
###################################
def hand():
global loopy, X, Y, Z
while loopy:
handmove()
ball1.translate(X,Y,Z)
viz.director(hand)
def targ():
global loopy
while loopy:
targmove()
viz.director(targ)
|