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
For some applications a "f()" call with nearly the same duration is important. If a "f()" takes to long, the next call will be obviously to late and the used ticker will be adjusted in the background by golang. This is wrong or misleading with the comment of the Every() method, which states: "It does not wait for the previous execution of f to finish before it fires the next f."
Most users has no RT Kernel running and most likely do not tweak the system to run the gobot application with any special process scheduler. So this will lead to sometimes the distance between call will be to long or, if the implementation of "f()" is to expensive, this will always happen.
This behavior must be taken into account e.g. for implementing digital controllers.
Two ideas could simplify the life by adding some code to the existing gobot.Every() functionality:
an adjustment algorithm by using the ticker.Reset() function, which increases the ticker until it keeps nearly constant
property to return the last real duration
The text was updated successfully, but these errors were encountered:
gen2thomas
changed the title
gobot.Every() comment wrong and try to run() calls most equidistant
gobot.Every() comment wrong and try to f() calls most equidistant
Jun 26, 2023
gen2thomas
changed the title
gobot.Every() comment wrong and try to f() calls most equidistant
gobot.Every() comment wrong and try to f() calls as equidistant as possible
Jun 26, 2023
For some applications a "f()" call with nearly the same duration is important. If a "f()" takes to long, the next call will be obviously to late and the used ticker will be adjusted in the background by golang. This is wrong or misleading with the comment of the Every() method, which states: "It does not wait for the previous execution of f to finish before it fires the next f."
Most users has no RT Kernel running and most likely do not tweak the system to run the gobot application with any special process scheduler. So this will lead to sometimes the distance between call will be to long or, if the implementation of "f()" is to expensive, this will always happen.
This behavior must be taken into account e.g. for implementing digital controllers.
Two ideas could simplify the life by adding some code to the existing gobot.Every() functionality:
The text was updated successfully, but these errors were encountered: