|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||||
|
|||||
|
We have a PID control loop to control velocity of a motor. We have the tooth counter giving us our current velocity, and an OI analog input giving us our target. The code is written such that the motor can never go backwards. (The tooth counters are giving us a speed of about 0-18, we're hoping to increase that range a little.)
The problem is that, when using only a P loop, it oscillates violently at mid- to low-speeds. Meaning that it revs up, then stops, revs up then stops, etc. (Victor set to coast.) Anyone seen this before in their own code? Any recomendations on using PID for velocity->velocity control loops? |
|
#2
|
|||||
|
|||||
|
Re: Problems Using PID for Velocity
We saw exactly that behavior last year with a simpleminded attempt at closed-loop speed control. Adding the D term is absolutely the most reasonable way to resolve the oscillation.
It can be resolved with a much quicker control loop, but you'll definitely have issues measuring the speed if you try it that way. |
|
#3
|
||||
|
||||
|
Re: Problems Using PID for Velocity
Quote:
- Set Kd to 0. - Increase Kp slowly until the robot starts to oscillate around its setpoint. Watch the oscillations, are they dying down, or staying consistent? - - + If yes, then set Kp to about 30% of its current value. - - + If no, then Kp is set way too high, for some reason. Reduce it by 60%, and watch for the oscillations again. When the oscillations are reasonable (staying about constant, or dying away, and aren't too violent), then move to the next step. - Increase Kd slowly until the robot "snaps" to its setpoint. - If the robot "snaps" eventually, but there is some error between where it snaps, and the desired setpoint (and you can't live with this error), then you have to add in a bit of Ki. - Ki is usally ends up being 1/Kd. I don't like Ki for velocity control purposes, but you can fiddle with it if you want. |
|
#4
|
|||||
|
|||||
|
Re: Problems Using PID for Velocity
Quote:
Quote:
|
|
#5
|
||||
|
||||
|
Re: Problems Using PID for Velocity
Ahaha. Ambiguity follows me around, it seems. Glad its up and working.
|
|
#6
|
|||
|
|||
|
Re: Problems Using PID for Velocity
We are using the PID code as it was originally provided. As the velocity approaches the target value, the error approaches zero and the corresponding pwm value will also go to zero. This seems to hold the velocity at about half of the commanded value, which makes sense. Have other teams had this problem and how have you gotten around it? Also in the tuning example from Joel J., what do you do with DIV_V?
|
|
#7
|
|||||
|
|||||
|
Re: Problems Using PID for Velocity
Increase the I term to eliminate steady-state error.
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Concept of PID explained | ConKbot of Doom | Technical Discussion | 11 | 01-27-2008 12:11 AM |
| Anyone Else Having Problems with Q&A on FIRST? | Windwarrior | General Forum | 6 | 01-25-2006 10:54 AM |
| PID cmd_drive can't drive straight? | gnormhurst | Programming | 4 | 02-18-2005 01:54 AM |
| All-Time PID Drive with Hall-effects: Coming along very nicely | jdong | Programming | 6 | 02-05-2005 07:39 PM |
| PC problems. . . | opnickc | IT / Communications | 5 | 01-12-2005 04:53 PM |