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

Replace existing RealtimeBox implementation with RealtimeBoxBestEffort implementation #146

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

Conversation

firesurfer
Copy link
Contributor

@firesurfer firesurfer commented Jan 25, 2024

Hi as said in #139 this PR replaces the existing RealtimeBox implementation with the new implementation provided in #139 . I merged the tests into a single file and they work fine (even though the existing implementation had only a very small amount of tests)

The implementation of the get/set methods matches exactly the one from the existing implementation apart from some template magic which disables the standard get/set methods for pointer types. (For which they wouldnt provide any thread safety btw from my point of view - see #138)

TLDR: Merging this has the potential to break existing code if someone used pointer types with the RealtimeBox. For everything else it should work just fine.

I would also be happy to provide some documentation on how to use this implementation but I am not sure where in the repository it should go.

This PR should be merged after #139

EDIT: One question regarding the copyright notice for the existing tests. How should this be handled? At the moment I didn't copy any of it to the merged file.

@codecov-commenter
Copy link

codecov-commenter commented Jan 31, 2024

Codecov Report

Attention: Patch coverage is 86.20690% with 8 lines in your changes missing coverage. Please review.

Project coverage is 73.34%. Comparing base (c0d6b2b) to head (6ece6a4).

Files with missing lines Patch % Lines
include/realtime_tools/realtime_box.h 86.20% 3 Missing and 5 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #146      +/-   ##
==========================================
+ Coverage   72.97%   73.34%   +0.36%     
==========================================
  Files           8        7       -1     
  Lines         396      409      +13     
  Branches       65       67       +2     
==========================================
+ Hits          289      300      +11     
  Misses         68       68              
- Partials       39       41       +2     
Flag Coverage Δ
unittests 73.34% <86.20%> (+0.36%) ⬆️

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

Files with missing lines Coverage Δ
include/realtime_tools/realtime_box.h 86.20% <86.20%> (-13.80%) ⬇️

@firesurfer
Copy link
Contributor Author

@christophfroehlich I will update this PR as soon as #139 is finished

@firesurfer
Copy link
Contributor Author

Fixes #138

@firesurfer
Copy link
Contributor Author

@christophfroehlich Given that #139 is now merged I updated this PR.
Please see my notes in the initial description about open points for discussion.

Also pinging @saikishor

@firesurfer
Copy link
Contributor Author

@christophfroehlich Just a note about the CI. Interestingly I just had the case that pre-commit in the CI failed but did run sucessfully on my system. (Note about using the right include guard - REALTIME_TOOLS__REALTIME_BOX_H_)

@christophfroehlich
Copy link
Contributor

EDIT: One question regarding the copyright notice for the existing tests. How should this be handled? At the moment I didn't copy any of it to the merged file.

Please just add another line to the copyright claim and don't remove the old one if old code remained inside (at least I saw this in other ROS repos)

@firesurfer
Copy link
Contributor Author

@saikishor Perhaps you'll find some time for another review? It will now handle pointers types as before but print a deprecation warning

@firesurfer
Copy link
Contributor Author

Just a friendly ping :)

Copy link
Member

@saikishor saikishor left a comment

Choose a reason for hiding this comment

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

@firesurfer few minor comments.

Thank you and sorry for the huge delay

include/realtime_tools/realtime_box.h Outdated Show resolved Hide resolved
include/realtime_tools/realtime_box.h Outdated Show resolved Hide resolved
test/realtime_box_tests.cpp Show resolved Hide resolved
test/realtime_box_tests.cpp Outdated Show resolved Hide resolved
@christophfroehlich
Copy link
Contributor

hi @firesurfer! after the big changes to ros2_control are done, we now really want to get this PR merged soon.

  • Could you please add Fix build error with clang #183 to this PR
  • and address the snake_case as @bmagyar mentioned? (yes, we should have persisted on that when the first realtime box PR was merged.) As you might be the only one using it until now, you can decide if we should go with the API break due to the renaming or add wrappers with deprecation notes.

If we manage to merge this within next week, it might go into the final iron release as well.

@firesurfer
Copy link
Contributor Author

@christophfroehlich I'll try to find sometime to work on this this week

@firesurfer
Copy link
Contributor Author

and address the snake_case as @bmagyar mentioned? (yes, we should have persisted on that when the first realtime box PR was merged.) As you might be the only one using it until now, you can decide if we should go with the API break due to the renaming or add wrappers with deprecation notes.

I can do that. But then I would really like to remove the pointer deprecation message workaround we introduced earlier on - if we are going to break API/ABI by changing the method names.

@firesurfer
Copy link
Contributor Author

@christophfroehlich @bmagyar
I removed the pointer deprecation overload (which makes this class way more maintainable) and made the method names all snake_case.

@firesurfer
Copy link
Contributor Author

I just realized that I forgot to add copy and move constructors (needed due to the std::mutex not being copyable/movable) and added them.

Copy link
Member

@saikishor saikishor left a comment

Choose a reason for hiding this comment

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

@firesurfer sorry for not getting back sooner. Do you think it is possible to add deprecation notes to the older methods? I think it's better to have a smoother transition to others. What do you think?

BTW do you know which packages we will break with not supporting raw pointers anymore?

@firesurfer
Copy link
Contributor Author

@saikishor Could you please elaborate what you mean with "older methods" and by "pages" ?

@saikishor
Copy link
Member

@saikishor Could you please elaborate what you mean with "older methods" and by "pages" ?

@firesurfer I mean the CamelCase methods that you removed in the recent commits. Can we add a deprecation notice to them?

"Pages" is a typo here, I just fixed it. I was referring to the packages. Do you know which packages we will break with not supporting raw pointers anymore?

@christophfroehlich
Copy link
Contributor

"Pages" is a typo here, I just fixed it. I was referring to the packages. Do you know which packages we will break with not supporting raw pointers anymore?

afaik (according to index.ros.org) there is no package listing realtime_tools as a direct dependency using the RealtimeBox. Apart from that it is hard to track dependencies if they aren't released.

@firesurfer
Copy link
Contributor Author

@saikishor I don't think that is necessary. They were added just recently with the RealtimeBoxBestEffort and I think nobody is using them yet.

Regarding the second question:
I did a quick search on github: https://github.com/search?q=RealtimeBox%3C&type=code
But as @christophfroehlich said: hard to tell: I looked into some of those packages and they were still ROS1.

@saikishor
Copy link
Member

saikishor commented Nov 11, 2024

@saikishor I don't think that is necessary. They were added just recently with the RealtimeBoxBestEffort and I think nobody is using them yet.

Got it. I see that there are none of these methods in the original implementation and so it is backward compatible. Thanks for the explanation.

Regarding the second question: I did a quick search on github: https://github.com/search?q=RealtimeBox%3C&type=code But as @christophfroehlich said: hard to tell: I looked into some of those packages and they were still ROS1.

I could see these released packages are using it in rolling, we just have to make sure that all of these are using shared_ptrs instead of raw pointers. We will have to check the same for Jazzy and Humble

$ apt-cache rdepends ros-rolling-realtime-tools
ros-rolling-realtime-tools
Reverse Depends:
  ros-rolling-realtime-tools-dbgsym
  ros-rolling-ur-controllers
  ros-rolling-tricycle-controller
  ros-rolling-steering-controllers-library
  ros-rolling-admittance-controller
  ros-rolling-range-sensor-broadcaster
  ros-rolling-pid-controller
  ros-rolling-picknik-twist-controller
  ros-rolling-picknik-reset-fault-controller
  ros-rolling-parallel-gripper-controller
  ros-rolling-moveit-servo
  ros-rolling-joint-trajectory-controller
  ros-rolling-joint-state-broadcaster
  ros-rolling-joint-limits
  ros-rolling-imu-sensor-broadcaster
  ros-rolling-gripper-controllers
  ros-rolling-forward-command-controller
  ros-rolling-force-torque-sensor-broadcaster
  ros-rolling-diff-drive-controller
  ros-rolling-controller-manager
  ros-rolling-control-toolbox
  ros-rolling-canopen-ros2-controllers
  ros-rolling-battery-state-broadcaster

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.

6 participants