I'm struggling with the practical application of a PID control algorithm when the set point does not require any external force to stay in position.
For example, I have a geared electric motor that has a mass attached perpendicular to the motor's shaft. The mass is fixed to the shaft so it will rotate with the shaft without slipping. There is a sensor on the mass that knows its angle relative to horizontal (an accelerometer in my case), which is used for error feedback. The control system attempts to drive the motor such that the mass is always balanced vertically above the shaft, as pictured below. The motor itself is attached to a robotic arm that may rotate around arbitrarily, so the motor will work to keep the mass vertical at all times.
The key thing to note here is that once the motor has achieved the set point (the mass is vertical above the shaft), it does not require any more work from the motor. No additional force is required to hold it there. In fact, there's enough back-drive friction in the gearing that even if the mass is, say, 10 degrees from vertical, it'll still stay put.
My question is in regards to correctly implementing a PID control loop for this kind of system. Here's the situation that has me confused:
Let's say the mass has come to rest deflected 5 degrees from vertical. In the PID loop, the P component is very small because the error is very small. So the integrator winds up to do most of the work of removing this steady-state error. It does its job and adds just enough power into the motor to drive the mass to the vertical position. Once the vertical position is achieved, no additional force is required to hold it there. But that integrator component still has a non-zero value and will keep driving the motor, making it push the mass passed the set point and to the other side. An inevitable oscillation about the set point will then occur.
Are there special considerations in a PID algorithm for this case? Or am I just fundamentally misunderstanding how a standard PID algorithm will react to the system I described above?
My original question was misusing the word "stable". Thank you to Carl Witthoft for pointing that out. The focus of my question, however, is how to properly implement a PID loop when the system requires that the control forces drop to zero as the position error approaches zero.