|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools |
Rating:
|
Display Modes |
|
#1
|
||||
|
||||
|
Tuning PID
On our robot is an arm with 3 positions
Up Middle Down Middle is about 1/4 the way between down and up (closer to down) We control the arm with encoders on AM-2971 motors. When we tell the arm to go from up to middle, it gets to the position fine, but when we go from down to middle, it undershoots and only goes about halfway. The current PID is 2, 0, 0. What can we change to make the arm not undershoot when moving the short distance between down and middle? |
|
#2
|
||||
|
||||
|
Re: Tuning PID
After you tune your P value, tune the I until the arm gets about to where it should be. The D value may not be necessary at all (0).
|
|
#3
|
||||
|
||||
|
Re: Tuning PID
Quote:
And how do I know when the P value is tuned? It seems to work, but is there a way I could make it work "better"? Last edited by TimTheGreat : 22-01-2016 at 17:07. |
|
#4
|
|||||
|
|||||
|
Re: Tuning PID
Quote:
A good method to start with (it's in no way optimal, but often good enough), is the Ziegler-Nichols method. Basically, set all three of P, I, and D to 0. Then, raise P (this can be by any amount, again, see guesswork) until there is oscillation around the setpoint. Then, increase D until the oscillation stops. If you're noticing a lot of friction in the system so it never quite gets to the setpoint, add some I to compensate. Take note, however, that long arms are tricky. The gravitational forces acting to pull the arm down vary nonlinearly based on the arm position - this makes it difficult to control, since it's difficult to model. That's not saying it's uncontrollable, but it'll take more work to make smooth. Last edited by plnyyanks : 23-01-2016 at 12:34. |
|
#5
|
|||||
|
|||||
|
Re: Tuning PID
Your initial problem is not that surprising. For an arm with a large angular displacement, the gravity torque is directed and proportional to the cosine of the arm's angle to the horizontal. This is going to give very different behavior up vs down. As stated above, tune P (and possibly I) so that the oscillation center is correct, then increase D to dampen the oscillations. P and I may require minor mods after increasing D, but probably not too severely.
|
|
#6
|
||||
|
||||
|
Re: Tuning PID
Sounds like a feedback error more than a PID issue. If the PID isn't making setpoint it should still be hunting and/or oscillating.
Are you trying to sense angular motion or linear motion? |
|
#7
|
||||
|
||||
|
Re: Tuning PID
Quote:
There are many combinations of values for the gains which will cause the system to do exactly as described in the original post: When we tell the arm to go from up to middle, it gets to the position fine, but when we go from down to middle, it undershoots and only goes about halfway. |
|
#8
|
||||
|
||||
|
Re: Tuning PID
I actually read the issue incorrectly.
Thank you for being condescending without any elaboration. |
|
#9
|
|||||
|
|||||
|
Re: Tuning PID
Quote:
Also, one of the main purposes of this forum is to help people with problems. That wasn't condescension, it was being helpful. |
|
#10
|
|||
|
|||
|
Re: Tuning PID
Quote:
1) Don't use I unless you have tried P and D extensively and can't get it to converge to the actual goal but can get it to converge close but not close enough. I rarely use I on 971's robots, and when I do, the loops end up being much more complicated and hard to reason about. 2) Start with 0.00001 for P (then D then I) and multiply them by a factor of 2 each time. I tend to round from 4 to 10 when multiplying to keep it easy. You'll quickly cover the space and learn what matters. One of my colleagues just multiplies by 10 each time. 3) Use the method recommended by plnyyanks You can also choose to gain-schedule your PID gains based on if you are above or below the goal. That would mean that you have 2 different coefficients depending on if the arm is below or above your setpoint. Unless you have mastered normal PID, I wouldn't try this. (I needed to do this on 254's 2011 elevator and claw to get them to converge nicely with PD) |
|
#11
|
||||
|
||||
|
Re: Tuning PID
Quote:
0.00001 0.00002 0.00005 0.00010 0.00020 0.00050 0.00100 0.00200 0.00500 ... |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|