Synchronizing image display and services between two ROS nodes
Now that I have been put on the right track for synchronizing topics, I would like to do something similar between an image message topic and a service that draws a marker (e.g. rectangle) on that image.
So I have a "display node" that subscribes to an image topic and uses cv_bridge and the OpenCV ShowImage function to display the image. Then I define a service within this node, that accepts time stamped ROI messages and displays a rectangle on the image using OpenCV's Rectangle function.
A second node also subscribes to the image topic and looks for faces using the OpenCV Haar detector. When it finds a face, it sends a service request to the display node to draw a rectangle around the ROI that surrounds the face.
The trouble is that the displayed rectangle lags the movement of the face in the image by a noticeable amount--about 0.5 seconds. It doesn't matter if I stamp the ROI service request with the image timestamp or rospy.Time.now(). I now know from the link above how to synchronize two ROS topics to fix this problem, but can I do something similar between a ROS topic and a service?
Thanks!
--patrick