SMACC2
Loading...
Searching...
No Matches
cl_lifecycle_node::CbConfigure Class Reference

#include <cb_configure.hpp>

Inheritance diagram for cl_lifecycle_node::CbConfigure:
Inheritance graph
Collaboration diagram for cl_lifecycle_node::CbConfigure:
Collaboration graph

Public Member Functions

 CbConfigure ()
 
virtual ~CbConfigure ()
 
template<typename TOrthogonal , typename TSourceObject >
void onStateOrthogonalAllocation ()
 
virtual void onEntry () override
 
void onTransitionSuccess ()
 
void onTransitionFailure ()
 
- Public Member Functions inherited from smacc2::SmaccAsyncClientBehavior
template<typename TOrthogonal , typename TSourceObject >
void onStateOrthogonalAllocation ()
 
 SmaccAsyncClientBehavior ()=default
 
 ~SmaccAsyncClientBehavior () override
 
 SmaccAsyncClientBehavior (const SmaccAsyncClientBehavior &)=delete
 
SmaccAsyncClientBehavior & operator= (const SmaccAsyncClientBehavior &)=delete
 
 SmaccAsyncClientBehavior (SmaccAsyncClientBehavior &&)=delete
 
SmaccAsyncClientBehavior & operator= (SmaccAsyncClientBehavior &&)=delete
 
template<typename TCallback , typename T >
smacc2::SmaccSignalConnection onSuccess (TCallback callback, T *object)
 
template<typename TCallback , typename T >
smacc2::SmaccSignalConnection onFinished (TCallback callback, T *object)
 
template<typename TCallback , typename T >
smacc2::SmaccSignalConnection onFailure (TCallback callback, T *object)
 
void requestForceFinish ()
 
void executeOnEntry () override
 
void executeOnExit () override
 
void waitOnEntryThread (bool requestFinish)
 
template<typename TCallbackMethod , typename T >
smacc2::SmaccSignalConnection onSuccess (TCallbackMethod callback, T *object)
 
template<typename TCallbackMethod , typename T >
smacc2::SmaccSignalConnection onFinished (TCallbackMethod callback, T *object)
 
template<typename TCallbackMethod , typename T >
smacc2::SmaccSignalConnection onFailure (TCallbackMethod callback, T *object)
 
- Public Member Functions inherited from smacc2::ISmaccClientBehavior
 ISmaccClientBehavior ()
 
virtual ~ISmaccClientBehavior ()
 
 ISmaccClientBehavior (const ISmaccClientBehavior &)=delete
 
ISmaccClientBehavior & operator= (const ISmaccClientBehavior &)=delete
 
 ISmaccClientBehavior (ISmaccClientBehavior &&)=delete
 
ISmaccClientBehavior & operator= (ISmaccClientBehavior &&)=delete
 
ISmaccStateMachine * getStateMachine ()
 
std::string getName () const
 
template<typename SmaccClientType >
void requiresClient (SmaccClientType *&storage)
 
template<typename SmaccComponentType >
void requiresComponent (SmaccComponentType *&storage, ComponentRequirement requirementType=ComponentRequirement::SOFT)
 
template<typename SmaccComponentType >
void requiresComponent (const std::string &name, SmaccComponentType *&storage, ComponentRequirement requirementType=ComponentRequirement::SOFT)
 
virtual void onExit ()
 

Private Attributes

ClLifecycleNode * lifecycleNodeClient_ = nullptr
 
CpLifecycleEventMonitor * eventMonitor_ = nullptr
 

Additional Inherited Members

- Protected Member Functions inherited from smacc2::SmaccAsyncClientBehavior
void postSuccessEvent ()
 
void postFailureEvent ()
 
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 ()
 
ISmaccState * getCurrentState ()
 
void postInitializationFailureEvent (const std::string &what)
 
virtual rclcpp::Node::SharedPtr getNode () const
 
virtual rclcpp::Logger getLogger () const
 
std::string getTraceStateName () const
 
std::string getTraceOrthogonalName () const
 

Detailed Description

Definition at line 29 of file cb_configure.hpp.

Constructor & Destructor Documentation

◆ CbConfigure()

cl_lifecycle_node::CbConfigure::CbConfigure ( )
inline

Definition at line 32 of file cb_configure.hpp.

32{}

◆ ~CbConfigure()

virtual cl_lifecycle_node::CbConfigure::~CbConfigure ( )
inlinevirtual

Definition at line 33 of file cb_configure.hpp.

33{}

Member Function Documentation

◆ onEntry()

virtual void cl_lifecycle_node::CbConfigure::onEntry ( )
inlineoverridevirtual

Reimplemented from smacc2::ISmaccClientBehavior.

Definition at line 51 of file cb_configure.hpp.

52 {
53 // Runs on this behavior's thread. The wait inside the client ends when the request is
54 // answered, when this behavior is asked to finish (state exit, shutdown) or when ROS shuts
55 // down. If the request was abandoned nothing is posted: the state is already leaving. If the
56 // node rejected it, no transition event will ever arrive for this attempt, so the behavior
57 // reports the failure itself.
58 const bool accepted =
59 lifecycleNodeClient_->configure([this]() { return this->isShutdownRequested(); });
60 if (!accepted && !this->isShutdownRequested())
61 {
62 this->postFailureEvent();
63 }
64 }
ClLifecycleNode * lifecycleNodeClient_
bool configure(const CancelPredicate &cancelled=CancelPredicate())
bool isShutdownRequested()
onEntry is executed in a new thread. However the current state cannot be left until the onEntry threa...

References cl_lifecycle_node::ClLifecycleNode::configure(), smacc2::SmaccAsyncClientBehavior::isShutdownRequested(), lifecycleNodeClient_, and smacc2::SmaccAsyncClientBehavior::postFailureEvent().

Here is the call graph for this function:

◆ onStateOrthogonalAllocation()

template<typename TOrthogonal , typename TSourceObject >
void cl_lifecycle_node::CbConfigure::onStateOrthogonalAllocation ( )
inline

Definition at line 36 of file cb_configure.hpp.

37 {
39
42 // State-scoped signal connections, made on the state machine thread. Each is tracked by this
43 // behavior's address and finalized when the behavior is disposed at state exit, so a
44 // transition event that arrives after the exit cannot call into a destroyed behavior. The
45 // raw connect() calls this replaces were never disconnected (finding T).
49 }
CpLifecycleEventMonitor * eventMonitor_
smacc2::SmaccSignalConnection onTransitionOnConfigureFailure(void(T::*callback)(), T *object)
smacc2::SmaccSignalConnection onTransitionOnConfigureError(void(T::*callback)(), T *object)
smacc2::SmaccSignalConnection onTransitionOnConfigureSuccess(void(T::*callback)(), T *object)
void requiresClient(SmaccClientType *&storage)
void requiresComponent(SmaccComponentType *&storage, ComponentRequirement requirementType=ComponentRequirement::SOFT)

References eventMonitor_, lifecycleNodeClient_, smacc2::SmaccAsyncClientBehavior::onStateOrthogonalAllocation(), onTransitionFailure(), cl_lifecycle_node::CpLifecycleEventMonitor::onTransitionOnConfigureError(), cl_lifecycle_node::CpLifecycleEventMonitor::onTransitionOnConfigureFailure(), cl_lifecycle_node::CpLifecycleEventMonitor::onTransitionOnConfigureSuccess(), onTransitionSuccess(), smacc2::ISmaccClientBehavior::requiresClient(), and smacc2::ISmaccClientBehavior::requiresComponent().

Here is the call graph for this function:

◆ onTransitionFailure()

void cl_lifecycle_node::CbConfigure::onTransitionFailure ( )
inline

Definition at line 72 of file cb_configure.hpp.

73 {
74 RCLCPP_WARN(getLogger(), "[CbConfigure] Configure transition failed or errored");
75 this->postFailureEvent();
76 }
virtual rclcpp::Logger getLogger() const

References smacc2::ISmaccClientBehavior::getLogger(), and smacc2::SmaccAsyncClientBehavior::postFailureEvent().

Referenced by onStateOrthogonalAllocation().

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

◆ onTransitionSuccess()

void cl_lifecycle_node::CbConfigure::onTransitionSuccess ( )
inline

Definition at line 66 of file cb_configure.hpp.

67 {
68 RCLCPP_INFO(getLogger(), "[CbConfigure] Configure transition succeeded");
69 this->postSuccessEvent();
70 }

References smacc2::ISmaccClientBehavior::getLogger(), and smacc2::SmaccAsyncClientBehavior::postSuccessEvent().

Referenced by onStateOrthogonalAllocation().

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

Member Data Documentation

◆ eventMonitor_

CpLifecycleEventMonitor* cl_lifecycle_node::CbConfigure::eventMonitor_ = nullptr
private

Definition at line 80 of file cb_configure.hpp.

Referenced by onStateOrthogonalAllocation().

◆ lifecycleNodeClient_

ClLifecycleNode* cl_lifecycle_node::CbConfigure::lifecycleNodeClient_ = nullptr
private

Definition at line 79 of file cb_configure.hpp.

Referenced by onEntry(), and onStateOrthogonalAllocation().


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