I am sorry if I am not using the proper words when I refer to "run a callback function" from a subscriber while using rospy. I'm not sure I got the concept of keeping the nodes sleeping. However, this is not my question.
I want to make a logger node node which takes data from the first message received in a topic, and writes it as a header in a file. Then it will be storing the raw data as long as rospy.spin() says so. The problem is, I have not found an example of how to do this, or if there is such a function. All I can think about are pretty cluttered solutions, which take the time stamp and compares them in every message.
my question is, is there a way to call
rospy.Subscriber("Flow", OpticalFlow2D.msg.FrameFlow, callbackOF)
many times and
rospy.Subscriber("Flow", OpticalFlow2D.msg.FrameFlow, callbackOFonce)
just on the first time, to write the header?