nirefa.blogg.se

Cancel active timer
Cancel active timer





cancel active timer
  1. Cancel active timer update#
  2. Cancel active timer code#

  • Return after the callback has completed.ĭuring the callback the timer can be canceled or have its period and/or callback modified.
  • Call the callback, passing this timer and the time since the last call.
  • Exchange the current time with the last call time of the timer.
  • Get the current time into a temporary rcl_steady_time_point_t.
  • Ensure the timer has not been canceled.
  • The order of operations in this command are as follows:

    cancel active timer

    Cancel active timer update#

    However, this function should still be called by the client library to update the state of the timer. If the callback pointer is NULL (either set in init or exchanged after initialized), no callback is fired.

    Cancel active timer code#

    It is up to the calling code to make sure the period has elapsed by first calling rcl_timer_is_ready(). This function will call the callback and change the last call time even if the timer's period has not yet elapsed. Else, it must be a function which returns void and takes two arguments, the first being a pointer to the associated timer, and the second a int64_t which is the time since the previous call, or since the timer was created if it is the first call to the callback.Ĭall the timer's callback and set the last call time. If the callback is NULL, the caller client library is responsible for firing the timer callback. Valid inputs are either a pointer to the function callback, or NULL to indicate that no callback will be stored in rcl. If the period is 0 then it will always be ready. The period is a duration (rather an absolute time in the future). Calling this function on a timer struct which has been allocated but not zero initialized is undefined behavior. Calling this function on an already initialized timer will fail. The timer handle must be a pointer to an allocated and zero initialized rcl_timer_t struct. When rcl_timer_is_ready() returns true, the timer must still be called explicitly using rcl_timer_call(). For blocking behavior it can be used in conjunction with a wait set and rcl_wait(). It does not create any threads, register interrupts, or consume signals. A timer can be added to a wait set and waited on, such that the wait set will wake up when a timer is ready to be executed.Ī timer simply holds state and does not automatically call callbacks. More.Ī timer consists of a callback function and a period. Rcl_timer_get_allocator (const rcl_timer_t *timer)

    cancel active timer

    Rcl_timer_is_canceled (const rcl_timer_t *timer, bool *is_canceled) Rcl_timer_exchange_callback ( rcl_timer_t *timer, const rcl_timer_callback_t new_callback)Įxchange the current timer callback and return the current callback. Rcl_timer_get_callback (const rcl_timer_t *timer) Rcl_timer_exchange_period (const rcl_timer_t *timer, int64_t new_period, int64_t *old_period)Įxchange the period of the timer and return the previous period. Rcl_timer_get_period (const rcl_timer_t *timer, int64_t *period) Retrieve the time since the previous call to rcl_timer_call() occurred. Rcl_timer_get_time_since_last_call (const rcl_timer_t *timer, int64_t *time_since_last_call) Rcl_timer_get_time_until_next_call (const rcl_timer_t *timer, int64_t *time_until_next_call)Ĭalculate and retrieve the time until the next call in nanoseconds. Rcl_timer_is_ready (const rcl_timer_t *timer, bool *is_ready)Ĭalculates whether or not the timer should be called. Rcl_timer_init ( rcl_timer_t *timer, int64_t period, const rcl_timer_callback_t callback, rcl_allocator_t allocator)Ĭall the timer's callback and set the last call time. Rcl_timer_callback_t) ( rcl_timer_t *, int64_t) Structure which encapsulates a ROS Timer.







    Cancel active timer