OCCRA
Go to Post Be kind to you mentors. They are exhausted and you need them. - MrJohnston [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

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 12-21-2016, 10:25 PM
ollien ollien is offline
Registered User
FRC #5202
Team Role: Alumni
 
Join Date: Feb 2015
Rookie Year: 2015
Location: United States
Posts: 493
ollien is a splendid one to beholdollien is a splendid one to beholdollien is a splendid one to beholdollien is a splendid one to beholdollien is a splendid one to beholdollien is a splendid one to beholdollien is a splendid one to behold
Drivetrain PID tuning

Today, I was encouraging my rookie programmers to utilize the NavX to experiment with PID Control in order to make our robot drive straight. Given that we've never done this in a season, one of the things that crossed my mind is how we should deal with the differences in CoFs between our lab's carpet and that of a true to life field. What have other teams done to account for this? Have you guys just purchased carpet, and just calibrated it on that? What would you use to re-tune your loop at competition?

Thanks so much!
Reply With Quote
  #2   Spotlight this post!  
Unread 12-21-2016, 10:36 PM
Jared Russell's Avatar
Jared Russell Jared Russell is offline
in hibernation
FRC #0254 (The Cheesy Poofs), FRC #0341 (Miss Daisy)
Team Role: Engineer
 
Join Date: Nov 2002
Rookie Year: 2001
Location: San Francisco, CA
Posts: 3,297
Jared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond repute
Re: Drivetrain PID tuning

Sensitivity to carpet variation is somewhat dependent on your drivetrain geometry and dynamics. A 6 wheel drive, dropped-center robot with a roughly central CoM and hard wheels is going to turn pretty similarly on a wide variety of floor surfaces. Meanwhile, a 4 wheel drive robot with a long wheelbase and pneumatic wheels may scrub quite differently depending on carpet.

Ideally your PID algorithm can be tuned to compensate for various types of floor conditions (after all, well-worn vs. brand new field carpet can be quite different in its own right!). If you are able to control your robot on a couple different types of surfaces at home (including whatever you have that is most similar to the field surface), you ought to be good when you get to competition.
Reply With Quote
  #3   Spotlight this post!  
Unread 12-22-2016, 11:28 AM
beijing_strbow's Avatar
beijing_strbow beijing_strbow is offline
Registered User
FRC #5968 (Cyborg Indians)
Team Role: Alumni
 
Join Date: Aug 2016
Rookie Year: 2016
Location: Kansas
Posts: 76
beijing_strbow is an unknown quantity at this point
Re: Drivetrain PID tuning

We're able to get pretty good straight driving using only the P term with the navX, so that may be worth trying. As for carpet, a local store gave us a 5x12 foot square of the official carpet (different color though).
Reply With Quote
  #4   Spotlight this post!  
Unread 12-22-2016, 02:33 PM
GeeTwo's Avatar
GeeTwo GeeTwo is offline
Technical Director
AKA: Gus Michel II
FRC #3946 (Tiger Robotics)
Team Role: Mentor
 
Join Date: Jan 2014
Rookie Year: 2013
Location: Slidell, LA
Posts: 4,654
GeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond repute
Re: Drivetrain PID tuning

Quote:
Originally Posted by beijing_strbow View Post
We're able to get pretty good straight driving using only the P term with the navX, so that may be worth trying. As for carpet, a local store gave us a 5x12 foot square of the official carpet (different color though).
A P only loop makes sense in this application, because there is so much physical damping/resistance in the yaw of a robot; there is no need for a software dampening. The navX is likely much more dependable than the wheels for determining orientation, that I would not use drive train encoders in the navigation loop, but ONLY to to feed the wheel/motor PID loop.

As far as color, if you insist on the right color, you'd need a new piece (or two) of carpet each year.
__________________

If you can't find time to do it right, how are you going to find time to do it over?
If you don't pass it on, it never happened.
Robots are great, but inspiration is the reason we're here.
Friends don't let friends use master links.
Reply With Quote
  #5   Spotlight this post!  
Unread 12-22-2016, 04:25 PM
Oblarg Oblarg is online now
Registered User
AKA: Eli Barnett
FRC #0449 (The Blair Robot Project)
Team Role: Mentor
 
Join Date: Mar 2009
Rookie Year: 2008
Location: Philadelphia, PA
Posts: 1,539
Oblarg has a reputation beyond reputeOblarg has a reputation beyond reputeOblarg has a reputation beyond reputeOblarg has a reputation beyond reputeOblarg has a reputation beyond reputeOblarg has a reputation beyond reputeOblarg has a reputation beyond reputeOblarg has a reputation beyond reputeOblarg has a reputation beyond reputeOblarg has a reputation beyond reputeOblarg has a reputation beyond repute
Re: Drivetrain PID tuning

Things to watch out for when doing this, based on personal experience:

1) It is very hard for a loop to keep you driving straight at max speed, because if your motors are saturated you can only slow down one side to adjust, rather than both slow down one side and speed up the other. If you give yourself some headroom, it will work much better.

2) Unless you are using cascading control (i.e. feeding the output of your heading loop to a wheel velocity loop), it is likely that you won't be able to make the p gain high enough on the heading loop to make steady state error acceptably small without introducing instability. A quick and dirty fix for this is to simply add or subtract some minimum output to/from the calculated heading loop output whenever it is outside of some tolerance around 0.
__________________
"Mmmmm, chain grease and aluminum shavings..."
"The breakfast of champions!"

Member, FRC Team 449: 2007-2010
Drive Mechanics Lead, FRC Team 449: 2009-2010
Alumnus/Technical Mentor, FRC Team 449: 2010-Present
Lead Technical Mentor, FRC Team 4464: 2012-2015
Technical Mentor, FRC Team 5830: 2015-2016
Reply With Quote
  #6   Spotlight this post!  
Unread 12-27-2016, 11:21 AM
sspoldi's Avatar
sspoldi sspoldi is offline
Steven Spoldi
AKA: Steve Spoldi
FRC #0230 (Gaelhawks)
Team Role: Mentor
 
Join Date: Mar 2010
Rookie Year: 2008
Location: Shelton, CT
Posts: 16
sspoldi is a splendid one to beholdsspoldi is a splendid one to beholdsspoldi is a splendid one to beholdsspoldi is a splendid one to beholdsspoldi is a splendid one to beholdsspoldi is a splendid one to behold
Re: Drivetrain PID tuning

Quote:
Originally Posted by ollien View Post
Today, I was encouraging my rookie programmers to utilize the NavX to experiment with PID Control in order to make our robot drive straight. Given that we've never done this in a season, one of the things that crossed my mind is how we should deal with the differences in CoFs between our lab's carpet and that of a true to life field. What have other teams done to account for this? Have you guys just purchased carpet, and just calibrated it on that? What would you use to re-tune your loop at competition?

Thanks so much!
We have never needed to re-tune for a change in carpet. Our typical heading stabilization is a PI controller for angular rate via gyro to stabilize heading. We tune via the following:

1.We do a quick system id on the yaw axis
a. Apply a moderate amplitude yaw step
(usually 1/2 max input on whatever yaw command input you have)
b. Model the angular rate output with the equation
rate = input*k*(1 - exp(-t/tau))

2. design a controller using the following architecture;
error = (yaw_cmd - yaw_rate)
motor_cmd = PID(error, Kp, Ki, Kd)
where:
Kp = gain/K*tau
Ki = gain/K
Kd = 0
gain = 5 to 10 (arbitrary, desired bandwith in rad/sec);

3. Vary gain to get the command response you want. We start at 10, and if it's too sluggish bump it up, if it oscillates or limit cycles (bounces back and forth due to backlash) we back it off.

Sorry for the terse explanation, but that's pretty much it. We do all our own code, so the PI controller is just written into the yaw service function. Sorry I don't have the code right now, but I can find it.

Cheers,
Steve.
Reply With Quote
  #7   Spotlight this post!  
Unread 12-28-2016, 09:38 AM
SamcFuchs's Avatar
SamcFuchs SamcFuchs is offline
Programmer
AKA: Sam Fuchs
FRC #0236 (TechnoTicks)
Team Role: Programmer
 
Join Date: Aug 2015
Rookie Year: 2014
Location: Old Lyme, Connecticut
Posts: 125
SamcFuchs has much to be proud ofSamcFuchs has much to be proud ofSamcFuchs has much to be proud ofSamcFuchs has much to be proud ofSamcFuchs has much to be proud ofSamcFuchs has much to be proud ofSamcFuchs has much to be proud ofSamcFuchs has much to be proud of
Re: Drivetrain PID tuning

Can anyone explain to me why so many teams use gyros for driving straight instead of encoders?
__________________
Sam Fuchs
236 TechnoTicks, Old Lyme, CT






2015 - Programming, Electrical
2016 - Lead Programmer, Co-Driver
2017 - Lead Programmer, Co-Driver
Reply With Quote
  #8   Spotlight this post!  
Unread 12-28-2016, 09:46 AM
Ty Tremblay's Avatar
Ty Tremblay Ty Tremblay is offline
Robotics Engineer
FRC #0319 (Big Bad Bob)
Team Role: Mentor
 
Join Date: Feb 2006
Rookie Year: 2004
Location: Alton NH
Posts: 953
Ty Tremblay has a reputation beyond reputeTy Tremblay has a reputation beyond reputeTy Tremblay has a reputation beyond reputeTy Tremblay has a reputation beyond reputeTy Tremblay has a reputation beyond reputeTy Tremblay has a reputation beyond reputeTy Tremblay has a reputation beyond reputeTy Tremblay has a reputation beyond reputeTy Tremblay has a reputation beyond reputeTy Tremblay has a reputation beyond reputeTy Tremblay has a reputation beyond repute
Re: Drivetrain PID tuning

Quote:
Originally Posted by SamcFuchs View Post
Can anyone explain to me why so many teams use gyros for driving straight instead of encoders?
Wheel slip is not a factor and the sensor's value more directly represents robot angle*. That being said, there are downsides to both so it's really just team preference.

*aka "math"
__________________

Last edited by Ty Tremblay : 12-28-2016 at 09:48 AM.
Reply With Quote
  #9   Spotlight this post!  
Unread 12-28-2016, 09:47 AM
GeeTwo's Avatar
GeeTwo GeeTwo is offline
Technical Director
AKA: Gus Michel II
FRC #3946 (Tiger Robotics)
Team Role: Mentor
 
Join Date: Jan 2014
Rookie Year: 2013
Location: Slidell, LA
Posts: 4,654
GeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond repute
Re: Drivetrain PID tuning

Quote:
Originally Posted by SamcFuchs View Post
Can anyone explain to me why so many teams use gyros for driving straight instead of encoders?
short answer: wheels slip.

Once the wheels have slipped against the carpet/floor/obstacle and you don't know how much, you can't reliably use the encoders (by themselves) to determine orientation. Gyros have more drift, but are not subject to this sudden loss of calibration.
__________________

If you can't find time to do it right, how are you going to find time to do it over?
If you don't pass it on, it never happened.
Robots are great, but inspiration is the reason we're here.
Friends don't let friends use master links.
Reply With Quote
  #10   Spotlight this post!  
Unread 12-28-2016, 09:49 AM
D.Allred's Avatar
D.Allred D.Allred is offline
Registered User
FRC #4451 (Rat Rod Robotics)
Team Role: Mentor
 
Join Date: Jun 2009
Rookie Year: 2009
Location: Greenville, SC
Posts: 264
D.Allred has a reputation beyond reputeD.Allred has a reputation beyond reputeD.Allred has a reputation beyond reputeD.Allred has a reputation beyond reputeD.Allred has a reputation beyond reputeD.Allred has a reputation beyond reputeD.Allred has a reputation beyond reputeD.Allred has a reputation beyond reputeD.Allred has a reputation beyond reputeD.Allred has a reputation beyond reputeD.Allred has a reputation beyond repute
Re: Drivetrain PID tuning

Quote:
Originally Posted by SamcFuchs View Post
Can anyone explain to me why so many teams use gyros for driving straight instead of encoders?
I found it easy to implement with arcade drive. The heading loop replaces the rotate joystick.

David
Reply With Quote
  #11   Spotlight this post!  
Unread 12-28-2016, 09:58 AM
SamcFuchs's Avatar
SamcFuchs SamcFuchs is offline
Programmer
AKA: Sam Fuchs
FRC #0236 (TechnoTicks)
Team Role: Programmer
 
Join Date: Aug 2015
Rookie Year: 2014
Location: Old Lyme, Connecticut
Posts: 125
SamcFuchs has much to be proud ofSamcFuchs has much to be proud ofSamcFuchs has much to be proud ofSamcFuchs has much to be proud ofSamcFuchs has much to be proud ofSamcFuchs has much to be proud ofSamcFuchs has much to be proud ofSamcFuchs has much to be proud of
Re: Drivetrain PID tuning

Quote:
Originally Posted by GeeTwo View Post
short answer: wheels slip.

Once the wheels have slipped against the carpet/floor/obstacle and you don't know how much, you can't reliably use the encoders (by themselves) to determine orientation. Gyros have more drift, but are not subject to this sudden loss of calibration.
Good point. I'm used to encoders because we use them for motion profiling, which you couldn't really do with a gyro.
__________________
Sam Fuchs
236 TechnoTicks, Old Lyme, CT






2015 - Programming, Electrical
2016 - Lead Programmer, Co-Driver
2017 - Lead Programmer, Co-Driver

Last edited by SamcFuchs : 12-28-2016 at 10:13 AM.
Reply With Quote
  #12   Spotlight this post!  
Unread 12-28-2016, 10:00 AM
SamcFuchs's Avatar
SamcFuchs SamcFuchs is offline
Programmer
AKA: Sam Fuchs
FRC #0236 (TechnoTicks)
Team Role: Programmer
 
Join Date: Aug 2015
Rookie Year: 2014
Location: Old Lyme, Connecticut
Posts: 125
SamcFuchs has much to be proud ofSamcFuchs has much to be proud ofSamcFuchs has much to be proud ofSamcFuchs has much to be proud ofSamcFuchs has much to be proud ofSamcFuchs has much to be proud ofSamcFuchs has much to be proud ofSamcFuchs has much to be proud of
Re: Drivetrain PID tuning

Quote:
Originally Posted by Ty Tremblay View Post
Wheel slip is not a factor and the sensor's value more directly represents robot angle*. That being said, there are downsides to both so it's really just team preference.

*aka "math"
Sure you get a number that represents your angle, but if you're trying to go a predetermined distance, encoders make corrections much easier.
__________________
Sam Fuchs
236 TechnoTicks, Old Lyme, CT






2015 - Programming, Electrical
2016 - Lead Programmer, Co-Driver
2017 - Lead Programmer, Co-Driver
Reply With Quote
  #13   Spotlight this post!  
Unread 12-28-2016, 12:20 PM
ollien ollien is offline
Registered User
FRC #5202
Team Role: Alumni
 
Join Date: Feb 2015
Rookie Year: 2015
Location: United States
Posts: 493
ollien is a splendid one to beholdollien is a splendid one to beholdollien is a splendid one to beholdollien is a splendid one to beholdollien is a splendid one to beholdollien is a splendid one to beholdollien is a splendid one to behold
Re: Drivetrain PID tuning

Quote:
Originally Posted by D.Allred View Post
I found it easy to implement with arcade drive. The heading loop replaces the rotate joystick.

David
How do you accomplish this? Do you just set your setpoint proportional to the position of the stick?
Reply With Quote
  #14   Spotlight this post!  
Unread 12-28-2016, 01:10 PM
ahartnet's Avatar
ahartnet ahartnet is offline
Registered User
AKA: Andrew Hartnett
FRC #5414 (Pearadox)
Team Role: Mentor
 
Join Date: Jan 2011
Rookie Year: 2005
Location: Houston, Texas
Posts: 281
ahartnet has a reputation beyond reputeahartnet has a reputation beyond reputeahartnet has a reputation beyond reputeahartnet has a reputation beyond reputeahartnet has a reputation beyond reputeahartnet has a reputation beyond reputeahartnet has a reputation beyond reputeahartnet has a reputation beyond reputeahartnet has a reputation beyond reputeahartnet has a reputation beyond reputeahartnet has a reputation beyond repute
Re: Drivetrain PID tuning

Quote:
Originally Posted by ollien View Post
How do you accomplish this? Do you just set your setpoint proportional to the position of the stick?
Code:
Robot.drivetrain.arcadeDrive(DriveForwardSpeed, (Robot.drivetrain.getGyroAngle().getAngle()));
You might want/need to multiply the gyro angle by a Kp or -Kp. We actually ended up with the following:

Code:
Robot.drivetrain.arcadeDrive(-DriveForwardSpeed, (-(Robot.drivetrain.getGyroAngle().getAngle()) * Kp+.1));
__________________
Team 5414 Pearadox, Mentor (2015-Present) | Website | Facebook
Team 2936 Gatorzillas, Mentor (2011-2014)
Team 1646 Precision Guessworks, Mentor (2006-2008)
Team 451 The Cat Attack, Student Alumni (2005)
Reply With Quote
  #15   Spotlight this post!  
Unread 12-28-2016, 01:13 PM
Jared Russell's Avatar
Jared Russell Jared Russell is offline
in hibernation
FRC #0254 (The Cheesy Poofs), FRC #0341 (Miss Daisy)
Team Role: Engineer
 
Join Date: Nov 2002
Rookie Year: 2001
Location: San Francisco, CA
Posts: 3,297
Jared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond repute
Re: Drivetrain PID tuning

Quote:
Originally Posted by SamcFuchs View Post
Good point. I'm used to encoders because we use them for motion profiling, which you couldn't really do with a gyro.
You can definitely do motion profiling with a gyro.
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 11:27 PM.

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