1#ifndef MRS_LIB_EXPERIMENTAL_TIMER_HPP_
2#define MRS_LIB_EXPERIMENTAL_TIMER_HPP_
8#include <rclcpp/callback_group.hpp>
9#include <rclcpp/create_timer.hpp>
10#include <rclcpp/node_interfaces/node_base_interface.hpp>
11#include <rclcpp/node_interfaces/node_clock_interface.hpp>
12#include <rclcpp/node_interfaces/node_interfaces.hpp>
13#include <rclcpp/node_interfaces/node_timers_interface.hpp>
14#include <rclcpp/timer.hpp>
25 using TimerNodeInterfaces = rclcpp::node_interfaces::NodeInterfaces<rclcpp::node_interfaces::NodeBaseInterface, rclcpp::node_interfaces::NodeTimersInterface,
26 rclcpp::node_interfaces::NodeClockInterface>;
72 virtual void set_period(std::chrono::nanoseconds period) = 0;
237 void set_period(std::chrono::nanoseconds period);
Base template for CoroCallback.
Definition callback.hpp:166
Owning pointer wrapper with move only value semantics. Usefull for implementing the pointer to implem...
Definition pimpl.hpp:39
void stop()
Stop the timer.
Definition timer.cpp:257
std::function< void()> EventCallback
Type of the accepted callback.
Definition timer.hpp:170
bool is_running() const
Check whether the timer is currently running.
Definition timer.cpp:272
Timer(const RosTimerOptions &options, std::chrono::nanoseconds period, EventCallback callback)
Construct a ROS-based timer with a regular callback.
Definition timer.cpp:237
CoroCallback< void()> EventCoroCallback
Type of the accepted coroutine callback.
Definition timer.hpp:175
void set_period(std::chrono::nanoseconds period)
Set the timer period.
Definition timer.cpp:267
void start_or_reset()
Start or reset the timer.
Definition timer.cpp:262
virtual void start_or_reset()=0
Start the timer or reset its countdown.
virtual void set_period(std::chrono::nanoseconds period)=0
Change the timer period.
virtual ~TimerImplInterface()=default
Virtual destructor.
TimerImplInterface()=default
Default constructor.
virtual bool is_running() const =0
Check whether the timer is running.
virtual void stop()=0
Stop the timer.
All mrs_lib functions, classes, variables and definitions are contained in this namespace.
Definition attitude_converter.h:24
rclcpp::node_interfaces::NodeInterfaces< rclcpp::node_interfaces::NodeBaseInterface, rclcpp::node_interfaces::NodeTimersInterface, rclcpp::node_interfaces::NodeClockInterface > TimerNodeInterfaces
ROS node interfaces required by the Timer.
Definition timer.hpp:25
Options for creating a ROS-based timer.
Definition timer.hpp:92
bool oneshot
Whether the timer should execute its callback only once.
Definition timer.hpp:108
std::shared_ptr< rclcpp::CallbackGroup > callback_group
Callback group in which the timer callback should be executed.
Definition timer.hpp:115
bool autostart
Whether the timer should start automatically after construction.
Definition timer.hpp:101
TimerNodeInterfaces node_interfaces
ROS node interfaces used by the timer.
Definition timer.hpp:96
Options for creating a thread-based timer.
Definition timer.hpp:125
TimerNodeInterfaces node_interfaces
ROS node interfaces used by the timer.
Definition timer.hpp:129
bool autostart
Whether the timer should start automatically after construction.
Definition timer.hpp:134
bool oneshot
Whether the timer should execute its callback only once.
Definition timer.hpp:141