Quote:
Originally Posted by tomy
So im still confused how will that help me? im getting current counts and its counting right i checked it. for the rpm im planing on doing something like:
Code:
Counter gts;
float rpm
.
.
.
rpm = ( ((1/gts.GetPeriod())/6)*60)
I might have missed a ( somewhere
|
The idea there is correct, our concern is that your screwheads aren't perfectly spaced and there's 6 of them. That means you're going to have a noisy signal. 6 screws means pulses are 1/6th as long, means at 5000 RPM, your period is 2ms. Ether will probably come in with the exact formula for how much inherent noise you'll see in a 2ms period, but it's definitively more than with the 12ms pulse. Add in the fact that each screw head is going to trigger the pulse at a different time, and you could end up with pretty noisy feedback that won't be fun to control.
You can fix that by making the edit to WPILib that Ether suggested. That will create a buffer of the last 6 period measurements and output the average of those. That means you'll get an average over all 6 of your unevenly spaced screws, which will even things out and greatly reduce the noise in your feedback.