|
Custom GetRate not working.
Hi all,
We've heard that the WIPlib Encoder method getRate() is inconsistent, so we're trying to write out our own (better) without any success. Any suggestions?
Code:
private static double currGet = 0.0;
public static double getRate() {
double prevGet = currGet;
currGet = shooterEncoder.get();
int scalar = 50;
double rateDegreePerSec = Math.abs(currGet-prevGet)*scalar;
double rpm = rateDegreePerSec/6.0;
System.out.println("Rate: " + rpm);
return rpm;
}
__________________
Engineering mentor: Team 2485: WARLords 2013-
Team President: Team 3647 2010-2013
Last edited by Mk.32 : 30-03-2012 at 23:52.
|