-
Notifications
You must be signed in to change notification settings - Fork 383
Use ParamListener::try_get_params to Avoid Blocking in Real-Time Contexts #1198
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
Use ParamListener::try_get_params to Avoid Blocking in Real-Time Contexts #1198
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@KentaKato Thank you for propagating these nice changes into the ros2_controllers.
We would need to wait for the generate_parameter_library to be released in the distros before merging this.
Thank you
Started a "tracking issue" for this ;) |
@saikishor @bmagyar Thank you! |
GPL got released, but something is very strange now with the JTC tests in the CI. Severals jobs fail with a segfault, and others have errors like
@KentaKato could you have a look please? |
Although I haven't been able to reproduce this in my environment and haven't had time to thoroughly investigate it yet, I think the following logs are abnormal:
This is because, according to I'll look into this further from tomorrow onward. |
There was one set of tests passing on the previous run of the CI so I'm suspecting flakiness, I poked the CI again, let's see the results... |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1198 +/- ##
==========================================
+ Coverage 86.39% 86.43% +0.03%
==========================================
Files 123 123
Lines 12239 12230 -9
Branches 1023 1020 -3
==========================================
- Hits 10574 10571 -3
+ Misses 1348 1344 -4
+ Partials 317 315 -2
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had another quick look: For me it seems that the API of try_get_params
is not suitable here because it also returns true even if the parameters haven't changed -> stuff is updated at every update call.
bool try_get_params(Params & params_in) const {
if (mutex_.try_lock()) {
if (const bool is_old = params_in.__stamp != params_.__stamp; is_old) {
params_in = params_;
}
mutex_.unlock();
return true;
}
return false;
}
This results in errors when I build this locally, and it might be that this is also the reason for the strange CI errors.
This PR is stale because it has been open for 45 days with no activity. Please tag a maintainer for help on completing this PR, or close it if you think it has become obsolete. |
@christophfroehlich do we have a verdict on this? |
there was no update anymore, I'm not sure if this is needed at all |
PickNikRobotics/generate_parameter_library#260 This should fix it |
This PR is stale because it has been open for 45 days with no activity. Please tag a maintainer for help on completing this PR, or close it if you think it has become obsolete. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As the upstream changes to GPL got released recently, we can go on with this PR. I updated all other occurrences as well, but kept the try_get_params
without evaluating its return value where it is not necessary.
kilted-testing is fine, but something broke on rolling-testing triggering the build to abort.
admittance_controller/include/admittance_controller/admittance_rule_impl.hpp
Show resolved
Hide resolved
9e89020
into
ros-controls:master
Due to the potential blocking risk associated with ParamListener::get_params, it is advisable to avoid its usage in real-time contexts. The method, defined here, can lead to delays that are unsuitable for time-sensitive operations.
As an alternative, I have switched to using ParamListener::try_get_params, which does not carry the risk of blocking. This non-blocking approach ensures better performance in real-time scenarios. You can find the implementation here.