View Single Post
  #5   Spotlight this post!  
Unread 04-07-2016, 18:58
alst alst is offline
Programming Mentor
AKA: Alan
FRC #0830 (RatPack)
Team Role: Mentor
 
Join Date: Jul 2015
Rookie Year: 1830
Location: MI
Posts: 10
alst is an unknown quantity at this point
Re: Why won't this PID loop stop?

Quote:
Originally Posted by Oblarg View Post
Edit 2: I have never worked with python myself, so perhaps I'm missing something, but it seems to me that the onTarget() function in the python WPILib doesn't actually, erm, do anything (other than throw a value error):

Code:
def onTarget(self):
    """Return True if the error is within the percentage of the total input
    range, determined by setTolerance. This assumes that the maximum and
    minimum input were set using :func:`setInput`.
    :returns: True if the error is less than the tolerance
    """
    raise ValueError("No tolerance value set when using PIDController.onTarget()")
The onTarget method of each instance gets assigned to either PercentageTolerance_onTarget or AbsoluteTolerance_onTarget when you call setTolerance, setAbsoluteTolerance, or setPercentTolerance (i.e. you have to call one of those before calling onTarget):
https://github.com/robotpy/robotpy-w...r.py#L431-L467
Reply With Quote