View Single Post
  #3   Spotlight this post!  
Unread 01-03-2010, 15:03
Chris Hibner's Avatar Unsung FIRST Hero
Chris Hibner Chris Hibner is offline
Eschewing Obfuscation Since 1990
AKA: Lars Kamen's Roadie
FRC #0051 (Wings of Fire)
Team Role: Engineer
 
Join Date: May 2001
Rookie Year: 1997
Location: Canton, MI
Posts: 1,488
Chris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond repute
Re: Update Rate of PID Loops

Hey Tom, here are my thoughts on this:

1) The rate that you run the PID loops depend on what you're trying to control, how fast it is moving, and if you have any other logic that interacts with the PID loop. For example, if your robot is traveling at 10 ft/s you can travel 6 inches in one 50 ms time step. If you need to control to more accuracy than 6 inches (or you have some logic that looks for you to be in a 6 inch window) and you need to do it at a high robot speed, then you might want to move to the faster loop. If you are controlling motion that is slower or you don't need that kind of accuracy while traveling that fast, then the faster sample rate won't help you too much.

2) You can easily take the actual sample period into account in the PID code. For the integral, multiply the error by the time step before adding. For the derivative, divide the error by the time step before the subtraction. Just be sure to take this into account for your control gains - they will change by a factor of the average time step.
__________________
-
An ounce of perception is worth a pound of obscure.