WaitForTopics: let the user inject a callaback to be executed after starting the subscribers (backport #356)
#504
+202
−5
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I created this pull request as a proof of concept for the new feature discussed here: #348.
The ticket description is still correct and relevant, but for clarity's sake, let me summarize and expand on it here.
Let us assume there is a node ("NODE under test" in the diagram) which:
At the moment, there is no way to programmatically test the whole node end-to-end. For that, we need a way to:
Currently, the
WaitForTopicsclass provided by this package takes care of 2 and 3, but there is no mechanism to reliably accomplish 1, due to the asynchronous nature of ROS2 publishers and subscribers.This PR is an attempt to enhance the
WaitForTopicsclass so that it can take care of 1 as well, thus closing the loop. But it might well not be the only solution or the most effective. I am open to any kind of suggestion and guidance.The main issue behind the implementation of such a feature is that in ROS2 the order of creation of publishers and subscribers does matter. They must either always be created in a specific order or be synchronized in some other way.
Below is a cartoon-style diagram illustrating what the end result should look like:
This is an automatic backport of pull request #356 done by Mergify.