-
Notifications
You must be signed in to change notification settings - Fork 486
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
Allow usage of lambdas as transport subscription callbacks #3309
Conversation
Hello, may I ask to rerun the CI / give me a first review iteration so that I can address arising problems, if any? |
@traversaro sorry for tagging (I saw you were active recently on this repo), may I ask for a feedback here? |
Sure, give me one day, thanks! |
No rush ;) |
In the meanwhile, can you rebase on the latest |
Build error on windows, not due to the patch (at least IMHO)
|
@traversaro I see some test failing (IMHO not related to the patch itself). Is there something I can do to help push forward this patch? |
I think the test errors are unrelated. Sorry for the delay in review on my part. Can you please add a test that uses a lambda callback? You can copy one of the PubSub integration tests: |
@scpeters thank you! Added the test with the first test appearing at the code line you linked, linux & mac build passing (windows still fails). |
Sorry for the noise, we are working in fixing that: #3330 . |
Now that #3331 got merged, may I ask to please trigger again Windows CI here? |
If you rebase the PR on gazebo11 it will trigger on its own. |
Well, did it but I do not see the 3 CI jobs called "C++ CI Workflow with conda-forge dependencies" unfortunately :( |
I am not sure what happened, but apparently now I need to manually start the conda-forge CI for each new commit, I will look into it. Anyhow, now I started them. |
there appears to be a compilation error arising from the test:
|
Do conda-forge builds also run test or are just for build checks? Because those seems to go well. The failures you mention are from the integration test, I am of course digging into them already and will provide a fix ASAP. |
The test steps are currently commented out in our conda-forge workflow
thanks! |
Lambdas can be supported, but with a small caveat. Capturing lamdas work fine! See this one... Note: existing code may have already leveraged some non-capturing lambdas (due to implicit conversion to bare function) and may thus require to introduce this kind of disambiguation. Another solution could be to remove the
|
Compilation passing, some unrelated test still failing. Could you please review/trigger conda-forge builds? |
Conda-forge ok, new tests passed 🥳 |
Thanks for approval! Is there something else I could do, or this can be merged? |
As @scpeters asked for the tests I was waiting for him to see if the added test was ok. |
@scpeters did you have perhaps the chance to give a look here? |
thanks for your patience and for adding a test! |
This patch adds one method to gazebo::transport::Node, enabling users to pass a lambda (even a capturing one) as callback to call when a message is received.
This does not modify any previously existing logic. Before this patch, only pure functions or class methods were supported.
This is a prerequisite for ros-controls/gazebo_ros2_control#185 (even if an out-of-tree redefinition of the Node class is possible without Gazebo recompilation, if this PR is not merged in time).