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

Open
wants to merge 26 commits into
base: master
Choose a base branch
from

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 95.93909% with 8 lines in your changes missing coverage. Please review.

Project coverage is 87.09%. Comparing base (4472287) to head (dbfe3a0).

Files with missing lines Patch % Lines
hardware_interface/src/resource_manager.cpp 77.77% 4 Missing and 4 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1570      +/-   ##
==========================================
+ Coverage   86.77%   87.09%   +0.31%     
==========================================
  Files         116      116              
  Lines       10703    10860     +157     
  Branches      981      988       +7     
==========================================
+ Hits         9288     9458     +170     
+ Misses       1062     1053       -9     
+ Partials      353      349       -4     
Flag Coverage Δ
unittests 87.09% <95.93%> (+0.31%) ⬆️

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 78.67% <100.00%> (+6.49%) ⬆️
hardware_interface/src/component_parser.cpp 94.62% <100.00%> (+0.19%) ⬆️
hardware_interface/src/sensor.cpp 74.56% <100.00%> (+4.02%) ⬆️
hardware_interface/src/system.cpp 78.67% <100.00%> (+6.49%) ⬆️
...dware_interface/test/test_component_interfaces.cpp 96.21% <100.00%> (+0.05%) ⬆️
hardware_interface/test/test_component_parser.cpp 98.88% <100.00%> (+0.06%) ⬆️
... and 3 more

... and 2 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
Copy link
Contributor

mergify bot commented Sep 11, 2024

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

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