rospy SubscribeListener unsubscribe issues? [closed]

asked 2012-11-05 12:29:52 -0500

Eruditass gravatar image

I'm trying to create a lazy subscriber in python and am having issues getting the peer_unsubscribe function to get called. When I echo the topic, I get the msg telling me I have 1 sub, but when I kill the echo, I don't get the unsub. If I do it again, I get 2 listeners. Only when I kill the node do I get the unsub messages. What am I doing wrong?

class mySubscribeListener(rospy.SubscribeListener):
    def peer_subscribe(self, topic_name, topic_publish, peer_publish):
        global _pub
        print("got sub, I have %d"%_pub.get_num_connections())

    def peer_unsubscribe(self, topic_name, num_peers):
        print("got unsub")

global _pub
_pub = rospy.Publisher(topic, myMsg, mySubscribeListener())
edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by Eruditass
close date 2012-11-05 12:50:58


Hi, Eruditass: I have the same issue of rospy.SubscribeListener (ROS indigo 1.11.20) Did you have any solution ? Thx.

Raymond Liu gravatar image Raymond Liu  ( 2016-11-08 01:59:12 -0500 )edit

This is a really old question. You might want to open a new one. Please include sufficient info if/when you do.

gvdhoorn gravatar image gvdhoorn  ( 2016-11-08 02:12:36 -0500 )edit