|
Keep your Eye on the I
I have not checked the code yet to see if this is in the standard code, but I urge everyone who uses the I part of PID to make sure you put in a term that does not let the integral term build up when the robot is disabled.
Before we had this feature, we had countless times where the robot would do an erratic jump up or down as soon as it was enabled. The problem was that if someone moved the arm or the controls when the robot was disabled and the robot stayed disabled for any period of time, the integral term would build up and then cause a step jump as soon as the robot was able to move.
It was dangerous. It was spooky. And... ...we broke ourselve more that once as the robot thrashed around.
The ghosts went away when we kept the integral term from building up when the robot was disabled.
ACTUALLY, while I am on the topic, the most reliable method we had was to add two subrountines to our code: IveJustBeenEnabled() and IveJustBeenDisabled()*
These two routines are good coding practice and should be part of the default code (imho).
You'd be surprised how many robot freakouts are caused by folks not taking care of business when the enter or leave the enabled state. These two make integral wind up due to being disabled a non-issue: just zero the integral term as soon as you are enabled. While you are at it, perhaps you want to set the desired state equal to the current state until someone does something appropriate on the OI like maybe put their finger on the deadman button.
Joe J.
*These two have close cousins: IveJustEnteredAutonMode() and IveJustLeftAutonMode(), MatchJustBegun(), MatchJustEnded(), etc -- again these sort of routines should be required coding!
__________________
Joseph M. Johnson, Ph.D., P.E.
Mentor
Team #88, TJ2
|