11-15-2020 09:29 AM
Hello,
I am relatively new to LabVIEW, and I could use some help with programming a linear actuator. The actuator I am using is a Phidgets DC linear actuator L16-50-35-12-P. The actuator has a buiilt in potentiometer and I am able to access its voltage. Essentially what I want to program is when the actuator reaches a maximum position (user input) which is obtained from the potentiometer voltage, I want to reverse the sign of the input velocity. And when the actuator reaches a minimum position, I want to change the sign of the input velocity back to a positive value. I thought of using an event structure to program this, however I am unsure how to do so. Any tips would be much appreciated!
I've attached my program so far below, thanks!
Solved! Go to Solution.
11-15-2020 02:13 PM
Events are for user interactions. Your loop is already spinning so just keep a state boolean in a shift register (two possible values, one per direction) and flip it whenever a boundary is reached. Use it's value to determine the travel direction.
11-15-2020 02:28 PM
Thanks for the response,
I have two instances where I would want to reverse the direction, one when the actuator reaches xmin and one when the actuator reaches xmax. So I am trying how to incorporate both of these reverals with the two boundaries with the not function. Would you mind providing me with an example if you don't mind?
11-15-2020 02:34 PM
@mpkennedy wrote:
Would you mind providing me with an example if you don't mind?
Try this.... (Probably needs a few tweaks to be useful)
11-15-2020 03:00 PM
Thanks a lot for the example, I understand what you are saying now. would the "x" in the "in range and coerce function" be the current actuators position? The one thing I still don't understand in the example is adding the "coerced(x)" from the "in range and coerce function" and the output of the "select function." which wire would be the output velocity to the actuator motor?
11-15-2020 03:10 PM
Yes, the input to the range function is the current position. You might have to be a bit more complicated, depending on the hardware. Maybe you want to reverse the position if it reached the safe limits. (0.2, 4.8) instead of stopping the loop.
I am not familiar with your hardware. Does a negative output velocity imply reverse movement?
11-15-2020 03:28 PM
Yes, sorry, that is something I should have specified. A negative velocity indicates reverse movement. And yes, ultimately I want to reverse the direction at the safe limits (0.2 and 4.8). the current VI stops the loop at these limits just so I could test the actuators at different speed. Also, would the output of the "select function" go to the motors target velocity?
11-15-2020 03:30 PM
Yes, just select between +1 and -1 and multiply with the desired absolute velocity.
11-15-2020 03:39 PM
Thank you! appreciate the help.