View Single Post
  #13   Spotlight this post!  
Unread 10-05-2015, 14:49
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,051
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: pic: Small CIM in wheel swerve

Quote:
Originally Posted by Ether View Post
6) incorrect programming (resetting the counts rather than letting the FPGA accumulator run freely).
Quote:
Originally Posted by Bryce2471 View Post
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".


Reply With Quote