|
PID Issue
We are trying to use PID on LabVIEW for the first time, and are having difficulties getting it to work. I've read the tutorials and threads, so I understand how it's supposed to function. We have encoders on the left and right wheels of a tank drive practice bot. We convert the rotation rate of each wheel into a linear speed in inches/sec. We feed that into a PID as the Process Variable. On the Front Panel of Teleop, we have a control to enter the desired speed for each wheel as the Setpoint. We set the maximum output to +/- 1, and feed that into a Tank Drive. A screen shot of the code is attached.
We put both Setpoints to 25 in/s, which is about one rotation per sec. When we set all 3 gains to 0, the wheels don't turn (of course). When the P gain increases above 0.003 the wheels begin to turn slowly, but not at the Setpoint. When the gain gets above 0.007, the wheels ramp up directly to full speed (+/- 1); the encoder velocity (process variable) goes to about 250 in/s. Its basically all or nothing. Adjusting the Setpoint higher or lower has no effect. If the P gain goes above 0.2, the wheels switch rapidly between +1 and -1, flipping back and forth. Adding gain to I or D only makes matters worse.
Clearly there is too much gain if we're maxxing out at P=0.007. The robot is on blocks, so there's no real load on the wheels; shouldn't it work anyway? (We don't want to put it on the ground when it's acting crazy.) Do we leave the dt(s) input empty? Is there something else we are missing?
Any advice would be appreciated. Thanks.
|