|
SMACC2
|
Component that tracks the current lifecycle state. More...
#include <cp_lifecycle_state_tracker.hpp>
Public Member Functions | |
| CpLifecycleStateTracker ()=default | |
| virtual | ~CpLifecycleStateTracker ()=default |
| void | updateState (const lifecycle_msgs::msg::State &state) |
| Update the current state. | |
| std::optional< lifecycle_msgs::msg::State > | getCurrentState () const |
| Get the current lifecycle state. | |
| std::optional< std::string > | getCurrentStateLabel () const |
| Get the current state label as string. | |
| uint8_t | getCurrentStateId () const |
| Get the current state ID. | |
| void | onInitialize () override |
| Component initialization. | |
Public Member Functions inherited from smacc2::ISmaccComponent | |
| ISmaccComponent () | |
| virtual | ~ISmaccComponent () |
| virtual std::string | getName () const |
Private Attributes | |
| std::optional< lifecycle_msgs::msg::State > | currentState_ |
| std::mutex | stateMutex_ |
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 tracks the current lifecycle state.
CpLifecycleStateTracker maintains knowledge of the current lifecycle node state, providing thread-safe query methods for state information.
Definition at line 33 of file cp_lifecycle_state_tracker.hpp.
|
default |
|
virtualdefault |
| std::optional< lifecycle_msgs::msg::State > cl_lifecycle_node::CpLifecycleStateTracker::getCurrentState | ( | ) | const |
Get the current lifecycle state.
Definition at line 34 of file cp_lifecycle_state_tracker.cpp.
References currentState_, and stateMutex_.
| uint8_t cl_lifecycle_node::CpLifecycleStateTracker::getCurrentStateId | ( | ) | const |
Get the current state ID.
Definition at line 50 of file cp_lifecycle_state_tracker.cpp.
References currentState_, and stateMutex_.
| std::optional< std::string > cl_lifecycle_node::CpLifecycleStateTracker::getCurrentStateLabel | ( | ) | const |
Get the current state label as string.
Definition at line 40 of file cp_lifecycle_state_tracker.cpp.
References currentState_, and stateMutex_.
|
overridevirtual |
Component initialization.
Reimplemented from smacc2::ISmaccComponent.
Definition at line 19 of file cp_lifecycle_state_tracker.cpp.
References smacc2::ISmaccComponent::getLogger().
| void cl_lifecycle_node::CpLifecycleStateTracker::updateState | ( | const lifecycle_msgs::msg::State & | state | ) |
Update the current state.
| state | New lifecycle state |
Definition at line 25 of file cp_lifecycle_state_tracker.cpp.
References currentState_, smacc2::ISmaccComponent::getLogger(), and stateMutex_.
|
private |
Definition at line 69 of file cp_lifecycle_state_tracker.hpp.
Referenced by getCurrentState(), getCurrentStateId(), getCurrentStateLabel(), and updateState().
|
mutableprivate |
Definition at line 70 of file cp_lifecycle_state_tracker.hpp.
Referenced by getCurrentState(), getCurrentStateId(), getCurrentStateLabel(), and updateState().