Skip to content

Add on_set_value_callbacks to State and Command Interface #2365

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

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

Conversation

saikishor
Copy link
Member

This PR opens a possibility to add on_set_value_callback to the State and Command Interfaces, so we can simply add filters or pre-process the data before setting the value. This is helpful when you get references, and when they do not meet certain conditions, you process them and set the right value.

@saikishor saikishor changed the title Add ability to set on_set_value_callbacks to State and Command Interface Add on_set_value_callbacks to State and Command Interface Jul 2, 2025
Copy link

codecov bot commented Jul 2, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.89%. Comparing base (b87334a) to head (0a0d543).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2365      +/-   ##
==========================================
+ Coverage   88.84%   88.89%   +0.05%     
==========================================
  Files         148      148              
  Lines       16893    16938      +45     
  Branches     1438     1442       +4     
==========================================
+ Hits        15008    15057      +49     
+ Misses       1319     1316       -3     
+ Partials      566      565       -1     
Flag Coverage Δ
unittests 88.89% <100.00%> (+0.05%) ⬆️

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

Files with missing lines Coverage Δ
...re_interface/include/hardware_interface/handle.hpp 91.59% <100.00%> (+0.68%) ⬆️
hardware_interface/test/test_handle.cpp 98.80% <100.00%> (+0.31%) ⬆️

... and 2 files with indirect coverage changes

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

@saikishor saikishor added the backport-jazzy This label should be used by maintainers only! Label triggers PR backport to ROS 2 jazzy. label Jul 3, 2025
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.

The changes LGTM, but I'm not really sure if we should add this level of complexity or improve controller chaining with filter plugins to achieve the same. Would like to hear other opinions on that

@saikishor
Copy link
Member Author

The changes LGTM, but I'm not really sure if we should add this level of complexity or improve controller chaining with filter plugins to achieve the same. Would like to hear other opinions on that

I also thought the same at the beginning, but then thinking a bit. I realized that the chaining is completely configuration dependent on the control strategy. If the controller chaining or HW (The owner of the Command and State Interface) expect some kind of filtering, they cannot always expect that the other party always respects that. In that case, the one who is responsible of handling these value will have to filter them again just to make sure, and the approach proposed in the PR makes it simpler by defining the callbacks.

This is one of the things we added to the Kilted roadmap

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-jazzy This label should be used by maintainers only! Label triggers PR backport to ROS 2 jazzy.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants