-
Notifications
You must be signed in to change notification settings - Fork 77
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
Added a new implementation of the RealtimeBox with added best effort behaviour #139
Conversation
@christophfroehlich here we have a new contender for C++17 support. Do you know how Debian compilation would be affected? |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #139 +/- ##
===========================================
+ Coverage 53.64% 77.15% +23.51%
===========================================
Files 18 7 -11
Lines 755 232 -523
Branches 375 98 -277
===========================================
- Hits 405 179 -226
+ Misses 56 26 -30
+ Partials 294 27 -267
Flags with carried forward coverage won't be shown. Click here to find out more.
|
it compiles and the test runs successfully on debian11 |
…meBox, enable/disable certain methods for pointer types, Box is now usable for pointer types
@christophfroehlich I reworked the PR and you might want to test if it still compiles on older platforms.
As further steps I would suggest:
|
I can't give proper feedback to your implementation, but it still compiles on debian11. And I made a mistake pushing something of your PR to the master (that's why the conflicts now appeared) btw: I propose that we fix the RHEL image and add maybe another CI for the supported versions of debian to our CIs |
Then given that it still compiles for you on an older system perhaps @bmagyar might want to review it ? I am btw not sure why the formatting step fails. I am pretty sure I ran clang-format on all files I touched. EDIT: Perhaps you might want to note at a prominent place that you have additional requirements for this package when it comes to build platforms. As far as I know the base line for rolling/iron is Ubuntu 22.04 and C++17 (correct me if I am wrong) |
The copyright notice is missing in the files, and maybe you have different clang settings. Please install pre-commit in this repo and run it (
The mentioned combination was never a problem so far, but gcc on debian11 (which is Tier 3 for humble) has not implemented all of the c++17 standard. This is why |
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.
The changes seem fine to me.
I have a comment regarding the style of the methods. Do we follow the ROS standard or the Google style?
@saikishor Do you mean the style of the methods themselves or of the comments? Is there anything else required to get this merged? I would additionally add another PR to replace the existing RealtimeBox implementation with this one. I already checked locally on my system if all RTBox Tests also run fine with this implementation. |
I meant the methods naming style |
@firesurfer please check if the merge was successful, and why the format job fails again. |
@christophfroehlich Should be fixed now. The formatter just added a whitespace at the end of some comments... I think cppcheck can't cope wit the std::enable_if_t at two points which is why the ament_cppcheck fails
|
This seems to be fixed and should be part of cppcheck 2.10, but this is not released for Ubuntu jammy. Nothing we can do here? format job is still complaining: |
I fixed the format job now (hopefully). Sorry that this took so long. For some reason I get way more errors when I run |
@christophfroehlich Apparently now the ament_cpplint fails. I am a bit puzzled because at least half of the issues there should be fixed by clang-format as they are purely formatting related. What is the best way to fix them without going manually through each of them. I already tried ament_uncrustify but then the clang-format check from pre-commit fails again. EDIT:
When I run
|
@christophfroehlich All checks seem to pass now. I simply suppressed the two cppcheck warnings regarding the wrong return type. |
@christophfroehlich So all checks have passed. What is needed to get this merged? |
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.
This looks good! Just a few comments about formatting and style
@destogl I tried to resolve your comments wherever possible. Some of the formatting comments are not possible to resolve because |
Should fix pre-commit formatting warning
So anyone interested in clicking on merge ;) As far is can tell there should be no remaining issue? |
@destogl @christophfroehlich Is there any remaining issue left in order to get this merged? |
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.
Few minor suggestions.
Thank you! :)
@saikishor Thanks for your comments. I implemented most of them as appropriate. (E.g. we can not remove the additional function template parameter). The only open point is if we shall rename / remove |
Only waiting on CI and a thumbs up from @saikishor |
@saikishor |
@firesurfer If others are okay with it, then it is fine for me and can be merged. For me, it is not with the naming This is just nitpicking, apart from that everything else looks good to me. |
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.
Apart from the nitpicking discussion we are having, the logic and the idea of this PR look good to me.
If it is fine how it is, then I think it is good to be merged
So if I understood it correctly we are just waiting for a comment on the |
Hello @firesurfer! As I have mentioned it is just a nitpicking comment, the changes in the PR look good to me. If they are okay with it, it can be merged. |
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 you contribution (and perseverance).
b5b78cd
into
ros-controls:master
Hi, I realized the current implementation of the RealtimeBox does not have a "try write/try read" access method. This im important from my point of view. Therefore I implemented a
RealtimeBoxBestEffort
which per default trys to calltry_lock
for read and write operations but also implements the previous behaviour which waits until it can aquire a lock.As already stated in #138 this implementation is not safe to be used with pointers from my point of view. (In the tests I added an example which shows how to use a pointer type with the box but well..for pointers not using this kind of box might be better or we could specialize the template to provide a different behaviour)
Furthermore I took the chance to provide some more modern c++ "magic". For example it is possible to have "emplace behaviour" - basically construct in place or if the underlying type allows it to directly pass an initilizer list.
Note: This implementation requires at least c++17 which is the current default target for ROS2 if I am informed correctly.
Perhaps we could even figure out a way how to replace the current RealTimeBox with an updated interface (#81 says that there are plans to update the API in general)