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

#include <cb_wait_node.hpp>

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

Public Member Functions

 CbWaitNode (std::string nodeName)
 
void onEntry () 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)
 
virtual void onExit ()
 

Protected Attributes

std::string nodeName_
 
rclcpp::Rate rate_
 

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 33 of file cb_wait_node.hpp.

Constructor & Destructor Documentation

◆ CbWaitNode()

smacc2::client_behaviors::CbWaitNode::CbWaitNode ( std::string  nodeName)

Definition at line 27 of file cb_wait_node.cpp.

Member Function Documentation

◆ onEntry()

void smacc2::client_behaviors::CbWaitNode::onEntry ( )
overridevirtual

Reimplemented from smacc2::ISmaccClientBehavior.

Definition at line 29 of file cb_wait_node.cpp.

30{
31 bool found = false;
32 while (!this->isShutdownRequested() && !found)
33 {
34 std::stringstream ss;
35 auto nodenames = getNode()->get_node_names();
36
37 for (auto n : nodenames)
38 {
39 ss << " - " << n << std::endl;
40
41 if (n == nodeName_) found = true;
42 }
43
44 auto totalstr = ss.str();
45 RCLCPP_INFO_STREAM(
46 getLogger(), "[" << getName() << "] on entry, listing nodes (" << nodenames.size() << ")"
47 << std::endl
48 << totalstr);
49
50 rate_.sleep();
51 }
52
53 if (found)
54 {
55 this->postSuccessEvent();
56 }
57 else
58 {
59 this->postFailureEvent();
60 }
61}
virtual rclcpp::Logger getLogger() const
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::getLogger(), smacc2::ISmaccClientBehavior::getName(), smacc2::ISmaccClientBehavior::getNode(), smacc2::SmaccAsyncClientBehavior::isShutdownRequested(), nodeName_, smacc2::SmaccAsyncClientBehavior::postFailureEvent(), smacc2::SmaccAsyncClientBehavior::postSuccessEvent(), and rate_.

Here is the call graph for this function:

Member Data Documentation

◆ nodeName_

std::string smacc2::client_behaviors::CbWaitNode::nodeName_
protected

Definition at line 41 of file cb_wait_node.hpp.

Referenced by onEntry().

◆ rate_

rclcpp::Rate smacc2::client_behaviors::CbWaitNode::rate_
protected

Definition at line 43 of file cb_wait_node.hpp.

Referenced by onEntry().


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