Quote:
Originally Posted by Ether
6) incorrect programming (resetting the counts rather than letting the FPGA accumulator run freely).
|
Quote:
Originally Posted by Bryce2471
We used the WPI lib encoder software, so I'll hope it wasn't #6.
|
Using the WPILib
doesn't rule out #6. #6 refers to using the reset() function repeatedly in your software in the roboRIO.
Code:
/**
* Reset the Encoder distance to zero. Resets the current count to zero on
* the encoder.
*/
public void reset() {
if (m_counter != null) {
m_counter.reset();
} else {
ByteBuffer status = ByteBuffer.allocateDirect(4);
// set the byte order
status.order(ByteOrder.LITTLE_ENDIAN);
EncoderJNI.resetEncoder(m_encoder, status.asIntBuffer());
HALUtil.checkStatus(status.asIntBuffer());
}
}
I've seen code where the counts are read and then reset() every cycle. You can miss counts that way. I'm not saying that's what your code is doing... but if it is, that might explain your "drift".