Go to Post DonRotolo used COMMON SENSE. ... ... FIRST/Chief Delphi Community fainted! - PayneTrain [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 22-01-2008, 15:38
Joohoo's Avatar
Joohoo Joohoo is offline
Registered User
FRC #0340 (G.R.R.)
Team Role: Mentor
 
Join Date: Jun 2005
Rookie Year: 2005
Location: Rochester
Posts: 241
Joohoo is just really niceJoohoo is just really niceJoohoo is just really niceJoohoo is just really niceJoohoo is just really nice
Send a message via AIM to Joohoo Send a message via Yahoo to Joohoo
PID without the D

so I looked around a bit for this and I can't seem to find a way to do this on the multiple white papers that are posted. So my question is, how do I use the proportional and Integral parts of the theory with out the derivative part of it.

I know how to do them individually but have no idea on how to combine ay of these aspects to do anything meaningful.

Thanks in advance for any help that can be provided
  #2   Spotlight this post!  
Unread 22-01-2008, 16:09
JonathanLKS JonathanLKS is offline
Code::Blocks
FRC #0610 (The Coyotes)
Team Role: Leadership
 
Join Date: Feb 2006
Rookie Year: 2005
Location: Toronto
Posts: 36
JonathanLKS will become famous soon enough
Send a message via MSN to JonathanLKS
Re: PID without the D

Well if you have a full PID loop up and running, then just set the D gain to zero and you'll be running PI, you'll need to retune the loop though.

Otherwise, if you have them running individually but not together, just take the output of P and I and add them together for a simple PI loop, once again you'll have to retune it.
__________________

Team 610 [ Co-Leader | Head Programmer | Webmaster ]
We're attending: Greater Toronto Regional, San Diego Regional, Championship

Last edited by JonathanLKS : 22-01-2008 at 16:11. Reason: typo
  #3   Spotlight this post!  
Unread 22-01-2008, 16:20
Joohoo's Avatar
Joohoo Joohoo is offline
Registered User
FRC #0340 (G.R.R.)
Team Role: Mentor
 
Join Date: Jun 2005
Rookie Year: 2005
Location: Rochester
Posts: 241
Joohoo is just really niceJoohoo is just really niceJoohoo is just really niceJoohoo is just really niceJoohoo is just really nice
Send a message via AIM to Joohoo Send a message via Yahoo to Joohoo
Re: PID without the D

Quote:
Originally Posted by JonathanLKS View Post
Well if you have a full PID loop up and running,
on that note, the PID loop, how fast do I really need it. Is the normal 26ms loop fast enough? or does this need to be faster?
  #4   Spotlight this post!  
Unread 22-01-2008, 16:27
ay2b's Avatar
ay2b ay2b is offline
Registered User
AKA: Andy
FRC #2928
Team Role: Mentor
 
Join Date: Mar 2004
Rookie Year: 1994
Location: Seattle, WA
Posts: 211
ay2b has a brilliant futureay2b has a brilliant futureay2b has a brilliant futureay2b has a brilliant futureay2b has a brilliant futureay2b has a brilliant futureay2b has a brilliant futureay2b has a brilliant futureay2b has a brilliant futureay2b has a brilliant futureay2b has a brilliant future
Re: PID without the D

Quote:
Originally Posted by Joohoo View Post
on that note, the PID loop, how fast do I really need it. Is the normal 26ms loop fast enough? or does this need to be faster?
a) We've always done the PID loop in the 26ms loop, and it's worked for us.
b) Since you can't update the PWM outputs any faster[*] than every 26ms, I don't see how running your PID calculations any faster would be of help to you.

Why do you want to do just a PI loop? I've heard of people using just P, or PD, but never PI.

[*] Actually, you can update your PWM outputs faster, if you use PWMs 13-16 and your own pwm generation functions (or one from a non-IFI library)
__________________

2011 - SD Quarterfinalists (980), LA Quarterfinalists (980)
2010 - LA (2404) Finalists (980), AZ Motorola Quality (980)
2009 - LA Semifinalists (980); Las Vegas Quarterfinalists (980); SD (2404); IRI #1 Seed, Finalist (980)
2008 - SD Quarterfinalists (980), LA Champions (980), LA Rookie Inspiration Award (2404); CalGames Finalists
2007 - So.Cal Finalists (980), SD Quarterfinalists (980); CalGames Finalists
2006 - So.Cal Regional Champion (4), Toronto Judge's Award Day 1 (4)
2005 - SVR Champions, Delphi "Driving Tomorrow's Technology" (980); AZ Xerox Creativity (980); So.Cal Finalists, RadioShack Innovation in Control (980); Championship Archimedes Division Semifinalists; IRI Finalists (980)
2004 - So.Cal Regional Champions, Leadership in Controls (980); AZ GM Industrial Design (980); Championship Galileo Division #2 Seed; IRI Champions
2003 - PNW Semi-finalists (488)
2002 - PNW Finalists (488)
2000 - X-bot / 488 - Mentor / Founder
1994 - Sunny Delight - Driver - champion
  #5   Spotlight this post!  
Unread 22-01-2008, 16:37
Alex.Norton's Avatar
Alex.Norton Alex.Norton is offline
Fidgetting
no team
 
Join Date: Apr 2005
Rookie Year: 2003
Location: Ft. Collins, Colorado
Posts: 190
Alex.Norton has much to be proud ofAlex.Norton has much to be proud ofAlex.Norton has much to be proud ofAlex.Norton has much to be proud ofAlex.Norton has much to be proud ofAlex.Norton has much to be proud ofAlex.Norton has much to be proud ofAlex.Norton has much to be proud of
Send a message via AIM to Alex.Norton Send a message via MSN to Alex.Norton
Re: PID without the D

I would think that doing a PI would be really unstable. The D part has the effect usually of dampening the I since the I will always overshoot the goal. Of course the instability will dampen itself over time because of friction in the system but I would agree that I have never seen a PI loop. Plenty of P+D and P-D and just P loops but never a PI loop.

What exactly is your reason for not using the derivative part of the loop?
  #6   Spotlight this post!  
Unread 22-01-2008, 16:57
billbo911's Avatar
billbo911 billbo911 is offline
I prefer you give a perfect effort.
AKA: That's "Mr. Bill"
FRC #2073 (EagleForce)
Team Role: Mentor
 
Join Date: Mar 2005
Rookie Year: 2005
Location: Elk Grove, Ca.
Posts: 2,356
billbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond repute
Re: PID without the D

Quote:
Originally Posted by Alex.Norton View Post
Plenty of P+D and P-D and ......
Not meaning to side track here, but that is what I'm going to do.

P+D and P-D, which is correct? Or should I ask, how do I determine which to use?
__________________
CalGames 2009 Autonomous Champion Award winner
Sacramento 2010 Creativity in Design winner, Sacramento 2010 Quarter finalist
2011 Sacramento Finalist, 2011 Madtown Engineering Inspiration Award.
2012 Sacramento Semi-Finals, 2012 Sacramento Innovation in Control Award, 2012 SVR Judges Award.
2012 CalGames Autonomous Challenge Award winner ($$$).
2014 2X Rockwell Automation: Innovation in Control Award (CVR and SAC). Curie Division Gracious Professionalism Award.
2014 Capital City Classic Winner AND Runner Up. Madtown Throwdown: Runner up.
2015 Innovation in Control Award, Sacramento.
2016 Chezy Champs Finalist, 2016 MTTD Finalist
  #7   Spotlight this post!  
Unread 22-01-2008, 16:11
Joe Ross's Avatar Unsung FIRST Hero
Joe Ross Joe Ross is offline
Registered User
FRC #0330 (Beachbots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Los Angeles, CA
Posts: 8,567
Joe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond repute
Re: PID without the D

If you know how to calculate the P, I, and D errors, combining them is easy. Just use a different gain constant for each and add the outputs together.

For example output = Kgain * Kerror + Igain * Ierror + Dgain * Derror.

Once you have code that does all three, an easy way to disable any of them is to set the gain to 0 for that one.
  #8   Spotlight this post!  
Unread 22-01-2008, 16:26
marccenter's Avatar
marccenter marccenter is offline
Registered User
FRC #3548 (RoboRavens2)
Team Role: Coach
 
Join Date: Sep 2004
Rookie Year: 2004
Location: Royal Oak
Posts: 406
marccenter has a spectacular aura aboutmarccenter has a spectacular aura about
Re: PID without the D - implementation of the I

When implementing the integral part, you can start by just adding or subtracting a constant value (start with one) and adding the integral part to the Proportional part. So, suppose you have a 5V analog potentiometer that is connected to an arm. The target or set point you want is 4V which corresponds to about 818 counts or units on the 10 bit A/D. If you are presently at 3V or about 614 counts or units, you want to move towards 818 counts. So, Error is 818 minus 614 = 204 counts. Multiply 204 by let's say 10 percent . To speed up calculation , use multiply by 26 and divide by 256 (26/256 is about 10 %).
So, (204 times 26)/256 is 20.7. With roundoff you will get 20 counts. Next, since PWM units are scaled 0 to 255, which is 1/4 range of 0-1023 a-d units, you will need to rescale (divide by 4) the 20 counts output by 4 to get 5 counts. This will be what you add to the present value you are already outputting to the PWM (which is scaled zero to 127 for one direction and 127 to 254 for the other direction). So if your present PWM output is 150 counts, you will add 5 counts for the proportional part of the 26.2 msec loop you are in. Next, since you are below your target, add 1 PWM output unit to the 150 counts for the integral portion of the PI gain. Remember this is all happening 38 times per second, so the numbers you add for the Proportional and Integral part can be small. Hope this sheds some insight into one way of making your PID work for you.
__________________
Marc Center
FIRST FRC Mentor/Coach - Team 3548 Royal Oak RoboRavens#2 - on Sabbatical 2017 season
marc.center@gmail.com
Mobile: 248-255-7377

Last edited by marccenter : 22-01-2008 at 16:28. Reason: Make page look better
  #9   Spotlight this post!  
Unread 22-01-2008, 17:06
Kevin Watson's Avatar
Kevin Watson Kevin Watson is offline
La Caņada High School
FRC #2429
Team Role: Mentor
 
Join Date: Jan 2002
Rookie Year: 2001
Location: La Caņada, California
Posts: 1,335
Kevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond repute
Re: PID without the D

Quote:
Originally Posted by Joohoo View Post
so I looked around a bit for this and I can't seem to find a way to do this on the multiple white papers that are posted. So my question is, how do I use the proportional and Integral parts of the theory with out the derivative part of it.

I know how to do them individually but have no idea on how to combine ay of these aspects to do anything meaningful.

Thanks in advance for any help that can be provided
Actually PI control loops are fairly common. If you have a situation where proportional control alone works well, it's common to add an integral term with a low gain to remove the fixed error inherent with proportional control. Here is example integer PI code from the camera tracking code:

Code:
//
// 
// x-axis/pan tracking code
//
//
 
// save the current pan servo PWM value into a local
// integer variable so that we can detect and correct 
// underflow and overflow conditions before we update 
// the pan servo PWM value with a new value
temp_pan_servo = (int)pan_servo_position;
 
// calculate how many image pixels we're away from the
// vertical center line.
pan_error = (int)T_Packet_Data.mx - (int)Tracking_Config_Data.Pan_Target_Pixel;
 
// Are we too far to the left or right of the vertical 
// center line? If so, calculate how far we should step
// the pan servo to reduce the error.
if(pan_error > (int)Tracking_Config_Data.Pan_Allowable_Error)
{
// calculate how far we need to step the pan servo
servo_step = pan_error / (int)Tracking_Config_Data.Pan_Gain;
 
// Due to rounding error in the division calculation above,
// the step may be calculated as zero, which will make it
// impossible to converge on the target when pan_error is
// smaller than Pan_Gain. To get around this problem, we just 
// test for the zero case and set the step size to one. 
 if(servo_step == 0)
{
    servo_step = 1;
}
}
elseif(pan_error <-1* (int)Tracking_Config_Data.Pan_Allowable_Error)
{
// calculate how far we need to step the pan servo
servo_step = pan_error / (int)Tracking_Config_Data.Pan_Gain;
 
// Due to rounding error in the division calculation above,
// the step may be calculated as zero, which will make it
// impossible to converge on the target when pan_error is
// smaller than Pan_Gain. To get around this problem, we just 
// test for the zero case and set the step size to one. 
 if(servo_step == 0)
{
    servo_step = -1;
}
}
else
{
// if we've fallen through to here, it means that we're
// neither too far to the left or too far to the right
// of the vertical center line of the image and don't 
// need to move the servo
servo_step =0;
 
// signal that the pan servo is on target
Tracking_State += STATE_PAN_ON_TARGET;
}
 
// add the step to the current servo position, taking into
// account the direction set by the user in tracking.h
temp_pan_servo += ((int)Tracking_Config_Data.Pan_Rotation_Sign * servo_step);
 
// check the pan servo PWM value for under/overflow
if(temp_pan_servo < (int)Tracking_Config_Data.Pan_Min_PWM)
{
 temp_pan_servo = (int)Tracking_Config_Data.Pan_Min_PWM;
}
elseif(temp_pan_servo > (int)Tracking_Config_Data.Pan_Max_PWM)
{
 temp_pan_servo = (int)Tracking_Config_Data.Pan_Max_PWM;
}
 
pan_servo_position = (unsigned char)temp_pan_servo;
 
// update pan servo PWM value
Set_Pan_Servo_Position(pan_servo_position);
-Kevin
__________________
Kevin Watson
Engineer at stealth-mode startup
http://kevin.org
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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Running the robot without a tether Hiromi Technical Discussion 3 05-10-2007 08:37
PID How to hold an arm in a fixed position without a locking gear box Ian_Xodus General Forum 29 28-01-2007 08:50
PID without a Ph.D. Joe Johnson Programming 3 07-02-2006 17:37
Emergency: PID with Wheels Off the Ground Rick TYler Programming 9 07-02-2006 11:37
Drive Straight C Code using Encoders without PID? Chris_Elston Programming 17 15-02-2005 23:41


All times are GMT -5. The time now is 23:15.

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