|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
||||
|
||||
|
Sensing RPM with the kit encoder.
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.
Last edited by Ty Tremblay : 14-01-2012 at 16:41. Reason: Clarification |
|
#2
|
|||
|
|||
|
Re: Sensing RPM with the kit encoder.
Code:
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;
}
|
|
#3
|
||||
|
||||
|
Re: Sensing RPM with the kit encoder.
Thanks for the code.
Im just asking if the FPGA can keep up with the speed that the counts will come in from a 3000 rpm shaft. |
|
#4
|
||||
|
||||
|
Re: Sensing RPM with the kit encoder.
Quote:
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|