Labview Timed Loop

How does one go about making a timed loop in labview? Pictures would be great, but words will make due. Our team would like to use a timed loop to fulfill the following function. For our arm, it is currently set to move up when joystick is forward and vice-versa. Our mentors would like it so when the joystick is forward, the arm will move up for let’s say 2 seconds, and stop. Then when the joystick is moved back, the arm will move down for 2 seconds back to initial position. Is this possible at all? If so, please help


First, I think you need to sit down with you mentors and understand truly what they want. I suspect that they actually do NOT want the arm to move for 2 seconds. I suspect that they want the arm to move a certain distance.

People unfamiliar with programming often make that mistake. Instead of trying to program thier robot to do something definite - like drive 3 feet using the encoders, they try to make it do something non-definite like drive for 3 seconds (at what speed? at what battery voltage? On what field? With how much wheel slip). One will get you the exact same result every single time. The other will get you a nearly random result that is unrepeatable.

People who program their autonomous based on timing almost always have problems with it being very inconsistent and unpredictable.

So go back and find out what your mentors actually want. Do they want the arm motion smoother? Do they want it to go to specific locations?

It’s trivial to make an arm simply move for 2 seconds. But I’d wager a pretty penny that it isn’t really what they mean.

Yes, you are somewhat right. Yesterday we measured the time it took the arm to go from its lowest location (where it can grab tube from human player), and its highest location(second row). It was an average of about 2.4 seconds. They thought of just making it run up for 2.4 seconds, stop, then run down for 2.4 seconds when the joystick is moved back. After what you said, it does sound like it can vary in results.
We were also thinking of using a limit switch to regulate when the arm is at lowest and highest points.
According to what you said, how could i program the arm to move distance rather than time? Like when pushed forward, arm travels 2 feet, when pushed back, arm travels down 2 feet.

Thanks for the quick response

There are several ways to move something a set distance. All require some type of feedback to the robot.

The first would be a limit switch. A limit switch would be hooked up to the digital i/o on the digital sidecar, and you could read it in your code.

I’ll leave the mechanical thinking to you, but consider - what if you programmed your arm so that when the operator pressed forward the arm would move, but would stop when it hit the limit switch until the operator released the joystick then pressed it forward again?

That is one example.

More common, though, is a potentiometer. That is a variable resistor. They are hooked up to your analog breakout and as they are rotated their resistance varies. This means the voltage sent back to the robot varies. So you can determine the voltage at any given height and use that as I suggested you use the limit switch above. The difference would be that the potentiometer will work for any position you like, whereas you will need multiple limit switches.

You could also start looking at PID loops. Essentially if you drive the arm to a point and tell it to stop, it will over-shoot the location due to momentum. A pid scales down the motor speed as the manipulator nears the stop point. Do a search for PID on the Chief Delphi media section under papers and you will find any number of excellent resources, however if you haven’t ever done it before it might be a bit of a challenge.

We were also thinking of the use of a limit switch, which i think is the easiest. Now i am wondering about placement of the limit switch. We were thinking of putting it where the arm is at its lowest point, thus it would trigger when going down. Any ideas?

Yes. Make sure you put a flexible extension on the limit switch so that the arm’s momentum does not destroy it.


Yes. I was gonna do that to avoid damage.
For programming this, i know how to set up a limit switch, but is their any special programming i need to do to make it work in this case?

Whenever the switch is activated, de-power the motor in the direction that activated the switch, but allow power in the opposite direction (if commanded).