15 #ifndef RCLCPP__TIMER_HPP_ 16 #define RCLCPP__TIMER_HPP_ 23 #include <type_traits> 33 #include "tracetools/tracetools.h" 34 #include "tracetools/utils.hpp" 136 :
TimerBase(clock, period, context), callback_(
std::forward<FunctorT>(callback))
139 rclcpp_timer_callback_added,
141 (
const void *)&callback_);
143 rclcpp_callback_register,
144 (
const void *)&callback_,
145 get_symbol(callback_));
165 TRACEPOINT(callback_start, (
const void *)&callback_,
false);
166 execute_callback_delegate<>();
167 TRACEPOINT(callback_end, (
const void *)&callback_);
172 typename CallbackT = FunctorT,
184 typename CallbackT = FunctorT,
209 typename
std::enable_if<
221 FunctorT && callback,
224 std::make_shared<
Clock>(RCL_STEADY_TIME), period,
std::move(callback), context)
233 #endif // RCLCPP__TIMER_HPP_ virtual void execute_callback()=0
#define RCLCPP_DISABLE_COPY(...)
Definition: macros.hpp:26
Clock::SharedPtr clock_
Definition: timer.hpp:105
Definition: timer.hpp:214
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:178
This header provides the get_node_base_interface() template function.
Definition: allocator_common.hpp:24
virtual ~GenericTimer()
Default destructor.
Definition: timer.hpp:149
Generic timer. Periodically executes a user-specified callback.
Definition: timer.hpp:121
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:161
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:196
#define RCLCPP_PUBLIC
Definition: visibility_control.hpp:50
Set the data type used in the intra-process buffer as std::shared_ptr<MessageT>
void execute_callback() override
Definition: timer.hpp:156
std::shared_ptr< rcl_timer_t > timer_handle_
Definition: timer.hpp:106
bool is_canceled()
Return the timer cancellation state.