SMACC2
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
smacc2::client_behaviors::CbSleepFor Class Reference

#include <cb_sleep_for.hpp>

Inheritance diagram for smacc2::client_behaviors::CbSleepFor:
Inheritance graph
Collaboration diagram for smacc2::client_behaviors::CbSleepFor:
Collaboration graph

Public Member Functions

 CbSleepFor (rclcpp::Duration sleeptime)
 
void onEntry () override
 
void onExit () override
 
- Public Member Functions inherited from smacc2::SmaccAsyncClientBehavior
template<typename TOrthogonal , typename TSourceObject >
void onOrthogonalAllocation ()
 
virtual ~SmaccAsyncClientBehavior ()
 
template<typename TCallback , typename T >
boost::signals2::connection onSuccess (TCallback callback, T *object)
 
template<typename TCallback , typename T >
boost::signals2::connection onFinished (TCallback callback, T *object)
 
template<typename TCallback , typename T >
boost::signals2::connection onFailure (TCallback callback, T *object)
 
void requestForceFinish ()
 
void executeOnEntry () override
 
void executeOnExit () override
 
void waitOnEntryThread (bool requestFinish)
 
template<typename TCallbackMethod , typename T >
boost::signals2::connection onSuccess (TCallbackMethod callback, T *object)
 
template<typename TCallbackMethod , typename T >
boost::signals2::connection onFinished (TCallbackMethod callback, T *object)
 
template<typename TCallbackMethod , typename T >
boost::signals2::connection onFailure (TCallbackMethod callback, T *object)
 
- Public Member Functions inherited from smacc2::ISmaccClientBehavior
 ISmaccClientBehavior ()
 
virtual ~ISmaccClientBehavior ()
 
ISmaccStateMachinegetStateMachine ()
 
std::string getName () const
 
template<typename SmaccClientType >
void requiresClient (SmaccClientType *&storage)
 
template<typename SmaccComponentType >
void requiresComponent (SmaccComponentType *&storage, bool throwExceptionIfNotExist=false)
 

Private Attributes

rclcpp::Duration sleeptime_
 

Additional Inherited Members

- Protected Member Functions inherited from smacc2::SmaccAsyncClientBehavior
void postSuccessEvent ()
 
void postFailureEvent ()
 
virtual void dispose () override
 
bool isShutdownRequested ()
 onEntry is executed in a new thread. However the current state cannot be left until the onEntry thread finishes. This flag can be checked from the onEntry thread to force finishing the thread.
 
- Protected Member Functions inherited from smacc2::ISmaccClientBehavior
virtual void runtimeConfigure ()
 
template<typename EventType >
void postEvent (const EventType &ev)
 
template<typename EventType >
void postEvent ()
 
ISmaccStategetCurrentState ()
 
virtual rclcpp::Node::SharedPtr getNode () const
 
virtual rclcpp::Logger getLogger () const
 

Detailed Description

Definition at line 31 of file cb_sleep_for.hpp.

Constructor & Destructor Documentation

◆ CbSleepFor()

smacc2::client_behaviors::CbSleepFor::CbSleepFor ( rclcpp::Duration  sleeptime)
inline

Definition at line 34 of file cb_sleep_for.hpp.

34: sleeptime_(sleeptime) {}

Member Function Documentation

◆ onEntry()

void smacc2::client_behaviors::CbSleepFor::onEntry ( )
inlineoverridevirtual

Reimplemented from smacc2::ISmaccClientBehavior.

Definition at line 36 of file cb_sleep_for.hpp.

37 {
38 auto starttime = getNode()->now();
39 while (!this->isShutdownRequested() && (getNode()->now() - starttime) < sleeptime_)
40 {
41 rclcpp::sleep_for(10ms);
42 }
43
44 //rclcpp::sleep_for(std::chrono::nanoseconds(sleeptime_.nanoseconds()));
45 this->postSuccessEvent();
46 }
virtual rclcpp::Node::SharedPtr getNode() const
bool isShutdownRequested()
onEntry is executed in a new thread. However the current state cannot be left until the onEntry threa...

References smacc2::ISmaccClientBehavior::getNode(), smacc2::SmaccAsyncClientBehavior::isShutdownRequested(), smacc2::SmaccAsyncClientBehavior::postSuccessEvent(), and sleeptime_.

Here is the call graph for this function:

◆ onExit()

void smacc2::client_behaviors::CbSleepFor::onExit ( )
inlineoverridevirtual

Reimplemented from smacc2::ISmaccClientBehavior.

Definition at line 48 of file cb_sleep_for.hpp.

48{}

Member Data Documentation

◆ sleeptime_

rclcpp::Duration smacc2::client_behaviors::CbSleepFor::sleeptime_
private

Definition at line 51 of file cb_sleep_for.hpp.

Referenced by onEntry().


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