PDA

View Full Version : Creating a Vizard Sensor Plugin


farshizzo
07-08-2003, 10:42 AM
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 sensor.zip (http://www.worldviz.com/download/files/sensor.zip) 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

viz.go()

mysensor = viz.add('mysensor.dls')



When you want to reset your sensor you would perform the following command:

mysensor.reset()

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 (http://www.worldviz.com/forum/showthread.php3?s=&threadid=38).

Have fun!

sled
07-09-2003, 02:40 PM
Hi, I cannot use your flockofbird plug-in since my flock of bird has a Extended Range Controller/Transmitter. could you give me some examples, and I cannot open the stickydot.dlr file in the souceForge.

thanks.

farshizzo
07-09-2003, 03:39 PM
Hi,

I've posted the code for the flockofbirds plugin here (http://www.worldviz.com/download/files/flock.zip) . Hope that helps.

sled
07-09-2003, 05:41 PM
thanks, it's great.

methode
07-25-2003, 01:17 PM
Would you be able to post the device code you have made for the Intersense tracking systems?

farshizzo
07-25-2003, 01:36 PM
Hi,

You can download the source code for the intersense plugin here (http://www.worldviz.com/download/files/intersense.zip). The file intersense.cxx contains the code for the plugin. The other source files are part of the intersense SDK and were created by intersense.

dioselin
08-27-2003, 12:21 PM
Hi, we have an intersense IS-900 tracker system with a head tracker and a wand. We would like to add the wand to the intersense plug in, so we can use it as another tracker and also to add functionality to the buttons.

Does anyone have a sample code for this?

thank you!

farshizzo
08-27-2003, 12:30 PM
Hi,

The source code for the intersense plugin is available for download here (http://www.worldviz.com/download/files/intersense.zip) . The source code includes the intersense SDK. If you need anymore help creating the plugin feel free to post your question here. Good Luck!

dioselin
08-28-2003, 09:50 AM
Hi, this is a newbie question:

Is there any more documentation on how to modify the sensors plugin to add more stations (e.g. a wand)?

I want to read and send the data from a head tracker as well as the wand (IS-900 system). I tried modifying MAX_SENSOR_DATA in sensors.h and copying the additional wand data in the array, but when I execute
data = mysensor.get(), it won't read the wand info.

Should I create two different plugins 'headtracker .dls' and 'wand.dls' instead?

Thanks,

farshizzo
08-28-2003, 10:07 AM
Hi,

There is actually a new undocumented feature of the plug-in API that allows you to specify the size of the data field. First download the newer version of sensors.h (http://www.worldviz.com/download/files/sensorHeader.zip)

Then in your InitializeSensor function you can set the size of the data field by doing the following:

((VRUTSensorObj *)sensor)->dataSize = 20;


Now the data field can hold up to 20 values and calling the get function in your script should return 20 values.

Another way is to do as you suggested and create a separate plug-in for the wand. Hope this helps.

Vbents
09-27-2005, 12:41 PM
Another newbie question:

I am trying to make a generic wand device which has an LED light on either end, and one or two buttons for basic input/resetting the user when the lights become switched. Does such a device already exist, in some form?

If not, then I would be interested in buying several more LEDs either from WorldViz or some online retailer. Also, if anyone could suggest a simple way of getting button input, that would be very helpful. I saw that someone has posted an example using serial input, but I wonder if this would be reinventing the wheel for my simple application.

Thanks.

farshizzo
09-27-2005, 02:06 PM
Hi,

Your best bet is to use some wireless joystick or mouse. Check out the following site, http://ilab.cs.ucsb.edu/projects/ismo/fogscreen.html
They created a wireless joystick with a ppt light embedded in it (scroll half way down the page).

You can also purchase special remote controls for computers that can map a button to a specific key press. This might be overkill in your case.

Contact support@worldviz.com for information about acquiring extra LEDs for the PPT.

rdotsch
10-17-2005, 02:33 AM
There is actually a new undocumented feature of the plug-in API that allows you to specify the size of the data field. First download the newer version of sensors.h

Then in your InitializeSensor function you can set the size of the data field by doing the following:

code:--------------------------------------------------------------------------------
((VRUTSensorObj *)sensor)->dataSize = 20;
--------------------------------------------------------------------------------

Now the data field can hold up to 20 values and calling the get function in your script should return 20 values.

Another way is to do as you suggested and create a separate plug-in for the wand. Hope this helps.

I don't have access to a C compiler, but also want to be able to use the buttons on our intersense wand. Does anybody have a compiled version of the adapted isense.dls?

Best regards,

Ron

farshizzo
10-17-2005, 11:52 AM
Hi,

I've never been able to use an IS-900, this is the main reason the plugin doesn't support buttons. I went ahead and implemented it, if you don't mind testing it out I will provide you with the new version of it. Email me at lashkari@worldviz.com if you are interested.

rdotsch
11-01-2005, 05:34 AM
Hi!

Does the current intersense plugin support ethernet? We would like vizard to read data from our intersense processor connected through a router on port 5005. The plugin does seem to detect the is900 on port 5001, but then crashes. Also, using intersense software, we can only make a succesful connection on port 5005.

I have tried setting the port with PORT_INTERSENSE = 5005. It seems to be able to connect to the IS900, but it doesn't find a tracker.

Regards,

Ron

farshizzo
11-01-2005, 10:12 AM
Hi,

The Intersense API we are currently using only supports connecting through a serial or USB port. There is also no mention of an Intersense Processor either. Are you using a new version of the Intersense driver?

rdotsch
11-01-2005, 11:53 AM
Hi,

With Intersense Processor, I just meant the IS900 unit.

Right now I'm not using any driver at all.

Are there any plans to update the intersense plugin for vizard with a newer API in the near future?

farshizzo
11-01-2005, 12:15 PM
Hi,

I just checked the intersense site, and we are using the latest version of their SDK.

I found the following information in their manual.TCP SUPPORT
===========================
Windows and Irix versions support communication to InterSense
tracking devices over TCP/IP. To use this feature you must
define the connection string in the isports.ini file in following
form: PortX = IP:Port. In the included sample isports.ini file
you will see it as Port3 = 192.168.1.44:5005Have you tried this? It seems as though all you need to do is create a file called isports.ini and place it in the [Vizard25]/bin directoy. Then add the IP address and port number of the IS-900. Let me know if this works so we can document it.

rdotsch
11-03-2005, 04:26 AM
Hi!

I tried all your suggestions, but they didn't make it work. Then, I replaced isense.dll (version 3.0.5.8) with an older one (version 3.0.4.5). And with the older one it works perfectly! It autodetects the IS900 on the correct network address and port, even without isports.ini.

What happened between the two DLL versions?

Ron

farshizzo
11-03-2005, 09:11 AM
Hi,

That's strange. You might have to contact Intersense about this. There might be a problem with their new driver or something different must be done to get it working. Thanks for letting us know about this.

mizutani_jun
09-21-2010, 05:18 PM
Hi.
This is my first post in this forum.
I`m new to Vizard so i hope you all can help me.
I`m now try to make treadmile as my plugin for my Vizard project.
I only want to take the data for z+ axis to make pedestrian move forward.
I already tried severel times but failed.
I dont really understand the details about step 2.
Can someone teach me the details about step 2?

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.

I dont have much experience about Visual Studio or compile.
So it`ll be great if someone can send me pm about this details.
And screen saver can make me more understand.
Thanks.

mizutani_jun
09-21-2010, 05:38 PM
LOL.
Sorry for my mistake.
I mean print screen not screen saver.
Print screen for the details step will be great.
Thanks.

smith_toh
04-12-2011, 06:26 AM
Hi Mr.farshizzo,
i tried the sensor.zip, and i got a error message at step 2.
here is the error message
http://140.114.89.113/error.jpg

my environment is:
Windows 7 Enterprise 64 bit
Visual Studio 2010

is it the version problem ?
thank you.

ann olegovna
01-08-2013, 08:09 AM
how about plug in for flex sensor??

embee
04-18-2013, 04:45 AM
Can you please post the source of the XSens plugin? I wan't to make it work with the newer MTi-300 devices.

chander
08-01-2019, 12:24 AM
Hi Farshizzo,
I unable to download sensor.zip file, please can you help me