-
Notifications
You must be signed in to change notification settings - Fork 312
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
Add new get_value
API for Handles and Interfaces
#1976
base: master
Are you sure you want to change the base?
Add new get_value
API for Handles and Interfaces
#1976
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1976 +/- ##
==========================================
+ Coverage 89.35% 89.36% +0.01%
==========================================
Files 130 130
Lines 14576 14570 -6
Branches 1258 1254 -4
==========================================
- Hits 13024 13021 -3
+ Misses 1088 1086 -2
+ Partials 464 463 -1
Flags with carried forward coverage won't be shown. Click here to find out more.
|
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.
Thanks for pushing this forward.
I was thinking of something shorter than 2xget+2xvalue in get().get_value<double>().value()
, but still have no better suggestion.
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.
One thing: Could you please update the release_notes and also add something to the migration notes? We have only a section about the hardware_components there.
Sure I'll do that |
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.
It is not beautiful, but probably we don't have a better way to do this…
Maybe we think of a simpler API in the future. At least we are good with the types.
Maybe the approach from ROS 2 parameters using method get_value_as_double()
is better compared to get_value<double>().value()
?
@bmagyar what do you think?
} | ||
|
||
template <typename T> | ||
[[nodiscard]] bool get_value(T & value) const |
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.
Do we actually need this format of get_value
? Are we using this somewhere of do you have specific use-case where this has advantages over std::optional<T> get_value()
?
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.
Right now, we are not using it in ros2_control repositories, but this exists from many releases both in rolling nd jazzy. So, at least not to break API of people that might use it, I haven't removed it here
hardware_interface/include/hardware_interface/loaned_command_interface.hpp
Outdated
Show resolved
Hide resolved
++get_value_statistics_.timeout_counter; | ||
return std::nullopt; | ||
} | ||
|
||
template <typename T> | ||
[[nodiscard]] bool get_value(T & value, unsigned int max_tries = 10) const |
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.
Also this version, do we need it?
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.
Same here as well
hardware_interface/include/hardware_interface/loaned_state_interface.hpp
Outdated
Show resolved
Hide resolved
Co-authored-by: Dr. Denis <[email protected]>
If we use I have used |
Related to ros-controls/ros2_controllers#1442 and ros-controls/ros2_controllers#1443
There are still some deprecated warnings in the following ros2_control packages:
transmission_interface: Once this PR is merged. I will perform the changes here : #1845
hardware components: This needs to be handled in a different PR.
I'll take care of both