

Every team in FIRST can make this choice. Be positive, help others, and work like a maniac behind the scenes. This approach will bring you joy and satisfaction, whether you win or not.  OZ_341 [more] 



Thread Tools  Rate Thread  Display Modes 
#31




Re: Tuning a PIDF follower on a robot with high gearing
Quote:
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 driveback to measure data too, but we didn't because we used an incredibly backheavy 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




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




Re: Tuning a PIDF follower on a robot with high gearing
Quote:
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)? 
#34




Re: Tuning a PIDF follower on a robot with high gearing
Quote:
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). Last edited by Oblarg : 10112017 at 08:34 PM. 
#35




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 "accelerationcausing 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. "Accelerationcausing 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 6CIM drive, geared at 6.1:1. The stalltorque of a CIM is, ostensibly, ~340 ozinches. 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 soonish, because I can't find any record on Chief Delphi of anyone doing anything similar. Last edited by Oblarg : 10152017 at 12:05 AM. 
#36




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




Re: Tuning a PIDF follower on a robot with high gearing
Quote:
Edit: I have changed the wording of the post to make this a bit clearer. Last edited by Oblarg : 10152017 at 12:04 AM. 
#38




Re: Tuning a PIDF follower on a robot with high gearing
Quote:
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




Re: Tuning a PIDF follower on a robot with high gearing
All good suggestions, though what's causing me so much headscratching is that the way we constructed this test should have accounted for many of those factors already; our calculation of "accelerationcausing voltage" accounts for all frictional losses that could be detected in our quasistatic 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 steadystate 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 motorside of the gearbox) required to move the wheels with the robot at rest, and compare it to the torque corresponding to our frictionintercept (if there's any sense to the world, this should yield numbers that are reasonably consistent with the motor stalltorque test...). Past that, though, I am not sure. Last edited by Oblarg : 10152017 at 12:43 AM. 
#40




Re: Tuning a PIDF follower on a robot with high gearing
Quote:

#41




Re: Tuning a PIDF follower on a robot with high gearing
I think it's pretty reasonable to infer that we are correctly accounting for steadystate 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).

Thread Tools  
Display Modes  Rate This Thread 

