10-04-2015 03:47 PM
Hello!
I am trying to make a 3d scanner using 3 linear stages from Standa and a magnetometer.
say the volume to be scanned is (known) 4x3x2 mm (x,y,z)
Please see this thread:
2d:
0 1 2 3
7 6 5 4
8 9 10 11
When pressing Start:
-the X linear stage moves +4mm at a speed vx, with acceleration ax, taking time tx.
-a time counter starts to count time units 0,1,2,3
-the magnetometer starts to sample 1 per time unit and store the samples in an array (please see attached program)
When the counter reaches 3 it stops because X is maximum(asuming velocity,acceleration and deceleration are respected)
and pauses for tpause;
After the counter has reached 3 and during tpause, Y is incremented by 1.
The pause is needed for moving the Y stage by one step, time during which no sample is taken hence the pause/stop for the counter.
After tpause, X movement is resumed by distance -4mm at the same pace
and so is the sampling; so the time counter resumes: 4,5,6,7.
At counter=7, sampling stops because X is (presumed to be ) again at minimum; tpause
y becomes 1+1=2;
After tpause, xmovement is resumed by distance +4mm.
so is the sampling: timer resumes: 8,9,10,11
stops
z becomes z+1, x,y stay the same.
The problem is inserting that pause at the end of the X cycle, incrementing y/z and restarting the Xcounter/cycle;
I tried to do it using event structures (please see attached tbEventTime.vi) but the structure does not see the boolean indicator and I did not manage to solve its blindness by property node/signalling (I probably did it wrong).
How could I insert a pause in the time counter at every n*X-1 time unit (n=1,2... ; X=nr of columns/X distance) ?
Would timed loops help and if so, where might I find useful videos?
Thank you!
10-04-2015 05:18 PM - edited 10-05-2015 11:24 AM
What is the point of the 500ms global wait? The 500ms timeout value (or infinite, depending on state) seems sufficient.
"Pause" is an indicator, and thus the event wil never trigger.Just wire to a "select" node that manipulates the timeout value based on the comparison before it gets wired to the event structure.
You should probably initialize the (currently orange) shift register. It also seems to me that everything that is currently orange should be blue (integers). equal comparisons on floating point values are dangerous.
It seems to me that all you need is a well defined state machine. Look at the design templates that ship with LabVIEW.
10-06-2015 10:31 AM
Thank you for the reply, altenbach!
How do I change the representation of the data in the shift registers?
there is no 'data representation' section in the properties menu.
I am looking into state machines, as you suggested.
10-06-2015 11:27 AM
All your orange controls should be I32. Once you change all the representations, the value in the shift regsiter will turn blue too.
(Also don't forget to initialize the shift regsiter)
10-07-2015 02:40 AM
Thank you again !
I did that and it changed the shift registers' data representation.
10-07-2015 03:28 AM
"Just wire to a "select" node that manipulates the timeout value based on the comparison before it gets wired to the event structure."
Great idea.
I will try this first.