Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Java (http://www.chiefdelphi.com/forums/forumdisplay.php?f=184)
-   -   WPILibJ Encoder getRate() bug? (http://www.chiefdelphi.com/forums/showthread.php?t=133602)

notmattlythgoe 28-01-2015 09:46

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


Joe Ross 30-01-2015 20:25

Re: WPILibJ Encoder getRate() bug?
 
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.

notmattlythgoe 31-01-2015 08:23

Re: WPILibJ Encoder getRate() bug?
 
Quote:

Originally Posted by Joe Ross (Post 1436366)
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.


All times are GMT -5. The time now is 22:26.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi