WorldViz User Forum  

Go Back   WorldViz User Forum > Plug-in development

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 03-01-2005, 10:24 AM
JRichizzle JRichizzle is offline
Member
 
Join Date: Mar 2003
Location: Houston, TX
Posts: 43
Vizard output signals/voltages?

We know Vizard can receive information from external hardware via plug-ins... But, can Vizard send data (e.g., voltage signal) to other hardware?

We have an experimental protocol in which subjects walk on a treadmill while viewing smooth/continuous motion simulations. The kind of motion and scenery changes every 30 seconds, and simultaneously we are collecting subject motion data via an optical tracking system. We would like to be able to accurately mark the changes in motion and scenery in time with signals (e.g., voltages) to another computer running LabView. This way, we can link changes in subject stability with changes in the scenes.

Can Vizard send signals, say through the COM port, to another device?
Reply With Quote
  #2  
Old 03-01-2005, 10:37 AM
tobin tobin is offline
WorldViz Team Member
 
Join Date: Feb 2003
Posts: 251
Vizard directly supports a USB-based multifunction data acquisition and control device called LabJack. This can read voltages into digital values and convert digital values into voltages. This is probably the easiest solution since there is no direct support in Vizard to change the voltages on either serial (COM) or parallel ports.

LabJack multifunction data acquisition and control device:
http://www.labjack.com/labjack_u12.html

You might be able to find some libs available from the Python community that provide direct control of parallel but I don't immediately know of any.
Reply With Quote
  #3  
Old 03-01-2005, 10:41 AM
JRichizzle JRichizzle is offline
Member
 
Join Date: Mar 2003
Location: Houston, TX
Posts: 43
Thanks...

Can Vizard call C or C++ code that will then trigger the desired signal through serial or parallel ports?
Reply With Quote
  #4  
Old 03-01-2005, 10:57 AM
tobin tobin is offline
WorldViz Team Member
 
Join Date: Feb 2003
Posts: 251
Yes, if you have your own C/C++ code and want Vizard to execute it, that's very straightforward and relatively easy if you have a C compiler. The method is to buld a compiled Python module (DLL) that you "import" just as if it were a .py module. There's very accessible docs on how to "extend" the Python language on the Python website:

http://docs.python.org/ext/ext.html

If you get stuck on this feel free to ask further.
Reply With Quote
  #5  
Old 03-01-2005, 11:22 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
Hi,

The Vizard SDK has an example on how to create a python plugin. You can download it here
Reply With Quote
  #6  
Old 03-02-2005, 04:09 PM
JRichizzle JRichizzle is offline
Member
 
Join Date: Mar 2003
Location: Houston, TX
Posts: 43
Visual Studio .NET and Python version #s

In preparation for developing a plug-in to send data to an external device, I have acquired a copy of the Visual Studio .NET version 2002... will this version work okay? And what version of Python is integrated with Vizard?

FYI, I ran across a Python plug-in module (Win32 Serial Interface Module) at http://starship.python.net/crew/roger/ that might do the trick. There seem to be a lot of interesting and potentially useful things for Vizard users on this website.
Reply With Quote
  #7  
Old 03-02-2005, 04:24 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
Yeah, that version should work fine. Vizard uses Python 2.3. The Vizard SDK comes with the necessary python files in order to create a plugin.
Reply With Quote
  #8  
Old 03-02-2005, 04:30 PM
JRichizzle JRichizzle is offline
Member
 
Join Date: Mar 2003
Location: Houston, TX
Posts: 43
Great, thanks!
Reply With Quote
  #9  
Old 03-03-2005, 01:19 PM
JRichizzle JRichizzle is offline
Member
 
Join Date: Mar 2003
Location: Houston, TX
Posts: 43
Serial port access

I found a project on sourceforge.net called pySerial in which someone has already developed a module for reading and writing data to the serial port(s). They provide a Windows installer as well as the source code. When I try to run the Windows installer, it crashes because there is "no python installation found in the registry." I click 'OK' and then the following window appears:



Why doesn't the installer find the version of Python that Vizard uses?
Attached Images
File Type: png pyserial3.png (8.8 KB, 3760 views)
Reply With Quote
  #10  
Old 03-03-2005, 01:27 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
Try running the attached script with Vizard. It should register Vizard as a python installation.
Attached Files
File Type: zip registervizardwithpython.zip (790 Bytes, 3266 views)
Reply With Quote
  #11  
Old 03-03-2005, 02:22 PM
JRichizzle JRichizzle is offline
Member
 
Join Date: Mar 2003
Location: Houston, TX
Posts: 43
Thumbs up

That worked nicely... thanks!
Reply With Quote
  #12  
Old 03-03-2005, 02:45 PM
JRichizzle JRichizzle is offline
Member
 
Join Date: Mar 2003
Location: Houston, TX
Posts: 43
Okay, the module installed fine, but now when I try to import it within a script, I get the following error message:


ImportError: No module named serial

The installer placed files in the following directory:

C:\Program Files\Vizard25\bin\lib\site-packages\serial

The attached zip file contains all the source code. Only a subset of these was dropped in the above directory. The remainder are not able to be found at all on my hard drive.

Any suggestions?
Attached Files
File Type: zip pyserial-2.1.zip (42.6 KB, 3293 views)
Reply With Quote
  #13  
Old 03-03-2005, 03:00 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
The pySerial library requires that you have the win32all python extension installed. You can download the installer here. (Scroll to the bottom of the page)
Reply With Quote
  #14  
Old 03-03-2005, 03:18 PM
JRichizzle JRichizzle is offline
Member
 
Join Date: Mar 2003
Location: Houston, TX
Posts: 43
Thanks! After installing win32all, I was able to run my script (including 'import serial') without any error msgs.... however... near the end of installation process there were two successive error msgs.

The first is attached to this posting. The second is attached to the subsequent posting.

Is this something I should worry about?
Attached Images
File Type: png win32all_installerror.png (4.8 KB, 3654 views)
Reply With Quote
  #15  
Old 03-03-2005, 03:19 PM
JRichizzle JRichizzle is offline
Member
 
Join Date: Mar 2003
Location: Houston, TX
Posts: 43
second error msg
Attached Images
File Type: png win32all_installerror2.png (10.9 KB, 3828 views)
Reply With Quote
  #16  
Old 03-03-2005, 03:22 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
I'm not sure what the error is about, but if your script is working then I'm assuming that the files were installed correctly.
Reply With Quote
  #17  
Old 03-03-2005, 03:25 PM
JRichizzle JRichizzle is offline
Member
 
Join Date: Mar 2003
Location: Houston, TX
Posts: 43
Okay, I'll leave you alone....... for now!
Reply With Quote
  #18  
Old 03-07-2005, 11:08 AM
JRichizzle JRichizzle is offline
Member
 
Join Date: Mar 2003
Location: Houston, TX
Posts: 43
I've installed the opensource module for communicating through the serial port. Connected to the serial port, I have a numeric keypad. For any number I press, when I issue a command to read the port (e.g., "port.read()") a series of the following kind of data are shown:

\x80

Data encoded like this are called a "two's complement little-endian binary string"

By using the Python module "pickle," this data can be decoded into the following:

-128L

...which itself is encoded and is called a "long."

Have you ever dealt with this kind of encoded data? ...and decoding of said data? If not, can you refer me to a helpful resource ?
Reply With Quote
  #19  
Old 03-07-2005, 12:06 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
The value '\xhh' represents a character with a hex value of hh. In your case the character '\x80' would be equal to the hex number 0x80, which is 128. If you wanted to convert a number to this character format you would do the following:
Code:
val = chr(128)
The variable val will now hold the character '\x80'. To convert a character to the number format you would do the following:
Code:
val = ord('\x80')
I'm not sure what the pickle module does and why it converted the character to -128L, but if you are going to be reading the data character by character, then the above functions should be enough.
Reply With Quote
  #20  
Old 06-28-2008, 10:30 AM
Uttama_vizard Uttama_vizard is offline
Member
 
Join Date: Sep 2007
Posts: 60
Serial Port Access

Hello,

I am trying to access the serial port.

When I am doing

import serial

I am getting the error : No Module named serial.

I was going through the suggestion given in the Forum.

I found the following suggestion.................
The pySerial library requires that you have the win32all python extension installed. You can download the installer here. (Scroll to the bottom of the page)

When I am trying to download the installer, I am not getting it. Actually, the link given above is not working. Has the site changed?

If anyone has some information....it would be very helpful to me.

Thanks

Uttama
Reply With Quote
  #21  
Old 06-28-2008, 10:45 AM
Uttama_vizard Uttama_vizard is offline
Member
 
Join Date: Sep 2007
Posts: 60
Hello,

I was trying to search the plugin.

http://sourceforge.net/project/showf...group_id=46487

Here we can find the latest as of June 19, 2008. This version being downloaded has solved my problem. It is detecting the serial port and error message is not coming.

Thanks

Uttama
Reply With Quote
Reply


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


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


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