Quote:
Originally Posted by virtuald
This commit seems to have addressed the bug dvanvoorst is talking about.
|
Actually that's not the bug I was referring to. Here's the portion of code from the "calculate" method. This is the corrected code:
Code:
// Update the buffer.
m_buf.add(m_error);
m_bufTotal += m_error;
// Remove old elements when the buffer is full.
if (m_buf.size() > m_bufLength) {
m_bufTotal -= m_buf.remove();
The original code used m_buf.push and m_buf.pop instead of add and remove, which resulted in the most recent value being popped off instead of the oldest.
I'm running version 0.1.0.201603020231 of the Java WPILib.