Description
Feature request
Rewrite rclcpp::lifecycle
for clearer separation of concerns (SoC).
Initial PR: #2211
Feature description
I rewrote some of the lifecycle backend code while attempting to create async transitions (#2214). It was suggested it would be best to separate this SoC contribution out into its own issue/PR.
The primary goal was to separate out some of LifecycleNodeInterfaceImpl
is responsible for. Currently the LifecycleNodeInterfaceImpl
is responsible for:
- managing
ManagedEntities
- managing underlying
rcl::state_machine
- managing services
I separated these out into files/classes.
Proposed architecture:
This follows more closely to a model-view-controller design:
LifecycleNodeInterfaceImpl
: ("controller
") owner of:
EntitiesManager
: (model:managed_entities
)responsible for entity stateStateManager
: (model:lifecycle_state
) responsible for lifecyclestate_machine
StateServicesManager
: ("view + controller
") public interface of services
I also separated out the change_state
process into multiple functions to allow for easier splitting when creating async transitions. Additionally, I did some miscellaneous function cleanup and added helper functions for readability.