|
SMACC2
|
Component that monitors ROS2 lifecycle node transition events. More...
#include <cp_lifecycle_event_monitor.hpp>


Public Member Functions | |
| CpLifecycleEventMonitor (std::string nodeName) | |
| Constructor with node name. | |
| virtual | ~CpLifecycleEventMonitor ()=default |
| void | setOwner (smacc2::ISmaccClient *owner, smacc2::ISmaccStateMachine *stateMachine) |
| Set the owner client and state machine for this component. | |
| std::optional< lifecycle_msgs::msg::TransitionEvent > | getLastTransitionEvent () const |
| Get the last received transition event. | |
| void | onInitialize () override |
| Component initialization - creates subscription. | |
| template<typename TOrthogonal , typename TClient > | |
| void | onStateOrthogonalAllocation () |
| Configure event posting with orthogonal template parameter This is called from the client's onStateOrthogonalAllocation to set up type-safe event posting. | |
Public Member Functions inherited from smacc2::ISmaccComponent | |
| ISmaccComponent () | |
| virtual | ~ISmaccComponent () |
| virtual std::string | getName () const |
Private Member Functions | |
| void | onTransitionEvent (const lifecycle_msgs::msg::TransitionEvent::SharedPtr msg) |
| Callback for transition event subscription. | |
Private Attributes | |
| std::string | nodeName_ |
| rclcpp::Subscription< lifecycle_msgs::msg::TransitionEvent >::SharedPtr | subscription_ |
| lifecycle_msgs::msg::TransitionEvent::SharedPtr | lastTransitionEvent_ |
| std::mutex | eventMutex_ |
| std::function< void()> | postEventConfigure_ |
| std::function< void()> | postEventActivate_ |
| std::function< void()> | postEventDeactivate_ |
| std::function< void()> | postEventCleanup_ |
| std::function< void()> | postEventUnconfiguredShutdown_ |
| std::function< void()> | postEventInactiveShutdown_ |
| std::function< void()> | postEventActiveShutdown_ |
| std::function< void()> | postEventDestroy_ |
| std::function< void()> | postEventOnConfigureSuccess_ |
| std::function< void()> | postEventOnConfigureFailure_ |
| std::function< void()> | postEventOnConfigureError_ |
| std::function< void()> | postEventOnActivateSuccess_ |
| std::function< void()> | postEventOnActivateFailure_ |
| std::function< void()> | postEventOnActivateError_ |
| std::function< void()> | postEventOnDeactivateSuccess_ |
| std::function< void()> | postEventOnDeactivateFailure_ |
| std::function< void()> | postEventOnDeactivateError_ |
| std::function< void()> | postEventOnCleanupSuccess_ |
| std::function< void()> | postEventOnCleanupFailure_ |
| std::function< void()> | postEventOnCleanupError_ |
| std::function< void()> | postEventOnShutdownSuccess_ |
| std::function< void()> | postEventOnShutdownFailure_ |
| std::function< void()> | postEventOnShutdownError_ |
| std::function< void()> | postEventOnErrorSuccess_ |
| std::function< void()> | postEventOnErrorFailure_ |
Additional Inherited Members | |
Protected Member Functions inherited from smacc2::ISmaccComponent | |
| template<typename TOrthogonal , typename TClient > | |
| void | onComponentInitialization () |
| template<typename EventType > | |
| void | postEvent (const EventType &ev) |
| template<typename EventType > | |
| void | postEvent () |
| template<typename TOrthogonal , typename TSourceObject > | |
| void | onStateOrthogonalAllocation () |
| template<typename TComponent > | |
| void | requiresComponent (TComponent *&requiredComponentStorage, ComponentRequirement requirementType=ComponentRequirement::SOFT) |
| template<typename TComponent > | |
| void | requiresComponent (std::string name, TComponent *&requiredComponentStorage, ComponentRequirement requirementType=ComponentRequirement::SOFT) |
| template<typename TClient > | |
| void | requiresClient (TClient *&requiredClientStorage) |
| template<typename SmaccComponentType , typename TOrthogonal , typename TClient , typename... TArgs> | |
| SmaccComponentType * | createSiblingComponent (TArgs... targs) |
| template<typename SmaccComponentType , typename TOrthogonal , typename TClient , typename... TArgs> | |
| SmaccComponentType * | createSiblingNamedComponent (std::string name, TArgs... targs) |
| rclcpp::Node::SharedPtr | getNode () |
| rclcpp::Logger | getLogger () const |
| ISmaccStateMachine * | getStateMachine () |
Protected Attributes inherited from smacc2::ISmaccComponent | |
| ISmaccStateMachine * | stateMachine_ |
| ISmaccClient * | owner_ |
Component that monitors ROS2 lifecycle node transition events.
CpLifecycleEventMonitor subscribes to lifecycle transition events and parses them to detect specific transition types. It emits SMACC2 signals for each transition, enabling event-driven responses to lifecycle state changes.
This component handles the complex state-pair matching logic required to distinguish between transition starts, successes, failures, and errors.
Definition at line 98 of file cp_lifecycle_event_monitor.hpp.
| cl_lifecycle_node::CpLifecycleEventMonitor::CpLifecycleEventMonitor | ( | std::string | nodeName | ) |
Constructor with node name.
| nodeName | Name of the lifecycle node to monitor |
Definition at line 19 of file cp_lifecycle_event_monitor.cpp.
|
virtualdefault |
| std::optional< lifecycle_msgs::msg::TransitionEvent > cl_lifecycle_node::CpLifecycleEventMonitor::getLastTransitionEvent | ( | ) | const |
Get the last received transition event.
Definition at line 36 of file cp_lifecycle_event_monitor.cpp.
References eventMutex_, and lastTransitionEvent_.
|
overridevirtual |
Component initialization - creates subscription.
Reimplemented from smacc2::ISmaccComponent.
Definition at line 21 of file cp_lifecycle_event_monitor.cpp.
References smacc2::ISmaccComponent::getLogger(), smacc2::ISmaccComponent::getNode(), nodeName_, onTransitionEvent(), and subscription_.

|
inline |
Configure event posting with orthogonal template parameter This is called from the client's onStateOrthogonalAllocation to set up type-safe event posting.
Definition at line 183 of file cp_lifecycle_event_monitor.hpp.
References smacc2::ISmaccComponent::postEvent(), postEventActivate_, postEventActiveShutdown_, postEventCleanup_, postEventConfigure_, postEventDeactivate_, postEventDestroy_, postEventInactiveShutdown_, postEventOnActivateError_, postEventOnActivateFailure_, postEventOnActivateSuccess_, postEventOnCleanupError_, postEventOnCleanupFailure_, postEventOnCleanupSuccess_, postEventOnConfigureError_, postEventOnConfigureFailure_, postEventOnConfigureSuccess_, postEventOnDeactivateError_, postEventOnDeactivateFailure_, postEventOnDeactivateSuccess_, postEventOnErrorFailure_, postEventOnErrorSuccess_, postEventOnShutdownError_, postEventOnShutdownFailure_, postEventOnShutdownSuccess_, and postEventUnconfiguredShutdown_.

|
private |
Callback for transition event subscription.
| msg | Transition event message |
Definition at line 46 of file cp_lifecycle_event_monitor.cpp.
References eventMutex_, smacc2::ISmaccComponent::getLogger(), lastTransitionEvent_, onTransitionActivate_, onTransitionActiveShutdown_, onTransitionCleanup_, onTransitionConfigure_, onTransitionDeactivate_, onTransitionDestroy_, onTransitionInactiveShutdown_, onTransitionOnActivateError_, onTransitionOnActivateFailure_, onTransitionOnActivateSuccess_, onTransitionOnCleanupError_, onTransitionOnCleanupSuccess_, onTransitionOnConfigureError_, onTransitionOnConfigureFailure_, onTransitionOnConfigureSuccess_, onTransitionOnDeactivateError_, onTransitionOnDeactivateSuccess_, onTransitionOnErrorFailure_, onTransitionOnErrorSuccess_, onTransitionOnShutdownError_, onTransitionOnShutdownSuccess_, onTransitionUnconfiguredShutdown_, postEventActivate_, postEventActiveShutdown_, postEventCleanup_, postEventConfigure_, postEventDeactivate_, postEventDestroy_, postEventInactiveShutdown_, postEventOnActivateError_, postEventOnActivateFailure_, postEventOnActivateSuccess_, postEventOnCleanupError_, postEventOnCleanupSuccess_, postEventOnConfigureError_, postEventOnConfigureFailure_, postEventOnConfigureSuccess_, postEventOnDeactivateError_, postEventOnDeactivateSuccess_, postEventOnErrorFailure_, postEventOnErrorSuccess_, postEventOnShutdownError_, postEventOnShutdownSuccess_, and postEventUnconfiguredShutdown_.
Referenced by onInitialize().


|
inline |
Set the owner client and state machine for this component.
| owner | Pointer to the owning client |
| stateMachine | Pointer to the state machine |
Definition at line 114 of file cp_lifecycle_event_monitor.hpp.
References smacc2::ISmaccComponent::owner_, and smacc2::ISmaccComponent::stateMachine_.
|
mutableprivate |
Definition at line 268 of file cp_lifecycle_event_monitor.hpp.
Referenced by getLastTransitionEvent(), and onTransitionEvent().
|
private |
Definition at line 267 of file cp_lifecycle_event_monitor.hpp.
Referenced by getLastTransitionEvent(), and onTransitionEvent().
|
private |
Definition at line 265 of file cp_lifecycle_event_monitor.hpp.
Referenced by onInitialize().
| smacc2::SmaccSignal<void()> cl_lifecycle_node::CpLifecycleEventMonitor::onTransitionActivate_ |
Definition at line 124 of file cp_lifecycle_event_monitor.hpp.
Referenced by onTransitionEvent().
| smacc2::SmaccSignal<void()> cl_lifecycle_node::CpLifecycleEventMonitor::onTransitionActiveShutdown_ |
Definition at line 129 of file cp_lifecycle_event_monitor.hpp.
Referenced by onTransitionEvent().
| smacc2::SmaccSignal<void()> cl_lifecycle_node::CpLifecycleEventMonitor::onTransitionCleanup_ |
Definition at line 126 of file cp_lifecycle_event_monitor.hpp.
Referenced by onTransitionEvent().
| smacc2::SmaccSignal<void()> cl_lifecycle_node::CpLifecycleEventMonitor::onTransitionConfigure_ |
Definition at line 123 of file cp_lifecycle_event_monitor.hpp.
Referenced by onTransitionEvent().
| smacc2::SmaccSignal<void()> cl_lifecycle_node::CpLifecycleEventMonitor::onTransitionCreate_ |
Definition at line 122 of file cp_lifecycle_event_monitor.hpp.
| smacc2::SmaccSignal<void()> cl_lifecycle_node::CpLifecycleEventMonitor::onTransitionDeactivate_ |
Definition at line 125 of file cp_lifecycle_event_monitor.hpp.
Referenced by onTransitionEvent().
| smacc2::SmaccSignal<void()> cl_lifecycle_node::CpLifecycleEventMonitor::onTransitionDestroy_ |
Definition at line 130 of file cp_lifecycle_event_monitor.hpp.
Referenced by onTransitionEvent().
| smacc2::SmaccSignal<void()> cl_lifecycle_node::CpLifecycleEventMonitor::onTransitionInactiveShutdown_ |
Definition at line 128 of file cp_lifecycle_event_monitor.hpp.
Referenced by onTransitionEvent().
| smacc2::SmaccSignal<void()> cl_lifecycle_node::CpLifecycleEventMonitor::onTransitionOnActivateError_ |
Definition at line 140 of file cp_lifecycle_event_monitor.hpp.
Referenced by cl_lifecycle_node::CbActivate::onStateOrthogonalAllocation(), and onTransitionEvent().
| smacc2::SmaccSignal<void()> cl_lifecycle_node::CpLifecycleEventMonitor::onTransitionOnActivateFailure_ |
Definition at line 139 of file cp_lifecycle_event_monitor.hpp.
Referenced by cl_lifecycle_node::CbActivate::onStateOrthogonalAllocation(), and onTransitionEvent().
| smacc2::SmaccSignal<void()> cl_lifecycle_node::CpLifecycleEventMonitor::onTransitionOnActivateSuccess_ |
Definition at line 138 of file cp_lifecycle_event_monitor.hpp.
Referenced by cl_lifecycle_node::CbActivate::onStateOrthogonalAllocation(), and onTransitionEvent().
| smacc2::SmaccSignal<void()> cl_lifecycle_node::CpLifecycleEventMonitor::onTransitionOnActiveShutdownError_ |
Definition at line 160 of file cp_lifecycle_event_monitor.hpp.
| smacc2::SmaccSignal<void()> cl_lifecycle_node::CpLifecycleEventMonitor::onTransitionOnActiveShutdownFailure_ |
Definition at line 159 of file cp_lifecycle_event_monitor.hpp.
| smacc2::SmaccSignal<void()> cl_lifecycle_node::CpLifecycleEventMonitor::onTransitionOnActiveShutdownSuccess_ |
Definition at line 158 of file cp_lifecycle_event_monitor.hpp.
| smacc2::SmaccSignal<void()> cl_lifecycle_node::CpLifecycleEventMonitor::onTransitionOnCleanupError_ |
Definition at line 150 of file cp_lifecycle_event_monitor.hpp.
Referenced by cl_lifecycle_node::CbCleanup::onStateOrthogonalAllocation(), and onTransitionEvent().
| smacc2::SmaccSignal<void()> cl_lifecycle_node::CpLifecycleEventMonitor::onTransitionOnCleanupFailure_ |
Definition at line 149 of file cp_lifecycle_event_monitor.hpp.
Referenced by cl_lifecycle_node::CbCleanup::onStateOrthogonalAllocation().
| smacc2::SmaccSignal<void()> cl_lifecycle_node::CpLifecycleEventMonitor::onTransitionOnCleanupSuccess_ |
Definition at line 148 of file cp_lifecycle_event_monitor.hpp.
Referenced by cl_lifecycle_node::CbCleanup::onStateOrthogonalAllocation(), and onTransitionEvent().
| smacc2::SmaccSignal<void()> cl_lifecycle_node::CpLifecycleEventMonitor::onTransitionOnConfigureError_ |
Definition at line 135 of file cp_lifecycle_event_monitor.hpp.
Referenced by cl_lifecycle_node::CbConfigure::onStateOrthogonalAllocation(), and onTransitionEvent().
| smacc2::SmaccSignal<void()> cl_lifecycle_node::CpLifecycleEventMonitor::onTransitionOnConfigureFailure_ |
Definition at line 134 of file cp_lifecycle_event_monitor.hpp.
Referenced by cl_lifecycle_node::CbConfigure::onStateOrthogonalAllocation(), and onTransitionEvent().
| smacc2::SmaccSignal<void()> cl_lifecycle_node::CpLifecycleEventMonitor::onTransitionOnConfigureSuccess_ |
Definition at line 133 of file cp_lifecycle_event_monitor.hpp.
Referenced by cl_lifecycle_node::CbConfigure::onStateOrthogonalAllocation(), and onTransitionEvent().
| smacc2::SmaccSignal<void()> cl_lifecycle_node::CpLifecycleEventMonitor::onTransitionOnDeactivateError_ |
Definition at line 145 of file cp_lifecycle_event_monitor.hpp.
Referenced by cl_lifecycle_node::CbDeactivate::onStateOrthogonalAllocation(), cl_lifecycle_node::CbDeactivateOnExit::onStateOrthogonalAllocation(), and onTransitionEvent().
| smacc2::SmaccSignal<void()> cl_lifecycle_node::CpLifecycleEventMonitor::onTransitionOnDeactivateFailure_ |
Definition at line 144 of file cp_lifecycle_event_monitor.hpp.
Referenced by cl_lifecycle_node::CbDeactivate::onStateOrthogonalAllocation(), and cl_lifecycle_node::CbDeactivateOnExit::onStateOrthogonalAllocation().
| smacc2::SmaccSignal<void()> cl_lifecycle_node::CpLifecycleEventMonitor::onTransitionOnDeactivateSuccess_ |
Definition at line 143 of file cp_lifecycle_event_monitor.hpp.
Referenced by cl_lifecycle_node::CbDeactivate::onStateOrthogonalAllocation(), cl_lifecycle_node::CbDeactivateOnExit::onStateOrthogonalAllocation(), and onTransitionEvent().
| smacc2::SmaccSignal<void()> cl_lifecycle_node::CpLifecycleEventMonitor::onTransitionOnErrorError_ |
Definition at line 165 of file cp_lifecycle_event_monitor.hpp.
| smacc2::SmaccSignal<void()> cl_lifecycle_node::CpLifecycleEventMonitor::onTransitionOnErrorFailure_ |
Definition at line 164 of file cp_lifecycle_event_monitor.hpp.
Referenced by onTransitionEvent().
| smacc2::SmaccSignal<void()> cl_lifecycle_node::CpLifecycleEventMonitor::onTransitionOnErrorSuccess_ |
Definition at line 163 of file cp_lifecycle_event_monitor.hpp.
Referenced by onTransitionEvent().
| smacc2::SmaccSignal<void()> cl_lifecycle_node::CpLifecycleEventMonitor::onTransitionOnShutdownError_ |
Definition at line 155 of file cp_lifecycle_event_monitor.hpp.
Referenced by cl_lifecycle_node::CbShutdown::onStateOrthogonalAllocation(), and onTransitionEvent().
| smacc2::SmaccSignal<void()> cl_lifecycle_node::CpLifecycleEventMonitor::onTransitionOnShutdownFailure_ |
Definition at line 154 of file cp_lifecycle_event_monitor.hpp.
Referenced by cl_lifecycle_node::CbShutdown::onStateOrthogonalAllocation().
| smacc2::SmaccSignal<void()> cl_lifecycle_node::CpLifecycleEventMonitor::onTransitionOnShutdownSuccess_ |
Definition at line 153 of file cp_lifecycle_event_monitor.hpp.
Referenced by cl_lifecycle_node::CbShutdown::onStateOrthogonalAllocation(), and onTransitionEvent().
| smacc2::SmaccSignal<void()> cl_lifecycle_node::CpLifecycleEventMonitor::onTransitionUnconfiguredShutdown_ |
Definition at line 127 of file cp_lifecycle_event_monitor.hpp.
Referenced by onTransitionEvent().
|
private |
Definition at line 278 of file cp_lifecycle_event_monitor.hpp.
Referenced by onStateOrthogonalAllocation(), and onTransitionEvent().
|
private |
Definition at line 283 of file cp_lifecycle_event_monitor.hpp.
Referenced by onStateOrthogonalAllocation(), and onTransitionEvent().
|
private |
Definition at line 280 of file cp_lifecycle_event_monitor.hpp.
Referenced by onStateOrthogonalAllocation(), and onTransitionEvent().
|
private |
Definition at line 277 of file cp_lifecycle_event_monitor.hpp.
Referenced by onStateOrthogonalAllocation(), and onTransitionEvent().
|
private |
Definition at line 279 of file cp_lifecycle_event_monitor.hpp.
Referenced by onStateOrthogonalAllocation(), and onTransitionEvent().
|
private |
Definition at line 284 of file cp_lifecycle_event_monitor.hpp.
Referenced by onStateOrthogonalAllocation(), and onTransitionEvent().
|
private |
Definition at line 282 of file cp_lifecycle_event_monitor.hpp.
Referenced by onStateOrthogonalAllocation(), and onTransitionEvent().
|
private |
Definition at line 292 of file cp_lifecycle_event_monitor.hpp.
Referenced by onStateOrthogonalAllocation(), and onTransitionEvent().
|
private |
Definition at line 291 of file cp_lifecycle_event_monitor.hpp.
Referenced by onStateOrthogonalAllocation(), and onTransitionEvent().
|
private |
Definition at line 290 of file cp_lifecycle_event_monitor.hpp.
Referenced by onStateOrthogonalAllocation(), and onTransitionEvent().
|
private |
Definition at line 300 of file cp_lifecycle_event_monitor.hpp.
Referenced by onStateOrthogonalAllocation(), and onTransitionEvent().
|
private |
Definition at line 299 of file cp_lifecycle_event_monitor.hpp.
Referenced by onStateOrthogonalAllocation().
|
private |
Definition at line 298 of file cp_lifecycle_event_monitor.hpp.
Referenced by onStateOrthogonalAllocation(), and onTransitionEvent().
|
private |
Definition at line 288 of file cp_lifecycle_event_monitor.hpp.
Referenced by onStateOrthogonalAllocation(), and onTransitionEvent().
|
private |
Definition at line 287 of file cp_lifecycle_event_monitor.hpp.
Referenced by onStateOrthogonalAllocation(), and onTransitionEvent().
|
private |
Definition at line 286 of file cp_lifecycle_event_monitor.hpp.
Referenced by onStateOrthogonalAllocation(), and onTransitionEvent().
|
private |
Definition at line 296 of file cp_lifecycle_event_monitor.hpp.
Referenced by onStateOrthogonalAllocation(), and onTransitionEvent().
|
private |
Definition at line 295 of file cp_lifecycle_event_monitor.hpp.
Referenced by onStateOrthogonalAllocation().
|
private |
Definition at line 294 of file cp_lifecycle_event_monitor.hpp.
Referenced by onStateOrthogonalAllocation(), and onTransitionEvent().
|
private |
Definition at line 307 of file cp_lifecycle_event_monitor.hpp.
Referenced by onStateOrthogonalAllocation(), and onTransitionEvent().
|
private |
Definition at line 306 of file cp_lifecycle_event_monitor.hpp.
Referenced by onStateOrthogonalAllocation(), and onTransitionEvent().
|
private |
Definition at line 304 of file cp_lifecycle_event_monitor.hpp.
Referenced by onStateOrthogonalAllocation(), and onTransitionEvent().
|
private |
Definition at line 303 of file cp_lifecycle_event_monitor.hpp.
Referenced by onStateOrthogonalAllocation().
|
private |
Definition at line 302 of file cp_lifecycle_event_monitor.hpp.
Referenced by onStateOrthogonalAllocation(), and onTransitionEvent().
|
private |
Definition at line 281 of file cp_lifecycle_event_monitor.hpp.
Referenced by onStateOrthogonalAllocation(), and onTransitionEvent().
|
private |
Definition at line 266 of file cp_lifecycle_event_monitor.hpp.
Referenced by onInitialize().