View Single Post
  #5   Spotlight this post!  
Unread 31-03-2012, 03:18
Mk.32's Avatar
Mk.32 Mk.32 is offline
Registered User
AKA: Mark
FRC #2485 (W.A.R. Lords)
Team Role: Engineer
 
Join Date: Jan 2011
Rookie Year: 2011
Location: San Diego
Posts: 770
Mk.32 has much to be proud ofMk.32 has much to be proud ofMk.32 has much to be proud ofMk.32 has much to be proud ofMk.32 has much to be proud ofMk.32 has much to be proud ofMk.32 has much to be proud ofMk.32 has much to be proud ofMk.32 has much to be proud ofMk.32 has much to be proud of
Re: Custom GetRate not working.

Here is a quick re-write I did, using all the above comments. Encoder is set to 1x.

Wouldn't get to test till next Wednesday. But comments are welcome.

Code:
    public static void shooterEncoderStart() {
        shooterEncoder.start();
        shooterEncoder.setDistancePerPulse(1.0 / 360.0);
    }
    
    public static void shooterEncoderReset() {
        shooterEncoder.reset();
    }
    
    public static double getRate() {
        double get1 = shooterEncoder.get();
            double time = Timer.getFPGATimestamp();
        double get2 = shooterEncoder.get();
            time -= Timer.getFPGATimestamp();
        double rateDegreePerSec = Math.abs(get2-get1)/Math.abs(time);
        return rateDegreePerSec/6.0; //RPM
    }
__________________
Engineering mentor: Team 2485: WARLords 2013-

Team President: Team 3647 2010-2013
Reply With Quote