#[repr(C)]pub struct TimerCallInfo {
pub expected_call_time: i64,
pub actual_call_time: i64,
pub clock: TimerClockSource,
pub since_last_call_ns: i64,
}Expand description
When a timer activation was DUE and when it actually RAN — issue 1974, the
Jazzy rcl_timer_call_info_t / rclcpp::TimerInfo pair.
Both are nanoseconds on the TIMER’S OWN clock (the TimerClockSource it
was registered with, which Executor::timer_clock_source reports):
/clock time for a Ros timer, the wall clock for System, the
platform’s monotonic clock for Steady.
There is ONE producer: the executor’s timer dispatcher fills this in at the
moment it decides the activation is due, from the same elapsed_us /
period_us comparison that decides it, and hands it by reference to the
callback. The C (rcl_timer_call_info_t) and C++ (rclcpp::TimerInfo)
surfaces copy these two numbers; neither computes its own.
actual_call_time— the timer’s clock as read for this dispatch.expected_call_time—actual_call_timeminus how farelapsed_ushad run past the period, i.e. the deadline the dispatcher was serving. UnderTimerOverrunPolicy::CatchUpeach replayed activation reports its own (earlier) deadline.
actual_call_time >= expected_call_time always holds: an activation is
dispatched only once elapsed_us >= period_us, so the difference — the
activation’s lateness, Self::lateness_ns — is never negative.
Copy, a few words, no allocation: it lives on the dispatcher’s stack for
the duration of the callback.
Fields§
§expected_call_time: i64The deadline this activation was serving, in nanoseconds on the timer’s clock.
actual_call_time: i64When the dispatcher ran the callback, in nanoseconds on the timer’s clock.
clock: TimerClockSourceWHICH clock both times are on — the timer’s registered source, so a
consumer that wraps the numbers in a typed time (C++’s
rclcpp::Time(ns, clock_type)) needs no second lookup.
since_last_call_ns: i64Nanoseconds since the previous activation, or since registration or
the last reset for the first one — the argument rcl’s
rcl_timer_callback_t receives (phase-515 C1). It is the dispatcher’s
elapsed_us at the moment the activation became due, so it reads the
same as Executor::timer_elapsed_us just before the call, at the same
microsecond resolution (issue #505). Measured from the previous DUE
POINT, which for a timer running on time is the previous call.
Implementations§
Source§impl TimerCallInfo
impl TimerCallInfo
Sourcepub const fn lateness_ns(&self) -> i64
pub const fn lateness_ns(&self) -> i64
actual_call_time - expected_call_time: how late this activation ran.
Never negative (see the type’s docs).
Trait Implementations§
Source§impl Clone for TimerCallInfo
impl Clone for TimerCallInfo
Source§fn clone(&self) -> TimerCallInfo
fn clone(&self) -> TimerCallInfo
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more