PID output fluctuates heavily between + and - values but set point always larger than measurement

Most likely caused by too much derivative gain for a given latency. Latency is unavoidable yet it destabilizes PID loops, with there being a critical value of the derivative gain (or proportional gain on velocity PID) in which you get sustained oscillations regardless of the distance from the setpoint. I do not know what this critical gain is theoretically, but it shows up in simulations if you simulate latency.

I would suggest running the controller with 0 derivative gain, and see if they go away. If they do, you can slowly increase kD until they return again, and then back off, or just run PI control without the derivative gain because derivatives and latency do not play nice.

6 Likes