def METHOD_NAME(t, res):
    global readout_window_w
    global readout_window_h
    mapped_cx, mapped_cy = get_mapped_centroid(t)
    # Switch to the res (if res was unchanged this does nothing).
    sensor.set_framesize(res)
    # Construct readout window. x/y are offsets from the center.
    x = int(mapped_cx - (sensor_w / 2.0))
    y = int(mapped_cy - (sensor_h / 2.0))
    w = int(readout_window_w)
    h = int(readout_window_h)
    # Focus on the centroid.
    sensor.ioctl(sensor.IOCTL_SET_READOUT_WINDOW, (x, y, w, h))
    # See if we are hitting the edge.
    new_x, new_y, w, h = sensor.ioctl(sensor.IOCTL_GET_READOUT_WINDOW)
    # You can use these error values to drive servos to move the camera if you want.
    x_error = x - new_x
    y_error = y - new_y
    if x_error < 0:
        print("-X Limit Reached ", end="")
    if x_error > 0:
        print("+X Limit Reached ", end="")
    if y_error < 0:
        print("-Y Limit Reached ", end="")
    if y_error > 0:
        print("+Y Limit Reached ", end="")