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.


        /**
	 * 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();
	}

Late in beta we tested the rate in 1x, 2x, and 4x modes to verify the same rate was returned in all 3 modes and that it seemed reasonable in magnitude. It’s possible something broke since then.

I think the scaling is done deeper in the library.

Thanks Joe. I actually figures out what we were doing wrong, forgot to convert from feet to inches.