15 #include "rclcpp/node_interfaces/node_timers.hpp"
19 #include "tracetools/tracetools.h"
24 : node_base_(node_base)
27 NodeTimers::~NodeTimers()
32 rclcpp::TimerBase::SharedPtr timer,
33 rclcpp::CallbackGroup::SharedPtr callback_group)
38 throw std::runtime_error(
"Cannot create timer, group not in node.");
43 callback_group->add_timer(timer);
48 callback_group->trigger_notify_guard_condition();
50 throw std::runtime_error(
51 std::string(
"failed to notify wait set on timer creation: ") + ex.what());
55 rclcpp_timer_link_node,
56 static_cast<const void *
>(timer->get_timer_handle().get()),
RCLCPP_PUBLIC void trigger()
Notify the wait set waiting on this condition, if any, that the condition had been met.
Created when the return code does not match one of the other specialized exceptions.
Pure virtual interface class for the NodeBase part of the Node API.
virtual RCLCPP_PUBLIC bool callback_group_in_node(rclcpp::CallbackGroup::SharedPtr group)=0
Return true if the given callback group is associated with this node.
virtual RCLCPP_PUBLIC rclcpp::CallbackGroup::SharedPtr get_default_callback_group()=0
Return the default callback group.
virtual RCLCPP_PUBLIC rcl_node_t * get_rcl_node_handle()=0
Return the rcl_node_t node handle (non-const version).
virtual RCLCPP_PUBLIC rclcpp::GuardCondition & get_notify_guard_condition()=0
Return a guard condition that should be notified when the internal node state changes.
Implementation of the NodeTimers part of the Node API.
RCLCPP_PUBLIC void add_timer(rclcpp::TimerBase::SharedPtr timer, rclcpp::CallbackGroup::SharedPtr callback_group) override
Add a timer to the node.