Forum: Slow Motor Response with AndyMark Motors
- Hits: 1752
Using RUN_WITH_ENCODERS can cause significant response delays.
If you command a speed using RUN_WITH_ENCODERS that the robot cannot obtain, the controller with ramp the output voltage to full power, and then it starts accumulating a speed error (it's the "I" term of the PID controller). This is sometimes known as "windup".
If this windup is not clipped when the controller reaches max power output it has the effect of "remembering" that the robot has been lagging behind.
Then, when you finally reduce the speed request, the controller tends to ignore the change and runs on until it "recovered" all of the accumulated error. The more you reduce the requested speed, the faster it will recover.
The controller doesn't reach match speed with the AndyMark Neverest motors due to the pulses per revolution is 1120 versus the TETRIX 1440 pulses per revolution. The motor controller is expecting 1440 pulses per revolution. At full speed, the TETRIX motor is about 4000 pulses per second versus 3000 for the AndyMark. So the motor controller really thinks they are seriously lagging behind.
The solution is to don't request a speed when using RUN_WITH_ENCODERS that the motor/encoder combination cannot obtain. Scaling the requested speed by about 70% should fix the problem. Note this doesn't really slow the AndyMark motor. Scaling is better than clipping to keep the responsiveness of the Joysticks.