|
Re: Setting Mechanism Position with Button
Instead of switching between multiple loops in different cases, what I am suggesting is having a single loop with the PID controller in it.
You could implement this with a simple global variable as your set point. When you press the button to change the arm angle, just write your desired position to the global variable.
So in periodic tasks you have a single loop for the PID controller. The loop constantly reads from the global variable which is set to the target arm position. When the arm is near the target the PID output will be close to 0. This is also where you can implement a deadband to force the output to 0.
Now in auton/teleop all you need to do to set the arm angle is write to the global variable.
__________________
Programming in LabVIEW? Try VI Snippets!
FIRST LEGO League 2004 - 2005
FRC Team 870 Student 2006 - 2009
FRC Team 3005 Mentor 2013 -
|