![]() |
mrs_lib
Various reusable classes, functions and utilities for use in MRS projects
|
Common wrapper representing the functionality of the rclcpp::Timer. More...
#include <timer_handler.h>
Public Types | |
using | callback_t = std::function< void()> |
Public Member Functions | |
virtual void | stop ()=0 |
stop the timer | |
virtual void | start ()=0 |
start the timer | |
virtual void | setPeriod (const rclcpp::Duration &duration)=0 |
set the timer period/duration | |
virtual void | setCallback (const std::function< void()> &callback)=0 |
change the callback method | |
virtual bool | running ()=0 |
returns true if callbacks should be called | |
MRSTimer (const MRSTimer &)=default | |
MRSTimer (MRSTimer &&)=default | |
MRSTimer & | operator= (const MRSTimer &)=default |
MRSTimer & | operator= (MRSTimer &&)=default |
Protected Attributes | |
rclcpp::Node::SharedPtr | node_ |
Common wrapper representing the functionality of the rclcpp::Timer.
The implementation can then use either rclcpp::Timer (the ROSTimer class) or threads and synchronization primitives from the C++ standard library (the ThreadTimer class). Both these variants implement the same interface.
|
pure virtual |
returns true if callbacks should be called
Implemented in mrs_lib::ROSTimer, and mrs_lib::ThreadTimer.
|
pure virtual |
change the callback method
Usable e.g. for running thread with a specific parameter if you bind it using std::bind
callback | callback method to be called. |
Implemented in mrs_lib::ROSTimer, and mrs_lib::ThreadTimer.
|
pure virtual |
set the timer period/duration
duration | |
reset |
Implemented in mrs_lib::ROSTimer, and mrs_lib::ThreadTimer.
|
pure virtual |
start the timer
Implemented in mrs_lib::ROSTimer, and mrs_lib::ThreadTimer.
|
pure virtual |
stop the timer
Implemented in mrs_lib::ROSTimer, and mrs_lib::ThreadTimer.