View Single Post
Old 07-08-2003, 10:42 AM
farshizzo farshizzo is offline
WorldViz Team Member
Join Date: Mar 2003
Posts: 2,849
Creating a Vizard Sensor Plugin

If you want to connect to a hardware device within your Vizard script you need to use a Sensor Plugin. Vizard already comes with Sensor Plugins for popular hardware devices, but you can easily make one for your own hardware device. You must know C/C++ programming in order to create one. Here are the basic steps:

Step 1:

Download to your computer and unzip it.

Step 2:

Open the project files. If you don't have Visual Studio then create a Win32 DLL project and add the files main.cxx and sensors.h to it. Fill in the functions outlined in main.cxx. When you compile your program make sure the extension for your dll is .dls. Put your new plugin in the [VIZARD_PATH]/plug-ins directory, where [VIZARD_PATH] is the location of your Vizard installation.

Step 3:

To use the plugin within you Vizard script it would look something like this, assuming the name of your plugin is mysensor.dls:

import viz


mysensor = viz.add('mysensor.dls')
When you want to reset your sensor you would perform the following command:

When you want to retrieve data from your sensor you would perform the following command:

data = mysensor.get()
If you would like to send a command to your sensor then performing the following command:

mysensor.command(1,'some string',1.2,3.4,5.6)

That's it, you should now have your own working Sensor Plugin for Vizard. If you would like to share your plugin with other users then read the post Sharing Files on SourceForge.

Have fun!
Reply With Quote