19#include <rclcpp/rclcpp.hpp>
26namespace client_core_components
51 getLogger(),
"[" << this->
getName() <<
"] Initializing ROS2 Timer with duration: "
54 auto clock = this->
getNode()->get_clock();
55 timer_ = rclcpp::create_timer(
68 RCLCPP_INFO_STREAM(
getLogger(),
"[" << this->
getName() <<
"] Starting timer");
77 RCLCPP_INFO_STREAM(
getLogger(),
"[" << this->
getName() <<
"] Stopping timer");
86 RCLCPP_INFO_STREAM(
getLogger(),
"[" << this->
getName() <<
"] Cancelling timer");
92 boost::signals2::connection
onTimerTick(
void (T::*callback)(), T *
object)
102 if (!onTimerTick_.empty())
110 getLogger(),
"[" << this->
getName() <<
"] Oneshot timer completed, cancelling");
ISmaccStateMachine * getStateMachine()
virtual std::string getName() const
rclcpp::Logger getLogger() const
rclcpp::Node::SharedPtr getNode()
boost::signals2::connection createSignalConnection(TSmaccSignal &signal, TMemberFunctionPrototype callback, TSmaccObjectType *object)
boost::signals2::connection onTimerTick(void(T::*callback)(), T *object)
CpRos2Timer(rclcpp::Duration duration, bool oneshot=false)
rclcpp::TimerBase::SharedPtr timer_
smacc2::SmaccSignal< void()> onTimerTick_
void onInitialize() override
rclcpp::Duration duration_