WorldViz User Forum  

Go Back   WorldViz User Forum > Plug-in development

Reply
 
Thread Tools Rating: Thread Rating: 10 votes, 5.00 average. Display Modes
  #1  
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 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:

Code:
import viz

viz.go()

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

Code:
mysensor.reset()
When you want to retrieve data from your sensor you would perform the following command:

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

Code:
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
  #2  
Old 07-09-2003, 02:40 PM
sled sled is offline
Member
 
Join Date: Jun 2003
Posts: 31
Unhappy

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.
Reply With Quote
  #3  
Old 07-09-2003, 03:39 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
Hi,

I've posted the code for the flockofbirds plugin here . Hope that helps.
Reply With Quote
  #4  
Old 07-09-2003, 05:41 PM
sled sled is offline
Member
 
Join Date: Jun 2003
Posts: 31
Talking

thanks, it's great.
Reply With Quote
  #5  
Old 07-25-2003, 01:17 PM
methode methode is offline
Member
 
Join Date: Jul 2003
Posts: 1
Would you be able to post the device code you have made for the Intersense tracking systems?
Reply With Quote
  #6  
Old 07-25-2003, 01:36 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
Hi,

You can download the source code for the intersense plugin here. 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.
Reply With Quote
  #7  
Old 08-27-2003, 12:21 PM
dioselin dioselin is offline
Member
 
Join Date: Aug 2003
Posts: 3
Question IS-900 wand

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!
__________________
Dioselin.-
Reply With Quote
  #8  
Old 08-27-2003, 12:30 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
Hi,

The source code for the intersense plugin is available for download here . The source code includes the intersense SDK. If you need anymore help creating the plugin feel free to post your question here. Good Luck!
Reply With Quote
  #9  
Old 08-28-2003, 09:50 AM
dioselin dioselin is offline
Member
 
Join Date: Aug 2003
Posts: 3
Question adding more stations

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,
__________________
Dioselin.-
Reply With Quote
  #10  
Old 08-28-2003, 10:07 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
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

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.
Reply With Quote
  #11  
Old 09-27-2005, 12:41 PM
Vbents Vbents is offline
Member
 
Join Date: Sep 2005
Posts: 25
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.
Reply With Quote
  #12  
Old 09-27-2005, 02:06 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
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.
Reply With Quote
  #13  
Old 10-17-2005, 02:33 AM
rdotsch rdotsch is offline
Member
 
Join Date: Jul 2005
Location: The Netherlands
Posts: 20
Quote:
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
Reply With Quote
  #14  
Old 10-17-2005, 11:52 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
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.
Reply With Quote
  #15  
Old 11-01-2005, 05:34 AM
rdotsch rdotsch is offline
Member
 
Join Date: Jul 2005
Location: The Netherlands
Posts: 20
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
Reply With Quote
  #16  
Old 11-01-2005, 10:12 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
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?
Reply With Quote
  #17  
Old 11-01-2005, 11:53 AM
rdotsch rdotsch is offline
Member
 
Join Date: Jul 2005
Location: The Netherlands
Posts: 20
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?
Reply With Quote
  #18  
Old 11-01-2005, 12:15 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
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.
Quote:
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:5005
Have 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.
Reply With Quote
  #19  
Old 11-03-2005, 04:26 AM
rdotsch rdotsch is offline
Member
 
Join Date: Jul 2005
Location: The Netherlands
Posts: 20
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
Reply With Quote
  #20  
Old 11-03-2005, 09:11 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
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.
Reply With Quote
  #21  
Old 09-21-2010, 05:18 PM
mizutani_jun mizutani_jun is offline
Member
 
Join Date: Jun 2010
Posts: 23
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.
Reply With Quote
  #22  
Old 09-21-2010, 05:38 PM
mizutani_jun mizutani_jun is offline
Member
 
Join Date: Jun 2010
Posts: 23
LOL.
Sorry for my mistake.
I mean print screen not screen saver.
Print screen for the details step will be great.
Thanks.
Reply With Quote
  #23  
Old 04-12-2011, 06:26 AM
smith_toh smith_toh is offline
Member
 
Join Date: Mar 2011
Posts: 5
Hi Mr.farshizzo,
i tried the sensor.zip, and i got a error message at step 2.
here is the error message


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

is it the version problem ?
thank you.
Reply With Quote
  #24  
Old 01-08-2013, 08:09 AM
ann olegovna ann olegovna is offline
Member
 
Join Date: Nov 2012
Posts: 5
how about plug in for flex sensor??
Reply With Quote
  #25  
Old 04-18-2013, 04:45 AM
embee embee is offline
Member
 
Join Date: Apr 2013
Posts: 1
Can you please post the source of the XSens plugin? I wan't to make it work with the newer MTi-300 devices.
Reply With Quote
  #26  
Old 08-01-2019, 12:24 AM
chander chander is offline
Registered User
 
Join Date: Jul 2019
Posts: 1
Hi Farshizzo,
I unable to download sensor.zip file, please can you help me
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


All times are GMT -7. The time now is 08:01 PM.


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