rospy SubscribeListener unsubscribe issues? [closed]
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")
rospy.init_node('test')
global _pub
_pub = rospy.Publisher(topic, myMsg, mySubscribeListener())
rospy.spin()
Hi, Eruditass: I have the same issue of rospy.SubscribeListener (ROS indigo 1.11.20) Did you have any solution ? Thx.
This is a really old question. You might want to open a new one. Please include sufficient info if/when you do.