Skip to main content

Module timer

Module timer 

Source
Expand description

Timer API for nros

This module provides timer support matching rclrs patterns while maintaining no_std compatibility for embedded systems.

§Overview

Timers allow scheduling periodic or one-shot callbacks. A timer lives in the executor’s static table: a node creates one with create_timer_repeating / create_timer_oneshot / create_timer_inert, which return its HandleId, and Executor::spin_once fires every due timer. There is no separate timer-processing call to make (the pre-executor API’s process_timers() is gone), so this holds on embedded targets without background threads too.

§Timer Modes

  • Repeating: Fires at regular intervals until canceled
  • OneShot: Fires once after a delay, then becomes inert
  • Inert: Never fires, useful as a placeholder

§Example

ⓘ
let mut node = executor.node_mut(node_id);
node.create_timer_repeating(core::time::Duration::from_millis(100), || {
    // runs from inside `spin_once`
})?;

loop {
    executor.spin_once(core::time::Duration::from_millis(10));
}

Structs§

TimerCallInfo
When a timer activation was DUE and when it actually RAN — issue 1974, the Jazzy rcl_timer_call_info_t / rclcpp::TimerInfo pair.
TimerDuration
Duration type for timer periods
TimerHandle
A handle to a timer stored in a node
TimerState
Internal timer state

Enums§

TimerClockSource
Which clock advances a timer (phase-425 W4, RFC-0075-adjacent: this is the distinction rclcpp draws between create_wall_timer and create_timer).
TimerMode
Timer mode (repeating, one-shot, or inert)

Type Aliases§

TimerCallbackFn
Timer callback as a bare function pointer (no_std, no heap required).