Unsubscribing from ROS Topic - Python
So I have a Class and in its init function, I subscribe to a camera, whose callback function is created in my class. i.e:
class example(object):
def __init__(self):
rospy.subscriber("/cameras/left_hand_camera/image",Image,self.callback_viewer)
def callback_viewer(self,data):
try:
cv_image = self.bridge.imgmsg_to_cv2(data, "bgr8")
except CvBridgeError as e:
print(e)
cv2.imshow("window", cv_image)
So for the purposes of my project, I need to create another class, which, in addition to doing some other stuff, unsubscribe to all the topics it is currently subscribing to. but I don't know how to use the unsubscriber function listed here
Can anyone help me with that, how would i use that function?