While we're on the topic of games... there have to be some people who'd be interested in a good round of FIRST ROBOTICS!!!!!!!!!!!!!!!!!!! :p :yikes: :D :rolleyes: - Leav [more]
 Chief Delphi Tuning a PIDF follower on a robot with high gearing
 User Name Remember Me? Password
 CD-Media CD-Spy
 portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 Thread Tools Rate Thread Display Modes
#31
10-11-2017, 03:05 PM
 noah.gleason Registered User FRC #0449 (The Blair Robot Project) Team Role: Programmer Join Date: Mar 2017 Rookie Year: 2016 Location: Bethesda, MD Posts: 139
Re: Tuning a PIDF follower on a robot with high gearing

Quote:
 Originally Posted by Classified* Question, How did you measure the points on this graph? Was your robot up on blocks or on the ground? It seems like you would only get an intercept if the robot is on the ground.
The code is here: https://github.com/blair-robot-proje...VsVoltage.java

To quickly explain, I fed a list of voltage into that command, and for each one, the robot would drive forwards, on the ground, at that voltage, for 20 feet, then go back to 0 position at 3 volts, then drive forwards again with the next voltage, etc. You can use the drive-back to measure data too, but we didn't because we used an incredibly back-heavy robot that would've tipped if we had tried to switch from -11v to 12v.

The voltage you command isn't really close to what the motor outputs, so while the robot is driving back and forth, you have to log both the velocity and the voltage. We then looked through the logs and tried to find when the velocity leveled out for each voltage, then took the average vel and voltage after it leveled out and plotted that.
#32
10-11-2017, 03:28 PM
 Jared Russell 4933T15 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,550
Re: Tuning a PIDF follower on a robot with high gearing

Ka is definitely not 1/acceleration. There is better advice in this thread on how to tune it analytically, and the procedure you followed is generally what I do. Kp can generally be very high in profile following applications, because you never expect to have large errors - that's precisely why you are using a profile! In practice, you may want to detect the case that error is very large and abort your profile in this case (or replan a new one if you are fast enough).
#33
10-11-2017, 03:52 PM
 Classified* Drive it like you stole it AKA: Julia Cecchetti (the girl in the orange fedora) FRC #0291 (CIA: Creativity in Action) Team Role: Alumni Join Date: Nov 2015 Rookie Year: 2015 Location: Erie PA Posts: 278
Re: Tuning a PIDF follower on a robot with high gearing

Quote:
 Originally Posted by noah.gleason The code is here: https://github.com/blair-robot-proje...VsVoltage.java To quickly explain, I fed a list of voltage into that command, and for each one, the robot would drive forwards, on the ground, at that voltage, for 20 feet, then go back to 0 position at 3 volts, then drive forwards again with the next voltage, etc. You can use the drive-back to measure data too, but we didn't because we used an incredibly back-heavy robot that would've tipped if we had tried to switch from -11v to 12v.
Thanks! I will try this when I get the time.

In general, did I tune kv and ka well enough before adding kp, referring back to my first post? Is the effect of the velocity intercept such that it is impossible it get it better with only kv and ka (excluding perturbations)?
__________________

2018 Tesla Subdivision 8th alliance captain Quarter Finalist with 5675, 1360, and 4039
2018 Buckeye Regional Finalist with 379 and 6490, Quality Award
2017 NEOFRA MVRC Winner with 2399 and 2252
2017 Steel City Showdown Winner with 2614 and 3260
2017 WOW Championship Finalist with 4145, 3138, and 3511
2016 Rachacha Ruckus Finalist with 5406 and 639
2015 Rachacha Ruckus Finalist with 1126 and 5406
2015 NEOFRA MVRC Finalist with 48 and 379
2015 Buckeye Regional Finalist with 48 and 5413
Team291.com
#34
10-11-2017, 04:54 PM
 Oblarg 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,901
Re: Tuning a PIDF follower on a robot with high gearing

Quote:
 Originally Posted by Classified* Question, How did you measure the points on this graph? Was your robot up on blocks or on the ground? It seems like you would only get an intercept if the robot is on the ground.
Those tests were steady-state and on the ground. The intercept would, indeed, be much smaller if it had been on blocks.

Re: measuring Ka, one thing we're going to try to do in a future test is, after determining our Kv and intercept, run the robot at some voltage well below max (to avoid slipping the wheels) while logging acceleration with our accelerometer, and performing the following calculation for each time slice:

Vacc = (V - Kv*vel - intercept)

Here, Vacc should be the "amount of voltage going towards causing acceleration" (this is not quite equal to the voltage across the motor windings, because some amount of the motor's output torque is going towards overcoming friction, as is accounted for by the intercept term). Thus, if we plot Vacc versus our measured acceleration, the slope of the resulting line (which, hopefully, will pass through the origin as we have already subtracted off the intercept due to friction) should be Ka. Thus, we just perform another linear regression to determine it (possibly one constrained to have an intercept of zero).
__________________
"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

FRC Drivetrain Characterization

Last edited by Oblarg : 10-11-2017 at 07:34 PM.
#35
10-14-2017, 08:11 PM
 Oblarg 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,901
Re: Tuning a PIDF follower on a robot with high gearing

After another fruitful day of testing, we at 449 come bearing more data!

As discussed in the previous post, this is a graph of measured acceleration versus "acceleration-causing voltage," from a test in which we ran our robot from a dead stop at 60% of max voltage for 2.5 seconds.

How did we determine these? Well, acceleration was calculated from our encoder readings, averaging over 4 ticks. We first tried using instantaneous readings from the NavX accelerometer - no dice, the noise was atrocious (though the plots were roughly similar in shape where the signal was not buried in the noise) - and found the calculated value from the encoders to be too noisy if computed over a single time slice, as well. "Acceleration-causing voltage" was calculated as described above: "Applied voltage - Kv*vel - intercept," where "applied voltage" was read by the Talon's "getOutputVoltage" method (as this only updates at 10 Hz, which is slower than our logging loop, a rolling average was used to smooth it), and Kv and "intercept" were determined as described in previous posts.

The fit line is constrained to an intercept of zero - the actual intercept corresponds to about .08 volts, which is insignificant (and also encouraging, as the intercept *ought* to be zero given our formulation), and has a slope of ~4.4 ft/(V*s^2). This corresponds to a maximum acceleration (at 12V) of ~55 ft/s^2.

The graphs all look nice, the assumptions seem to be holding, and this appears to be a perfectly easy and reasonable way of determining a suitable value for Ka.

The only wrinkle:

Our test robot weighs ~113 lbs, including battery. It has wheels with a measured rolling diameter of ~3.8 inches (and thus a radius of ~1.9 inches). It has a 6-CIM drive, geared at 6.1:1.

The stall-torque of a CIM is, ostensibly, ~340 oz-inches. Doing what I believe to be the appropriate calculation (it is dimensionally correct, at least) yields a peak acceleration of slightly more than twice than is consistent with our observed voltage/acceleration curve.

What gives? Where's that factor of two coming from? Our approach ought to already be compensating for friction. Admittedly, the CIMs are several years old; should that matter? What's the actual tolerance on CIM stall torque? I am, I suppose, neglecting the rotational inertia of the drive; but could that possibly account for half of the total torque of the drive, after accounting for friction?

We're happy with our analysis, but the deviation from the theoretical value is vexing, and any input would be appreciated. It's entirely possible I've dropped a factor of two somewhere in my calculation, but I can't find it.

Edit: We are probably going to consolidate all of this into a whitepaper soon-ish, because I can't find any record on Chief Delphi of anyone doing anything similar.
__________________
"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

FRC Drivetrain Characterization

Last edited by Oblarg : 10-14-2017 at 11:05 PM.
#36
10-14-2017, 10:54 PM
 Jared Russell 4933T15 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,550
Re: Tuning a PIDF follower on a robot with high gearing

You only get stall torque momentarily when you start. Max power torque is half stall torque. Battery voltage sag is also a factor.
#37
10-14-2017, 11:01 PM
 Oblarg 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,901
Re: Tuning a PIDF follower on a robot with high gearing

Quote:
 Originally Posted by Jared Russell You only get stall torque momentarily when you start. Max power torque is half stall torque. Battery voltage sag is also a factor.
Battery voltage sag isn't a factor in this plot; the calculations were done with the voltage actually being applied to the motors, not the voltage being commanded. Additionally, the issue is not that we didn't observe the acceleration corresponding to stall torque (we would not expect to, for the reasons you have stated) - it is that the linear function describing the observed relation between robot acceleration and the portion of voltage causing that acceleration, when extrapolated to 12v, does not correspond to stall torque.

Edit: I have changed the wording of the post to make this a bit clearer.
__________________
"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

FRC Drivetrain Characterization

Last edited by Oblarg : 10-14-2017 at 11:04 PM.
#38
10-14-2017, 11:07 PM
 AustinSchuh Registered User FRC #0971 (Spartan Robotics) #254 (The Cheesy Poofs) Team Role: Engineer Join Date: Feb 2005 Rookie Year: 1999 Location: Los Altos, CA Posts: 887
Re: Tuning a PIDF follower on a robot with high gearing

Quote:
 Originally Posted by Oblarg Our test robot weighs ~113 lbs, including battery. It has wheels with a measured rolling diameter of ~3.8 inches (and thus a radius of ~1.9 inches). It has a 6-CIM drive, geared at 6.1:1. The stall-torque of a CIM is, ostensibly, ~340 oz-inches. Doing what I believe to be the appropriate calculation (it is dimensionally correct, at least) yields a peak acceleration of slightly more than twice what we observed. What gives? Where's that factor of two coming from? Our approach ought to already be compensating for friction. Admittedly, the CIMs are several years old; should that matter? What's the actual tolerance on CIM stall torque? I am, I suppose, neglecting the rotational inertia of the drive; but could that possibly account for half of the total torque of the drive, after accounting for friction? We're happy with our analysis, but the deviation from the theoretical value is vexing, and any input would be appreciated. It's entirely possible I've dropped a factor of two somewhere in my calculation, but I can't find it.
This is on par with what I've seen in the past. Our 2014 robot as 60% efficient (compared to theoretical.) I'm getting weird numbers suggesting our 2017 robot is 20% efficient, which is a bit disconcerting. I'm using a kalman filter with both an accelerometer and the encoders to estimate it.

There are a couple places the inefficiency can be coming from. You should be able to measure some of them (or the lumped sum of some of them).

1) Battery internal resistance.
2) Battery wire/PDB/fuse wire resistance.
3) Talon FET/wire resistance

Those can all be lumped together. The easiest way to do it is to take a fresh battery and do a locked rotor test on a CIM. Measure the voltage that the CIM sees and the battery voltage. Measure voltage drops, etc. And please post back on your findings

Your gearbox/etc will have some more inefficiency. Each gear stage is ~95% efficient if you've done it well.

I haven't been able to actually measure it, but I would be willing to bet there is significant energy lost into the carpet itself. The carpet fibers bend as force is applied, and that takes energy.

I encourage you to keep digging into that 50% number until you've gotten the unknowns down significantly. You'll learn a huge amount while you do it.
#39
10-14-2017, 11:19 PM
 Oblarg 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,901
Re: Tuning a PIDF follower on a robot with high gearing

All good suggestions, though what's causing me so much head-scratching is that the way we constructed this test should have accounted for many of those factors already; our calculation of "acceleration-causing voltage" accounts for all frictional losses that could be detected in our quasi-static test (i.e. the one in which we determined the voltage/speed curve; given the extreme linearity of this curve, I don't think there's much we missed), and our use of the Talon's getOutputVoltage() function (in both tests) should account for the internal resistance of the battery and the resistances of any circuitry between the battery and the Talons themselves.

Are there frictional effects that only show up dynamically, that might effect robot acceleration but not steady-state speed?

I'm thinking of swinging by the hardware store and picking up a torque wrench tomorrow so that I might attempt to measure some of this stuff more directly; even then, though, it is challenging to figure out how to take many of the measurements I'd like. First thing I might do is remove a motor from the robot and test its torque directly, because I have always taken the CIM specs at their word but now think it might be worth investigating them a bit more closely. I will also likely measure the input torque (on the motor-side of the gearbox) required to move the wheels with the robot at rest, and compare it to the torque corresponding to our friction-intercept (if there's any sense to the world, this should yield numbers that are reasonably consistent with the motor stall-torque test...). Past that, though, I am not sure.
__________________
"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

FRC Drivetrain Characterization

Last edited by Oblarg : 10-14-2017 at 11:43 PM.
#40
10-14-2017, 11:44 PM
 AustinSchuh Registered User FRC #0971 (Spartan Robotics) #254 (The Cheesy Poofs) Team Role: Engineer Join Date: Feb 2005 Rookie Year: 1999 Location: Los Altos, CA Posts: 887
Re: Tuning a PIDF follower on a robot with high gearing

Quote:
 Originally Posted by Oblarg All good suggestions, though what's causing me so much head-scratching is that the way we constructed this test should have accounted for many of those factors already; our calculation of "acceleration-causing voltage" accounts for all frictional losses that could be detected in our quasi-static test (i.e. the one in which we determined the voltage/speed curve; given the extreme linearity of this curve, I don't think there's much we missed), and our use of the Talon's getOutputVoltage() function (in both tests) should account for the internal resistance of the battery and the resistances of any circuitry between the battery and the Talons themselves.
Oh the magical "should" How have you verified these assumptions? My debugging process tends to boil down to figuring out which assumptions I started with are wrong...
#41
10-14-2017, 11:50 PM
 Oblarg 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,901
Re: Tuning a PIDF follower on a robot with high gearing

Quote:
 Originally Posted by AustinSchuh Oh the magical "should" How have you verified these assumptions? My debugging process tends to boil down to figuring out which assumptions I started with are wrong...
I think it's pretty reasonable to infer that we are correctly accounting for steady-state frictional losses and battery sag given that the observed intercept of this plot was, indeed, zero (playing around with the data a bit reveals that this is pretty sensitive to errors in the voltage/velocity curve, which is a pretty nice endorsement of this characterization method).
__________________
"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

FRC Drivetrain Characterization

 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 03:48 PM.

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

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

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