Quote:
Originally Posted by ProgrammerMatt
So i have code that runs our actuators to set our zero's for our Closed Loop PID system. using setPosition(0.0); to set the zero.
It seems to loose its zero after switching positions a few times. its off by about 0.9 rotations about 6-8 inches on our actuator. im using the SRX Mag encoder with the pulse width position feedback selected.
Thanks,
Matthew Smith
|
We have found, for various reasons, encoders don't always return the same count if the motor has spun back and forth a number of times back to the original position. We suspect in some scenarios, where optical encoders are used, there could be slight scratches on the optical wheels that a small number of pulses may be missed by the counter. It is not significant to the overall tracking of position but enough to cumulate errors that it no longer "return to zero" when the actuator is moved back to "zero position". That's why we have put code in our library that when a limit switch is used to calibrate zero position, not only we called the zeroCalibrate() method during robot initialization, we also zero the encoder whenever the lower limit switch is hit. This will prevent the "zero point drifting" problem.
Here is an example on how we did it. The code is in the method setMotorPower.
https://github.com/trc492/Frc2016Fir...cPidMotor.java