Class CpLifecycleStateTracker

Inheritance Relationships

Base Type

  • public smacc2::ISmaccComponent

Class Documentation

class CpLifecycleStateTracker : public smacc2::ISmaccComponent

Component that tracks the current lifecycle state.

CpLifecycleStateTracker maintains knowledge of the current lifecycle node state, providing thread-safe query methods for state information.

Public Functions

CpLifecycleStateTracker() = default
virtual ~CpLifecycleStateTracker() = default
void updateState(const lifecycle_msgs::msg::State &state)

Update the current state.

Parameters:

state – New lifecycle state

std::optional<lifecycle_msgs::msg::State> getCurrentState() const

Get the current lifecycle state.

Returns:

Optional state (empty if not yet initialized)

std::optional<std::string> getCurrentStateLabel() const

Get the current state label as string.

Returns:

Optional state label (empty if not yet initialized)

uint8_t getCurrentStateId() const

Get the current state ID.

Returns:

State ID (0 if not yet initialized)

void onInitialize() override

Component initialization.