Quote:
Originally Posted by jordansch
.
|
Quote:
|
1. The photo switch we are using is a Banner M12 series metal barrel sensor(i can post a .pdf with the specs if you want me to).
|
Please do, if you have it handy
Quote:
|
2. The piece of reflective tape we are using is roughly three-quarters of an inch wide. Our photo sensor is mounted about three inches above the wheel, looking down on the tape at a ninety degree angle
|
How far away, radially, is the sensing element from the center of rotation?
Quote:
|
3. At full power to the motors, our sensor was measuring roughly 12,500 RPM, and at 75% power, which we use more often for our shooting positions, it measures at about 8,000. Our numbers are not completely accurate, as the sensor is always reading about 100 RPM on each side of the actual value.
|
If you use the getPeriod() method in the Counter class, you can do much better than that. More below.
Quote:
|
4. We had the photosensor programmed into the code as a counter. We then took the time between when the sensor picks up the tape, ran some math on it, and got the RPM of the wheels.
|
From the above description, it sounds like what you are doing is this:
a) get the counts from the sensor
b) subtract the previous count value to get the change in counts
c) divide that by the corresponding elapsed time
That's a good method to use for high speeds with a high-CPR counter, but it's not the best method to use for a one-count-per-rev sensor like what you have.
What you should do instead for a one-count-per-rev sensor is this:
a) instantiate your sensor as an up/down counter from the counter class and configure it to count up only
b) use the getPeriod() method in the counter class to get the period.
c) compute rpm = 60/period
Using that method, you should do
much better than +/- 100 rpm.
Quote:
|
5. We had to create our own homemade velocity pid loop. The motor will increase power by .005 each iteration of the code until we get to within, say, 1000 RPM. Then it will slowly move closer to the point, increasing or decreasing by .001 each iteration, and it will hold the same power once it gets within 100 RPM.
|
What you are describing is not a PID controller. It is a voltage-ramped on/off controller with a deadband.