View Single Post
  #1   Spotlight this post!  
Unread 01-03-2010, 13:46
FRC4ME FRC4ME is offline
Registered User
FRC #0339
 
Join Date: Feb 2008
Rookie Year: 2007
Location: Fredericksburg, VA
Posts: 324
FRC4ME has a brilliant futureFRC4ME has a brilliant futureFRC4ME has a brilliant futureFRC4ME has a brilliant futureFRC4ME has a brilliant futureFRC4ME has a brilliant futureFRC4ME has a brilliant futureFRC4ME has a brilliant futureFRC4ME has a brilliant futureFRC4ME has a brilliant futureFRC4ME has a brilliant future
WPI PIDController doesn't account for varying dT?

I was looking through WPI's PIDController code and noticed that they do not incorporate dT into the calculations anywhere. For example, the calculate() method contains the line:

Code:
m_totalError += m_error;
Shouldn't it be like this?

Code:
m_totalError += m_error * m_period;
The way it is now, changing the period of the PID loop would require resetting of the I and D constants. Multiplying the integral by the period and dividing the derivative by the period would remove this inconvenience.
__________________
Go directly to queue. Do not pass pit.