Skip to content

Shift to Struct based Method and Constructors, with Executor passed from CM to on_init() (backport #2323)#2339

Merged
bmagyar merged 3 commits intojazzyfrom
mergify/bp/jazzy/pr-2323
Jul 20, 2025
Merged

Shift to Struct based Method and Constructors, with Executor passed from CM to on_init() (backport #2323)#2339
bmagyar merged 3 commits intojazzyfrom
mergify/bp/jazzy/pr-2323

Conversation

@mergify
Copy link
Copy Markdown
Contributor

@mergify mergify Bot commented Jun 25, 2025

Brief

This addition is the first step towards solving #2141 (also #1732 in some way).
The concept is simple, we are creating a Struct pathway of sorts all the way from the CM to the on_init() call in the hardware component. This enables future additions without too harsh API/ABI breaks.

An example to show this currently is to give the user access to the MultiThreadedExecutor so that they can add nodes to it and publish if necessary by propogating the executor_ from CM all the way to on_init() (refer ab8d08c). A future PR will add a node by default with the hardware_components name

Three Structs have been added to help in the above

  • HardwareComponentInterfaceParams
    • To be passed in on_init() and parsed by user to get all relevant data (hardware_info and executor at this point)
  • HardwareComponentParams
    • To be used for all other initialisation, loading calls up till resource manager
  • ResourceManagerParams
    • To construct Resource Manager

Important Note

This means over time we will have to deprecate and remove the non struct based methods

Side Notes

…rom CM to `on_init()` (#2323)

(cherry picked from commit 8c52010)
Copy link
Copy Markdown
Contributor

@soham2560 soham2560 left a comment

Choose a reason for hiding this comment

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

LGTM, works with current version of gz_ros2_control as well

@saikishor saikishor requested a review from bmagyar June 28, 2025 09:06
@codecov
Copy link
Copy Markdown

codecov Bot commented Jul 2, 2025

Codecov Report

Attention: Patch coverage is 83.33333% with 23 lines in your changes missing coverage. Please review.

Project coverage is 88.69%. Comparing base (d413447) to head (d0cf031).
Report is 11 commits behind head on jazzy.

Files with missing lines Patch % Lines
hardware_interface/src/resource_manager.cpp 79.45% 11 Missing and 4 partials ⚠️
controller_manager/src/controller_manager.cpp 0.00% 8 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##            jazzy    #2339      +/-   ##
==========================================
+ Coverage   88.67%   88.69%   +0.02%     
==========================================
  Files         145      148       +3     
  Lines       16745    16818      +73     
  Branches     1442     1439       -3     
==========================================
+ Hits        14848    14917      +69     
- Misses       1339     1345       +6     
+ Partials      558      556       -2     
Flag Coverage Δ
unittests 88.69% <83.33%> (+0.02%) ⬆️

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

Files with missing lines Coverage Δ
..._interface/include/hardware_interface/actuator.hpp 100.00% <ø> (ø)
.../include/hardware_interface/actuator_interface.hpp 91.30% <100.00%> (+0.34%) ⬆️
...re_interface/include/hardware_interface/sensor.hpp 100.00% <ø> (ø)
...ce/include/hardware_interface/sensor_interface.hpp 85.98% <100.00%> (+0.98%) ⬆️
...re_interface/include/hardware_interface/system.hpp 100.00% <ø> (ø)
...ce/include/hardware_interface/system_interface.hpp 84.80% <100.00%> (+0.53%) ⬆️
...face/types/hardware_component_interface_params.hpp 100.00% <100.00%> (ø)
...ware_interface/types/hardware_component_params.hpp 100.00% <100.00%> (ø)
...rdware_interface/types/resource_manager_params.hpp 100.00% <100.00%> (ø)
hardware_interface/src/actuator.cpp 80.61% <100.00%> (+0.61%) ⬆️
... and 4 more

... and 1 file with indirect coverage changes

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

@bmagyar bmagyar merged commit c14d38a into jazzy Jul 20, 2025
11 of 13 checks passed
@bmagyar bmagyar deleted the mergify/bp/jazzy/pr-2323 branch July 20, 2025 18:20
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.

3 participants