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
is gone), so this holds on embedded targets without
background threads too.process_timers()
§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§
- Timer
Call Info - When a timer activation was DUE and when it actually RAN — issue 1974, the
Jazzy
rcl_timer_call_info_t/rclcpp::TimerInfopair. - Timer
Duration - Duration type for timer periods
- Timer
Handle - A handle to a timer stored in a node
- Timer
State - Internal timer state
Enums§
- Timer
Clock Source - Which clock advances a timer (phase-425 W4, RFC-0075-adjacent: this is the
distinction rclcpp draws between
create_wall_timerandcreate_timer). - Timer
Mode - Timer mode (repeating, one-shot, or inert)
Type Aliases§
- Timer
Callback Fn - Timer callback as a bare function pointer (
no_std, no heap required).