WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 02-12-2008, 03:09 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
1) If you want to read in binary numbers in Python you will need to use the struct module. Have a look at the Python documentation for detailed info. Here is a basic usage that will read in 4 binary floating point values from a data string:
Code:
import struct
.
.
.

#Read data from socket
s = InSocket.recv(PACKET_SIZE)

#Unpack binary data into 4 floating point numbers
data = struct.unpack('ffff',s)

#Print floating point list
print data
2)At what frequency are you sending data in MATLAB. If you send data faster than it can be read, then some packets might be lost. Vizard's graphics loop runs at your monitor refresh rate, which is usually 60Hz. Either way, you can save the time when a packet is received and compare it to the previous receive time. This will give you a rough estimate on the time between packets. Example:
Code:
recv_time = viz.tick()
.
.
.
#Code that should be called when data is received
global recv_time
now = viz.tick()
print '%.2f ms between packets' % (now-recv_time)*1000.0
recv_time = now
Reply With Quote
 


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
data glove navigation arielasso Vizard 6 10-24-2007 02:15 PM
Floating license server problems jrodman Vizard 2 10-30-2006 10:39 AM
looking at a point vadrian Vizard 5 06-07-2005 05:43 PM


All times are GMT -7. The time now is 08:39 AM.


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