Package rospy :: Module timer :: Class Timer

Class Timer

source code

        object --+        
                 |        
threading._Verbose --+    
                     |    
      threading.Thread --+
                         |
                        Timer

Convenience class for calling a callback at a specified rate

Instance Methods
 
__init__(self, period, callback, oneshot=False, reset=False)
Constructor.
source code
 
shutdown(self)
Stop firing callbacks.
source code
 
run(self)
Method representing the thread's activity.
source code

Inherited from threading.Thread: __repr__, getName, isAlive, isDaemon, is_alive, join, setDaemon, setName, start

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

Properties

Inherited from threading.Thread: daemon, ident, name

Inherited from object: __class__

Method Details

__init__(self, period, callback, oneshot=False, reset=False)
(Constructor)

source code 

Constructor.

Parameters:
  • period (rospy.Duration) - desired period between callbacks
  • callback (function taking rospy.TimerEvent) - callback to be called
  • oneshot (bool) - if True, fire only once, otherwise fire continuously until shutdown is called [default: False]
  • reset (bool) - if True, timer is reset when rostime moved backward. [default: False]
Overrides: object.__init__

run(self)

source code 

Method representing the thread's activity.

You may override this method in a subclass. The standard run() method invokes the callable object passed to the object's constructor as the target argument, if any, with sequential and keyword arguments taken from the args and kwargs arguments, respectively.

Overrides: threading.Thread.run
(inherited documentation)