View Single Post
  #1   Spotlight this post!  
Unread 01-03-2013, 18:26
AsianRookie AsianRookie is offline
Registered User
AKA: Steven/Tim
FRC #0321 (Robolancers)
Team Role: Programmer
 
Join Date: Oct 2012
Rookie Year: 2007
Location: Philadelphia
Posts: 31
AsianRookie is an unknown quantity at this point
Encoder getRate question

Hey guys, so I have a couple of questions for encoders.
I wired it correctly because live window shows values for speed.
1)Am I using the setDistancePerPulse() correctly?
2)I am getting 0 for getRate() method, is the code correct?
Code:
        shooterMotor = new Talon(RobotMap.SHOOTER_MOTOR);
        shooterEncoder = new Encoder(RobotMap.SHOOTER_ENCODER_A, RobotMap.SHOOTER_ENCODER_B, true, CounterBase.EncodingType.k4X);
        shooterEncoder.setDistancePerPulse(4/360);//4:1 gear ratio
        shooterEncoder.setPIDSourceParameter(Encoder.PIDSourceParameter.kRate);
        shooterEncoder.start();
If anyone can help, that would be appreciated.
Reply With Quote