ros2 / ros2/rclcpp

Lifecycle rewrite for separation of concerns

Open
#2,212 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
805
Forks
564
Avg merge
1d 17h
Merged PRs (30d)
27

Description

Feature request

Rewrite rclcpp::lifecycle for clearer separation of concerns (SoC).

Initial PR: https://github.com/ros2/rclcpp/pull/2211

Feature description

I rewrote some of the lifecycle backend code while attempting to create async transitions (https://github.com/ros2/rclcpp/pull/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:

  1. managing ManagedEntities
  2. managing underlying rcl::state_machine
  3. managing services

I separated these out into files/classes.
Proposed architecture:
soc_lifecycle

This follows more closely to a model-view-controller design:
LifecycleNodeInterfaceImpl: ("controller") owner of:

  • EntitiesManager: (model:managed_entities)responsible for entity state
  • StateManager: (model:lifecycle_state) responsible for lifecycle state_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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing LifecycleNodeInterfaceImpl and the proposed architecture, then read PRs #2211 and #2214 for the existing separation and async-transition context. Done means responsibilities are split among EntitiesManager, StateManager, and StateServicesManager, with change_state separated into smaller functions and existing behavior preserved.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
robotics
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.