WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 06-01-2014, 08:16 AM
Shweta Shweta is offline
Member
 
Join Date: Jun 2014
Posts: 9
Interface between Matlab and Vizard

Hello,
I am new to Vizard and have some experience with MATLAB.
I want to create an interface between MATLAB and Vizard.
I went through a few forums which state that I can create such an interface using PyMat.
Can someone elaborate on this?
Also, can I use TCP/IP or UDP to achieve this?

Any kind of help is greatly appreciated.

Thanks and Regards,
Shweta.
Reply With Quote
  #2  
Old 06-01-2014, 10:24 PM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,471
You could try using Vizard's networking support to communicate with Matlab over UDP. There's sample code that shows how to send and receive raw byte data in Vizard.

Last edited by Jeff; 06-01-2014 at 10:27 PM.
Reply With Quote
  #3  
Old 06-17-2014, 08:51 AM
Shweta Shweta is offline
Member
 
Join Date: Jun 2014
Posts: 9
Thank you for the reply.
However I am unable to create a proper serialization between matlab and vizard.
Could someone please elaborate a bit more on this?

Thanks
Reply With Quote
  #4  
Old 06-19-2014, 06:31 AM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,471
Vizard can receive raw byte network packets via UDP. If matlab can send the data via UDP then you should be able to get it in Vizard.

First you need to establish a connection with the machine running MatLab. You can either specify the machine name or IP address:

Code:
myNetwork = viz.addNetwork('machineName')
Then you create a callback function for the network event:

Code:
def onNetwork(e):
    if isinstance(e,viz.RawNetworkEvent):
        print e.raw_data

viz.callback(viz.NETWORK_EVENT,onNetwork)
Vizard sends/receives network data over UDP port 4950 by default. To receive data over a different port (e.g. 4960) use the following:

Code:
viz.net.addPort(4960)
Reply With Quote
  #5  
Old 06-20-2014, 08:35 AM
Shweta Shweta is offline
Member
 
Join Date: Jun 2014
Posts: 9
Hello Jeff,

Thanks for all the help.
I really appreciate it.
A small query, udp has worked fine but is there any other way to communicate between MATLAB and Vizard?

Kind Regards,
Shweta.
Reply With Quote
  #6  
Old 06-23-2014, 03:39 AM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,471
There are add-on packages for Python available to interface with matlab. I have not installed or tested any of these myself but hope to do so in the future. Vizard 4 uses Python 2.7 so the add-on must be compatible with 2.7. Here a few libraries you can look into:

Pymatbridge -
http://arokem.github.io/python-matlab-bridge/

mlabwrap -
http://mlabwrap.sourceforge.net/

pymatlab -
https://pypi.python.org/pypi/pymatlab

Can you describe the kind of data you're looking to send over and why the networking method is not meeting your needs?
Reply With Quote
  #7  
Old 06-23-2014, 10:52 AM
Shweta Shweta is offline
Member
 
Join Date: Jun 2014
Posts: 9
Hello Jeff,

This method does meet my needs. Only problem is that I was told by one of my colleagues that UDP may be unsafe.

My main task is to send a transform matrix from MATLAB to Vizard to change the viewpoint (I will mostly use setPosition(); Euler and scaling for this)

Using UDP I could display some text in Vizard through MATLAB. So I am currently working on establishing a server client relation between MATLAB and Vizard where MATLAB sends the transformation matrix with 6 DOF and on receiving this Vizard sends some acknowledgement to MATLAB and one more after executing the transformation after which MATLAB sends the next command and this continues till the process is terminated either through MATLAB or on receiving a stop status from Vizard.

I shall go through the links suggested by you.

Thanks once again.

Kind Regards,
Shweta.
Reply With Quote
  #8  
Old 06-23-2014, 02:27 PM
Shweta Shweta is offline
Member
 
Join Date: Jun 2014
Posts: 9
Hello,

I have another query which is not related to the interface between MATLAB and Vizard.
I need to create a cloud of triangles.
I was thinking of using viz.TRIANGLES for this purpose.
My question is, is there a way to select the size of the triangles and their location? For location can I use random?
I would really appreciate if someone can elaborate a bit on this.

Thanks and Regards,
Shweta.
Reply With Quote
  #9  
Old 06-30-2014, 09:40 AM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,471
Please create a new thread for questions that are not related to the thread topic.
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
Vizard with Tobii eye trackers Powell Vizard 1 02-28-2014 05:25 AM
Iinterface between MATLAB and Vizard suraj Vizard 7 07-17-2012 09:02 AM
MATLAB and vizard xingtzu Vizard 1 01-15-2008 10:25 AM
Matlab and Vizard brystewa Vizard 1 09-18-2006 03:11 PM
MATLAB and Vizard eagleman Vizard 4 06-10-2005 11:42 AM


All times are GMT -7. The time now is 09:05 AM.


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