Go to Post Our rookie drivers generally get their first "real match" experience at the Florida Regional which is usually a week 2 or week 3 event. That is a much easier "practice event" than IRI. - Kit Gerhart [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

 
Closed Thread
 
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 13-03-2011, 11:49
Chris27's Avatar
Chris27 Chris27 is offline
Registered User
AKA: Chris Freeman
FRC #1625 (Winnovation)
Team Role: Alumni
 
Join Date: Mar 2005
Rookie Year: 2004
Location: Mountain View
Posts: 196
Chris27 has a brilliant futureChris27 has a brilliant futureChris27 has a brilliant futureChris27 has a brilliant futureChris27 has a brilliant futureChris27 has a brilliant futureChris27 has a brilliant futureChris27 has a brilliant futureChris27 has a brilliant futureChris27 has a brilliant futureChris27 has a brilliant future
Re: PID Loops

read this starting at page 23

http://www.cs.cmu.edu/afs/cs/academi...y_friction.pdf


Basically, PID is a function that takes an input a target (set point) you want to achieve and your current error to this target and outputs the motor speed to get there.

P refers to a term that is proportional to the error. It is used to achieve the desired rise time to get to the set point. However having a high P will cause
the system to oscillate around the set point.

D refers to a term that is proportional to he derivative of the error. It is used to dampen the system to reduced the oscillations. If you overly dampen the system, you may rob it of the power it needs to actually reach the set point. This is called steady state error.

I refers to a term that is proportional to the integral of the error. It is used to address steady state error. Basically, as long as error persists, the system will try harder and harder to reduce the error. This may become dangerous because of wind up. E.g. say that you disable power to a motor
for a moment. The I term will cause the speed output to rise as the error is
not going away (the motor is disabled). When the motor is finally re enabled, it will go flying.

Sometimes you can get away with just using P especially if there is a lot of
friction in the system which would make it hard to shoot past the set point.

Hope that helps.
  #2   Spotlight this post!  
Unread 13-03-2011, 13:09
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,077
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: PID Loops

Quote:
Originally Posted by Chris27 View Post
D refers to a term that is proportional to he derivative of the error.
In the LabVIEW PID vi, D is the derivative of the process variable... not the error.


  #3   Spotlight this post!  
Unread 13-03-2011, 13:47
theNerd's Avatar
theNerd theNerd is offline
Registered User
FRC #3329 (Cam Bots)
Team Role: Programmer
 
Join Date: Jan 2011
Rookie Year: 2110
Location: St. Marys
Posts: 51
theNerd is an unknown quantity at this point
Re: PID Loops

Quote:
Originally Posted by Chris27 View Post
read this starting at page 23

D refers to a term that is proportional to he derivative of the error.

I refers to a term that is proportional to the integral of the error
I still don't understand to much about the details on how to find the derivative of the error (or the integral). I understand that the derivative of an equation is e.g.: instantaneous velocity, for instance F(x)' 4x^4 = 16x^3 (not pretending anything however I don't know the in depths of the derivatives all i know from second hand learning is the power rule). However my knowledge on integrals is null. How do you find the integral and derivative?
  #4   Spotlight this post!  
Unread 13-03-2011, 14:03
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,077
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: PID Loops

Quote:
Originally Posted by theNerd View Post
I still don't understand to much about the details on how to find the derivative of the error (or the integral). I understand that the derivative of an equation is e.g.: instantaneous velocity, for instance F(x)' 4x^4 = 16x^3 (not pretending anything however I don't know the in depths of the derivatives all i know from second hand learning is the power rule). However my knowledge on integrals is null. How do you find the integral and derivative?
If you are using PID functions that came with the language you are using, you don't have to. It is done within the provided library function.

All you need supply are:
the setpoint (the target value),

the process variable (the measured - with a sensor - value of what you are trying to control),

the 3 "gains" P, I, D

and any other optional inputs to the function such as output range

See attached screenshot of LabVIEW's PID


Attached Thumbnails
Click image for larger version

Name:	LabVIEW PID (help).png
Views:	54
Size:	18.3 KB
ID:	10401  

Last edited by Ether : 13-03-2011 at 14:06.
  #5   Spotlight this post!  
Unread 13-03-2011, 14:20
Chris27's Avatar
Chris27 Chris27 is offline
Registered User
AKA: Chris Freeman
FRC #1625 (Winnovation)
Team Role: Alumni
 
Join Date: Mar 2005
Rookie Year: 2004
Location: Mountain View
Posts: 196
Chris27 has a brilliant futureChris27 has a brilliant futureChris27 has a brilliant futureChris27 has a brilliant futureChris27 has a brilliant futureChris27 has a brilliant futureChris27 has a brilliant futureChris27 has a brilliant futureChris27 has a brilliant futureChris27 has a brilliant futureChris27 has a brilliant future
Re: PID Loops

Computing the derivative is easy as it is just change over time. Computing the integral is a bit more involved. You can use Fourth order Runge-Kutta to estimate the integral

http://mathworld.wolfram.com/Runge-KuttaMethod.html
http://doswa.com/blog/2009/01/02/fou...l-integration/

If you are using a PID function of some library, you probably don't need to worry about computing derivatives and integrals and will probably just need to pass it the desired set point and the current location/sensor reading (like in Labview)
  #6   Spotlight this post!  
Unread 13-03-2011, 14:40
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,077
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: PID Loops

Quote:
Originally Posted by Chris27 View Post
Computing the integral is a bit more involved. You can use Fourth order Runge-Kutta to estimate the integral
"Euler's Method is the most common integration method for control systems . Control methods such as PID do not need exact integration to work well. This is because the purpose of the integral is usually to force the average error to zero to ensure that the controlled signal matches the command signal over long periods of time. Only rarely is there a need to control the integral of a signal. In those cases you may need a more accurate integration method."


Control System Design Guide
Second Edition
George Ellis
Page 82


  #7   Spotlight this post!  
Unread 13-03-2011, 15:39
archaopteryx archaopteryx is offline
Registered User
FRC #2067
 
Join Date: Mar 2011
Location: Guilford
Posts: 2
archaopteryx is an unknown quantity at this point
Re: PID Loops

I'm not a mathematician, but couldn't
Quote:
Pedal = K * Error
, where K is a constant, simply do without K? If pedal and error have a direct correlation, why can't you just say that pedal = error and leave it at that?
  #8   Spotlight this post!  
Unread 13-03-2011, 15:44
Chris27's Avatar
Chris27 Chris27 is offline
Registered User
AKA: Chris Freeman
FRC #1625 (Winnovation)
Team Role: Alumni
 
Join Date: Mar 2005
Rookie Year: 2004
Location: Mountain View
Posts: 196
Chris27 has a brilliant futureChris27 has a brilliant futureChris27 has a brilliant futureChris27 has a brilliant futureChris27 has a brilliant futureChris27 has a brilliant futureChris27 has a brilliant futureChris27 has a brilliant futureChris27 has a brilliant futureChris27 has a brilliant futureChris27 has a brilliant future
Re: PID Loops

Quote:
Originally Posted by archaopteryx View Post
I'm not a mathematician, but couldn't , where K is a constant, simply do without K? If pedal and error have a direct correlation, why can't you just say that pedal = error and leave it at that?

If you are trying to move your car at 50 mph and currently, the error from this target is +10 mph, does it make sense to push the pedal down at 10 mph? A correlation does not mean an equivalent 1 to 1 relation. Another example is if you are trying to drive your robot 5 feet forward and the current error is 4 inches. Does it make sense to tell the motors to drive at 4 inches? Built into the k value is unit conversion among other things.

Last edited by Chris27 : 13-03-2011 at 15:48.
  #9   Spotlight this post!  
Unread 13-03-2011, 15:54
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,077
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: PID Loops

Quote:
Originally Posted by archaopteryx View Post
I'm not a mathematician, but couldn't , where K is a constant, simply do without K? If pedal and error have a direct correlation, why can't you just say that pedal = error and leave it at that?
If you are trying to control position, then the error will be in inches (or feet or meters or whatever). In response to this error, you want to choose the appropriate command to your motors, which will be a voltage command... which roughly corresponds to a speed command. So the K is a scaling and gain factor to convert the error to an appropriate motor voltage (speed) command.

On the other hand, suppose you are trying to control motor speed. You want to go 2000 rpm and you are presently going 1900 rpm. So the error is 100 rpm. Would it make sense to give the motor a voltage command which is roughly equal to 100 rpm?


Closed Thread


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 03:51.

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