WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 12-16-2010, 04:13 AM
psykoko psykoko is offline
Member
 
Join Date: Dec 2010
Posts: 9
data lose

I have an EEG system I'd like to use to send data to vizard over our network.
EEG System --> BCI Software ---> Network (UDP) ---> Vizard

so, when i send to data from BCI software to vizard, the data lose is induced. my BCI software data sampling rate is 256hz,

how can i get all data from BCI software to Vizard ?
Reply With Quote
  #2  
Old 12-16-2010, 05:18 PM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,462
You could try using the Python socket module to receive the data.

If you can send data via the parallel port you could try getting that in Vizard using the vizparallel.read command.
Reply With Quote
  #3  
Old 12-16-2010, 07:21 PM
psykoko psykoko is offline
Member
 
Join Date: Dec 2010
Posts: 9
HI.
i don't know how can use vizparallel.read .
where can i search this example ??

if possible, i want to example code.
Reply With Quote
  #4  
Old 12-16-2010, 08:08 PM
psykoko psykoko is offline
Member
 
Join Date: Dec 2010
Posts: 9
attach my code
Code:
import viz
import vizmat
import vizinfo
import socket
import struct
viz.go()
viz.mouse.setVisible(viz.OFF)



#The maximum amount of data to receive at a time
MAX_DATA_SIZE = 1024

#The port to send/receive data on
PORT = 8000

#Get the name of this computer
COMPUTER_NAME = socket.gethostname()

#Get the IP address of this computer
COMPUTER_IP_ADDRESS = socket.gethostbyname('localhost')

#Create a socket to send data over
OutSocket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
OutSocket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)

#Create a socket to receive data from
InSocket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
InSocket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
InSocket.bind(('', PORT))
InSocket.setblocking(0)
viz.directormode(viz.DIRECTOR_FAST)

def SendData(data):
	OutSocket.sendto(data,(COMPUTER_IP_ADDRESS,PORT))
	
def ReceiveData():
	try:
		return InSocket.recvfrom(MAX_DATA_SIZE)
	except:
		pass

def onkeydown(key):
	if key == ' ':
		#Send data over the socket
		SendData('hello there')

viz.callback(viz.KEYDOWN_EVENT,onkeydown)


def ontimer(num):
	#Try to receive data from socket
	data = ReceiveData()
	if data:
		udp = struct.unpack(">d", data[0][:8])[0]
		right = open('c:\\new\\new.txt', 'a+')
		right.write(str(udp)+'\n')
		print 'Received Message:',udp

viz.callback(viz.TIMER_EVENT,ontimer)
viz.starttimer(0,0,viz.FOREVER)
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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Use saved text file data as replay sources problem mizutani_jun Vizard 4 10-14-2010 04:49 PM
Using 5DT plug-in with the data coming through network... mcicek Vizard 1 05-18-2009 05:17 PM
Flagging the Data Elittdogg Vizard 5 04-11-2008 11:40 AM
Data Files betancourtb82 Vizard 6 05-04-2006 02:43 PM
tracking using quaternarion data jfreeman Vizard 2 06-01-2005 08:48 AM


All times are GMT -7. The time now is 11:15 AM.


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