View Single Post
  #6   Spotlight this post!  
Unread 28-02-2013, 23:50
jwhite jwhite is offline
Registered User
FRC #2823
Team Role: Mentor
 
Join Date: Feb 2013
Rookie Year: 2013
Location: Saint Paul, MN
Posts: 69
jwhite is an unknown quantity at this point
Re: PIDController (.cpp) issues and concerns

Quote:
Originally Posted by rawrxp View Post
It's still quite simple just to make your own OnTarget() method as well as GetError(). Even though it is more redundant, it should not lock the thread like it will otherwise. Simply, use GetSetpoint() and PIDGet() from your PIDSource object to calculate the error. From there, you can tune your OnTarget() error. For example...

Code:
//PIDSource is called source, PIDController is called controller.
float error = controller->GetSetpoint() - source->PIDGet();
float tolerance = error * .05; //any percentage value
return fabs(tolerance) < 5; // a tuned value
Oh, sure, and that's what we did. I was just mentioning the troubles we had in case any listening WPILib authors were interested in fixing 'em...