03-25-2008 12:45 PM
Synchronizing inputs of Tracking System (serial port) and Load Cell (NI USB 9237) in LabVIEW 8.5:
I
am taking in data from an optical tracking system (camera communicates with a
signal conditioning box which connects to the computer trough a serial port)
and a load cell (plugged into a USB 9237 DAQ). In LabVIEW I call the tracking
system (to get position and orientation information) using a matlab script node
and
the load cell (to get forces) from DAQmx read node.
The
load cell takes readings at a much higher frequency than the tracking system
(about 1000 sample to 1). So I want to run the load cell DAQmx read node repeatedly
while the matlab script node gets one set of tracking points...
Since LabVIEW executes one node at a time I am basically forced to choose which
node to execute first and which to execute second.
Is there anyway around this so that I can take in a group of samples from the load cell at the point in time when the tracking information is being requested and received (so maybe start load cell DAQ when tracking is requested, aka matlab script node starts, and stop load cell DAQ when tracking is received, aka matlab script node finishes).
Thanks,
Thomas
03-29-2008 03:07 PM - edited 03-29-2008 03:07 PM
03-31-2008 02:01 PM
Thanks for the response. The sample VI was very helpful in clarifying what you explained.
In general what you sent me seems to work nicely.
However due to the structure of my current code I do not know if I can incorporate this solution into my code for two reasons:
1. Real time display - The data from the two inputs, the tracking system and load cell, need to be processed and displayed in real time. So ideally, the display that shows the calculated output would be refreshed each time a set of tracker data is received. The calculated output would thus be based on one set of tracker data and multiple points of load cell data.
2. Seamless Tab Switching - There is a while loop around the outside of my code allowing the user to seamlessly switch between tasks without having to start and stop the code. So it is set up such that each run of this global while loop is often analogous to one run of the tracking system plus any other things occurring on a given selected tab.
I attached two files:
1. Attached is an edited version of the code you sent me. Although this VI isn’t what I need it sort of shows the general direction I am trying to go.
2. This VI shows what I was originally thinking of doing if there is not better solution. Here I am getting several points of load cell data (in this case 50), then one set of tracking data, and then a second grouping of 50 points of load data. The load cell data is then averaged before being used for the final multiplication of the load cell and tracking data. Because load cell data is received before and after tracking and these values are averaged, this creates a linear interpolation of the known load cell data. However, since the load cell data is most likely not linear this is a non-ideal solution.
Can the solution you sent me work in my current code or is there another solution that would work?
Thanks for your help,
Thomas