View Single Post
  #16   Spotlight this post!  
Unread 27-01-2016, 16:11
techkid86's Avatar
techkid86 techkid86 is offline
Magic Programer
FRC #3044 (0xBE4)
Team Role: Alumni
 
Join Date: Jan 2011
Rookie Year: 2010
Location: ballston spa
Posts: 58
techkid86 is an unknown quantity at this point
Re: Drive train PID control

1: you don't need the .get() in auto init. you might want to make it a .reset().
2: you also probably want to set a defined Max and Min output.
In auto periodic, you need to set a distance for the PID to get to, but before all that, you have to tune your PID.

PID tries to get to it's target with as little error as possible, but it uses coefficients to multiply by this error to get to this point. Now, for your use, it's likely you can get away with PD control, and leave I at 0. First thing you're going to need to do, is set it up such that your bot goes back and forth on it's own. ((be VERY careful with this. you might want the robot on blocks first, as I've had bad experiences with a run away robot while tuning PID)) you do this by using 2 set points, say, 100 and -100. it will set this set point every, say 10 seconds. now, the bot will get to that point, and either over shoot it, or slow down too early and never reach it. you want to only set 1 PID variable at a time.

So I typically start with P, and small values like 0.1 should be close. increase this until it starts to over shoot, or decrease it until it no longer overshoots, (then go back up one tick)

now you increase D until it no longer overshoots.
__________________
"you can build a perfect machine out of imperfect parts" -Urza
Reply With Quote