WorldViz User Forum  

Go Back   WorldViz User Forum > Plug-in development

Reply
 
Thread Tools Rating: Thread Rating: 6 votes, 5.00 average. Display Modes
  #1  
Old 06-12-2008, 02:36 PM
timbo timbo is offline
Member
 
Join Date: Jun 2008
Posts: 16
initialize sensor?

Im trying to create a plugin for a visualeyez tracker and I dont have a lot of experience with c++. I see in the outline the function "initialize sensor" however, I have no idea what needs to be added and how it should be added into this function. Can anyone give me a hand?

Thanks,
Tim
Reply With Quote
  #2  
Old 06-13-2008, 11:12 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
The InitializeSensor function is where you should initialize the connection to the device. You should set the status variable of the senor structure to TRUE or FALSE depending on if the initialized succeeded or failed.

The UpdateSensor function is called every frame and this is where you will place the tracking data into the data variable of the sensor structure.

Finally, the CloseSensor function is called when the script shuts down. This where you would disconnect from the device and cleanup your plugin.
Reply With Quote
  #3  
Old 06-13-2008, 01:13 PM
timbo timbo is offline
Member
 
Join Date: Jun 2008
Posts: 16
another question

Thanks.

Currently we are using a c++ environment that recieves a UDP from LabView to update arm position. To simplify the process of writing the plugin could I create a socket that runs fast enough (60 Hz) to update arm position and target position?
Reply With Quote
  #4  
Old 06-13-2008, 01:19 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
Yes, this is possible. You actually don't even need a plugin to accomplish this. Python has built-in support for socket handling. So you can do this all within your Python script. Search the forum, there are a few posts that have sample code that reads data from a socket.
Reply With Quote
  #5  
Old 06-16-2008, 11:31 AM
timbo timbo is offline
Member
 
Join Date: Jun 2008
Posts: 16
data from the socket

I understand how to create the socket in python from the examples on this forum and other sources. However, Im not sure how to sequester the x, y, and z data for the position of the LED. Using the code from an earlier question I see that you can recieve a "MAX_DATA_SIZE" but what I need is distinct values for x, y, and z. Is there something in the python socket library that can accomplish this? Thank you for all your help farshizzo!
Reply With Quote
  #6  
Old 06-16-2008, 06:10 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
It depends on what data format the values are sent over the socket. If they are sent as text, then you can use standard text to float conversion. If the values are sent as binary data, then you can use the struct module to extract the values. The following post has an example of this, http://www.worldviz.com/forum/showthread.php?t=1347
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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating a Vizard Sensor Plugin farshizzo Plug-in development 25 08-01-2019 01:24 AM
Sensor callback to the wii mote buttons shivanangel Vizard 3 03-14-2008 10:45 AM
wiimote and sensor bar masaki Vizard 1 03-06-2008 04:07 PM
Multiple Copies of same sensor plugin RedSpikeyThing Plug-in development 2 02-12-2008 03:10 PM
using sensor data in Physics1.py Eunice Vizard 4 01-03-2006 06:18 AM


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


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