I'm trying to control the position of a brushless DC gearmotor. To drive the motor, I have a controller box that provides a velocity that is proportional to a 0 to 5 V input. The motor has it's own Hall sensors for measuring velocity. I also have a rotary encoder attached to the motor to measure position.
I'm looking for an algorithm to control absolute position/angle of the motor (i.e. the outer loop in the diagram above). The first thing I tried was a PID loop which supplied a 0 to 5 V signal based on the position error calculated from the encoder. I was not able to tune the loop to go to a position quickly and accurately. And I have my doubts as to whether PID is even suitable for this kind of topology.
The algorithm I'm using now is to use KP only, but as my motor gets close to the setpoint, I lower the KP. I think I lower the KP about 4 times before I come to a complete stop. This algorithm kind of works, but it's highly unusual. It is pretty fast.
I've seen this question but found the answers to not be helpful.