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 onEntry ()
 
virtual void onExit ()
 
virtual void executeOnEntry ()
 
virtual void executeOnExit ()
 

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 ()
 
- 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 void dispose ()
 
virtual rclcpp::Node::SharedPtr getNode () const
 
virtual rclcpp::Logger getLogger () const
 

Detailed Description

Definition at line 35 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 for (auto n : nodenames)
37 {
38 ss << " - " << n << std::endl;
39
40 if (n == nodeName_) found = true;
41 }
42
43 auto totalstr = ss.str();
44 RCLCPP_INFO_STREAM(
45 getLogger(), "[" << getName() << "] on entry, listing nodes (" << nodenames.size() << ")"
46 << std::endl
47 << totalstr);
48
49 rate_.sleep();
50 }
51
52 if (found)
53 {
54 this->postSuccessEvent();
55 }
56 else
57 {
58 this->postFailureEvent();
59 }
60}
virtual rclcpp::Logger getLogger() const
virtual rclcpp::Node::SharedPtr getNode() const

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

Referenced by onEntry().

◆ rate_

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

Definition at line 45 of file cb_wait_node.hpp.

Referenced by onEntry().


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