Skip to main content

TimerCallInfo

Struct TimerCallInfo 

Source
#[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_time minus how far elapsed_us had run past the period, i.e. the deadline the dispatcher was serving. Under TimerOverrunPolicy::CatchUp each 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: i64

The deadline this activation was serving, in nanoseconds on the timer’s clock.

§actual_call_time: i64

When the dispatcher ran the callback, in nanoseconds on the timer’s clock.

§clock: TimerClockSource

WHICH 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: i64

Nanoseconds 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

Source

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

Source§

fn clone(&self) -> TimerCallInfo

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for TimerCallInfo

Source§

impl Debug for TimerCallInfo

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for TimerCallInfo

Source§

fn default() -> TimerCallInfo

Returns the “default value” for a type. Read more
Source§

impl Eq for TimerCallInfo

Source§

impl PartialEq for TimerCallInfo

Source§

fn eq(&self, other: &TimerCallInfo) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for TimerCallInfo

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.