Could a node can be stoped by another node ?
Hello guys ! I want to stop a node, once its published message is subscribe by another node. For example
Node 1(publisher)
def bridge_opencv():
image_pub = rospy.Publisher("quadrotor/videocamera1/camera_info",Image)
cv2.namedWindow("Image window", 1)
image_sub = rospy.Subscriber("quadrotor/videocamera1/image",Image, callback)
def callback(data):
bridge = CvBridge()
try:
cv_image = bridge.imgmsg_to_cv2(data, "bgr8")
except CvBridgeError, e:
print e
(rows,cols,channels) = cv_image.shape
if cols > 60 and rows > 60 :
cv2.circle(cv_image, (50,50), 10, 255)
x=5
puba.publish(x)
cv2.imshow("Image window", cv_image)
cv2.waitKey(3)
def pilot():
puba = rospy.Publisher("box_positiona", Float64)
bridge_opencv()
rospy.spin()
if __name__ == '__main__':
pilot()
Node 2 :(subscriber)
def where1(msg):
global x1
x1 = msg.data
print x1
def ground():
global cmd
rospy.init_node("ground")
rospy.Subscriber("/box_positiona", Float64, where1)
>>once i subscribe to that topic,stop node 1 immediatley
if __name__ == '__main__':
ground()
Thanks a lot ! Looking forward for your answers