|
#1
|
|||
|
|||
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 |
#2
|
|||
|
|||
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. |
#3
|
|||
|
|||
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? |
#4
|
|||
|
|||
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.
|
#5
|
|||
|
|||
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!
|
#6
|
|||
|
|||
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
|
|
|
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 |