15 #ifndef RCLCPP__TIMER_HPP_ 16 #define RCLCPP__TIMER_HPP_ 23 #include <type_traits> 50 Clock::SharedPtr clock,
52 rclcpp::Context::SharedPtr context);
124 :
TimerBase(clock, period, context), callback_(
std::forward<FunctorT>(callback))
145 execute_callback_delegate<>();
150 typename CallbackT = FunctorT,
162 typename CallbackT = FunctorT,
187 typename
std::enable_if<
199 FunctorT && callback,
202 std::make_shared<
Clock>(RCL_STEADY_TIME), period,
std::move(callback), context)
211 #endif // RCLCPP__TIMER_HPP_ virtual void execute_callback()=0
#define RCLCPP_DISABLE_COPY(...)
Definition: macros.hpp:26
Clock::SharedPtr clock_
Definition: timer.hpp:93
Definition: timer.hpp:192
bool is_ready()
Check if the timer is ready to trigger the callback.
Context which encapsulates shared state between nodes and other similar entities. ...
Definition: context.hpp:53
#define RCL_RET_TIMER_CANCELED
std::chrono::nanoseconds time_until_trigger()
Check how long the timer has until its next scheduled callback.
void execute_callback_delegate()
Definition: timer.hpp:156
Definition: allocator_common.hpp:24
virtual ~GenericTimer()
Default destructor.
Definition: timer.hpp:129
Generic timer. Periodically executes a user-specified callback.
Definition: timer.hpp:109
rcl_ret_t rcl_timer_call(rcl_timer_t *timer)
virtual bool is_steady()=0
Is the clock steady (i.e. is the time between ticks constant?)
#define RCLCPP_SMART_PTR_DEFINITIONS(...)
Definition: macros.hpp:36
Definition: function_traits.hpp:143
TimerBase(Clock::SharedPtr clock, std::chrono::nanoseconds period, rclcpp::Context::SharedPtr context)
std::shared_ptr< const rcl_timer_t > get_timer_handle()
#define RCLCPP_SMART_PTR_DEFINITIONS_NOT_COPYABLE(...)
Definition: macros.hpp:51
bool is_steady() override
Is the clock steady (i.e. is the time between ticks constant?)
Definition: timer.hpp:174
#define RCLCPP_PUBLIC
Definition: visibility_control.hpp:50
void execute_callback() override
Definition: timer.hpp:136
std::shared_ptr< rcl_timer_t > timer_handle_
Definition: timer.hpp:94