Rate limiter¶
Basic rate limiter.
- class loop_rate_limiters.rate_limiter.RateLimiter(frequency, name='rate limiter', warn=True)¶
Regulate the frequency between calls to the same instruction.
This rate limniter is meant to be used in e.g. a loop or callback function. It is, in essence, the same as rospy.Rate. It assumes Python’s performance counter never jumps backward nor forward, so that it does not handle such cases contrary to rospy.Rate.
- name¶
Human-readable name used for logging.
- warn¶
If set (default), warn when the time between two calls exceeded the rate clock.
- property next_tick: float¶
Time of next clock tick.
- remaining()¶
Get the time remaining until the next expected clock tick.
- Return type:
float
- Returns:
Time remaining, in seconds, until the next expected clock tick.
- property slack: float¶
Slack duration computed at the last call to
sleep()
.This duration is in seconds.
- sleep()¶
Sleep for the duration required to regulate inter-call frequency.