|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
||||
|
||||
|
Re: Major WPILib PIDController bug
Quote:
|
|
#2
|
|||
|
|||
|
Re: Major WPILib PIDController bug
Quote:
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(); |
|
#3
|
||||
|
||||
|
Re: Major WPILib PIDController bug
Quote:
The documentation should also probably specify what each of these functions should and should not do (is enable intended to clear the error? should setsetpoint always force onTarget to be false). Last edited by virtuald : 17-03-2016 at 20:53. |
|
#4
|
|||
|
|||
|
Re: Major WPILib PIDController bug
As I clarified above, I did indeed mean that.
|
|
#5
|
||||
|
||||
|
Re: Major WPILib PIDController bug
Missed it.
![]() Also, appears that C++ has an identical error. Python does not have this error. C# does however. |
|
#6
|
|||
|
|||
|
Re: Major WPILib PIDController bug
Quote:
Quote:
![]() |
|
#7
|
||||
|
||||
|
Re: Major WPILib PIDController bug
Quote:
|
|
#8
|
||||
|
||||
|
Re: Major WPILib PIDController bug
Pushed to gerrit here: https://usfirst.collab.net/gerrit/1372
|
|
#9
|
|||
|
|||
|
Re: Major WPILib PIDController bug
Quote:
setSetpoint doesn't have to force onTarget to be false because it clears the buffer - which makes isAvgErrorValid() false, which forces onTarget() to be false. ![]() However, I'd be interested in seeing isAvgErrorValid() being changed a bit to not return true until your buffer is full. I've had issues with OnTarget being true because of one value in the buffer when it first started up, even though I asked for a 20 reading average. I'd like to propose changing this: Code:
private synchronized boolean isAvgErrorValid() {
return m_buf.size() != 0;
}
Code:
private synchronized boolean isAvgErrorValid() {
return m_buf.size() == m_bufLength;
}
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|