LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Passing a Series of Values through a Slider

I'm working on a project to move 6 electric-motor actuators based on a set protocol.  Byte Data is written from arrays, concatonated into a string, and transfered via UDP.  This entire process is run through a While loop, passing multiple UDP messages to the motor.  I'm interested in using a slider GUI to control the length of the actuators.  The slider control works, but too well-- the actuators are moving directly from one position to another creating sudden starts and stops which are harsh on the actuators.  

 

I'm interested in passing multiple point values using the slider, interpolating the current slider value with a future value, creating an integral-esque effect and reducing the strain on the motor  What is the best way to make this happen?

0 Kudos
Message 1 of 4
(2,241 Views)

You simply need to generate a gradual change based on the difference of the current value and the desired setpoint.

 

You can keep the last sent value in a shift register and compare the slide with it. if they differ increment/decrement the value with small steps until they are equal, etc.

You could also use the ptbypt mean and send the slider average of the last 100 iterations, for example.

 

 

Why do you open and close the UDP connection withe very iteration of the loop? You should open it before the loop and close ot after the loop. Why are your arrays U16 if you only use the U8 values? I think the string building could be dramatically simplified. What determines the loop rate? Maybe you want a small wait.

0 Kudos
Message 2 of 4
(2,235 Views)

Altenbach,

 

Thanks for the suggestions.  This is just a small subroutine I'm showing, the larger VI has more pieces in an enumerated loop and includes a Wait function.  I was opening and closing the UDP within the loop because that was the system I implemented first, and it worked.  If it ain't broke, don't fix it-- likewise with the U16 arrays.  I've changed both at your suggestion.

 

Onto designing the incrementer, I'm not sure how to make it so the values will match the slide input perfectly.  My values are getting stuck on alternations between two values if I use a static increment value and the operation runs to infinity if I try to take the difference and divide it into one hundred values.  I'm interested in calculating the difference between the two values once, dividing it by 100 increments, and adding/subtracting to the given value using those increments while in the Loop.  Is there a good way to do that?  Sorry if these are silly questions, I am currently learning labview right now.

0 Kudos
Message 3 of 4
(2,194 Views)

The number of steps should depend on the difference. Have you tried my ptbypt suggestion?

 

This is very primitive ...

0 Kudos
Message 4 of 4
(2,191 Views)