You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If the time function uses system time rather than something like the Arduino millis() function that counts from the last microcontroller reset event, the initial value of deltaTime can be EXTREMELY large -- potentially large enough to cause the integral calculation to overflow. This can happen in embedded Linux, in systems that use a real time clock, in systems that either don't call tick() for extended periods (for example, when the system is disarmed), or reset the PID object for whatever reason. The result is a very large computed value of deltaTime on the first tick, which can disrupt the integral term. I see a few possible solutions:
A method that enables the user to initialize the lastTime member
Modify registerTimeFunction() so that it sets the value of lastTime to the output of the time function at the time of registration
Do not compute deltaTime or the integral/derivative components if lastTime == 0
Have a configurable limit to deltaTime and either bound it or disable integral and derivative computations if deltaTime is larger than the bound.
I like the second idea best, b/c it doesn't require any additional code from the user and still allows resetting the lastTime value any time the user feels the need. Thoughts?
The text was updated successfully, but these errors were encountered:
If the time function uses system time rather than something like the Arduino millis() function that counts from the last microcontroller reset event, the initial value of deltaTime can be EXTREMELY large -- potentially large enough to cause the integral calculation to overflow. This can happen in embedded Linux, in systems that use a real time clock, in systems that either don't call tick() for extended periods (for example, when the system is disarmed), or reset the PID object for whatever reason. The result is a very large computed value of deltaTime on the first tick, which can disrupt the integral term. I see a few possible solutions:
I like the second idea best, b/c it doesn't require any additional code from the user and still allows resetting the lastTime value any time the user feels the need. Thoughts?
The text was updated successfully, but these errors were encountered: