WorldViz User Forum

WorldViz User Forum (https://forum.worldviz.com/index.php)
-   Plug-in development (https://forum.worldviz.com/forumdisplay.php?f=8)
-   -   Vizard output signals/voltages? (https://forum.worldviz.com/showthread.php?t=302)

JRichizzle 03-01-2005 09:24 AM

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?

tobin 03-01-2005 09:37 AM

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.

JRichizzle 03-01-2005 09:41 AM

Thanks...

Can Vizard call C or C++ code that will then trigger the desired signal through serial or parallel ports?

tobin 03-01-2005 09:57 AM

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.

farshizzo 03-01-2005 10:22 AM

Hi,

The Vizard SDK has an example on how to create a python plugin. You can download it here

JRichizzle 03-02-2005 03:09 PM

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.

farshizzo 03-02-2005 03:24 PM

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.

JRichizzle 03-02-2005 03:30 PM

Great, thanks!

JRichizzle 03-03-2005 12:19 PM

Serial port access
 
1 Attachment(s)
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:

:confused:

Why doesn't the installer find the version of Python that Vizard uses?

farshizzo 03-03-2005 12:27 PM

1 Attachment(s)
Try running the attached script with Vizard. It should register Vizard as a python installation.

JRichizzle 03-03-2005 01:22 PM

That worked nicely... thanks!

JRichizzle 03-03-2005 01:45 PM

1 Attachment(s)
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?

farshizzo 03-03-2005 02:00 PM

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)

JRichizzle 03-03-2005 02:18 PM

1 Attachment(s)
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?

JRichizzle 03-03-2005 02:19 PM

1 Attachment(s)
second error msg

farshizzo 03-03-2005 02:22 PM

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.

JRichizzle 03-03-2005 02:25 PM

Okay, I'll leave you alone....... for now! :D

JRichizzle 03-07-2005 10:08 AM

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 ?

farshizzo 03-07-2005 11:06 AM

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.

Uttama_vizard 06-28-2008 09:30 AM

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

Uttama_vizard 06-28-2008 09:45 AM

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


All times are GMT -7. The time now is 03:36 PM.

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