View Single Post
  #2   Spotlight this post!  
Unread 17-03-2016, 20:38
dvanvoorst dvanvoorst is offline
Registered User
FRC #2771 (Code Red)
Team Role: Mentor
 
Join Date: Jan 2012
Rookie Year: 2012
Location: Grand Rapids, MI
Posts: 61
dvanvoorst is an unknown quantity at this point
Re: Major WPILib PIDController bug

Quote:
Originally Posted by virtuald View Post
Ah yes, here we go. I think I'm misreading everybody's comments tonight...
Yep, that's the one!

I have to agree with Oblarg that the failure to clear the accumulated buffer sum is a big problem. That's a flaw in the plan of never actually re-calculating the sum of the buffered entries - it's easy to introduce a bug like this when you forget to zero out the total when you empty the buffer.
m_bufTotal should be set to 0 in setSetpoint right after doing the m_buf.clear();