def goal_reached(current_state, desired_state, precision=3):
    """
    check if the current state is equal to the desired state with the user specified precision
    we define state as a list of centroid (array of size 2x1), theta (scalar), s1 (scalar), s2(scalar)
    state = [centroid, theta, s1, s2]
    """

    # retrieve the x coordinate of the centroid of current state
    curr_centroid_x = current_state[0][0].item()

    # retrieve the y coordinate of the centroid of  current state
    curr_centroid_y = current_state[0][1].item()

    # retrieve orientation of the current state
    curr_theta = current_state[1].item()

    # retrieve semi major axis of the ellipse of current state
    curr_s1 = current_state[2]

    # retrieve semi minor axis of the ellipse of the current state
    curr_s2 = current_state[3]

    # retrieve the x coordinate of the centroid of the desired state
    des_centroid_x = desired_state[0][0].item()

    # retrieve the y coordinate of the centroid of the desired state
    des_centroid_y = desired_state[0][1].item()

    # retrieve orientation of the desired state
    des_theta = desired_state[1]

    # retrieve semi major axis of the ellipse of the desired state
    des_s1 = desired_state[2]

    # retrieve semi minor axis of the ellipse of the desired state
    des_s2 = desired_state[3]

    # round of the difference in the values to the specified precision
    # if the difference after rounding off is non-ZERO in any case it means desired state is not reached yet
    if round(curr_centroid_x - des_centroid_x, ndigits=precision):
        return False
    if round(curr_centroid_y - des_centroid_y, ndigits=precision):
        return False
    if round(curr_theta - des_theta, ndigits=precision):
        return False
    if round(curr_s1 - des_s1, ndigits=precision):
        return False
    if round(curr_s2 - des_s2, ndigits=precision):
        return False

    return True