Skip to content

fix(ros2controlcli): use lifecycle nomenclature and add finalized sta…#3134

Open
shraavb wants to merge 4 commits into
ros-controls:masterfrom
shraavb:fix/set-controller-state-lifecycle-nomenclature
Open

fix(ros2controlcli): use lifecycle nomenclature and add finalized sta…#3134
shraavb wants to merge 4 commits into
ros-controls:masterfrom
shraavb:fix/set-controller-state-lifecycle-nomenclature

Conversation

@shraavb
Copy link
Copy Markdown

@shraavb shraavb commented Mar 22, 2026

Related to #688

Summary

Use ROS 2 lifecycle nomenclature consistently in the CLI and add the missing
finalized state to set_hardware_component_state.

Changes

set_controller_state.py

  • Replace informal "cleanup"/"stopping" with lifecycle terms (unconfigured, deactivating)
  • Improve help text to note that finalized is reached via unload_controller

set_hardware_component_state.py

  • Add finalized to valid choices using State.PRIMARY_STATE_FINALIZED
  • Fix if/if/ifif/elif/elif/elif for correct branch structure
  • Replace "cleaning up"/"stopping" with lifecycle terms throughout

Note on finalized for controllers

The controller manager has no FinalizeController service, so controllers cannot
be directly transitioned to finalized via this command. Hardware components can,
since SetHardwareComponentState.srv accepts any lifecycle state by ID.

Checklist

Copy link
Copy Markdown
Member

@christophfroehlich christophfroehlich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for submitting a PR.
The fixes of the if/elif branches and adding the finalized state are perfect, but I am not convinced from the rewording of the messages? I think this change is not needed.

I added a comment in the linked issue for clarification.

Comment thread ros2controlcli/ros2controlcli/verb/set_controller_state.py Outdated
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 28, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.36%. Comparing base (64b0963) to head (ae1474d).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3134      +/-   ##
==========================================
+ Coverage   89.32%   89.36%   +0.04%     
==========================================
  Files         158      158              
  Lines       19497    19497              
  Branches     1584     1584              
==========================================
+ Hits        17416    17424       +8     
+ Misses       1428     1422       -6     
+ Partials      653      651       -2     
Flag Coverage Δ
unittests 89.36% <ø> (+0.04%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.
see 3 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@shraavb shraavb force-pushed the fix/set-controller-state-lifecycle-nomenclature branch from de4d1c6 to 21ddb2c Compare March 28, 2026 23:29
@github-actions
Copy link
Copy Markdown
Contributor

This PR is stale because it has been open for 45 days with no activity. Please tag a maintainer for help on completing this PR, or close it if you think it has become obsolete.

@github-actions github-actions Bot added the stale label May 13, 2026
arg = parser.add_argument(
"state",
choices=["unconfigured", "inactive", "active"],
help="State in which the controller should be changed to",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add the note here again, only the "valid choices" parts were redundant.

Note: the 'finalized' state is reached via the 'unload_controller' command.

Copy link
Copy Markdown
Member

@christophfroehlich christophfroehlich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please readd the note again. As mentioned in #688 we also want to add the transition states to this CLI, so I disabled the auto-close of this issue. But let's merge this PR soon, and add the transition states in a second PR.

@github-actions github-actions Bot removed the stale label May 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants