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

[Feature] Choose different read and write rate for the hardware components #1570

Merged
merged 28 commits into from
Dec 4, 2024

Conversation

saikishor
Copy link
Member

@saikishor saikishor commented Jun 16, 2024

Hello!

This PR helps to obtain different read and write update rates rather than having the same update rate as of the controller manager. With these changes, each and every component can run at their own chosen rate and they update the State and Command interfaces according to that rate. This is very useful for system with different communication layers such as EtherCAT, CAN and Serial. Hope this helps the community.

image
y axis corresponds to the nanoseconds

Thank you

Copy link

codecov bot commented Jun 16, 2024

Codecov Report

Attention: Patch coverage is 96.36364% with 8 lines in your changes missing coverage. Please review.

Project coverage is 87.83%. Comparing base (dbee650) to head (68ddc9c).
Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
hardware_interface/src/resource_manager.cpp 75.75% 4 Missing and 4 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1570      +/-   ##
==========================================
+ Coverage   87.57%   87.83%   +0.26%     
==========================================
  Files         122      122              
  Lines       12768    12926     +158     
  Branches     1146     1153       +7     
==========================================
+ Hits        11181    11353     +172     
+ Misses       1157     1148       -9     
+ Partials      430      425       -5     
Flag Coverage Δ
unittests 87.83% <96.36%> (+0.26%) ⬆️

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% <ø> (ø)
...rface/include/hardware_interface/hardware_info.hpp 100.00% <ø> (ø)
...re_interface/include/hardware_interface/sensor.hpp 66.66% <ø> (+16.66%) ⬆️
...re_interface/include/hardware_interface/system.hpp 100.00% <ø> (ø)
hardware_interface/src/actuator.cpp 80.66% <100.00%> (+5.83%) ⬆️
hardware_interface/src/component_parser.cpp 94.82% <100.00%> (+0.18%) ⬆️
hardware_interface/src/sensor.cpp 76.03% <100.00%> (+3.76%) ⬆️
hardware_interface/src/system.cpp 80.66% <100.00%> (+5.83%) ⬆️
...dware_interface/test/test_component_interfaces.cpp 97.63% <100.00%> (+0.01%) ⬆️
...e/test/test_component_interfaces_custom_export.cpp 89.25% <100.00%> (+0.36%) ⬆️
... and 4 more

... and 3 files with indirect coverage changes

Copy link
Contributor

@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.

Great addition 👍

Why not just use update_rate as attribute name (same as for controller_manager or the controllers)

Please update the docs and add also a paragraph to the release notes.

@saikishor
Copy link
Member Author

Great addition 👍

Why not just use update_rate as attribute name (same as for controller_manager or the controllers)

Please update the docs and add also a paragraph to the release notes.

Sure. I forgot about the docs. I'll update it tomorrow at the earliest. Thanks for reminding me.

Well regarding the parameter name, I thought of using different because, we have update_rate for the update callback of the controllers and for the hardware I wanted to use the appropriate one, so I used rw_rate to specify the read/write_rate. How the changes are done, in future we can also have different read and write rates if needed, with just changing the parsing part. I'm open to the discussion on the parameter naming part.

Copy link
Contributor

@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.

Thanks for the docs 👍

hardware_interface/src/resource_manager.cpp Outdated Show resolved Hide resolved
hardware_interface/src/resource_manager.cpp Outdated Show resolved Hide resolved
Copy link
Contributor

mergify bot commented Jun 25, 2024

This pull request is in conflict. Could you fix it @saikishor?

@saikishor
Copy link
Member Author

Resolved conflicts!

Copy link
Contributor

mergify bot commented Jul 3, 2024

This pull request is in conflict. Could you fix it @saikishor?

@saikishor
Copy link
Member Author

@christophfroehlich I've just fixed the conflicts after your merged PR on deprecating mimic stuff

Copy link
Contributor

mergify bot commented Jul 8, 2024

This pull request is in conflict. Could you fix it @saikishor?

Copy link
Contributor

mergify bot commented Jul 14, 2024

This pull request is in conflict. Could you fix it @saikishor?

@saikishor saikishor force-pushed the add/hw_components/update_rate branch from ca62a0b to 3033380 Compare July 16, 2024 10:53
@saikishor saikishor added this to the Pre-Jazzy (Feb.'24) milestone Jul 18, 2024
@saikishor saikishor force-pushed the add/hw_components/update_rate branch from 9801548 to bc47f7d Compare November 25, 2024 22:06
@saikishor saikishor requested a review from bmagyar December 4, 2024 10:30
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 3d57fc8 into ros-controls:master Dec 4, 2024
15 of 21 checks passed
@saikishor saikishor deleted the add/hw_components/update_rate branch December 4, 2024 12:03
christophfroehlich added a commit that referenced this pull request Dec 5, 2024
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