15 #ifndef RCLCPP__TIMER_HPP_ 16 #define RCLCPP__TIMER_HPP_ 23 #include <type_traits> 49 explicit TimerBase(std::chrono::nanoseconds period);
73 std::chrono::nanoseconds
101 typename std::enable_if<
118 :
TimerBase(period), callback_(
std::forward<FunctorT>(callback))
140 throw std::runtime_error(
"Failed to notify timer that callback occurred");
142 execute_callback_delegate<>();
147 typename CallbackT = FunctorT,
148 typename std::enable_if<
159 typename CallbackT = FunctorT,
160 typename std::enable_if<
173 return Clock::is_steady;
182 template<typename CallbackType>
188 #endif // RCLCPP__TIMER_HPP_ TimerBase(std::chrono::nanoseconds period)
#define RCLCPP_DISABLE_COPY(...)
Definition: macros.hpp:26
virtual ~GenericTimer()
Default destructor.
Definition: timer.hpp:123
rcl_timer_t timer_handle_
Definition: timer.hpp:90
void execute_callback()
Definition: timer.hpp:133
#define RCL_RET_TIMER_CANCELED
std::function< void()> VoidCallbackType
Definition: timer.hpp:94
Definition: allocator_common.hpp:24
rcl_ret_t rcl_timer_fini(rcl_timer_t *timer)
Definition: parameter.hpp:235
rcl_timer_t rcl_get_zero_initialized_timer(void)
const rcl_timer_t * get_timer_handle()
rcl_ret_t rcl_timer_call(rcl_timer_t *timer)
void execute_callback_delegate()
Definition: timer.hpp:153
virtual bool is_steady()
Is the clock steady (i.e. is the time between ticks constant?)
Definition: timer.hpp:171
#define RCLCPP_SMART_PTR_DEFINITIONS(...)
Definition: macros.hpp:36
std::function< void(TimerBase &)> TimerCallbackType
Definition: timer.hpp:95
Definition: function_traits.hpp:141
#define rcl_get_error_string_safe
#define RCLCPP_SMART_PTR_DEFINITIONS_NOT_COPYABLE(...)
Definition: macros.hpp:51
virtual void execute_callback()=0
std::chrono::nanoseconds time_until_trigger()
Check how long the timer has until its next scheduled callback.
#define RCLCPP_PUBLIC
Definition: visibility_control.hpp:50
Generic timer templated on the clock type. Periodically executes a user-specified callback...
Definition: timer.hpp:107
bool is_ready()
Check if the timer is ready to trigger the callback.
virtual bool is_steady()=0
Is the clock steady (i.e. is the time between ticks constant?)