You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
and then subcribe to and unsubscribe from that topic, e.g, with
rostopic echo /test_topic && date +%s
^C
1555934665
What should happen: The publisher node should recognize the new subscriber, print out Someone is listening :) as long as the subscriber is active, and more or less immediately realize that there are no subscribers any more and switch back to I am alone :(.
What happens: The publisher recognizes a new subscriber but does not notice that the subscriber unsubscribes shortly after:
...
[ INFO] [1555934661.098353493]: I am alone :(
[ INFO] [1555934662.098477395]: I am alone :(
[ INFO] [1555934663.098413898]: Someone is listening :)
[ INFO] [1555934664.098555165]: Someone is listening :)
[ INFO] [1555934665.098341645]: Someone is listening :) (subscriber is shut off again)
[ INFO] [1555934666.098435134]: Someone is listening :)
[ INFO] [1555934667.098370738]: Someone is listening :)
[ INFO] [1555934668.098414957]: Someone is listening :)
[ INFO] [1555934669.098372386]: Someone is listening :)
[ INFO] [1555934670.098341077]: Someone is listening :)
...
Only after approx. 120 seconds the publisher realizes that there is no subscriber any longer:
...
[ INFO] [1555934784.098598787]: Someone is listening :)
[ INFO] [1555934785.098545304]: Someone is listening :) (120 seconds later)
[ INFO] [1555934786.098460942]: Someone is listening :)
[ INFO] [1555934787.098624760]: I am alone :(
[ INFO] [1555934788.098622298]: I am alone :(
[ INFO] [1555934789.098441571]: I am alone :(
...
Notes:
behavior is different when node actually publishes messages when someone listens: then getNumSubscribers() returns 0 immediately after subscribers are gone
could not reproduce with rospy
the 120 seconds is quite reproducible, so I guess there is a simple timeout set somewhere to update the subscription info
The text was updated successfully, but these errors were encountered:
Tested in melodic.
It seems that the method getNumSubscribers() does not return 0 when a topic is unsubscribed if a roscpp publisher is not publishing.
How to reproduce: Have a simple publisher running that does not publish anything but only checks the number of subscribers
and then subcribe to and unsubscribe from that topic, e.g, with
What should happen: The publisher node should recognize the new subscriber, print out
Someone is listening :)
as long as the subscriber is active, and more or less immediately realize that there are no subscribers any more and switch back toI am alone :(
.What happens: The publisher recognizes a new subscriber but does not notice that the subscriber unsubscribes shortly after:
Only after approx. 120 seconds the publisher realizes that there is no subscriber any longer:
Notes:
getNumSubscribers()
returns 0 immediately after subscribers are goneThe text was updated successfully, but these errors were encountered: