PID problems

We are using PID to control the speed on our shooter wheels. We need to set the back wheel to 1900 RPM, and the front wheel to 2700 RPM. On Monday night, we got it to speed up to the correct speed in under 1 second, and stay there with almost no error. Later that night, with the same code, it refused to work correctly. Both of the motors would speed up to around 200 RPM higher than their target, and stay there. The Victor lights showed that the only speeds being sent were full forward and full reverse. We swapped the victors and the motors, and the problem persisted. I have also re-imaged the cRIO, and used different laptops. The setpoint, output range, and PID values are all exactly the same as when it was working, and no changes have been made to the code. I have no idea what is going on.

Are you sure the motors aren’t just topping out at full speed? That can happen if you do something screwy and your command value doesn’t create a change in feed back in the same direction. For instance, a 0.5 command to a speed controller should give you a positive speed feedback. If a 0.5 speed command gives you a negative feedback, the the motor is going to quickly end up going full speed the wrong way.

So, if the motors are actually just running full speed in a direction, then something’s backwards with your speed feedback or motor polarity from the speed controller.

It doesn’t sound like this is your problem, but a PID-controlled system can change its behavior drastically depending on the battery voltage. Just to make sure, are you seeing the “incorrect” results when using a freshly charged battery? Or was the system perhaps tuned with a weak battery installed?