Now, if that team were to split...would it be dividing by zero? - Karibou [more]
 Chief Delphi Pid working differently at different distances
 CD-Media CD-Spy
 portal register members calendar search Today's Posts Mark Forums Read FAQ rules

#1
02-19-2018, 04:31 PM
 3674 Registered User FRC #3674 Join Date: Jan 2018 Location: usa Posts: 33
Pid working differently at different distances

We tuned our pid to 10 ft and it seemed accurate. But when running it for 5 feet it was not accurate at all. Any ideas?
#2
02-20-2018, 12:38 PM
 Fletch1373 Registered User AKA: Fletch FRC #1126 (SPARX(1126) and Panthers(3181)) Team Role: Mentor Join Date: Jan 2008 Rookie Year: 2003 Location: Webster, NY Posts: 289
Re: Pid working differently at different distances

We're definitely going to need more information.... Is your code posted anywhere? Also, how inaccurate is it? If it's only off by an inch or two, "meh". If it's off by 3 feet, "yowzah"
__________________
Student:
<05-08: FRC1373> <04: FRC0213>
Mentor:
<18-??: FRC1126> <15-??: FRC3181> <12-14: FRC0073> <11-12: FRC3555> <09-10: FRC0809>
Volunteer:
<FTAA> <CSA> <Scorekeeper> <Robot Inspector> <and many more...>
2018 Tour:
NYUT[CSA] > CTWAT[FTAA] > NYRO[CSA] > DetCMP[maybe...?]
#3
02-20-2018, 12:46 PM
 Kevin Sevcik (Insert witty comment here) FRC #0057 (The Leopards) Team Role: Mentor Join Date: Jun 2001 Rookie Year: 1998 Location: Houston, Texas Posts: 4,146
Re: Pid working differently at different distances

PID is not a great solution for drivetrain trajectories, assuming you're doing a position PID and just setting the target to 10' or 5'. If you have any I term at all, it's going to to wind up a lot over 10' versus 5', which probably means you're either overshooting 10' or undershooting 5'. It's probably too late to implement, but depending on your motor controller solution, Talon Motion Magic could work, or Jaci's Pathfinder both would work very well.

If not, you could try ramping your position instead of making one giant step. The basic idea would be to start with a target of 0, then add a small amount to it every loop until you get to 10'. That would require different (tighter/faster) tuning parameters, but it's going to be much more repeatable over different distances, especially if you don't change the ramp rate/speed.
__________________
The difficult we do today; the impossible we do tomorrow. Miracles by appointment only.

Lone Star Regional Troubleshooter
#4
02-20-2018, 01:10 PM
 John Bottenberg Unregistered User AKA: JABot67 FRC #2930 (Sonic Squirrels) Team Role: Engineer Join Date: Feb 2009 Rookie Year: 2007 Location: Redmond, WA Posts: 559
Re: Pid working differently at different distances

Hi, Cloverbots!

Are you using the I term?

First, other posters in this thread have pointed out the problem with PID control in drivetrain control, and that is the I term. Since the I term is proportional the sum of error of all previous samples, where "error" in this case means the distance between your current sensor location and your setpoint, it stands to reason that the further away from the target you started, and the longer it takes you to get to your setpoint, the bigger the I term will be. This is not desirable in drivetrain control.

Most drivetrain position feedback control I've seen has used PD control, eliminating the I term completely. This allows you to control the robot's drivetrain position using only (relatively) current information. PD control can be pretty accurate; I'm not an expert in feedback control tuning, but I can say that my teams have had success with the following drivetrain tuning instructions:

1.) Tune using just P control. Set kP to a reasonable value, and keep kI and kD at zero. Test multiple distances. Tune the P control so that the robot slightly overshoots and then corrects itself.
2.) Introduce a non-zero D constant, keeping kI at zero. If the robot still overshoots, increase kD until it doesn't overshoot anymore, again testing different distances. If the robot starts oscillating or behaving erratically (stop-go-stop-go) before it has even reached the setpoint, decrease kD.
3.) There is no third step. Your PD control is tuned! Maybe verify that the control repeatably gets you to within a small tolerance of the setpoint. This year, my team has been able to get it to within an inch or so most of the time.

Good luck this year, and I hope to see you at the Pacific Northwest Championship!
__________________
FLL Team "Dark Matter": 2003-2005
Robofest Team "Dark Matter": 2005-2008
Team 67 Programmer: 2007-2010
Team 3322 Programming Mentor: 2012-2014
Team 2930 Engineering Mentor: 2015-????
#5
02-20-2018, 07:52 PM
 3674 Registered User FRC #3674 Join Date: Jan 2018 Location: usa Posts: 33
Re: Pid working differently at different distances

Yes! That was our issue. All the documentation we were finding was telling us to do P, then add in I, and it was causing us to way overshoot. So, a with the gracious professionalism of FIRST, we were told to just do P, then D and it worked marvelous.

We are now starting to tune the PID on our gyro and having problems, but P with D isn't working quite as well as it did on the drive train. Any ideas?

 Thread Tools Display Modes Rate This Thread Linear Mode Rate This Thread: 5 : Excellent 4 : Good 3 : Average 2 : Bad 1 : Terrible

 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 User Control Panel Private Messages Subscriptions Who's Online Search Forums Forums Home Announcements     User Announcements FIRST     General Forum         FIRST E-Mail Blast Archive     Rumor Mill     Career     Robot Showcase Technical     Technical Discussion     Robotics Education and Curriculum     Motors     Electrical         CAN     Programming         NI LabVIEW         C/C++         Java         Python     Control System         FRC Control System         Sensors     Pneumatics     Kit & Additional Hardware     CAD         Inventor         SolidWorks         Creo     IT / Communications         3D Animation and Competition         Website Design/Showcase         Videography and Photography         Computer Graphics     National Instruments LabVIEW and Data Acquisition         LabView and Data Acquisition Competition     Unsung FIRST Heroes     Awards         Chairman's Award     Rules/Strategy         Scouting         You Make The Call     Team Organization         Fundraising         Starting New Teams         Finding A Team         College Teams     Championship Event     Regional Competitions     District Events     Off-Season Events     Thanks and/or Congrats     FRC Game Design     OCCRA         OCCRA Q&A         OCCRA Programming Other     Chit-Chat         Games/Trivia             Fantasy FIRST     Car Nack's Corner     College & University Education     Dean Kamen's Inventions     FIRST-related Organizations         Western Region Robotics Forum         Southern California Regional Robotics Forum         The Blue Alliance             Video Archives     FIRST In the News...     FIRST Lego League         Lego Mindstorm Discussion     FIRST Tech Challenge     VEX         VEX Robotics Competition         VEX IQ     Televised Robotics     Math and Science         NASA Discussion ChiefDelphi.com Website     CD Forum Support     Extra Discussion

All times are GMT -5. The time now is 08:59 AM.

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

 -- English (12 hour) -- English (24 hour) Contact Us - Chief Delphi - Rules - Archive - Top