Thread: PID Control
View Single Post
  #13   Spotlight this post!  
Unread 07-04-2007, 22:59
EricVanWyk EricVanWyk is offline
Registered User
no team
 
Join Date: Jan 2007
Rookie Year: 2000
Location: Boston
Posts: 1,597
EricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond repute
Send a message via AIM to EricVanWyk
Re: PID Control

Quote:
Originally Posted by sumadin View Post
The way we've handled it is that we reset the I term once the robot has settled in place. That way, it is used when necesary, and turns itself off when it hits the target.

Edit: something to the extent of
if(error > -n && error < -n){
I = 0;
output = 0;
}
Do not do this.

The integral term takes care of the low frequency to DC part of control. If you remove the I part when you are at rest, you will always be slightly off.


Imagine you are attempting to control the position of a pendulum such that it sticks out perfectly horizontal. The pendulum has finite mass, and you have a force driver at the pivot point. Note that motors are not ideal force drivers, they have funny curves.

Implement Proportional control only. This is exactly equivalent to making your force driver into a rotational spring. If you let it go, it will oscillate about the 90* home point. Eventually, it will come to a stop from friction in the mechanical system. If you had perfect bearings, it oscillate for ever.

Well that sucks. Lets add Derivative control. This is exactly equivalent to adding a damper to your spring. This term always adds force opposite to the direction of motion. Since work is force dot distance, this is a negative amount of energy. This will dampen the oscillations, and it will come to rest much sooner. Effectively, you put more friction in (sort of... - we are off by one rank)

Put look! It came to rest 10 degrees lower than you told it to. The blasted thing is drooping!

Why? Well, we have a spring and a damper fighting gravity. If the system were at rest where you told it to be, both P and D (spring and damper) would contribute no force, but gravity would. Naturally, it falls until P is large enough to counteract gravity.

This is where I comes in. It sees P and D failing to do the whole job, so it slowly gets angry and pushes the arm back up. NOW it will rest where it is supposed to. Remember though, at steady state ONLY the I term is active. P and D are both 0.

In summary:
P and I are both conservative terms. Only D removes energy from the system.
D handles high frequency stuff, I handles the low frequency stuff, and P is somewhere in between (actually, it has a flat spectral response).



If you really want to make the system "impure", i would suggest tying I to D nonlinearly. Perhaps I shouldn't be doing much while you are still trying to sprint to the set point.

Eric