Timers
Timer Class
- class RobotRaconteur.Timer
A timer to invoke a callback
Timers invoke a callback at a specified rate. The timer can either be one-short, or repeating.
Use RobotRaconteurNode.CreateTimer() to create timers.
- GetPeriod()
Get the period of the timer in seconds
- Return type:
float
- IsRunning()
Get if the timer is running
- Return type:
bool
- SetPeriod(period)
Set the period of the timer in seconds
- Parameters:
period (float) – Period in seconds
- Start()
Start the timer
Must be called after RobotRaconteurNode.CreateTimer()
- Stop()
Stop the timer
- TryStop()
Stop the timer without throwing an exception if the timer is not running
TimerEvent Class
- class RobotRaconteur.TimerEvent
Timer event structure
Contains information about the state of the timer. Passed to the callback on invocation.
- property current_expected
The current expected invocation time
- Return type:
datetime.datetime
- property current_real
The current invocation time
- Return type:
datetime.datetime
- property last_expected
The last expected callback invocation time
- Return type:
datetime.datetime
- property last_real
The real last callback invocation time
- Return type:
datetime.datetime
- property stopped
True if timer has been stopped
- Return type:
bool
Rate Class
AutoResetEvent Class
- class RobotRaconteur.AutoResetEvent
Synchronization event for thread synchronization. Resets automatically after being triggered
Construct using RobotRaconteurNode.CreateAutoResetEvent()
- Reset()
Reset the event
- Set()
Set the event, releasing waiting threads
- WaitOne(timeout=0)
Block the current thread until Set() is called, or timeout expires
Timeout is based on the RobotRaconteurNode time provider
- Parameters:
timeout (float) – The timeout in seconds
- Returns:
True if event was set, False if not
- Return type:
bool