Thread: PID While Loop
View Single Post
  #6   Spotlight this post!  
Unread 05-02-2016, 08:48
RyanN's Avatar
RyanN RyanN is offline
RyanN
AKA: Ryan Nazaretian
FRC #4901 (Garnet Squadron)
Team Role: Mentor
 
Join Date: Jun 2006
Rookie Year: 2005
Location: Columbia, SC
Posts: 1,126
RyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond repute
Re: PID While Loop

So a few problems here.

A while loop with no time constraint is asking for trouble. It'll eat up your CPU resources running as fast as possible while not maintaining a constant delta time between calls. That will make it untunable since the dT between calls is never the same. That's my biggest

If you want to terminate a separate running while loop, you can use Notifiers. Definitely look at some example code in the LabVIEW help. If you use Obtain Notifier in code that you call often, you need to call Release Notifier, or else it will eat up all your RAM over time. Ask me how I know...

But, as aeastet, you typically want to keep your PID running at all times. Perhaps put it in a while loop in Period Tasks that runs every 50ms? You can share the set-point using global variables or notifiers.
__________________
Garnet Squadron
FRC 4901
Controls Mentor
@rnazaretian

Previous mentor and student from Team Fusion, FRC 364
Reply With Quote