|
|
|
![]() |
|
|||||||
|
||||||||
|
|
Thread Tools | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
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; } Last edited by Mk.32 : 30-03-2012 at 23:52. |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|