rospy Subscriber object not getting destroyed?
This just came up in an assignment that I'm grading, and I can't figure out why it works. In the constructor of a class, there is:
self.sub = rospy.Subscriber('/odom', Odometry, self.seek_goal)
followed immediately by
self.sub = rospy.Subscriber('/base_scan', LaserScan, self.laser_agg)
My understanding is that, when self.sub
is reassigned, the original Subscriber
should go out of scope, get destroyed, and get garbage-collected. However, both callbacks seem to run happily for the duration of the node's existence.
Any Python gurus out there with any insight? I could guess about the object not getting reaped, but it should still go out of scope (and get destroyed), right?