|
SMACC2
|
#include <smacc_asynchronous_client_behavior.hpp>


Public Member Functions | |
| 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 | onEntry () |
| virtual void | onExit () |
Protected Member Functions | |
| 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 |
Private Member Functions | |
| void | waitFutureIfNotFinished (std::optional< std::future< int > > &threadfut, bool requestFinish) |
Private Attributes | |
| std::optional< std::future< int > > | onEntryThread_ |
| std::optional< std::future< int > > | onExitThread_ |
| std::function< void()> | postFinishEventFn_ |
| std::function< void()> | postSuccessEventFn_ |
| std::function< void()> | postFailureEventFn_ |
| SmaccSignal< void()> | onFinished_ |
| SmaccSignal< void()> | onSuccess_ |
| SmaccSignal< void()> | onFailure_ |
| std::atomic< bool > | isShutdownRequested_ {false} |
Definition at line 56 of file smacc_asynchronous_client_behavior.hpp.
|
default |
|
override |
Definition at line 242 of file smacc_client_async_behavior.cpp.
References smacc2::ISmaccClientBehavior::getLogger(), smacc2::ISmaccClientBehavior::getName(), onEntryThread_, onExitThread_, and waitOnEntryThread().

|
delete |
|
delete |
|
overrideprotectedvirtual |
Reimplemented from smacc2::ISmaccClientBehavior.
Definition at line 211 of file smacc_client_async_behavior.cpp.
References smacc2::ISmaccClientBehavior::getLogger(), smacc2::ISmaccClientBehavior::getName(), smacc2::logThreadException(), onExitThread_, and waitOnEntryThread().

|
overridevirtual |
Reimplemented from smacc2::ISmaccClientBehavior.
Definition at line 90 of file smacc_client_async_behavior.cpp.
References smacc2::ISmaccClientBehavior::getLogger(), smacc2::ISmaccClientBehavior::getName(), smacc2::ISmaccClientBehavior::getTraceOrthogonalName(), smacc2::ISmaccClientBehavior::getTraceStateName(), smacc2::logThreadException(), smacc2::ISmaccClientBehavior::onEntry(), onEntryThread_, postFinishEventFn_, and smacc2::ISmaccClientBehavior::postInitializationFailureEvent().

|
overridevirtual |
Reimplemented from smacc2::ISmaccClientBehavior.
Definition at line 190 of file smacc_client_async_behavior.cpp.
References smacc2::ISmaccClientBehavior::getLogger(), smacc2::ISmaccClientBehavior::getName(), smacc2::ISmaccClientBehavior::getTraceOrthogonalName(), smacc2::ISmaccClientBehavior::getTraceStateName(), smacc2::ISmaccClientBehavior::onExit(), onExitThread_, and waitOnEntryThread().

|
protected |
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.
Definition at line 284 of file smacc_client_async_behavior.cpp.
References isShutdownRequested_.
Referenced by cl_gcalcli::CbWaitConnection::onEntry(), cl_lifecycle_node::CbActivate::onEntry(), cl_lifecycle_node::CbCleanup::onEntry(), cl_lifecycle_node::CbConfigure::onEntry(), cl_lifecycle_node::CbDeactivate::onEntry(), cl_lifecycle_node::CbShutdown::onEntry(), cl_nav2z::CbAbortNavigation::onEntry(), cl_nav2z::CbActiveStop::onEntry(), cl_nav2z::CbPositionControlFreeSpace::onEntry(), cl_nav2z::CbPureSpinning::onEntry(), cl_px4_mr::CbConnectMicroRosAgent::onEntry(), cl_px4_mr::CbWaitForHeadingStable::onEntry(), cl_rgb::CbSurveyTable::onEntry(), smacc2::client_behaviors::CbRosLaunch2::onEntry(), smacc2::client_behaviors::CbSequence::onEntry(), smacc2::client_behaviors::CbServiceCall< ServiceType >::onEntry(), smacc2::client_behaviors::CbSleepFor::onEntry(), smacc2::client_behaviors::CbWaitActionServer2< ActionT >::onEntry(), smacc2::client_behaviors::CbWaitActionServer::onEntry(), smacc2::client_behaviors::CbWaitNode::onEntry(), smacc2::client_behaviors::CbWaitTopic::onEntry(), cl_lifecycle_node::CbDeactivateOnExit::onExit(), smacc2::client_behaviors::CbSequence::recursiveConsumeNext(), and smacc2::client_behavior_bases::CbActionClientBehaviorBase< TAction >::trackGoal().

| smacc2::SmaccSignalConnection smacc2::SmaccAsyncClientBehavior::onFailure | ( | TCallback | callback, |
| T * | object ) |
| smacc2::SmaccSignalConnection smacc2::SmaccAsyncClientBehavior::onFailure | ( | TCallbackMethod | callback, |
| T * | object ) |
Definition at line 77 of file smacc_asynchronous_client_behavior_impl.hpp.
References smacc2::ISmaccStateMachine::createSignalConnection(), smacc2::ISmaccClientBehavior::getStateMachine(), and onFailure_.

| smacc2::SmaccSignalConnection smacc2::SmaccAsyncClientBehavior::onFinished | ( | TCallback | callback, |
| T * | object ) |
| smacc2::SmaccSignalConnection smacc2::SmaccAsyncClientBehavior::onFinished | ( | TCallbackMethod | callback, |
| T * | object ) |
Definition at line 70 of file smacc_asynchronous_client_behavior_impl.hpp.
References smacc2::ISmaccStateMachine::createSignalConnection(), smacc2::ISmaccClientBehavior::getStateMachine(), and onFinished_.

| void smacc2::SmaccAsyncClientBehavior::onStateOrthogonalAllocation | ( | ) |
Definition at line 29 of file smacc_asynchronous_client_behavior_impl.hpp.
References smacc2::ISmaccClientBehavior::getLogger(), onFailure_, onFinished_, onSuccess_, smacc2::ISmaccClientBehavior::postEvent(), postFailureEventFn_, postFinishEventFn_, and postSuccessEventFn_.
Referenced by cl_lifecycle_node::CbActivate::onStateOrthogonalAllocation(), cl_lifecycle_node::CbCleanup::onStateOrthogonalAllocation(), cl_lifecycle_node::CbConfigure::onStateOrthogonalAllocation(), cl_lifecycle_node::CbDeactivate::onStateOrthogonalAllocation(), cl_lifecycle_node::CbDeactivateOnExit::onStateOrthogonalAllocation(), cl_lifecycle_node::CbShutdown::onStateOrthogonalAllocation(), cl_mission_tracker::CbBatteryDecission::onStateOrthogonalAllocation(), cl_modbus_tcp_relay::CbAllRelaysOff::onStateOrthogonalAllocation(), cl_modbus_tcp_relay::CbAllRelaysOn::onStateOrthogonalAllocation(), cl_modbus_tcp_relay::CbRelayOff::onStateOrthogonalAllocation(), cl_modbus_tcp_relay::CbRelayOn::onStateOrthogonalAllocation(), cl_modbus_tcp_relay::CbRelayStatus::onStateOrthogonalAllocation(), cl_moveit2z::CbMoveit2zClientBehaviorBase::onStateOrthogonalAllocation(), cl_nav2z::CbAbortNavigation::onStateOrthogonalAllocation(), cl_nav2z::CbNavigateNextWaypointUntilReached::onStateOrthogonalAllocation(), cl_nav2z::CbWaitPose::onStateOrthogonalAllocation(), cl_nav2z::CbWaitTransform::onStateOrthogonalAllocation(), cl_px4_mr::CbPx4ClientBehaviorBase::onStateOrthogonalAllocation(), cl_rgb::CbRgbClientBehaviorBase::onStateOrthogonalAllocation(), smacc2::client_behavior_bases::CbActionClientBehaviorBase< TAction >::onStateOrthogonalAllocation(), smacc2::client_behaviors::CbRosLaunch2::onStateOrthogonalAllocation(), smacc2::client_behaviors::CbRosStop2::onStateOrthogonalAllocation(), smacc2::client_behaviors::CbWaitActionServer2< ActionT >::onStateOrthogonalAllocation(), smacc2::client_behaviors::CbWaitActionServer::onStateOrthogonalAllocation(), and smacc2::client_behaviors::CbSequence::then().


| smacc2::SmaccSignalConnection smacc2::SmaccAsyncClientBehavior::onSuccess | ( | TCallback | callback, |
| T * | object ) |
Referenced by cl_nav2z::CbNavigateNextWaypointFree::onEntry().

| smacc2::SmaccSignalConnection smacc2::SmaccAsyncClientBehavior::onSuccess | ( | TCallbackMethod | callback, |
| T * | object ) |
Definition at line 63 of file smacc_asynchronous_client_behavior_impl.hpp.
References smacc2::ISmaccStateMachine::createSignalConnection(), smacc2::ISmaccClientBehavior::getStateMachine(), and onSuccess_.

|
delete |
|
delete |
|
protected |
Definition at line 274 of file smacc_client_async_behavior.cpp.
References postFailureEventFn_.
Referenced by cl_moveit2z::CbMoveEndEffectorTrajectory::executeJointSpaceTrajectory(), smacc2::client_behavior_bases::CbActionClientBehaviorBase< TAction >::onActionAbort(), cl_gcalcli::CbDetectCalendarEvent::onEntry(), cl_gcalcli::CbEventDetect::onEntry(), cl_gcalcli::CbQuickAdd::onEntry(), cl_gcalcli::CbWaitConnection::onEntry(), cl_lifecycle_node::CbActivate::onEntry(), cl_lifecycle_node::CbCleanup::onEntry(), cl_lifecycle_node::CbConfigure::onEntry(), cl_lifecycle_node::CbDeactivate::onEntry(), cl_lifecycle_node::CbShutdown::onEntry(), cl_modbus_tcp_relay::CbAllRelaysOff::onEntry(), cl_modbus_tcp_relay::CbAllRelaysOn::onEntry(), cl_modbus_tcp_relay::CbRelayOff::onEntry(), cl_modbus_tcp_relay::CbRelayOn::onEntry(), cl_moveit2z::CbAttachObject::onEntry(), cl_moveit2z::CbDetachObject::onEntry(), cl_moveit2z::CbMoveEndEffectorTrajectory::onEntry(), cl_nav2z::CbAbortNavigation::onEntry(), cl_nav2z::CbLoadWaypointsFile::onEntry(), cl_nav2z::CbNavigateNamedWaypoint::onEntry(), cl_nav2z::CbNavigateNextWaypoint::onEntry(), cl_nav2z::CbWaitNav2Nodes::onEntry(), cl_nav2z::CbWaitPose::onEntry(), cl_nav2z::CbWaitTransform::onEntry(), smacc2::client_behaviors::CbSequence::onEntry(), smacc2::client_behaviors::CbServiceCall< ServiceType >::onEntry(), smacc2::client_behaviors::CbWaitActionServer2< ActionT >::onEntry(), smacc2::client_behaviors::CbWaitActionServer::onEntry(), smacc2::client_behaviors::CbWaitNode::onEntry(), smacc2::client_behaviors::CbWaitTopic::onEntry(), cl_nav2z::CbNav2ZClientBehaviorBase::onNavigationActionAbort(), smacc2::client_behaviors::CbSequence::onSubNodeAbort(), cl_lifecycle_node::CbActivate::onTransitionFailure(), cl_lifecycle_node::CbCleanup::onTransitionFailure(), cl_lifecycle_node::CbConfigure::onTransitionFailure(), cl_lifecycle_node::CbDeactivate::onTransitionFailure(), cl_lifecycle_node::CbDeactivateOnExit::onTransitionFailure(), cl_lifecycle_node::CbShutdown::onTransitionFailure(), cl_moveit2z::CbMoveit2zClientBehaviorBase::postMotionFailure(), cl_px4_mr::CbPx4ClientBehaviorBase::postPx4Failure(), cl_rgb::CbRgbClientBehaviorBase::postRgbFailure(), cl_modbus_tcp_relay::CbRelayStatus::readAllChannels(), cl_modbus_tcp_relay::CbRelayStatus::readSingleChannel(), smacc2::client_behavior_bases::CbActionClientBehaviorBase< TAction >::sendGoal(), and smacc2::client_behavior_bases::CbActionClientBehaviorBase< TAction >::trackGoal().

|
protected |
Definition at line 272 of file smacc_client_async_behavior.cpp.
References postSuccessEventFn_.
Referenced by cl_nav2z::CbAssistedTeleop::onActionAbort(), smacc2::client_behavior_bases::CbActionClientBehaviorBase< TAction >::onActionSuccess(), cl_gcalcli::CbQuickAdd::onEntry(), cl_gcalcli::CbWaitConnection::onEntry(), cl_modbus_tcp_relay::CbAllRelaysOff::onEntry(), cl_modbus_tcp_relay::CbAllRelaysOn::onEntry(), cl_modbus_tcp_relay::CbRelayOff::onEntry(), cl_modbus_tcp_relay::CbRelayOn::onEntry(), cl_moveit2z::CbAttachObject::onEntry(), cl_moveit2z::CbDetachObject::onEntry(), cl_nav2z::CbAbortNavigation::onEntry(), cl_nav2z::CbActiveStop::onEntry(), cl_nav2z::CbLoadWaypointsFile::onEntry(), cl_nav2z::CbPositionControlFreeSpace::onEntry(), cl_nav2z::CbPureSpinning::onEntry(), cl_nav2z::CbSpiralMotion::onEntry(), cl_nav2z::CbWaitPose::onEntry(), cl_nav2z::CbWaitTransform::onEntry(), smacc2::client_behaviors::CbSequence::onEntry(), smacc2::client_behaviors::CbServiceCall< ServiceType >::onEntry(), smacc2::client_behaviors::CbSleepFor::onEntry(), smacc2::client_behaviors::CbWaitActionServer2< ActionT >::onEntry(), smacc2::client_behaviors::CbWaitActionServer::onEntry(), smacc2::client_behaviors::CbWaitNode::onEntry(), smacc2::client_behaviors::CbWaitTopic::onEntry(), cl_gcalcli::CbDetectCalendarEvent::onEventStarted(), cl_gcalcli::CbEventDetect::onEventStarted(), cl_nav2z::CbWaitNav2Nodes::onMessageReceived(), smacc2::client_behaviors::CbWaitTopicMessage< TMessage >::onMessageReceived(), cl_nav2z::CbNav2ZClientBehaviorBase::onNavigationActionSuccess(), cl_nav2z::CbNavigateNextWaypointUntilReached::onNavigationActionSuccess(), cl_lifecycle_node::CbActivate::onTransitionSuccess(), cl_lifecycle_node::CbCleanup::onTransitionSuccess(), cl_lifecycle_node::CbConfigure::onTransitionSuccess(), cl_lifecycle_node::CbDeactivate::onTransitionSuccess(), cl_lifecycle_node::CbDeactivateOnExit::onTransitionSuccess(), cl_lifecycle_node::CbShutdown::onTransitionSuccess(), cl_moveit2z::CbMoveit2zClientBehaviorBase::postMotionSuccess(), cl_px4_mr::CbPx4ClientBehaviorBase::postPx4Success(), cl_rgb::CbRgbClientBehaviorBase::postRgbSuccess(), cl_modbus_tcp_relay::CbRelayStatus::readAllChannels(), and cl_modbus_tcp_relay::CbRelayStatus::readSingleChannel().

| void smacc2::SmaccAsyncClientBehavior::requestForceFinish | ( | ) |
Definition at line 276 of file smacc_client_async_behavior.cpp.
References smacc2::ISmaccClientBehavior::getLogger(), smacc2::ISmaccClientBehavior::getName(), smacc2::ISmaccClientBehavior::getNode(), and isShutdownRequested_.
Referenced by smacc2::client_behaviors::CbSequence::onSubNodeAbort(), and waitFutureIfNotFinished().


|
private |
Definition at line 123 of file smacc_client_async_behavior.cpp.
References smacc2::ISmaccClientBehavior::getLogger(), smacc2::ISmaccClientBehavior::getName(), smacc2::ISmaccClientBehavior::getNode(), smacc2::logThreadException(), and requestForceFinish().
Referenced by waitOnEntryThread().


| void smacc2::SmaccAsyncClientBehavior::waitOnEntryThread | ( | bool | requestFinish | ) |
Definition at line 185 of file smacc_client_async_behavior.cpp.
References onEntryThread_, and waitFutureIfNotFinished().
Referenced by dispose(), executeOnExit(), and ~SmaccAsyncClientBehavior().


|
private |
Definition at line 123 of file smacc_asynchronous_client_behavior.hpp.
Referenced by isShutdownRequested(), and requestForceFinish().
|
private |
Definition at line 109 of file smacc_asynchronous_client_behavior.hpp.
Referenced by executeOnEntry(), waitOnEntryThread(), and ~SmaccAsyncClientBehavior().
|
private |
Definition at line 110 of file smacc_asynchronous_client_behavior.hpp.
Referenced by dispose(), executeOnExit(), and ~SmaccAsyncClientBehavior().
|
private |
Definition at line 118 of file smacc_asynchronous_client_behavior.hpp.
Referenced by onFailure(), and onStateOrthogonalAllocation().
|
private |
Definition at line 116 of file smacc_asynchronous_client_behavior.hpp.
Referenced by onFinished(), and onStateOrthogonalAllocation().
|
private |
Definition at line 117 of file smacc_asynchronous_client_behavior.hpp.
Referenced by onStateOrthogonalAllocation(), and onSuccess().
|
private |
Definition at line 114 of file smacc_asynchronous_client_behavior.hpp.
Referenced by onStateOrthogonalAllocation(), and postFailureEvent().
|
private |
Definition at line 112 of file smacc_asynchronous_client_behavior.hpp.
Referenced by executeOnEntry(), and onStateOrthogonalAllocation().
|
private |
Definition at line 113 of file smacc_asynchronous_client_behavior.hpp.
Referenced by onStateOrthogonalAllocation(), and postSuccessEvent().