15 #ifndef RCLCPP__TIMER_HPP_ 16 #define RCLCPP__TIMER_HPP_ 23 #include <type_traits> 50 Clock::SharedPtr clock,
52 rclcpp::Context::SharedPtr context);
134 :
TimerBase(clock, period, context), callback_(
std::forward<FunctorT>(callback))
155 execute_callback_delegate<>();
160 typename CallbackT = FunctorT,
172 typename CallbackT = FunctorT,
197 typename
std::enable_if<
209 FunctorT && callback,
212 std::make_shared<
Clock>(RCL_STEADY_TIME), period,
std::move(callback), context)
221 #endif // RCLCPP__TIMER_HPP_ virtual void execute_callback()=0
#define RCLCPP_DISABLE_COPY(...)
Definition: macros.hpp:26
Clock::SharedPtr clock_
Definition: timer.hpp:103
Definition: timer.hpp:202
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:166
This header provides the get_node_topics_interface() template function.
Definition: allocator_common.hpp:24
virtual ~GenericTimer()
Default destructor.
Definition: timer.hpp:139
Generic timer. Periodically executes a user-specified callback.
Definition: timer.hpp:119
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:184
#define RCLCPP_PUBLIC
Definition: visibility_control.hpp:50
void execute_callback() override
Definition: timer.hpp:146
std::shared_ptr< rcl_timer_t > timer_handle_
Definition: timer.hpp:104
bool is_canceled()
Return the timer cancellation state.