Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle SIGINT properly in the controller manager #2014

Merged
merged 14 commits into from
Jan 29, 2025

Conversation

saikishor
Copy link
Member

@saikishor saikishor commented Jan 22, 2025

resolves #2012
resolves #1168
resolves #472

Needed by ros-controls/ros2_control_demos#548

With example_1 of ros2_control_demos:

[ros2_control_node-1] [INFO] [1737720810.651704682] [controller_manager]: Shutdown request received....
[ros2_control_node-1] [INFO] [1737720810.651778082] [controller_manager]: Shutting down all controllers in the controller manager.
[ros2_control_node-1] [INFO] [1737720810.651830233] [controller_manager]: Deactivating controller 'joint_state_broadcaster'
[ros2_control_node-1] [INFO] [1737720810.652020354] [controller_manager]: Shutting down controller 'joint_state_broadcaster'
[ros2_control_node-1] [INFO] [1737720810.652065784] [controller_manager]: Deactivating controller 'forward_position_controller'
[ros2_control_node-1] [INFO] [1737720810.652169914] [controller_manager]: Shutting down controller 'forward_position_controller'
[ros2_control_node-1] [INFO] [1737720810.652240505] [resource_manager]: 'deactivate' hardware 'RRBot' 
[ros2_control_node-1] [INFO] [1737720810.652259975] [controller_manager.resource_manager.hardware_component.system.RRBot]: Deactivating ...please wait...
[INFO] [robot_state_publisher-2]: process has finished cleanly [pid 399725]
[INFO] [rviz2-5]: process has finished cleanly [pid 399819]
[ros2_control_node-1] [INFO] [1737720811.652349811] [controller_manager.resource_manager.hardware_component.system.RRBot]: 3.0 seconds left...
[ros2_control_node-1] [INFO] [1737720812.652490121] [controller_manager.resource_manager.hardware_component.system.RRBot]: 2.0 seconds left...
[ros2_control_node-1] [INFO] [1737720813.652626335] [controller_manager.resource_manager.hardware_component.system.RRBot]: 1.0 seconds left...
[ros2_control_node-1] [INFO] [1737720813.652682125] [controller_manager.resource_manager.hardware_component.system.RRBot]: Successfully deactivated!
[ros2_control_node-1] [INFO] [1737720813.652700605] [resource_manager]: Successful 'deactivate' of hardware 'RRBot'
[ros2_control_node-1] [INFO] [1737720813.652715105] [resource_manager]: 'shutdown' hardware 'RRBot' 
[ros2_control_node-1] [INFO] [1737720813.652722355] [resource_manager]: Successful 'shutdown' of hardware 'RRBot'
[ros2_control_node-1] [INFO] [1737720813.652773225] [controller_manager]: Shutting down the controller manager.

Copy link

codecov bot commented Jan 23, 2025

Codecov Report

Attention: Patch coverage is 75.67568% with 9 lines in your changes missing coverage. Please review.

Project coverage is 89.38%. Comparing base (fbfc01d) to head (75f194c).
Report is 3 commits behind head on master.

Files with missing lines Patch % Lines
controller_manager/src/controller_manager.cpp 75.86% 2 Missing and 5 partials ⚠️
hardware_interface/src/resource_manager.cpp 75.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2014      +/-   ##
==========================================
+ Coverage   89.37%   89.38%   +0.01%     
==========================================
  Files         132      132              
  Lines       14649    14683      +34     
  Branches     1261     1269       +8     
==========================================
+ Hits        13092    13124      +32     
+ Misses       1091     1086       -5     
- Partials      466      473       +7     
Flag Coverage Δ
unittests 89.38% <75.67%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
.../include/controller_manager/controller_manager.hpp 100.00% <ø> (ø)
hardware_interface/src/resource_manager.cpp 75.12% <75.00%> (+0.09%) ⬆️
controller_manager/src/controller_manager.cpp 76.20% <75.86%> (-0.08%) ⬇️

... and 3 files with indirect coverage changes

@saikishor saikishor changed the title Handle SIGINT properly in the ros2_control_node Handle SIGINT properly in the controller manager Jan 23, 2025
@saikishor saikishor marked this pull request as ready for review January 23, 2025 20:52
@saikishor saikishor mentioned this pull request Jan 24, 2025
@mjforan
Copy link

mjforan commented Jan 24, 2025

Tested with
Ubuntu 24.04/Jazzy in Docker

  • x86 (ros2_control_demos example_2)
  • arm64 (real robot, pca9685_hardware_interface + rm_motors_ros).

Not comprehensive testing, but the issue was fixed and I didn't notice any side effects 👍

@saikishor
Copy link
Member Author

@mjforan
Thank you for testing it out. I'm glad it worked for you :)

Copy link
Member

@bmagyar bmagyar 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!

@bmagyar bmagyar merged commit 882b489 into ros-controls:master Jan 29, 2025
23 of 25 checks passed
@bmagyar bmagyar deleted the handle/siginit branch January 29, 2025 19:06
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.

Segfault on Ctrl-C SIGINT handling in ros2 control Proper way to shutdown the hardware_interface
3 participants