3 Stage Motor Control

How would I go about making a motor that would run forward for a very short period of time, backward that same distance, then stop? We want to have a window motor slide a frisbee into the shooter and quickly retract back so it can slide the next frisbee (which will be falling in place of the previous one, they are in a vertical 4 stack).

Please let me know if that is confusing, thanks.

Will there be any feedback sensors on this window motor (such as a potentiometer), or do you want it to run solely on time? If this motor is turning an appendage of some kind, it may be wise to have some form of feedback to avoid over-turning and potentially breaking your arm.

If you want to go ahead with just using time, I can post some code to get you started.

It’s running a very very small appendage so time would do just fine.

I’ve attached some code I created that should do what you’re looking for. A few important things about it:

  1. The case structure on the left should be in teleop with the case selector wired up to your driver’s station input (button I presume).
  2. The case structure on the right should be in periodic tasks. I think it would be best to put it here because it will let you feed frisbees into your shooter in autonomous as well with minimum additional code.
  3. The “Feed Frisbee” local variable should be a global variable in your code.

The case structure on the right will use the elapsed time (once the button is pressed) to run the motor forward at .5 for one second, then backwards at .5 for one second. It will then return itself to the false case to await another button press.

Edit: I just realized this could be done with less code using a flat sequence. I’m not a fan of them personally, but if you want to take that route, just modify the code in the image below to run your motor for the desired amounts of time.

http://team358.org/files/programming/ControlSystem2009-/LabVIEW/ButtonTimedAction.jpg

Motor Forward.Backward.Stop.vi (13.7 KB)


Motor Forward.Backward.Stop.vi (13.7 KB)

Thanks! I completely forgot about using timed tasks. I’ll be sure to check everything out