|
Re: PID for velocity control
There's a perfect answer to what you want. It's called "velocity PID", and it works by computing the required change in output instead of the output itself.
I spent quite some time a couple of weeks ago trying to help the TechnoKats software group implement a velocity PID routine for our robot's drive motors. I might have been doing it wrong, or I might not have been patient enough when trying to tune the PID constants, or I might just have been fighting easyC too hard. In the end, however, we discarded the idea of controlling motor speed, and instead implemented a positional PID control for the robot itself.
To get the effect of closed-loop speed control, we just move the desired robot position at the right rate, and the robot follows along smoothly. There's a similar positional PID for direction, and turning the robot at a given rate works by changing the desired direction at that rate. Feedback inputs to both PID controllers are from quadrature encoders on the drive wheel shaft. The sum of the encoder counts is used as an odometer, and the difference tells us the robot's present heading relative to when it started.
|