ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

I guess you could create a global "image" variable and then if the variable is not set yet, just use the callback to store the variable. If the variable is set, use the callback you compare the new image with the stored image and afterwards set the saved image to the new image.

Some untested python pseudocode:

def image_cb(msg):
    global old_img
    if old_img is None:
         old_img = msg
         return
    movement_result = compare_imgs(old_img, msg)
    old_img = msg