-
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
: let the user inject a callaback to be executed after starting the subscribers
#356
base: rolling
Are you sure you want to change the base?
Conversation
WaitForTopics
: let the user inject callables after starting subscribers
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.
I've posted some questions worth discussing here : #348 (comment)
@adityapande-1995 @clalancette I have added a more comprehensive sample code in commit 5aa51d7 |
@adityapande-1995 @clalancette |
3f96cb5
to
b8004ab
Compare
@osrf-jenkins retest this please |
@adityapande-1995 @clalancette How would you test a node that is subscribed to a topic with a single |
@osrf-jenkins retest this please |
@adityapande-1995 @methylDragon Until now, I have been using my fork at work for our project, but it would give us more confidence if we could just use the official repository, or even better if this PR could end up in the released version on https://index.ros.org/packages/. |
@osrf-jenkins retest this please |
@LastStarDust my apologies, taking a look now |
|
||
|
||
# TODO: Test cases fail on Windows debug builds | ||
# https://github.com/ros2/launch_ros/issues/292 |
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 is a really old issue, is it still failing :O
WaitForTopics
: let the user inject callables after starting subscribersWaitForTopics
: let the user inject callables to be executed after starting the subscribers
@adityapande-1995 @methylDragon I fixed some linting errors and now the checks are finally passing. |
Hello, could we get a maintainer to look at this PR? |
WaitForTopics
: let the user inject callables to be executed after starting the subscribersWaitForTopics
: let the user inject callabacks to be executed after starting the subscribers
WaitForTopics
: let the user inject callabacks to be executed after starting the subscribersWaitForTopics
: let the user inject a callaback to be executed after starting the subscribers
@methylDragon is OOO, but I will ping him to look when he is back. |
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.
I tested this on a backport in humble in our own CI and it is very reliable with some minor mods.
launch_testing_ros/test/examples/wait_for_topic_inject_callback.py
Outdated
Show resolved
Hide resolved
@Ryanf55 Hello, I would like to resume working on this PR. Could you please take a look at the conversations you opened and resolve the ones you think are resolved? |
@osrf-jenkins retest this please |
Yep, all of the issues we found are still problems, and we never found a good workaround for doing this generically in Sorry, we've just spent an exorbitant amount of time on this trying to get this reliable in humble and could never figure out a way that wasn't extremely coupled to knowing exactly what was running and manual graph introspection hard-coded into our test framework. I'm optimistic that upgrading distros will make it easier, but this way of testing in python is not something we're going to pursue any further unless anyone can give us a reasonable approach that works without hard-coded timeouts/sleeps for discovery that fail on slower runners. |
@Ryanf55 Thank you for sharing the situation. I am sorry we could not figure out how to make this work reliably in Humble. |
Looks like I don't have authority to resolve threads, but consider the comments OBE. I'd be happy for this to be merged as-is, and then a follow up to go in that adds the event support. |
@adityapande-1995 @methylDragon @mjcarroll Here is the offending code: def trigger_callback():
command = 'ros2 topic pub --once --max-wait-time-secs 10 --keep-alive 1 \
/input std_msgs/msg/String "data: Hello World"'
p = Popen(command, shell=True, stdout=PIPE, stderr=PIPE)
stdout, stderr = p.communicate()
print("stdout: ", stdout)
print("stderr: ", stderr)
print('Callback triggered') and here is the CI output:
Please let me know how you want me to proceed. If the CI environment should be fixed or I should avoid using the |
That's because there is no That said, I don't think we can introduce that dependency. In particular, I'm worried about a circular dependency here, since |
21e7cf9
to
e92eb67
Compare
@clalancette |
d6066c3
to
57277d2
Compare
@mjcarroll Friendly ping for review. |
@mjcarroll Friendly ping for review. |
8936dd9
to
f2ee2fc
Compare
@adityapande-1995 @methylDragon @mjcarroll @MichaelOrlov @Ryanf55 I've revised how I pass callback arguments, which I found unsatisfactory before. Additionally, I've enhanced it by including the node itself as the first argument in the callback function, significantly boosting its versatility and power. I believe this PR is nearly ready for production from my side. Please share your thoughts. @Ryanf55, I urgently needed this feature to be reliable, so I took the initiative and upgraded our company's ROS2 distribution to ROS2 Jazzy. It wasn't an easy decision, but you might want to consider doing the same.
|
f2ee2fc
to
e5b92a3
Compare
@Ryanf55 Sorry to bother you but I just noticed that this PR is blocked because of you requesting some changes in the past. If that is related to the porting to Humble, it should be addressed in a different PR as this one is based on |
Signed-off-by: Giorgio Pintaudi <pintaudi@axelspace.com>
e5b92a3
to
fc97542
Compare
I have rebased and squashed all commits for ease of review. |
I created this pull request as a proof of concept for the new feature discussed here: #348