View Single Post
  #4   Spotlight this post!  
Unread 04-07-2016, 13:47
Oblarg Oblarg is offline
Registered User
AKA: Eli Barnett
FRC #0449 (The Blair Robot Project)
Team Role: Mentor
 
Join Date: Mar 2009
Rookie Year: 2008
Location: Philadelphia, PA
Posts: 1,049
Oblarg has a reputation beyond reputeOblarg has a reputation beyond reputeOblarg has a reputation beyond reputeOblarg has a reputation beyond reputeOblarg has a reputation beyond reputeOblarg has a reputation beyond reputeOblarg has a reputation beyond reputeOblarg has a reputation beyond reputeOblarg has a reputation beyond reputeOblarg has a reputation beyond reputeOblarg has a reputation beyond repute
Re: Why won't this PID loop stop?

Quote:
Originally Posted by team-4480 View Post
I did actually write code so that if it was onTarget(), it would be disabled but it never worked because I found out that if you call onTarget too often, it never returns true.
You are possibly encountering a bug that was discovered this year.

Edit: Or possibly not, as a reply in that thread indicates that bug does not occur in the python version of WPILib. I'd suggest looking through the PIDController code and debugging to find why this is happening.

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()")
__________________
"Mmmmm, chain grease and aluminum shavings..."
"The breakfast of champions!"

Member, FRC Team 449: 2007-2010
Drive Mechanics Lead, FRC Team 449: 2009-2010
Alumnus/Technical Mentor, FRC Team 449: 2010-Present
Lead Technical Mentor, FRC Team 4464: 2012-2015
Technical Mentor, FRC Team 5830: 2015-2016

Last edited by Oblarg : 04-07-2016 at 17:05.
Reply With Quote