OCCRA
Go to Post 1. If I had a nickel for every time I heard "But we passed at XXXX regional" I would have retired a long time ago. - Al Skierkiewicz [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
  #31   Spotlight this post!  
Unread 10-11-2017, 04:05 PM
noah.gleason's Avatar
noah.gleason noah.gleason is offline
Registered User
FRC #0449 (The Blair Robot Project)
Team Role: Programmer
 
Join Date: Mar 2017
Rookie Year: 2016
Location: Bethesda, MD
Posts: 69
noah.gleason has a reputation beyond reputenoah.gleason has a reputation beyond reputenoah.gleason has a reputation beyond reputenoah.gleason has a reputation beyond reputenoah.gleason has a reputation beyond reputenoah.gleason has a reputation beyond reputenoah.gleason has a reputation beyond reputenoah.gleason has a reputation beyond reputenoah.gleason has a reputation beyond reputenoah.gleason has a reputation beyond reputenoah.gleason has a reputation beyond repute
Re: Tuning a PIDF follower on a robot with high gearing

Quote:
Originally Posted by Classified* View Post
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.
Reply With Quote
  #32   Spotlight this post!  
Unread 10-11-2017, 04:28 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,301
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: 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).
Reply With Quote
  #33   Spotlight this post!  
Unread 10-11-2017, 04:52 PM
Classified*'s Avatar
Classified* Classified* is offline
Drive it like you stole it
AKA: Julia Cecchetti
FRC #0291 (CIA: Creativity in Action)
Team Role: Leadership
 
Join Date: Nov 2015
Rookie Year: 2015
Location: Erie PA
Posts: 159
Classified* is a splendid one to beholdClassified* is a splendid one to beholdClassified* is a splendid one to beholdClassified* is a splendid one to beholdClassified* is a splendid one to beholdClassified* is a splendid one to beholdClassified* is a splendid one to behold
Re: Tuning a PIDF follower on a robot with high gearing

Quote:
Originally Posted by noah.gleason View Post
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)?
__________________

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
Reply With Quote
  #34   Spotlight this post!  
Unread 10-11-2017, 05:54 PM
Oblarg Oblarg is offline
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,601
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: Tuning a PIDF follower on a robot with high gearing

Quote:
Originally Posted by Classified* View Post
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

Last edited by Oblarg : 10-11-2017 at 08:34 PM.
Reply With Quote
  #35   Spotlight this post!  
Unread 10-14-2017, 09:11 PM
Oblarg Oblarg is offline
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,601
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: 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

Last edited by Oblarg : 10-15-2017 at 12:05 AM.
Reply With Quote
  #36   Spotlight this post!  
Unread 10-14-2017, 11:54 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,301
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: 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.
Reply With Quote
  #37   Spotlight this post!  
Unread 10-15-2017, 12:01 AM
Oblarg Oblarg is offline
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,601
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: Tuning a PIDF follower on a robot with high gearing

Quote:
Originally Posted by Jared Russell View Post
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

Last edited by Oblarg : 10-15-2017 at 12:04 AM.
Reply With Quote
  #38   Spotlight this post!  
Unread 10-15-2017, 12:07 AM
AustinSchuh AustinSchuh is offline
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: 869
AustinSchuh has a reputation beyond reputeAustinSchuh has a reputation beyond reputeAustinSchuh has a reputation beyond reputeAustinSchuh has a reputation beyond reputeAustinSchuh has a reputation beyond reputeAustinSchuh has a reputation beyond reputeAustinSchuh has a reputation beyond reputeAustinSchuh has a reputation beyond reputeAustinSchuh has a reputation beyond reputeAustinSchuh has a reputation beyond reputeAustinSchuh has a reputation beyond repute
Re: Tuning a PIDF follower on a robot with high gearing

Quote:
Originally Posted by Oblarg View Post
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.
Reply With Quote
  #39   Spotlight this post!  
Unread 10-15-2017, 12:19 AM
Oblarg Oblarg is offline
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,601
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: 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

Last edited by Oblarg : 10-15-2017 at 12:43 AM.
Reply With Quote
  #40   Spotlight this post!  
Unread 10-15-2017, 12:44 AM
AustinSchuh AustinSchuh is offline
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: 869
AustinSchuh has a reputation beyond reputeAustinSchuh has a reputation beyond reputeAustinSchuh has a reputation beyond reputeAustinSchuh has a reputation beyond reputeAustinSchuh has a reputation beyond reputeAustinSchuh has a reputation beyond reputeAustinSchuh has a reputation beyond reputeAustinSchuh has a reputation beyond reputeAustinSchuh has a reputation beyond reputeAustinSchuh has a reputation beyond reputeAustinSchuh has a reputation beyond repute
Re: Tuning a PIDF follower on a robot with high gearing

Quote:
Originally Posted by Oblarg View Post
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...
Reply With Quote
  #41   Spotlight this post!  
Unread 10-15-2017, 12:50 AM
Oblarg Oblarg is offline
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,601
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: Tuning a PIDF follower on a robot with high gearing

Quote:
Originally Posted by AustinSchuh View Post
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
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 05:14 AM.

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