Skip to content

Fix the prepare_command_mode_switch behaviour when HW is INACTIVE#2347

Merged
bmagyar merged 11 commits into
ros-controls:masterfrom
pal-robotics-forks:fix/prepare_command_mode_switch
Jul 28, 2025
Merged

Fix the prepare_command_mode_switch behaviour when HW is INACTIVE#2347
bmagyar merged 11 commits into
ros-controls:masterfrom
pal-robotics-forks:fix/prepare_command_mode_switch

Conversation

@saikishor

Copy link
Copy Markdown
Member

This should fix the failing prepare_command_mode_switch method check when hardware goes to error

@codecov

codecov Bot commented Jun 28, 2025

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.89%. Comparing base (6d695b3) to head (2a803af).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2347      +/-   ##
==========================================
- Coverage   88.90%   88.89%   -0.01%     
==========================================
  Files         148      148              
  Lines       16950    16972      +22     
  Branches     1448     1448              
==========================================
+ Hits        15069    15088      +19     
- Misses       1318     1320       +2     
- Partials      563      564       +1     
Flag Coverage Δ
unittests 88.89% <100.00%> (-0.01%) ⬇️

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

Files with missing lines Coverage Δ
controller_manager/src/controller_manager.cpp 74.27% <ø> (-0.22%) ⬇️
hardware_interface/src/resource_manager.cpp 78.07% <100.00%> (+0.18%) ⬆️
...t/test_resource_manager_prepare_perform_switch.cpp 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@saikishor saikishor marked this pull request as ready for review June 29, 2025 20:49
@saikishor saikishor requested a review from MarqRazz June 29, 2025 20:51
@saikishor saikishor added the backport-jazzy Triggers PR backport to ROS 2 jazzy. label Jul 1, 2025

@MarqRazz MarqRazz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This looks much better as the controller_manger deactivates hardware when it returns ERROR thanks for fixing it @saikishor.

As discussed are we going to make the changes here to not allow hardware in the INACTIVE state to activate command interfaces? This ability does not make sense in the INACTIVE state and goes against the changes made in #2334 where returning DEACTIVATE stops any controllers with command interfaces to the DEACTIVATing hardware.

@saikishor saikishor requested a review from MarqRazz July 1, 2025 22:38

@MarqRazz MarqRazz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for fixing these issues @saikishor,! 🥇

I tested this on my hardware and can no longer activate the JTC while the hardware is INACTIVE.

[taskset-1] [controller_manager 1751465055.104089577]: Activating controllers: [ right_arm_jtc ]
[taskset-1] [controller_manager 1751465055.104233459]: Component 'right_arm_Hardware' is in INACTIVE state, but has start interfaces to switch: 
[taskset-1] Start interfaces: 
[taskset-1] [
[taskset-1]   right_arm_joint_1/velocity
[taskset-1]   right_arm_joint_2/velocity
[taskset-1]   right_arm_joint_3/velocity
[taskset-1]   right_arm_joint_4/velocity
[taskset-1]   right_arm_joint_5/velocity
[taskset-1]   right_arm_joint_6/velocity
[taskset-1] ]
[taskset-1] Stop interfaces: 
[taskset-1] [
[taskset-1] ]
[taskset-1] 
[taskset-1] [controller_manager 1751465055.104255917]: Could not switch controllers since prepare command mode switch was rejected.

@saikishor

Copy link
Copy Markdown
Member Author

@MarqRazz thanks a lot for taking time and testing things :)

@saikishor saikishor changed the title Fix the failing prepare_command_mode_switch check when HW goes to error Fix the prepare_command_mode_switch behaviour when HW is INACTIVE Jul 2, 2025
@bmagyar bmagyar merged commit 750ac8a into ros-controls:master Jul 28, 2025
21 of 26 checks passed
@bmagyar bmagyar deleted the fix/prepare_command_mode_switch branch July 28, 2025 22:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-jazzy Triggers PR backport to ROS 2 jazzy.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants