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

[HW_IF] Prepare the handles for async operations #1750

Merged

Conversation

saikishor
Copy link
Member

As with #1688 and #1689 there are not many changes in the handles.hpp file. I think this is the right moment to do it, to have straight away working handles in async. The proposed changes would work with zero overhead in synchronous operations.

Looking forward for your feedback!

Copy link

codecov bot commented Sep 12, 2024

Codecov Report

Attention: Patch coverage is 59.55056% with 36 lines in your changes missing coverage. Please review.

Project coverage is 87.41%. Comparing base (b0da4a1) to head (0e3416e).
Report is 10 commits behind head on master.

Files with missing lines Patch % Lines
...de/hardware_interface/loaned_command_interface.hpp 37.93% 15 Missing and 3 partials ⚠️
...lude/hardware_interface/loaned_state_interface.hpp 41.17% 8 Missing and 2 partials ⚠️
...re_interface/include/hardware_interface/handle.hpp 81.39% 4 Missing and 4 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1750      +/-   ##
==========================================
- Coverage   87.60%   87.41%   -0.19%     
==========================================
  Files         120      120              
  Lines       12223    12304      +81     
  Branches     1093     1105      +12     
==========================================
+ Hits        10708    10756      +48     
- Misses       1125     1150      +25     
- Partials      390      398       +8     
Flag Coverage Δ
unittests 87.41% <59.55%> (-0.19%) ⬇️

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 88.73% <81.39%> (-11.27%) ⬇️
...lude/hardware_interface/loaned_state_interface.hpp 57.57% <41.17%> (-18.90%) ⬇️
...de/hardware_interface/loaned_command_interface.hpp 51.35% <37.93%> (-48.65%) ⬇️

... and 1 file with indirect coverage changes

@saikishor
Copy link
Member Author

I've just gone through the coverage report, the missing coverage lines should already be handled in the testing of #1489 and #1567

Copy link
Contributor

mergify bot commented Sep 26, 2024

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

// BEGIN (Handle export change): for backward compatibility
// TODO(Manuel) return value_ if old functionality is removed
THROW_ON_NULLPTR(value_ptr_);
return *value_ptr_;
// END
}

void set_value(double value)
[[nodiscard]] bool get_value(double & value) const
Copy link
Member

Choose a reason for hiding this comment

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

@mamueluth please check this. This is how we can template the access to variables. This should simplify test changes.

destogl
destogl previously approved these changes Oct 28, 2024
Copy link
Member

@destogl destogl left a comment

Choose a reason for hiding this comment

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

Thanks! It looks great!

@@ -51,6 +60,27 @@ class LoanedCommandInterface

virtual ~LoanedCommandInterface()
{
auto logger = rclcpp::get_logger(command_interface_.get_name());
RCLCPP_WARN_EXPRESSION(
Copy link
Member

Choose a reason for hiding this comment

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

Should we put this to "DEBUG" mode?

Or do we always want output when switching controllers?

Copy link
Member Author

Choose a reason for hiding this comment

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

This is only when we deactivate the controller, i think it's good to have this statistical information.

Moreover, as it is conditioned it should only print for async cases and that too if you have some misses. This should give us some information of the functionality of the system

Copy link
Member Author

Choose a reason for hiding this comment

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

If we have reported issues about this, we can put this to debug in future

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.

I like the statistics part, but now its rather verbose on the CI and some percentages seem to be wrong (or some counters not properly initialized?)

2024-10-25T08:59:54.1674417Z 7: [WARN] [1729846793.768585551] [joint2/velocity]: LoanedStateInterface joint2/velocity has 1379847120 (34.40 %) timeouts and  32586 (0.00 %) missed calls out of 4011084229 get_value calls
2024-10-25T08:59:54.1677303Z 7: [WARN] [1729846793.768598835] [joint2/position]: LoanedStateInterface joint2/position has 1379846688 (10614205292.31 %) timeouts and  32764 (252030.77 %) missed calls out of 13 get_value calls

I can't give proper feedback about the threading stuff, but it looks fine for me.

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 latest commit fixes the output in the CI, so I'm happy.

@bmagyar bmagyar merged commit 033a6bc into ros-controls:master Nov 6, 2024
17 of 19 checks passed
saikishor added a commit to pal-robotics-forks/ros2_control that referenced this pull request Nov 12, 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.

4 participants