View Full Version : Sensing RPM with the kit encoder.
Ty Tremblay
14-01-2012, 16:40
Can the CRio keep up with the counts from the kit encoder if it's on a shaft rotating at 2500-3000 rpm? I'd like to run a velocity PID on our shooter. IIRC, the kit encoder doesn't have an indicator pulse, meaning you'd have to count all of the pulses. However, I don't know how many PPR the kit encoder has.
davidthefat
14-01-2012, 17:10
private double[] getRPM()
{
double rpm[] = new double[2]; //Declares an array of integers which the function will return.
currentTime = time.get(); //Sets currentTime to the time calculatged from FPGA
rpm[0] = leftEncoder.getRaw() * 16666666.666666 / currentTime; //dAngle*(60000000us/360deg)/dTime = RPM
rpm[1] = rightEncoder.getRaw() * 16666666.666666 / currentTime; //dAngle*(60000000us/360deg)/dTime = RPM
leftEncoder.reset(); //Resets the left wheel encoder.
rightEncoder.reset(); //Resets the right wheel encoder.
time.reset(); //This resets the timer.
return rpm;
}
Ty Tremblay
14-01-2012, 17:25
Thanks for the code. :p Im just asking if the FPGA can keep up with the speed that the counts will come in from a 3000 rpm shaft.
Thanks for the code. :p Im just asking if the FPGA can keep up with the speed that the counts will come in from a 3000 rpm shaft.
https://decibel.ni.com/content/message/12523#12523
Mark McLeod
14-01-2012, 18:10
The US Digital KOP encoders are 360 CPR.
They are rated (http://team358.org/files/programming/ControlSystem2009-/85_e4p_datasheet_0.pdf) at 10,000 max RPM
At 1X the cRIO will keep up.
vBulletin® v3.6.4, Copyright ©2000-2017, Jelsoft Enterprises Ltd.