-
Notifications
You must be signed in to change notification settings - Fork 76
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
WaitForTopics
: there is no way to manually trigger a topic
#348
Comments
I have a couple of questions wrt #356 :
Open to suggestions @methylDragon @wjwwood |
|
@LastStarDust Could you give us a little more concrete example of what you are trying to do here? We are just trying to figure out whether this is the right way to go, or if we should do something different like return a future from |
@clalancette Yes, of course. You can check the |
Hey there, this is a great improvement. I have implemented something similar. Would you like to compare branches, take the best of both, and get this PR into |
@Ryanf55 Thank you for your interest in this feature. |
Actually, there is one improvement that I would like to make to this PR, after the first round of review. |
Yea, I took quite a different approach and can post it here once I get approval (a few days). I'm glad you're still interested in getting something like this merged. Chat soon. |
Feature request
Feature description
The current implementation of
WaitForTopics
assumes that the node under test publishes messages without any external stimulus. But it might be that a node only publishes a topic if it received a certain stimulus, like receiving a message or a request.In other words, let us image a node acting as both subscriber and publisher, with an input topic (subscriber) and an output topic (publisher). The input is received and processed and the output is emitted.
In this case,
WaitForTopics
would be waiting for a topic without any means to actually trigger it.Implementation considerations
If the input topic is injected into the test node before calling
WaitForTopics::wait()
, the output topic might be emitted before thewait()
call and it is not intercepted bywait()
. On the other hand, if the input topic is injected after the call towait()
, obviouslywait()
cannot intercept the output.One solution would be to inject a callback function into
WaitForTopics
that can take care of feeding the node under test with the needed input to produce the desired output.Another solution is to provide a synchronization mechanism, such that the caller can create a dedicated thread to generate the input.
In any case, the input should be generated just after the subscribers have been started
Similarly to the issue #346 I am available to develop a solution if you think this feature is worth the effort.
The text was updated successfully, but these errors were encountered: