Class: Timer

Timer()

- Class representing a Timer in ROS

Members

period :bigint

- The period of the timer in nanoseconds.
Type:
  • bigint
Source:

timerPeriod

Get the timer period.
Source:

Methods

callTimerWithInfo() → {object}

Call a timer and starts counting again, retrieves actual and expected call time.
Source:
Returns:
- The timer information.
Type
object

cancel() → {undefined}

Cancel the timer.
Source:
Returns:
Type
undefined

changeTimerPeriod(period) → {undefined}

Change the timer period.
Parameters:
Name Type Description
period bigint The new period in nanoseconds.
Source:
Returns:
Type
undefined

clearOnResetCallback() → {undefined}

Clear the on reset callback.
Source:
Returns:
Type
undefined

getNextCallTime() → {bigint|null}

Get the absolute time in nanoseconds when the next callback is due. Note: Only available on ROS2 distributions after Humble.
Source:
Returns:
- The next call time in nanoseconds, or null if the timer is canceled. Returns undefined if not supported on current ROS2 distribution.
Type
bigint | null

isCanceled() → {boolean}

Check if the timer is canceled.
Source:
Returns:
Return true if timer is canceled, otherwise return false.
Type
boolean

isReady() → {boolean}

Check if the timer is ready.
Source:
Returns:
Return true if timer is ready, otherwise return false.
Type
boolean

reset() → {undefined}

Reset the timer.
Source:
Returns:
Type
undefined

setOnResetCallback(callback) → {undefined}

Set the on reset callback.
Parameters:
Name Type Description
callback function The callback to be called when the timer is reset.
Source:
Returns:
Type
undefined

timeSinceLastCall() → {bigint}

Get the interval since the last call of this timer.
Source:
Returns:
- the interval value in nanoseconds.
Type
bigint

timeUntilNextCall() → {bigint}

Get the interval until the next call will happen.
Source:
Returns:
- the interval value in nanoseconds.
Type
bigint