Go to Post so instead of saying why, we said why not? - Alpha Beta [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #6   Spotlight this post!  
Unread 29-12-2012, 09:13
pfreivald's Avatar
pfreivald pfreivald is offline
Registered User
AKA: Patrick Freivald
FRC #1551 (The Grapes of Wrath)
Team Role: Mentor
 
Join Date: Jan 2007
Rookie Year: 2001
Location: Naples, NY
Posts: 2,296
pfreivald has a reputation beyond reputepfreivald has a reputation beyond reputepfreivald has a reputation beyond reputepfreivald has a reputation beyond reputepfreivald has a reputation beyond reputepfreivald has a reputation beyond reputepfreivald has a reputation beyond reputepfreivald has a reputation beyond reputepfreivald has a reputation beyond reputepfreivald has a reputation beyond reputepfreivald has a reputation beyond repute
Re: PID: what is it exactly?

A(n over-)simplified version of PID control (which others can feel free to correct or elaborate upon):

What it is: It's a way to get motors to do what you want them to do efficiently and smoothly.

What it does (as opposed to how it works):

The problem: Suppose you are a bending unit (named Bender Bending Rodriquez, for example), and you want to use your robotic arm, motor controlled, to lift a refreshing, foamy, and energy-filled beverage to your mouth. You can't just give the motor voltage willy-nilly until it arrives at your mouth, or you'll end up with operating near stall and possibly lighting your roboarm on fire, or slamming yourself in the face with the aforementioned lofty beverage (possibly spilling it, which would be tragic), etc. What you need is some kind of control.

The solutions:

P -- Proportional Control

Your voltage is at least related to speed, though this may be nonlinear depending on lots of variables (controllers, motors, mechanical setup, friction effects, etc). Let's assume that the general relationship that an increase in voltage generally results in an increase in speed.

The first thing we want to do is avoid destroying your beautiful face, or spilling the beverage (or both), by causing the arm to overshoot the target value.

So step one in your quest to refresh yourself is to measure the difference between where the arm is (distressingly far from your mouth) and where you want it to be (at your mouth). Call this "error".

The voltage you give the motor can then be made Proportional to the error, so that you supply more voltage further away, and correspondingly less voltage as you draw near.

And so this is what you do, and what you find is that the lofty beverage asymptotically approaches your mouth, but doesn't get there. Due to frictional effects and pesky mathematics, the speed approaches zero faster than the voltage does, and two things may occur:

#1. the motor runs at close to stall, drawing a lot of current (inefficient and possibly ouchy of the fire variety), and,

#2. the beverage remains tantalizing out of reach of your robolips -- it undershoots.

Solution:

I -- Integral Control

Measure not only the error of the arm, but also how much that error has changed since the last time you checked (which you can do really fast because you're not a meatbag, you're a robot, Bender.)

If the error has not changed as much as you wanted it to, add a little voltage. Do this over and over again, really fast, and you have yourself what approximately amounts to an Integration. [I mean, he's no Farnsworth, but that Newton guy was pretty smart. (Leibniz, too).] Voila! You've got enough voltage!

And yet, two things may occur:

1. as these little bits of voltage stack up, you get enough energy per charge to get that arm going again -- but you might smack yourself in the teeth with the bottle, as (for example) the static friction gives way to (weaker) kinetic friction, and or that pesky inertia gets involved. You've overshot, and,

2. as you shoot past your target error value, P and I become negative, so your arm switches direction and goes the other way... And overshoots, moving too low, causing the values to switch signs, so it comes back up and hits you in the face again, and then drops too low... You've got an oscillation, and while your mouth control might theoretically be good enough to steal sips on the way by, this ridiculous motion won't impress the robo-floozies, and that's not good enough for you, Bender.

Solution:

D -- Derivative Control

Whoa, there, Nelly! That arm's going a little bonkers now, and you're getting frustrated by the lack of liquid refreshment and robot-running ethanol... frustrated enough, perhaps, to kill all humans--but for that you need energy, and thus the lofty beverage! You've got it up to your face, but you can't hold it in position long enough to slake your thirst.

So what you want to do is damp things down, chill them out a bit. So what you do now is measure how fast the error is changing -- take its Derivative. (This is the calculus term derivative, so we're back to Newton and Leibniz). If the error is changing too fast, you cut the voltage. You can do this very quickly, again, because you're not a meatbag, you're a robot, Bender.

The Derivative control compensates for the overshoots of the Integral control, which compensates for the undershoots of the Proportional control, and the combination of the three (though all three are not always needed) results in a smooth, efficient motion that draws exactly as much current as it needs to, and gets that beverage right where it needs to be -- in your craw.

That was easy, wasn't it?
Attached Thumbnails
Click image for larger version

Name:	bender.jpg
Views:	13
Size:	26.7 KB
ID:	13362  
__________________
Patrick Freivald -- Mentor
Team 1551
"The Grapes of Wrath"
Bausch & Lomb, PTC Corporation, and Naples High School

I write books, too!

Last edited by pfreivald : 29-12-2012 at 10:09.
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 16:27.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi