View Single Post
  #1   Spotlight this post!  
Unread 28-01-2015, 09:46
notmattlythgoe's Avatar
notmattlythgoe notmattlythgoe is offline
Flywheel Police
AKA: Matthew Lythgoe
FRC #2363 (Triple Helix)
Team Role: Mentor
 
Join Date: Feb 2010
Rookie Year: 2009
Location: Newport News, VA
Posts: 1,717
notmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond repute
WPILibJ Encoder getRate() bug?

Is it just me or should the getRate() method for encoders be dividing the rate by the encoding type? getDistance() seems to return the correct distance based on the encoding type, but when we accessed getRate() for the same encoder(4x) we got 4 times the rate we were expecting.

It seems to me that the distance configuration shouldn't need changed based on reading rate vs. distance.

Code:
        /**
	 * Get the current rate of the encoder. Units are distance per second as
	 * scaled by the value from setDistancePerPulse().
	 *
	 * @return The current rate of the encoder.
	 */
	public double getRate() {
		return m_distancePerPulse / getPeriod();
	}
Reply With Quote