WorldViz User Forum

WorldViz User Forum (https://forum.worldviz.com/index.php)
-   Vizard (https://forum.worldviz.com/forumdisplay.php?f=17)
-   -   UDP connection error (https://forum.worldviz.com/showthread.php?t=5808)

Ryan Choi 08-03-2016 01:10 PM

UDP connection error
 
I am trying to integrate a motion capture system into Vizard. The capture software broadcasts its data through a UDP port(7001 by default); however, Vizard produces this error when the script runs :

ERROR: VizReceive::init() failed to bind socket to local port (UNKNOWN)

I used the command prompt to make sure the port was being accessed by the capture software and it was. Also, I ran the program on another computer to check if the error was system based, which it wasn't. Maybe using TCP would help, but I couldn't find sufficient documentation on that.

Here's the section of the script where the error probably originates from:

import viz
import vizact
from Euler2Quat import *

class PerceptionNeuron:
def __init__(self):
self.avatar = None
self.mode = None
self.sample_frame = list(range(180))
self.oculus_tracker = None
self.offsetPos = [0,0,0]
self.offsetEuler = [0,0,0]
def connectUDP(self):
myNetwork = viz.addNetwork('127.0.0.1')
viz.net.addPort(7001)
viz.net.removePort(4950)
def connectAvatar(self,avatar):
self.avatar = avatar
def connectOculus(self,oculus_tracker):
self.oculus_tracker = oculus_tracker
def setMode(self,mode):
self.mode = mode.lower()
def setOffset(self,offset):
self.offsetPos = offset[0:3]
self.offsetEuler = offset[3:6]
def onNetwork(self,e):
if isinstance(e,viz.RawNetworkEvent):
print e.raw_data
ord_data = list(range(len(e.raw_data)))
chr_data = list(range(len(e.raw_data)))
space_index = []
for i in range(0,len(e.raw_data)-1):
ord_data[i] = ord(e.raw_data[i])
chr_data[i] = chr(ord_data[i])
if ord_data[i]==32:
space_index.append(i)
if ("".join(chr_data[0:8])!='0 Char00'):
raise ValueError('wrong header')
sample_frame = list(range(180))
for i in range(0,179):
sample_frame[i] = float("".join(chr_data[space_index[i+1]+1:space_index[i+2]]))
self.sample_frame = sample_frame
linkBVHtoAvatar(sample_frame,self)
def startCallback(self):
viz.callback(viz.NETWORK_EVENT,self.onNetwork)
def connectViewpoint(self,view=viz.MainView):
headLink = viz.link(self.avatar.getBone('Bip01 Head'),view)
vizact.onupdate(viz.PRIORITY_PLUGINS+2,headLink.up date)
if self.mode.find('oculus')!=-1 and self.mode.find('ppt')!=-1:
headLink.preTrans([0,0.3,0.2])
else:
headLink.preTrans([0,0.15,0.1])

Jeff 08-05-2016 07:26 AM

Did you try running this Vizard script on a different machine than the Perception Neuron server? It maybe an issue related to using the loopback address.

Ryan Choi 08-09-2016 10:51 AM

No, I did not, I'll try that. Thanks


All times are GMT -7. The time now is 12:01 AM.

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