Package rospy :: Module timer :: Class Rate

Class Rate

source code

object --+
         |
        Rate

Convenience class for sleeping in a loop at a specified rate

Instance Methods
 
__init__(self, hz, reset=False)
Constructor.
source code
Time
remaining(self)
Return the time remaining for rate to sleep.
source code
 
sleep(self)
Attempt sleep at the specified rate.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties

Inherited from object: __class__

Method Details

__init__(self, hz, reset=False)
(Constructor)

source code 

Constructor.

Parameters:
  • hz (float) - hz rate to determine sleeping
  • reset (bool) - if True, timer is reset when rostime moved backward. [default: False]
Overrides: object.__init__

remaining(self)

source code 

Return the time remaining for rate to sleep.

Returns: Time
time remaining

sleep(self)

source code 

Attempt sleep at the specified rate. sleep() takes into account the time elapsed since the last successful sleep().

Raises: