-
Notifications
You must be signed in to change notification settings - Fork 493
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
Express Humble/Rolling differences in #if #1620
Conversation
35b03c5
to
d2425ae
Compare
Codecov ReportBase: 51.08% // Head: 51.08% // No change to project coverage 👍
Additional details and impacted files@@ Coverage Diff @@
## main #1620 +/- ##
=======================================
Coverage 51.08% 51.08%
=======================================
Files 381 381
Lines 31738 31738
=======================================
Hits 16209 16209
Misses 15529 15529
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
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 the attempt to clean this up. What do you think of moving the implementation detail into a different header and only using the if statement as include guard. The header could provide something like a function rclcpp_compat::SystemDefaultsQoS()
, returning the right value for each version.
They are not the same type, so you can't just convert them. Disabling the warning for deprecated has to be the saddest "solution" to this. |
d2425ae
to
b74b3de
Compare
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.
Pretty cool! Thanks for taking over this issue :)
b74b3de
to
3dc7835
Compare
3dc7835
to
17945f5
Compare
Signed-off-by: Tyler Weaver <tyler@picknik.ai>
17945f5
to
f112b02
Compare
Why would it need to be? I'm not talking about conversion, I'm talking about defining the same function name in different headers, one for each version. Instead of wrapping the whole code block, we would only have to add include guards to select the right header. The return type can and must be different, that's the whole point. This would separate the compile-time logic from code in a more elegant way, imo. |
I don't understand what you are asking. Would you like to make that change? I'm frustrated by what was merged and am trying to fix this so we can re-enable the warning. I am not looking to develop some more generic solution to something that only shows up in this one file. I wish the person who merged disabling the warning for deprecations would have done almost anything else to fix this. Nowhere else in MoveIt are we specifying a callback group for services. I assume what you mean is to do something like this: #if RCLCPP_VERSION_GTE(17, 0, 0)
#include <moveit/rolling_interface.hpp>
#else
#include <moveit/humble_interface.hpp>
#endif Then we now have three files that need to be changed when we drop support for Humble in the future, along with some dead code. I like this solution much better because it localizes it to the one file where we are using it. Once it gets used in more than one place, then maybe we consider some sort of abstraction? |
5acb2f9
to
4b121b6
Compare
Signed-off-by: Tyler Weaver <tyler@picknik.ai>
4b121b6
to
c6b7c86
Compare
Valid point about the multiple files. I think what I dislike is that the guard wraps a lot more code than the affected type. The last change looks much better to me, thanks! |
I see that ros2_control has the same deprecation warnings right now on their master branch. I'm going to push this into RSL so we can hide these sorts of shims there. I'll make a follow on pr here to use the RSL shim for this once it is easy to use. |
Description
Instead of disabling the warning for deprecations in CMake, I looked into a way to support both Humble and Rolling in main so we can continue to get the warnings that will help us stay up to date with Rolling.
I found this ROS Answers post about how to write an #if pre-processor statement for detecting the ROS version: https://answers.ros.org/question/9562/how-do-i-test-the-ros-version-in-c-code/
That lead me to this ament package that is used by rclcpp to create a variable based on its version here: https://github.com/ament/ament_cmake/tree/rolling/ament_cmake_gen_version_h/cmake
The code in that generated file has changed over time and isn't exactly what is in the first ROS Answers post and on my machine is this:
From this, I was able to update the code to support both Rolling and Humble by detecting the version of the function calls.