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

#include <cb_wait_action_server.hpp>

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

Public Member Functions

 CbWaitActionServer (std::chrono::milliseconds timeout)
 
virtual ~CbWaitActionServer ()
 
template<typename TOrthogonal , typename TSourceObject >
void onOrthogonalAllocation ()
 
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)
 
- 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)
 

Private Attributes

ISmaccActionClientclient_
 
std::chrono::milliseconds timeout_
 

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 ()
 
virtual void onEntry ()
 
virtual void onExit ()
 
template<typename EventType >
void postEvent (const EventType &ev)
 
template<typename EventType >
void postEvent ()
 
ISmaccStategetCurrentState ()
 
virtual void dispose ()
 
virtual rclcpp::Node::SharedPtr getNode ()
 
virtual rclcpp::Logger getLogger ()
 

Detailed Description

Definition at line 33 of file cb_wait_action_server.hpp.

Constructor & Destructor Documentation

◆ CbWaitActionServer()

smacc2::client_behaviors::CbWaitActionServer::CbWaitActionServer ( std::chrono::milliseconds  timeout)

Definition at line 27 of file cb_wait_action_server.cpp.

27: timeout_(timeout) {}

◆ ~CbWaitActionServer()

smacc2::client_behaviors::CbWaitActionServer::~CbWaitActionServer ( )
virtual

Definition at line 29 of file cb_wait_action_server.cpp.

29{}

Member Function Documentation

◆ onEntry()

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

Reimplemented from smacc2::ISmaccClientBehavior.

Definition at line 31 of file cb_wait_action_server.cpp.

32{
33 if (client_ != nullptr)
34 {
35 std::shared_ptr<rclcpp_action::ClientBase> client_base = client_->getClientBase();
36 RCLCPP_INFO(getLogger(), "[CbWaitActionServer] waiting action server..");
37 bool found = client_base->wait_for_action_server(timeout_);
38
39 if (found)
40 {
41 RCLCPP_INFO(getLogger(), "[CbWaitActionServer] action server already available");
42 this->postSuccessEvent();
43 }
44 else
45 {
46 RCLCPP_INFO(getLogger(), "[CbWaitActionServer] action server not found, timeout");
47 this->postFailureEvent();
48 }
49 }
50 else
51 {
52 RCLCPP_INFO(getLogger(), "[CbWaitActionServer] there is no action client in this orthogonal");
53 this->postFailureEvent();
54 }
55}
virtual std::shared_ptr< rclcpp_action::ClientBase > getClientBase()=0

References client_, smacc2::client_bases::ISmaccActionClient::getClientBase(), smacc2::ISmaccClientBehavior::getLogger(), smacc2::SmaccAsyncClientBehavior::postFailureEvent(), smacc2::SmaccAsyncClientBehavior::postSuccessEvent(), and timeout_.

Here is the call graph for this function:

◆ onOrthogonalAllocation()

template<typename TOrthogonal , typename TSourceObject >
void smacc2::client_behaviors::CbWaitActionServer::onOrthogonalAllocation ( )
inline

Definition at line 40 of file cb_wait_action_server.hpp.

41 {
42 SmaccAsyncClientBehavior::onOrthogonalAllocation<TOrthogonal, TSourceObject>();
44 }
void requiresClient(SmaccClientType *&storage)

References client_, and smacc2::ISmaccClientBehavior::requiresClient().

Here is the call graph for this function:

Member Data Documentation

◆ client_

ISmaccActionClient* smacc2::client_behaviors::CbWaitActionServer::client_
private

Definition at line 49 of file cb_wait_action_server.hpp.

Referenced by onEntry(), and onOrthogonalAllocation().

◆ timeout_

std::chrono::milliseconds smacc2::client_behaviors::CbWaitActionServer::timeout_
private

Definition at line 50 of file cb_wait_action_server.hpp.

Referenced by onEntry().


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