View Single Post
  #6   Spotlight this post!  
Unread 20-03-2016, 18:46
wt200999's Avatar
wt200999 wt200999 is offline
Texas Instruments
AKA: Will Toth
FRC #3005 (Robochargers)
Team Role: Mentor
 
Join Date: Mar 2006
Rookie Year: 2004
Location: Dallas, Texas
Posts: 323
wt200999 has much to be proud ofwt200999 has much to be proud ofwt200999 has much to be proud ofwt200999 has much to be proud ofwt200999 has much to be proud ofwt200999 has much to be proud ofwt200999 has much to be proud ofwt200999 has much to be proud ofwt200999 has much to be proud of
Send a message via MSN to wt200999
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 -
Reply With Quote