SMACC
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
cl_ros_timer::ClRosTimer Class Reference

#include <cl_ros_timer.h>

Inheritance diagram for cl_ros_timer::ClRosTimer:
Inheritance graph
Collaboration diagram for cl_ros_timer::ClRosTimer:
Collaboration graph

Public Member Functions

 ClRosTimer (ros::Duration duration, bool oneshot=false)
 
virtual ~ClRosTimer ()
 
virtual void initialize ()
 
template<typename T >
boost::signals2::connection onTimerTick (void(T::*callback)(), T *object)
 
template<typename TOrthogonal , typename TSourceObject >
void onOrthogonalAllocation ()
 
- Public Member Functions inherited from smacc::ISmaccClient
 ISmaccClient ()
 
virtual ~ISmaccClient ()
 
virtual void initialize ()
 
virtual std::string getName () const
 
template<typename EventType >
void postEvent (const EventType &ev)
 
template<typename EventType >
void postEvent ()
 
template<typename TComponent >
TComponent * getComponent ()
 
template<typename TComponent >
TComponent * getComponent (std::string name)
 
virtual smacc::introspection::TypeInfo::Ptr getType ()
 
ISmaccStateMachinegetStateMachine ()
 
template<typename TSmaccSignal , typename T >
void connectSignal (TSmaccSignal &signal, void(T::*callback)(), T *object)
 
template<typename SmaccClientType >
void requiresClient (SmaccClientType *&storage)
 
void getComponents (std::vector< std::shared_ptr< ISmaccComponent > > &components)
 

Protected Member Functions

void timerCallback (const ros::TimerEvent &timedata)
 
- Protected Member Functions inherited from smacc::ISmaccClient
template<typename TOrthogonal , typename TSourceObject >
void onOrthogonalAllocation ()
 
template<typename SmaccComponentType , typename TOrthogonal , typename TClient , typename... TArgs>
SmaccComponentType * createComponent (TArgs... targs)
 
template<typename SmaccComponentType , typename TOrthogonal , typename TClient , typename... TArgs>
SmaccComponentType * createNamedComponent (std::string name, TArgs... targs)
 
void setStateMachine (ISmaccStateMachine *stateMachine)
 
void setOrthogonal (ISmaccOrthogonal *orthogonal)
 

Protected Attributes

ros::NodeHandle nh_
 
ros::Timer timer
 
ros::Duration duration
 
bool oneshot
 
std::function< void()> postTimerEvent_
 
smacc::SmaccSignal< void()> onTimerTick_
 
- Protected Attributes inherited from smacc::ISmaccClient
std::map< ComponentKey, std::shared_ptr< smacc::ISmaccComponent > > components_
 

Detailed Description

Definition at line 24 of file cl_ros_timer.h.

Constructor & Destructor Documentation

◆ ClRosTimer()

cl_ros_timer::ClRosTimer::ClRosTimer ( ros::Duration  duration,
bool  oneshot = false 
)

Definition at line 6 of file timer_client.cpp.

7{
8 this->duration = duration;
9 this->oneshot = oneshot;
10}
ros::Duration duration
Definition: cl_ros_timer.h:51

References duration, and oneshot.

◆ ~ClRosTimer()

cl_ros_timer::ClRosTimer::~ClRosTimer ( )
virtual

Definition at line 12 of file timer_client.cpp.

13{
14 timer.stop();
15}

References timer.

Member Function Documentation

◆ initialize()

void cl_ros_timer::ClRosTimer::initialize ( )
virtual

Reimplemented from smacc::ISmaccClient.

Definition at line 17 of file timer_client.cpp.

18{
19 timer = nh_.createTimer(duration, boost::bind(&ClRosTimer::timerCallback, this, _1), oneshot);
20}
void timerCallback(const ros::TimerEvent &timedata)
ros::NodeHandle nh_
Definition: cl_ros_timer.h:48

References duration, nh_, oneshot, timer, and timerCallback().

Here is the call graph for this function:

◆ onOrthogonalAllocation()

template<typename TOrthogonal , typename TSourceObject >
void cl_ros_timer::ClRosTimer::onOrthogonalAllocation ( )
inline

Definition at line 40 of file cl_ros_timer.h.

41 {
42 this->postTimerEvent_ = [=]() {
43 this->postEvent<EvTimer<TSourceObject, TOrthogonal>>();
44 };
45 }
std::function< void()> postTimerEvent_
Definition: cl_ros_timer.h:55

References postTimerEvent_.

◆ onTimerTick()

template<typename T >
boost::signals2::connection cl_ros_timer::ClRosTimer::onTimerTick ( void(T::*)()  callback,
T *  object 
)
inline

Definition at line 34 of file cl_ros_timer.h.

35 {
36 return this->getStateMachine()->createSignalConnection(onTimerTick_, callback, object);
37 }
smacc::SmaccSignal< void()> onTimerTick_
Definition: cl_ros_timer.h:56
ISmaccStateMachine * getStateMachine()
boost::signals2::connection createSignalConnection(TSmaccSignal &signal, TMemberFunctionPrototype callback, TSmaccObjectType *object)

References smacc::ISmaccStateMachine::createSignalConnection(), smacc::ISmaccClient::getStateMachine(), and onTimerTick_.

Referenced by cl_ros_timer::CbTimer::onEntry(), cl_ros_timer::CbTimerCountdownLoop::onEntry(), and cl_ros_timer::CbTimerCountdownOnce::onEntry().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ timerCallback()

void cl_ros_timer::ClRosTimer::timerCallback ( const ros::TimerEvent &  timedata)
protected

Definition at line 22 of file timer_client.cpp.

23{
24 if (!onTimerTick_.empty())
25 {
26 this->onTimerTick_();
27 }
29}

References onTimerTick_, and postTimerEvent_.

Referenced by initialize().

Here is the caller graph for this function:

Member Data Documentation

◆ duration

ros::Duration cl_ros_timer::ClRosTimer::duration
protected

Definition at line 51 of file cl_ros_timer.h.

Referenced by ClRosTimer(), and initialize().

◆ nh_

ros::NodeHandle cl_ros_timer::ClRosTimer::nh_
protected

Definition at line 48 of file cl_ros_timer.h.

Referenced by initialize().

◆ oneshot

bool cl_ros_timer::ClRosTimer::oneshot
protected

Definition at line 52 of file cl_ros_timer.h.

Referenced by ClRosTimer(), and initialize().

◆ onTimerTick_

smacc::SmaccSignal<void()> cl_ros_timer::ClRosTimer::onTimerTick_
protected

Definition at line 56 of file cl_ros_timer.h.

Referenced by onTimerTick(), and timerCallback().

◆ postTimerEvent_

std::function<void()> cl_ros_timer::ClRosTimer::postTimerEvent_
protected

Definition at line 55 of file cl_ros_timer.h.

Referenced by onOrthogonalAllocation(), and timerCallback().

◆ timer

ros::Timer cl_ros_timer::ClRosTimer::timer
protected

Definition at line 50 of file cl_ros_timer.h.

Referenced by initialize(), and ~ClRosTimer().


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