Quote:
Originally Posted by AsianRookie
shooterEncoder = new Encoder(RobotMap.SHOOTER_ENCODER_A, RobotMap.SHOOTER_ENCODER_B, true, CounterBase.EncodingType.k4X);
shooterEncoder.setDistancePerPulse(4/360);//4:1 gear ratio
|
You do
not want to use getRate() with a 360 CPR encoder with 4X decoding at shooter wheel speeds.
See the first attachment
Do this instead:
1) Connect only Channel A of the encoder to the DSC, and use an up/down counter (from the Counter class) set to count up only. Leave Channel B disconnected.
2)
Set the FPGA sampling ring buffer size to 120.
3) Use the counter class's getPeriod() to get the period, then calculate rpm = 60/(360*period)
See the second attachment.