ROS 2 rclcpp + rcl - humble
humble
ROS 2 C++ Client Library with ROS Client Library
|
Generic timer. Periodically executes a user-specified callback. More...
#include <rclcpp/timer.hpp>
Public Member Functions | |
GenericTimer (Clock::SharedPtr clock, std::chrono::nanoseconds period, FunctorT &&callback, rclcpp::Context::SharedPtr context) | |
Default constructor. More... | |
virtual | ~GenericTimer () |
Default destructor. | |
bool | call () override |
void | execute_callback () override |
template<typename CallbackT = FunctorT, typename std::enable_if< rclcpp::function_traits::same_arguments< CallbackT, VoidCallbackType >::value >::type * = nullptr> | |
void | execute_callback_delegate () |
template<typename CallbackT = FunctorT, typename std::enable_if< rclcpp::function_traits::same_arguments< CallbackT, TimerCallbackType >::value >::type * = nullptr> | |
void | execute_callback_delegate () |
bool | is_steady () override |
Is the clock steady (i.e. is the time between ticks constant?) More... | |
![]() | |
RCLCPP_PUBLIC | TimerBase (Clock::SharedPtr clock, std::chrono::nanoseconds period, rclcpp::Context::SharedPtr context) |
TimerBase constructor. More... | |
virtual RCLCPP_PUBLIC | ~TimerBase () |
TimerBase destructor. | |
RCLCPP_PUBLIC void | cancel () |
Cancel the timer. More... | |
RCLCPP_PUBLIC bool | is_canceled () |
Return the timer cancellation state. More... | |
RCLCPP_PUBLIC void | reset () |
Reset the timer. More... | |
RCLCPP_PUBLIC std::shared_ptr< const rcl_timer_t > | get_timer_handle () |
RCLCPP_PUBLIC std::chrono::nanoseconds | time_until_trigger () |
Check how long the timer has until its next scheduled callback. More... | |
RCLCPP_PUBLIC bool | is_ready () |
Check if the timer is ready to trigger the callback. More... | |
RCLCPP_PUBLIC bool | exchange_in_use_by_wait_set_state (bool in_use_state) |
Exchange the "in use by wait set" state for this timer. More... | |
Protected Attributes | |
FunctorT | callback_ |
![]() | |
Clock::SharedPtr | clock_ |
std::shared_ptr< rcl_timer_t > | timer_handle_ |
std::atomic< bool > | in_use_by_wait_set_ {false} |
Generic timer. Periodically executes a user-specified callback.
|
inlineexplicit |
|
inlineoverridevirtual |
std::runtime_error | if it failed to notify timer that callback will occurr |
Implements rclcpp::TimerBase.
Definition at line 211 of file timer.hpp.
References RCL_RET_OK, RCL_RET_TIMER_CANCELED, and rcl_timer_call().
|
inlineoverridevirtual |
Implements rclcpp::TimerBase.
|
inlineoverridevirtual |
Is the clock steady (i.e. is the time between ticks constant?)
Implements rclcpp::TimerBase.
Definition at line 262 of file timer.hpp.
References RCL_STEADY_TIME.