rclcpp  master
C++ ROS Client Library API
Public Member Functions | Protected Attributes | List of all members
rclcpp::GenericTimer< FunctorT, std::enable_if< rclcpp::function_traits::same_arguments< FunctorT, VoidCallbackType >::value||rclcpp::function_traits::same_arguments< FunctorT, TimerCallbackType >::value >::type * > Class Template Reference

Generic timer. Periodically executes a user-specified callback. More...

#include <timer.hpp>

Inheritance diagram for rclcpp::GenericTimer< FunctorT, std::enable_if< rclcpp::function_traits::same_arguments< FunctorT, VoidCallbackType >::value||rclcpp::function_traits::same_arguments< FunctorT, TimerCallbackType >::value >::type * >:
Inheritance graph
[legend]
Collaboration diagram for rclcpp::GenericTimer< FunctorT, std::enable_if< rclcpp::function_traits::same_arguments< FunctorT, VoidCallbackType >::value||rclcpp::function_traits::same_arguments< FunctorT, TimerCallbackType >::value >::type * >:
Collaboration graph
[legend]

Public Member Functions

 GenericTimer (Clock::SharedPtr clock, std::chrono::nanoseconds period, FunctorT &&callback, rclcpp::Context::SharedPtr context)
 Default constructor. More...
 
virtual ~GenericTimer ()
 Default destructor. More...
 
void execute_callback () override
 
template<typename CallbackT = FunctorT, typename std::enable_if< rclcpp::function_traits::same_arguments< CallbackT, VoidCallbackType >::value >::type * = nullptr>
void execute_callback_delegate ()
 
template<typename CallbackT = FunctorT, typename std::enable_if< rclcpp::function_traits::same_arguments< CallbackT, TimerCallbackType >::value >::type * = nullptr>
void execute_callback_delegate ()
 
bool is_steady () override
 Is the clock steady (i.e. is the time between ticks constant?) More...
 
- Public Member Functions inherited from rclcpp::TimerBase
 TimerBase (Clock::SharedPtr clock, std::chrono::nanoseconds period, rclcpp::Context::SharedPtr context)
 
 ~TimerBase ()
 
void cancel ()
 
void reset ()
 
std::shared_ptr< const rcl_timer_tget_timer_handle ()
 
std::chrono::nanoseconds time_until_trigger ()
 Check how long the timer has until its next scheduled callback. More...
 
bool is_ready ()
 Check if the timer is ready to trigger the callback. More...
 

Protected Attributes

FunctorT callback_
 
- Protected Attributes inherited from rclcpp::TimerBase
Clock::SharedPtr clock_
 
std::shared_ptr< rcl_timer_ttimer_handle_
 

Detailed Description

template<typename FunctorT, typename std::enable_if< rclcpp::function_traits::same_arguments< FunctorT, VoidCallbackType >::value||rclcpp::function_traits::same_arguments< FunctorT, TimerCallbackType >::value >::type * = nullptr>
class rclcpp::GenericTimer< FunctorT, std::enable_if< rclcpp::function_traits::same_arguments< FunctorT, VoidCallbackType >::value||rclcpp::function_traits::same_arguments< FunctorT, TimerCallbackType >::value >::type * >

Generic timer. Periodically executes a user-specified callback.

Constructor & Destructor Documentation

◆ GenericTimer()

template<typename FunctorT, typename std::enable_if< rclcpp::function_traits::same_arguments< FunctorT, VoidCallbackType >::value||rclcpp::function_traits::same_arguments< FunctorT, TimerCallbackType >::value >::type * = nullptr>
rclcpp::GenericTimer< FunctorT, >::GenericTimer ( Clock::SharedPtr  clock,
std::chrono::nanoseconds  period,
FunctorT &&  callback,
rclcpp::Context::SharedPtr  context 
)
inlineexplicit

Default constructor.

Parameters
[in]clockThe clock providing the current time.
[in]periodThe interval at which the timer fires.
[in]callbackUser-specified callback function.

◆ ~GenericTimer()

template<typename FunctorT, typename std::enable_if< rclcpp::function_traits::same_arguments< FunctorT, VoidCallbackType >::value||rclcpp::function_traits::same_arguments< FunctorT, TimerCallbackType >::value >::type * = nullptr>
virtual rclcpp::GenericTimer< FunctorT, >::~GenericTimer ( )
inlinevirtual

Default destructor.

Member Function Documentation

◆ execute_callback()

template<typename FunctorT, typename std::enable_if< rclcpp::function_traits::same_arguments< FunctorT, VoidCallbackType >::value||rclcpp::function_traits::same_arguments< FunctorT, TimerCallbackType >::value >::type * = nullptr>
void rclcpp::GenericTimer< FunctorT, >::execute_callback ( )
inlineoverridevirtual

Implements rclcpp::TimerBase.

◆ execute_callback_delegate() [1/2]

template<typename FunctorT, typename std::enable_if< rclcpp::function_traits::same_arguments< FunctorT, VoidCallbackType >::value||rclcpp::function_traits::same_arguments< FunctorT, TimerCallbackType >::value >::type * = nullptr>
template<typename CallbackT = FunctorT, typename std::enable_if< rclcpp::function_traits::same_arguments< CallbackT, VoidCallbackType >::value >::type * = nullptr>
void rclcpp::GenericTimer< FunctorT, >::execute_callback_delegate ( )
inline

◆ execute_callback_delegate() [2/2]

template<typename FunctorT, typename std::enable_if< rclcpp::function_traits::same_arguments< FunctorT, VoidCallbackType >::value||rclcpp::function_traits::same_arguments< FunctorT, TimerCallbackType >::value >::type * = nullptr>
template<typename CallbackT = FunctorT, typename std::enable_if< rclcpp::function_traits::same_arguments< CallbackT, TimerCallbackType >::value >::type * = nullptr>
void rclcpp::GenericTimer< FunctorT, >::execute_callback_delegate ( )
inline

◆ is_steady()

template<typename FunctorT, typename std::enable_if< rclcpp::function_traits::same_arguments< FunctorT, VoidCallbackType >::value||rclcpp::function_traits::same_arguments< FunctorT, TimerCallbackType >::value >::type * = nullptr>
bool rclcpp::GenericTimer< FunctorT, >::is_steady ( )
inlineoverridevirtual

Is the clock steady (i.e. is the time between ticks constant?)

Returns
True if the clock used by this timer is steady.

Implements rclcpp::TimerBase.

Member Data Documentation

◆ callback_

template<typename FunctorT, typename std::enable_if< rclcpp::function_traits::same_arguments< FunctorT, VoidCallbackType >::value||rclcpp::function_traits::same_arguments< FunctorT, TimerCallbackType >::value >::type * = nullptr>
FunctorT rclcpp::GenericTimer< FunctorT, >::callback_
protected

The documentation for this class was generated from the following file: