OCCRA
Go to Post Now, if that team were to split...would it be dividing by zero? - Karibou [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 02-19-2018, 04:31 PM
3674 3674 is offline
Registered User
FRC #3674
 
Join Date: Jan 2018
Location: usa
Posts: 33
3674 is an unknown quantity at this point
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?
Reply With Quote
  #2   Spotlight this post!  
Unread 02-20-2018, 12:38 PM
Fletch1373's Avatar
Fletch1373 Fletch1373 is offline
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
Fletch1373 has a brilliant futureFletch1373 has a brilliant futureFletch1373 has a brilliant futureFletch1373 has a brilliant futureFletch1373 has a brilliant futureFletch1373 has a brilliant futureFletch1373 has a brilliant futureFletch1373 has a brilliant futureFletch1373 has a brilliant futureFletch1373 has a brilliant futureFletch1373 has a brilliant future
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...?]
Reply With Quote
  #3   Spotlight this post!  
Unread 02-20-2018, 12:46 PM
Kevin Sevcik's Avatar
Kevin Sevcik Kevin Sevcik is offline
(Insert witty comment here)
FRC #0057 (The Leopards)
Team Role: Mentor
 
Join Date: Jun 2001
Rookie Year: 1998
Location: Houston, Texas
Posts: 4,146
Kevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond repute
Send a message via AIM to Kevin Sevcik Send a message via Yahoo to Kevin Sevcik
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
Reply With Quote
  #4   Spotlight this post!  
Unread 02-20-2018, 01:10 PM
John Bottenberg John Bottenberg is offline
Unregistered User
AKA: JABot67
FRC #2930 (Sonic Squirrels)
Team Role: Engineer
 
Join Date: Feb 2009
Rookie Year: 2007
Location: Redmond, WA
Posts: 559
John Bottenberg has a reputation beyond reputeJohn Bottenberg has a reputation beyond reputeJohn Bottenberg has a reputation beyond reputeJohn Bottenberg has a reputation beyond reputeJohn Bottenberg has a reputation beyond reputeJohn Bottenberg has a reputation beyond reputeJohn Bottenberg has a reputation beyond reputeJohn Bottenberg has a reputation beyond reputeJohn Bottenberg has a reputation beyond reputeJohn Bottenberg has a reputation beyond reputeJohn Bottenberg has a reputation beyond repute
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-????
Reply With Quote
  #5   Spotlight this post!  
Unread 02-20-2018, 07:52 PM
3674 3674 is offline
Registered User
FRC #3674
 
Join Date: Jan 2018
Location: usa
Posts: 33
3674 is an unknown quantity at this point
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?
Reply With Quote
Reply


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 08:59 AM.

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


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