Hey guys I have a quick question I would like to ask.
We’re using a linear potentionmeter to give us an analog value so we can set the arm position (high, mid, low) based on the flick of a switch. However, we’re using P.I.D. control in order to get to where we need to be.
Now, the problem we have is the large amount of oscillation occuring after the switch is pressed, ex. the arm jumps way past the position, then comes back and hits the ground before re-adjusting to the right height. Our motor is geared down 21:1 which we’re hoping to increase to 64:1. Basically, what is the best way to eliminate oscillations through P.I.D. control?
Your P gain (multiplier) is too large. Reduce it until it gets there with little overshoot. (No overshoot is not as easy to compensate for as a little bit of overshoot)
There is an excellent whitepaper on how to tune a PID loop called PID without a PhD, look it up and it’ll explain it very well.
Alright, I did try to decrement the P multipilier, but after I did that, it didn’t seem like the motor was outputting enough power to raise the arm, I could try again however.
The not outputting enough is a problem with the integral (“I”) component being too low. You want to increase it (though small changes make a huge difference)
One trick we did to keep the I from building up too much is to set the integral error (the one that keeps adding each frame) to 0 when it has passed the target angle (you can clear it if it’s within 5 or 10 ticks, depending on what works best and your tolerance)
We had similar problems with our arm, and the main problem is that gravity makes this really two control problems, and one controller can’t be tuned to do both well.
When the arm is moving up, gravity turns it into a self-regulating process, which is easy to control with straight proportional. When the arm is moving down, gravity turns it into a runaway process, which is harder to control. We ended up measuring the speed of the arm when moving down, and controlled it that way.